mirror of
https://github.com/grafana/grafana.git
synced 2024-12-02 13:39:19 -06:00
TopNav: Keyboard shortcut to toggle topnav on or off (#52572)
* TopNav: Keyboard shortcut to google topnav on off * gate it behind dev mode
This commit is contained in:
parent
1974f166e0
commit
9ef29bb5c3
@ -3,7 +3,7 @@ import Mousetrap from 'mousetrap';
|
||||
import 'mousetrap-global-bind';
|
||||
import 'mousetrap/plugins/global-bind/mousetrap-global-bind';
|
||||
import { LegacyGraphHoverClearEvent, locationUtil } from '@grafana/data';
|
||||
import { locationService } from '@grafana/runtime';
|
||||
import { config, locationService } from '@grafana/runtime';
|
||||
import appEvents from 'app/core/app_events';
|
||||
import { getExploreUrl } from 'app/core/utils/explore';
|
||||
import { SaveDashboardDrawer } from 'app/features/dashboard/components/SaveDashboard/SaveDashboardDrawer';
|
||||
@ -47,6 +47,10 @@ export class KeybindingSrv {
|
||||
|
||||
this.bind('t t', () => toggleTheme(false));
|
||||
this.bind('t r', () => toggleTheme(true));
|
||||
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
this.bind('t n', () => this.toggleNav());
|
||||
}
|
||||
}
|
||||
|
||||
globalEsc() {
|
||||
@ -75,6 +79,12 @@ export class KeybindingSrv {
|
||||
this.exit();
|
||||
}
|
||||
|
||||
toggleNav() {
|
||||
window.location.href = locationUtil.getUrlForPartial(locationService.getLocation(), {
|
||||
'__feature.topnav': (!config.featureToggles.topnav).toString(),
|
||||
});
|
||||
}
|
||||
|
||||
private openSearch() {
|
||||
locationService.partial({ search: 'open' });
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user