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FrC,QALe,SAAUa,IACrB,QAAc,WACVA","sources":["webpack://grafana/./public/app/core/components/SharedPreferences/SharedPreferences.tsx","webpack://grafana/./public/app/features/profile/UserOrganizations.tsx","webpack://grafana/./public/app/features/profile/UserProfileEditForm.tsx","webpack://grafana/./public/app/features/profile/UserSessions.tsx","webpack://grafana/./public/app/features/profile/UserTeams.tsx","webpack://grafana/./public/app/features/profile/UserProfileEditPage.tsx","webpack://grafana/./public/app/features/profile/state/actions.ts","webpack://grafana/./.yarn/__virtual__/react-use-virtual-00326e70ba/3/opt/drone/yarncache/react-use-npm-17.3.2-a032cbeb01-7379460f51.zip/node_modules/react-use/esm/useMount.js"],"sourcesContent":["import { css } from '@emotion/css';\nimport { t, Trans } from '@lingui/macro';\nimport React, { PureComponent } from 'react';\n\nimport { SelectableValue } from '@grafana/data';\nimport { selectors } from '@grafana/e2e-selectors';\nimport {\n Button,\n Field,\n FieldSet,\n Form,\n Icon,\n Label,\n RadioButtonGroup,\n Select,\n stylesFactory,\n TimeZonePicker,\n Tooltip,\n WeekStartPicker,\n} from '@grafana/ui';\nimport { PreferencesService } from 'app/core/services/PreferencesService';\nimport { backendSrv } from 'app/core/services/backend_srv';\nimport { DashboardSearchHit, DashboardSearchItemType } from 'app/features/search/types';\n\nimport { UserPreferencesDTO } from '../../../types';\n\nexport interface Props {\n resourceUri: string;\n disabled?: boolean;\n}\n\nexport type State = UserPreferencesDTO & {\n dashboards: DashboardSearchHit[];\n};\n\nconst themes: SelectableValue[] = [\n { value: '', label: t({ id: 'shared-preferences.theme.default-label', message: 'Default' }) },\n { value: 'dark', label: t({ id: 'shared-preferences.theme.dark-label', message: 'Dark' }) },\n { value: 'light', label: t({ id: 'shared-preferences.theme.light-label', message: 'Light' }) },\n];\n\nexport class SharedPreferences extends PureComponent<Props, State> {\n service: PreferencesService;\n\n constructor(props: Props) {\n super(props);\n\n this.service = new PreferencesService(props.resourceUri);\n this.state = {\n homeDashboardId: 0,\n theme: '',\n timezone: '',\n weekStart: '',\n dashboards: [],\n queryHistory: { homeTab: '' },\n };\n }\n\n async componentDidMount() {\n const prefs = await this.service.load();\n const dashboards = await backendSrv.search({ starred: true });\n const defaultDashboardHit: DashboardSearchHit = {\n id: 0,\n title: 'Default',\n tags: [],\n type: '' as DashboardSearchItemType,\n uid: '',\n uri: '',\n url: '',\n folderId: 0,\n folderTitle: '',\n folderUid: '',\n folderUrl: '',\n isStarred: false,\n slug: '',\n items: [],\n };\n\n if (prefs.homeDashboardId > 0 && !dashboards.find((d) => d.id === prefs.homeDashboardId)) {\n const missing = await backendSrv.search({ dashboardIds: [prefs.homeDashboardId] });\n if (missing && missing.length > 0) {\n dashboards.push(missing[0]);\n }\n }\n\n this.setState({\n homeDashboardId: prefs.homeDashboardId,\n theme: prefs.theme,\n timezone: prefs.timezone,\n weekStart: prefs.weekStart,\n dashboards: [defaultDashboardHit, ...dashboards],\n queryHistory: prefs.queryHistory,\n });\n }\n\n onSubmitForm = async () => {\n const { homeDashboardId, theme, timezone, weekStart, queryHistory } = this.state;\n await this.service.update({ homeDashboardId, theme, timezone, weekStart, queryHistory });\n window.location.reload();\n };\n\n onThemeChanged = (value: string) => {\n this.setState({ theme: value });\n };\n\n onTimeZoneChanged = (timezone?: string) => {\n if (!timezone) {\n return;\n }\n this.setState({ timezone: timezone });\n };\n\n onWeekStartChanged = (weekStart: string) => {\n this.setState({ weekStart: weekStart });\n };\n\n onHomeDashboardChanged = (dashboardId: number) => {\n this.setState({ homeDashboardId: dashboardId });\n };\n\n getFullDashName = (dashboard: SelectableValue<DashboardSearchHit>) => {\n if (typeof dashboard.folderTitle === 'undefined' || dashboard.folderTitle === '') {\n return dashboard.title;\n }\n return dashboard.folderTitle + ' / ' + dashboard.title;\n };\n\n render() {\n const { theme, timezone, weekStart, homeDashboardId, dashboards } = this.state;\n const { disabled } = this.props;\n const styles = getStyles();\n\n const homeDashboardTooltip = (\n <Tooltip\n content={\n <Trans id=\"shared-preferences.fields.home-dashboard-tooltip\">\n Not finding the dashboard you want? Star it first, then it should appear in this select box.\n </Trans>\n }\n >\n <Icon name=\"info-circle\" />\n </Tooltip>\n );\n\n return (\n <Form onSubmit={this.onSubmitForm}>\n {() => {\n return (\n <FieldSet label={<Trans id=\"shared-preferences.title\">Preferences</Trans>} disabled={disabled}>\n <Field label={t({ id: 'shared-preferences.fields.theme-label', message: 'UI Theme' })}>\n <RadioButtonGroup\n options={themes}\n value={themes.find((item) => item.value === theme)?.value}\n onChange={this.onThemeChanged}\n />\n </Field>\n\n <Field\n label={\n <Label htmlFor=\"home-dashboard-select\">\n <span className={styles.labelText}>\n <Trans id=\"shared-preferences.fields.home-dashboard-label\">Home Dashboard</Trans>\n </span>\n\n {homeDashboardTooltip}\n </Label>\n }\n data-testid=\"User preferences home dashboard drop down\"\n >\n <Select\n value={dashboards.find((dashboard) => dashboard.id === homeDashboardId)}\n getOptionValue={(i) => i.id}\n getOptionLabel={this.getFullDashName}\n onChange={(dashboard: SelectableValue<DashboardSearchHit>) =>\n this.onHomeDashboardChanged(dashboard.id)\n }\n options={dashboards}\n placeholder={t({\n id: 'shared-preferences.fields.home-dashboard-placeholder',\n message: 'Choose default dashboard',\n })}\n inputId=\"home-dashboard-select\"\n />\n </Field>\n\n <Field\n label={t({ id: 'shared-dashboard.fields.timezone-label', message: 'Timezone' })}\n data-testid={selectors.components.TimeZonePicker.containerV2}\n >\n <TimeZonePicker\n includeInternal={true}\n value={timezone}\n onChange={this.onTimeZoneChanged}\n inputId=\"shared-preferences-timezone-picker\"\n />\n </Field>\n\n <Field\n label={t({ id: 'shared-preferences.fields.week-start-label', message: 'Week start' })}\n data-testid={selectors.components.WeekStartPicker.containerV2}\n >\n <WeekStartPicker\n value={weekStart}\n onChange={this.onWeekStartChanged}\n inputId={'shared-preferences-week-start-picker'}\n />\n </Field>\n\n <div className=\"gf-form-button-row\">\n <Button\n type=\"submit\"\n variant=\"primary\"\n data-testid={selectors.components.UserProfile.preferencesSaveButton}\n >\n <Trans id=\"common.save\">Save</Trans>\n </Button>\n </div>\n </FieldSet>\n );\n }}\n </Form>\n );\n }\n}\n\nexport default SharedPreferences;\n\nconst getStyles = stylesFactory(() => {\n return {\n labelText: css`\n margin-right: 6px;\n `,\n };\n});\n","import { Trans } from '@lingui/macro';\nimport React, { PureComponent } from 'react';\n\nimport { selectors } from '@grafana/e2e-selectors';\nimport { Button, LoadingPlaceholder } from '@grafana/ui';\nimport { UserDTO, UserOrg } from 'app/types';\n\nexport interface Props {\n user: UserDTO | null;\n orgs: UserOrg[];\n isLoading: boolean;\n setUserOrg: (org: UserOrg) => void;\n}\n\nexport class UserOrganizations extends PureComponent<Props> {\n render() {\n const { isLoading, orgs, user } = this.props;\n\n if (isLoading) {\n return <LoadingPlaceholder text=\"Loading organizations...\" />;\n }\n\n if (orgs.length === 0) {\n return null;\n }\n\n return (\n <div>\n <h3 className=\"page-sub-heading\">\n <Trans id=\"user-orgs.title\">Organizations</Trans>\n </h3>\n\n <div className=\"gf-form-group\">\n <table className=\"filter-table form-inline\" data-testid={selectors.components.UserProfile.orgsTable}>\n <thead>\n <tr>\n <th>\n <Trans id=\"user-orgs.name-column\">Name</Trans>\n </th>\n <th>\n <Trans id=\"user-orgs.role-column\">Role</Trans>\n </th>\n <th />\n </tr>\n </thead>\n <tbody>\n {orgs.map((org: UserOrg, index) => {\n return (\n <tr key={index}>\n <td>{org.name}</td>\n <td>{org.role}</td>\n <td className=\"text-right\">\n {org.orgId === user?.orgId ? (\n <Button variant=\"secondary\" size=\"sm\" disabled>\n <Trans id=\"user-orgs.current-org-button\">Current</Trans>\n </Button>\n ) : (\n <Button\n variant=\"secondary\"\n size=\"sm\"\n onClick={() => {\n this.props.setUserOrg(org);\n }}\n >\n <Trans id=\"user-orgs.select-org-button\">Select organisation</Trans>\n </Button>\n )}\n </td>\n </tr>\n );\n })}\n </tbody>\n </table>\n </div>\n </div>\n );\n }\n}\n\nexport default UserOrganizations;\n","import { Trans, t } from '@lingui/macro';\nimport React, { FC } from 'react';\n\nimport { selectors } from '@grafana/e2e-selectors';\nimport { Button, Field, FieldSet, Form, Icon, Input, Tooltip } from '@grafana/ui';\nimport config from 'app/core/config';\nimport { UserDTO } from 'app/types';\n\nimport { ProfileUpdateFields } from './types';\n\nexport interface Props {\n user: UserDTO | null;\n isSavingUser: boolean;\n updateProfile: (payload: ProfileUpdateFields) => void;\n}\n\nconst { disableLoginForm } = config;\n\nexport const UserProfileEditForm: FC<Props> = ({ user, isSavingUser, updateProfile }) => {\n const onSubmitProfileUpdate = (data: ProfileUpdateFields) => {\n updateProfile(data);\n };\n\n return (\n <Form onSubmit={onSubmitProfileUpdate} validateOn=\"onBlur\">\n {({ register, errors }) => {\n return (\n <FieldSet label={<Trans id=\"user-profile.title\">Edit profile</Trans>}>\n <Field\n label={t({ id: 'user-profile.fields.name-label', message: 'Name' })}\n invalid={!!errors.name}\n error={<Trans id=\"user-profile.fields.name-error\">Name is required</Trans>}\n disabled={disableLoginForm}\n >\n <Input\n {...register('name', { required: true })}\n id=\"edit-user-profile-name\"\n placeholder={t({ id: 'user-profile.fields.name-label', message: 'Name' })}\n defaultValue={user?.name ?? ''}\n suffix={<InputSuffix />}\n />\n </Field>\n\n <Field\n label={t({ id: 'user-profile.fields.email-label', message: 'Email' })}\n invalid={!!errors.email}\n error={<Trans id=\"user-profile.fields.email-error\">Email is required</Trans>}\n disabled={disableLoginForm}\n >\n <Input\n {...register('email', { required: true })}\n id=\"edit-user-profile-email\"\n placeholder={t({ id: 'user-profile.fields.email-label', message: 'Email' })}\n defaultValue={user?.email ?? ''}\n suffix={<InputSuffix />}\n />\n </Field>\n\n <Field\n label={t({ id: 'user-profile.fields.username-label', message: 'Username' })}\n disabled={disableLoginForm}\n >\n <Input\n {...register('login')}\n id=\"edit-user-profile-username\"\n defaultValue={user?.login ?? ''}\n placeholder={t({ id: 'user-profile.fields.username-label', message: 'Username' })}\n suffix={<InputSuffix />}\n />\n </Field>\n\n <div className=\"gf-form-button-row\">\n <Button\n variant=\"primary\"\n disabled={isSavingUser}\n data-testid={selectors.components.UserProfile.profileSaveButton}\n type=\"submit\"\n >\n <Trans id=\"common.save\">Save</Trans>\n </Button>\n </div>\n </FieldSet>\n );\n }}\n </Form>\n );\n};\n\nexport default UserProfileEditForm;\n\nconst InputSuffix: FC = () => {\n return disableLoginForm ? (\n <Tooltip content=\"Login details locked because they are managed in another system.\">\n <Icon name=\"lock\" />\n </Tooltip>\n ) : null;\n};\n","import { t, Trans } from '@lingui/macro';\nimport { withI18n, withI18nProps } from '@lingui/react';\nimport React, { PureComponent } from 'react';\n\nimport { selectors } from '@grafana/e2e-selectors';\nimport { Button, Icon, LoadingPlaceholder } from '@grafana/ui';\nimport { UserSession } from 'app/types';\n\ninterface Props extends withI18nProps {\n sessions: UserSession[];\n isLoading: boolean;\n revokeUserSession: (tokenId: number) => void;\n}\n\nclass UserSessions extends PureComponent<Props> {\n render() {\n const { isLoading, sessions, revokeUserSession, i18n } = this.props;\n\n if (isLoading) {\n return <LoadingPlaceholder text={<Trans id=\"user-sessions.loading\">Loading sessions...</Trans>} />;\n }\n\n return (\n <div>\n {sessions.length > 0 && (\n <>\n <h3 className=\"page-sub-heading\">Sessions</h3>\n <div className=\"gf-form-group\">\n <table className=\"filter-table form-inline\" data-testid={selectors.components.UserProfile.sessionsTable}>\n <thead>\n <tr>\n <th>\n <Trans id=\"user-session.seen-at-column\">Last seen</Trans>\n </th>\n <th>\n <Trans id=\"user-session.created-at-column\">Logged on</Trans>\n </th>\n <th>\n <Trans id=\"user-session.ip-column\">IP address</Trans>\n </th>\n <th>\n <Trans id=\"user-session.browser-column\">Browser & OS</Trans>\n </th>\n <th></th>\n </tr>\n </thead>\n <tbody>\n {sessions.map((session: UserSession, index) => (\n <tr key={index}>\n {session.isActive ? <td>Now</td> : <td>{session.seenAt}</td>}\n <td>{i18n.date(session.createdAt, { dateStyle: 'long' })}</td>\n <td>{session.clientIp}</td>\n <td>\n {session.browser} on {session.os} {session.osVersion}\n </td>\n <td>\n <Button\n size=\"sm\"\n variant=\"destructive\"\n onClick={() => revokeUserSession(session.id)}\n aria-label={t({ id: 'user-session.revoke', message: 'Revoke user session' })}\n >\n <Icon name=\"power\" />\n </Button>\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n </>\n )}\n </div>\n );\n }\n}\n\nexport default withI18n()(UserSessions);\n","import React, { PureComponent } from 'react';\n\nimport { LoadingPlaceholder } from '@grafana/ui';\nimport { Team } from 'app/types';\n\nexport interface Props {\n teams: Team[];\n isLoading: boolean;\n}\n\nexport class UserTeams extends PureComponent<Props> {\n render() {\n const { isLoading, teams } = this.props;\n\n if (isLoading) {\n return <LoadingPlaceholder text=\"Loading teams...\" />;\n }\n\n if (teams.length === 0) {\n return null;\n }\n\n return (\n <div>\n <h3 className=\"page-sub-heading\">Teams</h3>\n <div className=\"gf-form-group\">\n <table className=\"filter-table form-inline\" aria-label=\"User teams table\">\n <thead>\n <tr>\n <th />\n <th>Name</th>\n <th>Email</th>\n <th>Members</th>\n </tr>\n </thead>\n <tbody>\n {teams.map((team: Team, index) => {\n return (\n <tr key={index}>\n <td className=\"width-4 text-center\">\n <img className=\"filter-table__avatar\" src={team.avatarUrl} alt=\"\" />\n </td>\n <td>{team.name}</td>\n <td>{team.email}</td>\n <td>{team.memberCount}</td>\n </tr>\n );\n })}\n </tbody>\n </table>\n </div>\n </div>\n );\n }\n}\n\nexport default UserTeams;\n","import React from 'react';\nimport { connect, ConnectedProps } from 'react-redux';\nimport { useMount } from 'react-use';\n\nimport { NavModel } from '@grafana/data';\nimport { VerticalGroup } from '@grafana/ui';\nimport Page from 'app/core/components/Page/Page';\nimport SharedPreferences from 'app/core/components/SharedPreferences/SharedPreferences';\nimport { getNavModel } from 'app/core/selectors/navModel';\nimport { StoreState } from 'app/types';\n\nimport UserOrganizations from './UserOrganizations';\nimport UserProfileEditForm from './UserProfileEditForm';\nimport UserSessions from './UserSessions';\nimport { UserTeams } from './UserTeams';\nimport { changeUserOrg, initUserProfilePage, revokeUserSession, updateUserProfile } from './state/actions';\n\nexport interface OwnProps {\n navModel: NavModel;\n}\n\nfunction mapStateToProps(state: StoreState) {\n const userState = state.user;\n const { user, teams, orgs, sessions, teamsAreLoading, orgsAreLoading, sessionsAreLoading, isUpdating } = userState;\n return {\n navModel: getNavModel(state.navIndex, 'profile-settings'),\n orgsAreLoading,\n sessionsAreLoading,\n teamsAreLoading,\n orgs,\n sessions,\n teams,\n isUpdating,\n user,\n };\n}\n\nconst mapDispatchToProps = {\n initUserProfilePage,\n revokeUserSession,\n changeUserOrg,\n updateUserProfile,\n};\n\nconst connector = connect(mapStateToProps, mapDispatchToProps);\n\nexport type Props = OwnProps & ConnectedProps<typeof connector>;\n\nexport function UserProfileEditPage({\n navModel,\n orgsAreLoading,\n sessionsAreLoading,\n teamsAreLoading,\n initUserProfilePage,\n orgs,\n sessions,\n teams,\n isUpdating,\n user,\n revokeUserSession,\n changeUserOrg,\n updateUserProfile,\n}: Props) {\n useMount(() => initUserProfilePage());\n\n return (\n <Page navModel={navModel}>\n <Page.Contents isLoading={!user}>\n <VerticalGroup spacing=\"md\">\n <UserProfileEditForm updateProfile={updateUserProfile} isSavingUser={isUpdating} user={user} />\n <SharedPreferences resourceUri=\"user\" />\n <UserTeams isLoading={teamsAreLoading} teams={teams} />\n <UserOrganizations isLoading={orgsAreLoading} setUserOrg={changeUserOrg} orgs={orgs} user={user} />\n <UserSessions isLoading={sessionsAreLoading} revokeUserSession={revokeUserSession} sessions={sessions} />\n </VerticalGroup>\n </Page.Contents>\n </Page>\n );\n}\n\nexport default connector(UserProfileEditPage);\n","import { config } from '@grafana/runtime';\n\nimport { ThunkResult, UserOrg } from '../../../types';\nimport { api } from '../api';\nimport { ChangePasswordFields, ProfileUpdateFields } from '../types';\n\nimport {\n initLoadOrgs,\n initLoadSessions,\n initLoadTeams,\n orgsLoaded,\n sessionsLoaded,\n setUpdating,\n teamsLoaded,\n userLoaded,\n userSessionRevoked,\n} from './reducers';\n\nexport function changePassword(payload: ChangePasswordFields): ThunkResult<void> {\n return async function (dispatch) {\n dispatch(setUpdating({ updating: true }));\n await api.changePassword(payload);\n dispatch(setUpdating({ updating: false }));\n };\n}\n\nexport function initUserProfilePage(): ThunkResult<void> {\n return async function (dispatch) {\n await dispatch(loadUser());\n dispatch(loadTeams());\n dispatch(loadOrgs());\n dispatch(loadSessions());\n };\n}\n\nexport function loadUser(): ThunkResult<void> {\n return async function (dispatch) {\n const user = await api.loadUser();\n dispatch(userLoaded({ user }));\n };\n}\n\nfunction loadTeams(): ThunkResult<void> {\n return async function (dispatch) {\n dispatch(initLoadTeams());\n const teams = await api.loadTeams();\n dispatch(teamsLoaded({ teams }));\n };\n}\n\nfunction loadOrgs(): ThunkResult<void> {\n return async function (dispatch) {\n dispatch(initLoadOrgs());\n const orgs = await api.loadOrgs();\n dispatch(orgsLoaded({ orgs }));\n };\n}\n\nfunction loadSessions(): ThunkResult<void> {\n return async function (dispatch) {\n dispatch(initLoadSessions());\n const sessions = await api.loadSessions();\n dispatch(sessionsLoaded({ sessions }));\n };\n}\n\nexport function revokeUserSession(tokenId: number): ThunkResult<void> {\n return async function (dispatch) {\n dispatch(setUpdating({ updating: true }));\n await api.revokeUserSession(tokenId);\n dispatch(userSessionRevoked({ tokenId }));\n };\n}\n\nexport function changeUserOrg(org: UserOrg): ThunkResult<void> {\n return async function (dispatch) {\n dispatch(setUpdating({ updating: true }));\n await api.setUserOrg(org);\n window.location.href = config.appSubUrl + '/profile';\n };\n}\n\nexport function updateUserProfile(payload: ProfileUpdateFields): ThunkResult<void> {\n return async function (dispatch) {\n dispatch(setUpdating({ updating: true }));\n await api.updateUserProfile(payload);\n await dispatch(loadUser());\n dispatch(setUpdating({ updating: false }));\n };\n}\n","import useEffectOnce from './useEffectOnce';\nvar useMount = function (fn) {\n useEffectOnce(function () {\n fn();\n });\n};\nexport default useMount;\n"],"names":["themes","value","label","id","SharedPreferences","PureComponent","constructor","props","super","async","homeDashboardId","theme","timezone","weekStart","queryHistory","this","state","service","update","window","location","reload","setState","dashboardId","dashboard","folderTitle","title","PreferencesService","resourceUri","dashboards","homeTab","prefs","load","backendSrv","starred","find","d","missing","dashboardIds","length","push","tags","type","uid","uri","url","folderId","folderUid","folderUrl","isStarred","slug","items","render","disabled","styles","getStyles","homeDashboardTooltip","Tooltip","content","Icon","name","Form","onSubmit","onSubmitForm","FieldSet","Field","RadioButtonGroup","options","item","onChange","onThemeChanged","Label","htmlFor","className","labelText","Select","getOptionValue","i","getOptionLabel","getFullDashName","onHomeDashboardChanged","placeholder","inputId","selectors","TimeZonePicker","includeInternal","onTimeZoneChanged","WeekStartPicker","onWeekStartChanged","Button","variant","stylesFactory","css","UserOrganizations","isLoading","orgs","user","LoadingPlaceholder","text","map","org","index","role","orgId","size","onClick","setUserOrg","disableLoginForm","config","isSavingUser","updateProfile","data","validateOn","register","errors","invalid","error","Input","required","defaultValue","suffix","InputSuffix","email","login","UserSessions","sessions","revokeUserSession","i18n","session","isActive","seenAt","date","createdAt","dateStyle","clientIp","browser","os","osVersion","withI18n","UserTeams","teams","team","src","avatarUrl","alt","memberCount","mapDispatchToProps","initUserProfilePage","changeUserOrg","updateUserProfile","UserProfileEditPage","navModel","orgsAreLoading","sessionsAreLoading","teamsAreLoading","isUpdating","useMount","Page","VerticalGroup","spacing","connect","userState","getNavModel","navIndex","changePassword","payload","dispatch","setUpdating","updating","api","loadUser","initLoadTeams","teamsLoaded","initLoadOrgs","orgsLoaded","initLoadSessions","sessionsLoaded","userLoaded","tokenId","userSessionRevoked","href","fn"],"sourceRoot":""}
|