I18n: Add locale to user preference (#49425)
* Add __debug_bin file to gitignore * Add locale user preference * undo defaulting to existing JSONData in preferences save
This commit is contained in:
@@ -10,6 +10,7 @@ type Prefs struct {
|
||||
HomeDashboardUID string `json:"homeDashboardUID,omitempty"`
|
||||
Timezone string `json:"timezone"`
|
||||
WeekStart string `json:"weekStart"`
|
||||
Locale string `json:"locale"`
|
||||
Navbar pref.NavbarPreference `json:"navbar,omitempty"`
|
||||
QueryHistory pref.QueryHistoryPreference `json:"queryHistory,omitempty"`
|
||||
}
|
||||
@@ -27,6 +28,7 @@ type UpdatePrefsCmd struct {
|
||||
WeekStart string `json:"weekStart"`
|
||||
Navbar *pref.NavbarPreference `json:"navbar,omitempty"`
|
||||
QueryHistory *pref.QueryHistoryPreference `json:"queryHistory,omitempty"`
|
||||
Locale string `json:"locale"`
|
||||
}
|
||||
|
||||
// swagger:model
|
||||
@@ -39,6 +41,7 @@ type PatchPrefsCmd struct {
|
||||
// Enum: utc,browser
|
||||
Timezone *string `json:"timezone,omitempty"`
|
||||
WeekStart *string `json:"weekStart,omitempty"`
|
||||
Locale *string `json:"locale,omitempty"`
|
||||
Navbar *pref.NavbarPreference `json:"navbar,omitempty"`
|
||||
QueryHistory *pref.QueryHistoryPreference `json:"queryHistory,omitempty"`
|
||||
HomeDashboardUID *string `json:"homeDashboardUID,omitempty"`
|
||||
|
||||
@@ -80,6 +80,7 @@ func (hs *HTTPServer) getPreferencesFor(ctx context.Context, orgID, userID, team
|
||||
}
|
||||
|
||||
if preference.JSONData != nil {
|
||||
dto.Locale = preference.JSONData.Locale
|
||||
dto.Navbar = preference.JSONData.Navbar
|
||||
dto.QueryHistory = preference.JSONData.QueryHistory
|
||||
}
|
||||
@@ -117,6 +118,7 @@ func (hs *HTTPServer) updatePreferencesFor(ctx context.Context, orgID, userID, t
|
||||
OrgID: orgID,
|
||||
TeamID: teamId,
|
||||
Theme: dtoCmd.Theme,
|
||||
Locale: dtoCmd.Locale,
|
||||
Timezone: dtoCmd.Timezone,
|
||||
WeekStart: dtoCmd.WeekStart,
|
||||
HomeDashboardID: dtoCmd.HomeDashboardID,
|
||||
@@ -165,6 +167,7 @@ func (hs *HTTPServer) patchPreferencesFor(ctx context.Context, orgID, userID, te
|
||||
Timezone: dtoCmd.Timezone,
|
||||
WeekStart: dtoCmd.WeekStart,
|
||||
HomeDashboardID: dtoCmd.HomeDashboardID,
|
||||
Locale: dtoCmd.Locale,
|
||||
Navbar: dtoCmd.Navbar,
|
||||
QueryHistory: dtoCmd.QueryHistory,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user