mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Command Palette: Maintain page state when changing theme (#59787)
* use same function as the change theme keybindings * rename toggleTheme service to just theme
This commit is contained in:
@@ -4,6 +4,7 @@ import React from 'react';
|
||||
import { isIconName, NavModelItem } from '@grafana/data';
|
||||
import { locationService } from '@grafana/runtime';
|
||||
import { Icon } from '@grafana/ui';
|
||||
import { changeTheme } from 'app/core/services/theme';
|
||||
|
||||
const SECTION_PAGES = 'Pages';
|
||||
const SECTION_ACTIONS = 'Actions';
|
||||
@@ -82,10 +83,7 @@ export default (navBarTree: NavModelItem[]) => {
|
||||
name: 'Dark',
|
||||
keywords: 'dark theme',
|
||||
section: '',
|
||||
perform: () => {
|
||||
locationService.push({ search: '?theme=dark' });
|
||||
location.reload();
|
||||
},
|
||||
perform: () => changeTheme('dark'),
|
||||
parent: 'preferences/theme',
|
||||
},
|
||||
{
|
||||
@@ -93,10 +91,7 @@ export default (navBarTree: NavModelItem[]) => {
|
||||
name: 'Light',
|
||||
keywords: 'light theme',
|
||||
section: '',
|
||||
perform: () => {
|
||||
locationService.push({ search: '?theme=light' });
|
||||
location.reload();
|
||||
},
|
||||
perform: () => changeTheme('light'),
|
||||
parent: 'preferences/theme',
|
||||
},
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user