Navigation: Add keyboard shortcut to navigate directly to Dashboards (#68350)

* add go to dashboards keybinding

* add shortcut to keybindings modal
This commit is contained in:
Ashley Harrison 2023-05-12 13:25:54 +01:00 committed by GitHub
parent e7a67e749c
commit 4f987a4a5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -9,6 +9,7 @@ const getShortcuts = (modKey: string) => {
return { return {
Global: [ Global: [
{ keys: ['g', 'h'], description: 'Go to Home Dashboard' }, { keys: ['g', 'h'], description: 'Go to Home Dashboard' },
{ keys: ['g', 'd'], description: 'Go to Dashboards' },
{ keys: ['g', 'e'], description: 'Go to Explore' }, { keys: ['g', 'e'], description: 'Go to Explore' },
{ keys: ['g', 'p'], description: 'Go to Profile' }, { keys: ['g', 'p'], description: 'Go to Profile' },
{ keys: [`${modKey} + k`], description: 'Open search' }, { keys: [`${modKey} + k`], description: 'Open search' },

View File

@ -38,9 +38,10 @@ export class KeybindingSrv {
if (!route.chromeless) { if (!route.chromeless) {
this.bind(['?', 'h'], this.showHelpModal); this.bind(['?', 'h'], this.showHelpModal);
this.bind('g h', this.goToHome); this.bind('g h', this.goToHome);
this.bind('g d', this.goToDashboards);
this.bind('g e', this.goToExplore);
this.bind('g a', this.openAlerting); this.bind('g a', this.openAlerting);
this.bind('g p', this.goToProfile); this.bind('g p', this.goToProfile);
this.bind('g e', this.goToExplore);
this.bind('t a', this.makeAbsoluteTime); this.bind('t a', this.makeAbsoluteTime);
this.bind('esc', this.exit); this.bind('esc', this.exit);
this.bindGlobalEsc(); this.bindGlobalEsc();
@ -88,6 +89,10 @@ export class KeybindingSrv {
this.locationService.push('/alerting'); this.locationService.push('/alerting');
} }
private goToDashboards() {
this.locationService.push('/dashboards');
}
private goToHome() { private goToHome() {
this.locationService.push('/'); this.locationService.push('/');
} }