|
|
|
@ -140,89 +140,88 @@ export class SharedPreferences extends PureComponent<Props, State> { |
|
|
|
|
<Form onSubmit={this.onSubmitForm}> |
|
|
|
|
{() => { |
|
|
|
|
return ( |
|
|
|
|
<FieldSet label={<Trans i18nKey="shared-preferences.title">Preferences</Trans>} disabled={disabled}> |
|
|
|
|
<Field label={t('shared-preferences.fields.theme-label', 'Interface theme')}> |
|
|
|
|
<Select |
|
|
|
|
options={this.themeOptions} |
|
|
|
|
value={currentThemeOption} |
|
|
|
|
onChange={this.onThemeChanged} |
|
|
|
|
inputId="shared-preferences-theme-select" |
|
|
|
|
/> |
|
|
|
|
</Field> |
|
|
|
|
|
|
|
|
|
<Field |
|
|
|
|
label={ |
|
|
|
|
<Label htmlFor="home-dashboard-select"> |
|
|
|
|
<span className={styles.labelText}> |
|
|
|
|
<Trans i18nKey="shared-preferences.fields.home-dashboard-label">Home Dashboard</Trans> |
|
|
|
|
</span> |
|
|
|
|
</Label> |
|
|
|
|
} |
|
|
|
|
data-testid="User preferences home dashboard drop down" |
|
|
|
|
> |
|
|
|
|
<DashboardPicker |
|
|
|
|
value={homeDashboardUID} |
|
|
|
|
onChange={(v) => this.onHomeDashboardChanged(v?.uid ?? '')} |
|
|
|
|
defaultOptions={true} |
|
|
|
|
isClearable={true} |
|
|
|
|
placeholder={t('shared-preferences.fields.home-dashboard-placeholder', 'Default dashboard')} |
|
|
|
|
inputId="home-dashboard-select" |
|
|
|
|
/> |
|
|
|
|
</Field> |
|
|
|
|
|
|
|
|
|
<Field |
|
|
|
|
label={t('shared-dashboard.fields.timezone-label', 'Timezone')} |
|
|
|
|
data-testid={selectors.components.TimeZonePicker.containerV2} |
|
|
|
|
> |
|
|
|
|
<TimeZonePicker |
|
|
|
|
includeInternal={true} |
|
|
|
|
value={timezone} |
|
|
|
|
onChange={this.onTimeZoneChanged} |
|
|
|
|
inputId="shared-preferences-timezone-picker" |
|
|
|
|
/> |
|
|
|
|
</Field> |
|
|
|
|
|
|
|
|
|
<Field |
|
|
|
|
label={t('shared-preferences.fields.week-start-label', 'Week start')} |
|
|
|
|
data-testid={selectors.components.WeekStartPicker.containerV2} |
|
|
|
|
> |
|
|
|
|
<WeekStartPicker |
|
|
|
|
value={weekStart || ''} |
|
|
|
|
onChange={this.onWeekStartChanged} |
|
|
|
|
inputId={'shared-preferences-week-start-picker'} |
|
|
|
|
/> |
|
|
|
|
</Field> |
|
|
|
|
|
|
|
|
|
<Field |
|
|
|
|
label={ |
|
|
|
|
<Label htmlFor="locale-select"> |
|
|
|
|
<span className={styles.labelText}> |
|
|
|
|
<Trans i18nKey="shared-preferences.fields.locale-label">Language</Trans> |
|
|
|
|
</span> |
|
|
|
|
<FeatureBadge featureState={FeatureState.beta} /> |
|
|
|
|
</Label> |
|
|
|
|
} |
|
|
|
|
data-testid="User preferences language drop down" |
|
|
|
|
> |
|
|
|
|
<Select |
|
|
|
|
value={languages.find((lang) => lang.value === language)} |
|
|
|
|
onChange={(lang: SelectableValue<string>) => this.onLanguageChanged(lang.value ?? '')} |
|
|
|
|
options={languages} |
|
|
|
|
placeholder={t('shared-preferences.fields.locale-placeholder', 'Choose language')} |
|
|
|
|
inputId="locale-select" |
|
|
|
|
/> |
|
|
|
|
</Field> |
|
|
|
|
|
|
|
|
|
<div className="gf-form-button-row"> |
|
|
|
|
<Button |
|
|
|
|
type="submit" |
|
|
|
|
variant="primary" |
|
|
|
|
data-testid={selectors.components.UserProfile.preferencesSaveButton} |
|
|
|
|
<> |
|
|
|
|
<FieldSet label={<Trans i18nKey="shared-preferences.title">Preferences</Trans>} disabled={disabled}> |
|
|
|
|
<Field label={t('shared-preferences.fields.theme-label', 'Interface theme')}> |
|
|
|
|
<Select |
|
|
|
|
options={this.themeOptions} |
|
|
|
|
value={currentThemeOption} |
|
|
|
|
onChange={this.onThemeChanged} |
|
|
|
|
inputId="shared-preferences-theme-select" |
|
|
|
|
/> |
|
|
|
|
</Field> |
|
|
|
|
|
|
|
|
|
<Field |
|
|
|
|
label={ |
|
|
|
|
<Label htmlFor="home-dashboard-select"> |
|
|
|
|
<span className={styles.labelText}> |
|
|
|
|
<Trans i18nKey="shared-preferences.fields.home-dashboard-label">Home Dashboard</Trans> |
|
|
|
|
</span> |
|
|
|
|
</Label> |
|
|
|
|
} |
|
|
|
|
data-testid="User preferences home dashboard drop down" |
|
|
|
|
> |
|
|
|
|
<Trans i18nKey="common.save">Save</Trans> |
|
|
|
|
</Button> |
|
|
|
|
</div> |
|
|
|
|
</FieldSet> |
|
|
|
|
<DashboardPicker |
|
|
|
|
value={homeDashboardUID} |
|
|
|
|
onChange={(v) => this.onHomeDashboardChanged(v?.uid ?? '')} |
|
|
|
|
defaultOptions={true} |
|
|
|
|
isClearable={true} |
|
|
|
|
placeholder={t('shared-preferences.fields.home-dashboard-placeholder', 'Default dashboard')} |
|
|
|
|
inputId="home-dashboard-select" |
|
|
|
|
/> |
|
|
|
|
</Field> |
|
|
|
|
|
|
|
|
|
<Field |
|
|
|
|
label={t('shared-dashboard.fields.timezone-label', 'Timezone')} |
|
|
|
|
data-testid={selectors.components.TimeZonePicker.containerV2} |
|
|
|
|
> |
|
|
|
|
<TimeZonePicker |
|
|
|
|
includeInternal={true} |
|
|
|
|
value={timezone} |
|
|
|
|
onChange={this.onTimeZoneChanged} |
|
|
|
|
inputId="shared-preferences-timezone-picker" |
|
|
|
|
/> |
|
|
|
|
</Field> |
|
|
|
|
|
|
|
|
|
<Field |
|
|
|
|
label={t('shared-preferences.fields.week-start-label', 'Week start')} |
|
|
|
|
data-testid={selectors.components.WeekStartPicker.containerV2} |
|
|
|
|
> |
|
|
|
|
<WeekStartPicker |
|
|
|
|
value={weekStart || ''} |
|
|
|
|
onChange={this.onWeekStartChanged} |
|
|
|
|
inputId={'shared-preferences-week-start-picker'} |
|
|
|
|
/> |
|
|
|
|
</Field> |
|
|
|
|
|
|
|
|
|
<Field |
|
|
|
|
label={ |
|
|
|
|
<Label htmlFor="locale-select"> |
|
|
|
|
<span className={styles.labelText}> |
|
|
|
|
<Trans i18nKey="shared-preferences.fields.locale-label">Language</Trans> |
|
|
|
|
</span> |
|
|
|
|
<FeatureBadge featureState={FeatureState.beta} /> |
|
|
|
|
</Label> |
|
|
|
|
} |
|
|
|
|
data-testid="User preferences language drop down" |
|
|
|
|
> |
|
|
|
|
<Select |
|
|
|
|
value={languages.find((lang) => lang.value === language)} |
|
|
|
|
onChange={(lang: SelectableValue<string>) => this.onLanguageChanged(lang.value ?? '')} |
|
|
|
|
options={languages} |
|
|
|
|
placeholder={t('shared-preferences.fields.locale-placeholder', 'Choose language')} |
|
|
|
|
inputId="locale-select" |
|
|
|
|
/> |
|
|
|
|
</Field> |
|
|
|
|
</FieldSet> |
|
|
|
|
<Button |
|
|
|
|
type="submit" |
|
|
|
|
variant="primary" |
|
|
|
|
data-testid={selectors.components.UserProfile.preferencesSaveButton} |
|
|
|
|
> |
|
|
|
|
<Trans i18nKey="common.save">Save</Trans> |
|
|
|
|
</Button> |
|
|
|
|
</> |
|
|
|
|
); |
|
|
|
|
}} |
|
|
|
|
</Form> |
|
|
|
|