mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Preferences: Add preferences kind and remove unused navbar settings (#59621)
This commit is contained in:
@@ -5,7 +5,7 @@ import TestProvider from 'test/helpers/TestProvider';
|
||||
import { assertInstanceOf } from 'test/helpers/asserts';
|
||||
import { getSelectParent, selectOptionInTest } from 'test/helpers/selectOptionInTest';
|
||||
|
||||
import { UserPreferencesDTO } from 'app/types';
|
||||
import { Preferences as UserPreferencesDTO } from '@grafana/schema/src/raw/preferences/x/preferences_types.gen';
|
||||
|
||||
import SharedPreferences from './SharedPreferences';
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import React, { PureComponent } from 'react';
|
||||
import { FeatureState, SelectableValue } from '@grafana/data';
|
||||
import { selectors } from '@grafana/e2e-selectors';
|
||||
import { config, reportInteraction } from '@grafana/runtime';
|
||||
import { Preferences as UserPreferencesDTO } from '@grafana/schema/src/raw/preferences/x/preferences_types.gen';
|
||||
import {
|
||||
Button,
|
||||
Field,
|
||||
@@ -21,7 +22,6 @@ import { DashboardPicker } from 'app/core/components/Select/DashboardPicker';
|
||||
import { t, Trans } from 'app/core/internationalization';
|
||||
import { LANGUAGES } from 'app/core/internationalization/constants';
|
||||
import { PreferencesService } from 'app/core/services/PreferencesService';
|
||||
import { UserPreferencesDTO } from 'app/types';
|
||||
|
||||
export interface Props {
|
||||
resourceUri: string;
|
||||
@@ -130,6 +130,10 @@ export class SharedPreferences extends PureComponent<Props, State> {
|
||||
const { disabled } = this.props;
|
||||
const styles = getStyles();
|
||||
const languages = getLanguageOptions();
|
||||
let currentThemeOption = this.themeOptions[0].value;
|
||||
if (theme?.length) {
|
||||
currentThemeOption = this.themeOptions.find((item) => item.value === theme)?.value;
|
||||
}
|
||||
|
||||
return (
|
||||
<Form onSubmit={this.onSubmitForm}>
|
||||
@@ -139,7 +143,7 @@ export class SharedPreferences extends PureComponent<Props, State> {
|
||||
<Field label={t('shared-preferences.fields.theme-label', 'UI Theme')}>
|
||||
<RadioButtonGroup
|
||||
options={this.themeOptions}
|
||||
value={this.themeOptions.find((item) => item.value === theme)?.value}
|
||||
value={currentThemeOption}
|
||||
onChange={this.onThemeChanged}
|
||||
/>
|
||||
</Field>
|
||||
@@ -181,7 +185,7 @@ export class SharedPreferences extends PureComponent<Props, State> {
|
||||
data-testid={selectors.components.WeekStartPicker.containerV2}
|
||||
>
|
||||
<WeekStartPicker
|
||||
value={weekStart}
|
||||
value={weekStart || ''}
|
||||
onChange={this.onWeekStartChanged}
|
||||
inputId={'shared-preferences-week-start-picker'}
|
||||
/>
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import { of } from 'rxjs';
|
||||
|
||||
import { Preferences as UserPreferencesDTO } from '@grafana/schema/src/raw/preferences/x/preferences_types.gen';
|
||||
|
||||
import { DatasourceSrv } from '../../features/plugins/datasource_srv';
|
||||
import { RichHistoryQuery, UserPreferencesDTO } from '../../types';
|
||||
import { RichHistoryQuery } from '../../types';
|
||||
import { SortOrder } from '../utils/richHistoryTypes';
|
||||
|
||||
import RichHistoryRemoteStorage, { RichHistoryRemoteStorageDTO } from './RichHistoryRemoteStorage';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { UserPreferencesDTO } from 'app/types';
|
||||
import { Preferences as UserPreferencesDTO } from '@grafana/schema/src/raw/preferences/x/preferences_types.gen';
|
||||
|
||||
import { backendSrv } from './backend_srv';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user