mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: remove i18n toggle (#69389)
* remove i18n toggle
* remove beta badge on language picker
* remove toggle from go code
* Revert "remove beta badge on language picker"
This reverts commit 3b76300aa7
.
This commit is contained in:
parent
914d1a94ba
commit
5a98348faf
@ -25,7 +25,6 @@ Some stable features are enabled by default. You can disable a stable feature by
|
|||||||
| `featureHighlights` | Highlight Grafana Enterprise features | |
|
| `featureHighlights` | Highlight Grafana Enterprise features | |
|
||||||
| `exploreMixedDatasource` | Enable mixed datasource in Explore | Yes |
|
| `exploreMixedDatasource` | Enable mixed datasource in Explore | Yes |
|
||||||
| `dataConnectionsConsole` | Enables a new top-level page called Connections. This page is an experiment that provides a better experience when you install and configure data sources and other plugins. | Yes |
|
| `dataConnectionsConsole` | Enables a new top-level page called Connections. This page is an experiment that provides a better experience when you install and configure data sources and other plugins. | Yes |
|
||||||
| `internationalization` | Enables internationalization | Yes |
|
|
||||||
| `topnav` | Enables new top navigation and page layouts | Yes |
|
| `topnav` | Enables new top navigation and page layouts | Yes |
|
||||||
| `cloudWatchCrossAccountQuerying` | Enables cross-account querying in CloudWatch datasources | Yes |
|
| `cloudWatchCrossAccountQuerying` | Enables cross-account querying in CloudWatch datasources | Yes |
|
||||||
| `newPanelChromeUI` | Show updated look and feel of grafana-ui PanelChrome: panel header, icons, and menu | Yes |
|
| `newPanelChromeUI` | Show updated look and feel of grafana-ui PanelChrome: panel header, icons, and menu | Yes |
|
||||||
|
@ -45,7 +45,6 @@ export interface FeatureToggles {
|
|||||||
disableSecretsCompatibility?: boolean;
|
disableSecretsCompatibility?: boolean;
|
||||||
logRequestsInstrumentedAsUnknown?: boolean;
|
logRequestsInstrumentedAsUnknown?: boolean;
|
||||||
dataConnectionsConsole?: boolean;
|
dataConnectionsConsole?: boolean;
|
||||||
internationalization?: boolean;
|
|
||||||
topnav?: boolean;
|
topnav?: boolean;
|
||||||
grpcServer?: boolean;
|
grpcServer?: boolean;
|
||||||
entityStore?: boolean;
|
entityStore?: boolean;
|
||||||
|
@ -49,7 +49,7 @@ func (hs *HTTPServer) setIndexViewData(c *contextmodel.ReqContext) (*dtos.IndexV
|
|||||||
locale := "en-US"
|
locale := "en-US"
|
||||||
language := "" // frontend will set the default language
|
language := "" // frontend will set the default language
|
||||||
|
|
||||||
if hs.Features.IsEnabled(featuremgmt.FlagInternationalization) && prefs.JSONData.Language != "" {
|
if prefs.JSONData.Language != "" {
|
||||||
language = prefs.JSONData.Language
|
language = prefs.JSONData.Language
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,13 +186,6 @@ var (
|
|||||||
Expression: "true", // turned on by default
|
Expression: "true", // turned on by default
|
||||||
Owner: grafanaPluginsPlatformSquad,
|
Owner: grafanaPluginsPlatformSquad,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
Name: "internationalization",
|
|
||||||
Description: "Enables internationalization",
|
|
||||||
State: FeatureStateStable,
|
|
||||||
Expression: "true", // enabled by default
|
|
||||||
Owner: grafanaUserEssentialsSquad,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
Name: "topnav",
|
Name: "topnav",
|
||||||
Description: "Enables new top navigation and page layouts",
|
Description: "Enables new top navigation and page layouts",
|
||||||
|
@ -26,7 +26,6 @@ scenes,alpha,@grafana/dashboards-squad,false,false,false,true
|
|||||||
disableSecretsCompatibility,alpha,@grafana/hosted-grafana-team,false,false,true,false
|
disableSecretsCompatibility,alpha,@grafana/hosted-grafana-team,false,false,true,false
|
||||||
logRequestsInstrumentedAsUnknown,alpha,@grafana/hosted-grafana-team,false,false,false,false
|
logRequestsInstrumentedAsUnknown,alpha,@grafana/hosted-grafana-team,false,false,false,false
|
||||||
dataConnectionsConsole,stable,@grafana/plugins-platform-backend,false,false,false,false
|
dataConnectionsConsole,stable,@grafana/plugins-platform-backend,false,false,false,false
|
||||||
internationalization,stable,@grafana/user-essentials,false,false,false,false
|
|
||||||
topnav,stable,@grafana/user-essentials,false,false,false,false
|
topnav,stable,@grafana/user-essentials,false,false,false,false
|
||||||
grpcServer,beta,@grafana/grafana-app-platform-squad,false,false,false,false
|
grpcServer,beta,@grafana/grafana-app-platform-squad,false,false,false,false
|
||||||
entityStore,alpha,@grafana/grafana-app-platform-squad,true,false,false,false
|
entityStore,alpha,@grafana/grafana-app-platform-squad,true,false,false,false
|
||||||
|
|
@ -115,10 +115,6 @@ const (
|
|||||||
// Enables a new top-level page called Connections. This page is an experiment that provides a better experience when you install and configure data sources and other plugins.
|
// Enables a new top-level page called Connections. This page is an experiment that provides a better experience when you install and configure data sources and other plugins.
|
||||||
FlagDataConnectionsConsole = "dataConnectionsConsole"
|
FlagDataConnectionsConsole = "dataConnectionsConsole"
|
||||||
|
|
||||||
// FlagInternationalization
|
|
||||||
// Enables internationalization
|
|
||||||
FlagInternationalization = "internationalization"
|
|
||||||
|
|
||||||
// FlagTopnav
|
// FlagTopnav
|
||||||
// Enables new top navigation and page layouts
|
// Enables new top navigation and page layouts
|
||||||
FlagTopnav = "topnav"
|
FlagTopnav = "topnav"
|
||||||
|
@ -224,10 +224,7 @@ func (s *Service) GetDefaults() *pref.Preference {
|
|||||||
HomeDashboardID: 0,
|
HomeDashboardID: 0,
|
||||||
JSONData: &pref.PreferenceJSONData{},
|
JSONData: &pref.PreferenceJSONData{},
|
||||||
}
|
}
|
||||||
|
|
||||||
if s.features.IsEnabled(featuremgmt.FlagInternationalization) {
|
|
||||||
defaults.JSONData.Language = s.cfg.DefaultLanguage
|
defaults.JSONData.Language = s.cfg.DefaultLanguage
|
||||||
}
|
|
||||||
|
|
||||||
return defaults
|
return defaults
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,9 @@ func TestGetDefaults(t *testing.T) {
|
|||||||
Theme: "light",
|
Theme: "light",
|
||||||
Timezone: "UTC",
|
Timezone: "UTC",
|
||||||
HomeDashboardID: 0,
|
HomeDashboardID: 0,
|
||||||
JSONData: &pref.PreferenceJSONData{},
|
JSONData: &pref.PreferenceJSONData{
|
||||||
|
Language: "en-US",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
if diff := cmp.Diff(expected, preference); diff != "" {
|
if diff := cmp.Diff(expected, preference); diff != "" {
|
||||||
t.Fatalf("Result mismatch (-want +got):\n%s", diff)
|
t.Fatalf("Result mismatch (-want +got):\n%s", diff)
|
||||||
@ -56,32 +58,6 @@ func TestGetDefaults(t *testing.T) {
|
|||||||
query := &pref.GetPreferenceWithDefaultsQuery{OrgID: 1}
|
query := &pref.GetPreferenceWithDefaultsQuery{OrgID: 1}
|
||||||
preference, err := prefService.GetWithDefaults(context.Background(), query)
|
preference, err := prefService.GetWithDefaults(context.Background(), query)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
expected := &pref.Preference{
|
|
||||||
WeekStart: &weekStart,
|
|
||||||
Theme: "light",
|
|
||||||
Timezone: "UTC",
|
|
||||||
HomeDashboardID: 0,
|
|
||||||
JSONData: &pref.PreferenceJSONData{},
|
|
||||||
}
|
|
||||||
if diff := cmp.Diff(expected, preference); diff != "" {
|
|
||||||
t.Fatalf("Result mismatch (-want +got):\n%s", diff)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestGetDefaultsWithI18nFeatureFlag(t *testing.T) {
|
|
||||||
prefService := &Service{
|
|
||||||
store: newFake(),
|
|
||||||
cfg: setting.NewCfg(),
|
|
||||||
features: featuremgmt.WithFeatures(featuremgmt.FlagInternationalization),
|
|
||||||
}
|
|
||||||
weekStart := ""
|
|
||||||
prefService.cfg.DefaultLanguage = "en-US"
|
|
||||||
prefService.cfg.DefaultTheme = "light"
|
|
||||||
prefService.cfg.DateFormats.DefaultTimezone = "UTC"
|
|
||||||
|
|
||||||
t.Run("GetDefaults", func(t *testing.T) {
|
|
||||||
preference := prefService.GetDefaults()
|
|
||||||
expected := &pref.Preference{
|
expected := &pref.Preference{
|
||||||
WeekStart: &weekStart,
|
WeekStart: &weekStart,
|
||||||
Theme: "light",
|
Theme: "light",
|
||||||
|
@ -7,19 +7,6 @@ import { Preferences as UserPreferencesDTO } from '@grafana/schema/src/raw/prefe
|
|||||||
|
|
||||||
import SharedPreferences from './SharedPreferences';
|
import SharedPreferences from './SharedPreferences';
|
||||||
|
|
||||||
jest.mock('@grafana/runtime', () => {
|
|
||||||
const originalModule = jest.requireActual('@grafana/runtime');
|
|
||||||
return {
|
|
||||||
...originalModule,
|
|
||||||
config: {
|
|
||||||
...originalModule.config,
|
|
||||||
featureToggles: {
|
|
||||||
internationalization: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
jest.mock('app/core/services/backend_srv', () => {
|
jest.mock('app/core/services/backend_srv', () => {
|
||||||
return {
|
return {
|
||||||
backendSrv: {
|
backendSrv: {
|
||||||
|
@ -49,8 +49,6 @@ function getLanguageOptions(): Array<SelectableValue<string>> {
|
|||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
const i18nFlag = Boolean(config.featureToggles.internationalization);
|
|
||||||
|
|
||||||
export class SharedPreferences extends PureComponent<Props, State> {
|
export class SharedPreferences extends PureComponent<Props, State> {
|
||||||
service: PreferencesService;
|
service: PreferencesService;
|
||||||
themeOptions: SelectableValue[];
|
themeOptions: SelectableValue[];
|
||||||
@ -195,7 +193,6 @@ export class SharedPreferences extends PureComponent<Props, State> {
|
|||||||
/>
|
/>
|
||||||
</Field>
|
</Field>
|
||||||
|
|
||||||
{i18nFlag ? (
|
|
||||||
<Field
|
<Field
|
||||||
label={
|
label={
|
||||||
<Label htmlFor="locale-select">
|
<Label htmlFor="locale-select">
|
||||||
@ -215,7 +212,6 @@ export class SharedPreferences extends PureComponent<Props, State> {
|
|||||||
inputId="locale-select"
|
inputId="locale-select"
|
||||||
/>
|
/>
|
||||||
</Field>
|
</Field>
|
||||||
) : null}
|
|
||||||
|
|
||||||
<div className="gf-form-button-row">
|
<div className="gf-form-button-row">
|
||||||
<Button
|
<Button
|
||||||
|
@ -22,19 +22,6 @@ jest.mock('app/core/core', () => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
jest.mock('@grafana/runtime', () => {
|
|
||||||
const originalModule = jest.requireActual('@grafana/runtime');
|
|
||||||
return {
|
|
||||||
...originalModule,
|
|
||||||
config: {
|
|
||||||
...originalModule.config,
|
|
||||||
featureToggles: {
|
|
||||||
internationalization: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
const setup = (propOverrides?: object) => {
|
const setup = (propOverrides?: object) => {
|
||||||
jest.clearAllMocks();
|
jest.clearAllMocks();
|
||||||
// needed because SharedPreferences is rendered in the test
|
// needed because SharedPreferences is rendered in the test
|
||||||
|
Loading…
Reference in New Issue
Block a user