diff --git a/.betterer.results b/.betterer.results index 1f976380ac4..9c7d33abd00 100644 --- a/.betterer.results +++ b/.betterer.results @@ -1050,9 +1050,6 @@ exports[`better eslint`] = { [0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "0"], [0, 0, 0, "Styles should be written using objects.", "1"] ], - "public/app/core/components/SharedPreferences/SharedPreferences.tsx:5381": [ - [0, 0, 0, "Styles should be written using objects.", "0"] - ], "public/app/core/components/TagFilter/TagFilter.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"], diff --git a/public/app/core/components/SharedPreferences/SharedPreferences.tsx b/public/app/core/components/SharedPreferences/SharedPreferences.tsx index 819608c4fb1..6bdfc8c89c6 100644 --- a/public/app/core/components/SharedPreferences/SharedPreferences.tsx +++ b/public/app/core/components/SharedPreferences/SharedPreferences.tsx @@ -9,7 +9,6 @@ import { Button, Field, FieldSet, - Form, Label, Select, stylesFactory, @@ -87,7 +86,8 @@ export class SharedPreferences extends PureComponent { }); } - onSubmitForm = async () => { + onSubmitForm = async (event: React.FormEvent) => { + event.preventDefault(); const confirmationResult = this.props.onConfirm ? await this.props.onConfirm() : true; if (confirmationResult) { @@ -137,94 +137,84 @@ export class SharedPreferences extends PureComponent { const currentThemeOption = this.themeOptions.find((x) => x.value === theme) ?? this.themeOptions[0]; return ( -
- {() => { - return ( - <> -
Preferences} disabled={disabled}> - - + - - - Home Dashboard - - - } - data-testid="User preferences home dashboard drop down" - > - this.onHomeDashboardChanged(v?.uid ?? '')} - defaultOptions={true} - isClearable={true} - placeholder={t('shared-preferences.fields.home-dashboard-placeholder', 'Default dashboard')} - inputId="home-dashboard-select" - /> - + + + Home Dashboard + + + } + data-testid="User preferences home dashboard drop down" + > + this.onHomeDashboardChanged(v?.uid ?? '')} + defaultOptions={true} + isClearable={true} + placeholder={t('shared-preferences.fields.home-dashboard-placeholder', 'Default dashboard')} + inputId="home-dashboard-select" + /> + - - - + + + - - - + + + - - - Language - - - - } - data-testid="User preferences language drop down" - > - lang.value === language)} + onChange={(lang: SelectableValue) => this.onLanguageChanged(lang.value ?? '')} + options={languages} + placeholder={t('shared-preferences.fields.locale-placeholder', 'Choose language')} + inputId="locale-select" + /> + +
+ +
); } } @@ -233,9 +223,13 @@ export default SharedPreferences; const getStyles = stylesFactory(() => { return { - labelText: css` - margin-right: 6px; - `, + labelText: css({ + marginRight: '6px', + }), + form: css({ + width: '100%', + maxWidth: '600px', + }), }; });