mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -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-global-bind';
|
||||||
import 'mousetrap/plugins/global-bind/mousetrap-global-bind';
|
import 'mousetrap/plugins/global-bind/mousetrap-global-bind';
|
||||||
import { LegacyGraphHoverClearEvent, locationUtil } from '@grafana/data';
|
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 appEvents from 'app/core/app_events';
|
||||||
import { getExploreUrl } from 'app/core/utils/explore';
|
import { getExploreUrl } from 'app/core/utils/explore';
|
||||||
import { SaveDashboardDrawer } from 'app/features/dashboard/components/SaveDashboard/SaveDashboardDrawer';
|
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 t', () => toggleTheme(false));
|
||||||
this.bind('t r', () => toggleTheme(true));
|
this.bind('t r', () => toggleTheme(true));
|
||||||
|
|
||||||
|
if (process.env.NODE_ENV === 'development') {
|
||||||
|
this.bind('t n', () => this.toggleNav());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
globalEsc() {
|
globalEsc() {
|
||||||
@ -75,6 +79,12 @@ export class KeybindingSrv {
|
|||||||
this.exit();
|
this.exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
toggleNav() {
|
||||||
|
window.location.href = locationUtil.getUrlForPartial(locationService.getLocation(), {
|
||||||
|
'__feature.topnav': (!config.featureToggles.topnav).toString(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private openSearch() {
|
private openSearch() {
|
||||||
locationService.partial({ search: 'open' });
|
locationService.partial({ search: 'open' });
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user