PG: Add shortcuts for dashboard and watched changes
Bug: Issue 10166
Change-Id: Iebe7929696f16d30de9309f589521a7c27ca3a69
diff --git a/polygerrit-ui/app/behaviors/keyboard-shortcut-behavior/keyboard-shortcut-behavior.html b/polygerrit-ui/app/behaviors/keyboard-shortcut-behavior/keyboard-shortcut-behavior.html
index af982cf..3e99d44 100644
--- a/polygerrit-ui/app/behaviors/keyboard-shortcut-behavior/keyboard-shortcut-behavior.html
+++ b/polygerrit-ui/app/behaviors/keyboard-shortcut-behavior/keyboard-shortcut-behavior.html
@@ -121,9 +121,11 @@
const Shortcut = {
OPEN_SHORTCUT_HELP_DIALOG: 'OPEN_SHORTCUT_HELP_DIALOG',
+ GO_TO_USER_DASHBOARD: 'GO_TO_USER_DASHBOARD',
GO_TO_OPENED_CHANGES: 'GO_TO_OPENED_CHANGES',
GO_TO_MERGED_CHANGES: 'GO_TO_MERGED_CHANGES',
GO_TO_ABANDONED_CHANGES: 'GO_TO_ABANDONED_CHANGES',
+ GO_TO_WATCHED_CHANGES: 'GO_TO_WATCHED_CHANGES',
CURSOR_NEXT_CHANGE: 'CURSOR_NEXT_CHANGE',
CURSOR_PREV_CHANGE: 'CURSOR_PREV_CHANGE',
@@ -192,12 +194,16 @@
_describe(Shortcut.SEARCH, ShortcutSection.EVERYWHERE, 'Search');
_describe(Shortcut.OPEN_SHORTCUT_HELP_DIALOG, ShortcutSection.EVERYWHERE,
'Show this dialog');
+ _describe(Shortcut.GO_TO_USER_DASHBOARD, ShortcutSection.EVERYWHERE,
+ 'Go to User Dashboard');
_describe(Shortcut.GO_TO_OPENED_CHANGES, ShortcutSection.EVERYWHERE,
'Go to Opened Changes');
_describe(Shortcut.GO_TO_MERGED_CHANGES, ShortcutSection.EVERYWHERE,
'Go to Merged Changes');
_describe(Shortcut.GO_TO_ABANDONED_CHANGES, ShortcutSection.EVERYWHERE,
'Go to Abandoned Changes');
+ _describe(Shortcut.GO_TO_WATCHED_CHANGES, ShortcutSection.EVERYWHERE,
+ 'Go to Watched Changes');
_describe(Shortcut.CURSOR_NEXT_CHANGE, ShortcutSection.ACTIONS,
'Select next change');
diff --git a/polygerrit-ui/app/elements/core/gr-navigation/gr-navigation.html b/polygerrit-ui/app/elements/core/gr-navigation/gr-navigation.html
index 3650707..c0ef3ac 100644
--- a/polygerrit-ui/app/elements/core/gr-navigation/gr-navigation.html
+++ b/polygerrit-ui/app/elements/core/gr-navigation/gr-navigation.html
@@ -348,6 +348,13 @@
},
/**
+ * Navigate to the user's dashboard
+ */
+ navigateToUserDashboard() {
+ return this._navigate(this.getUrlForUserDashboard('self'));
+ },
+
+ /**
* @param {!Object} change The change object.
* @param {number=} opt_patchNum
* @param {number|string=} opt_basePatchNum The string 'PARENT' can be
diff --git a/polygerrit-ui/app/elements/gr-app.js b/polygerrit-ui/app/elements/gr-app.js
index 321dc58..30767e4 100644
--- a/polygerrit-ui/app/elements/gr-app.js
+++ b/polygerrit-ui/app/elements/gr-app.js
@@ -112,9 +112,11 @@
keyboardShortcuts() {
return {
[this.Shortcut.OPEN_SHORTCUT_HELP_DIALOG]: '_showKeyboardShortcuts',
+ [this.Shortcut.GO_TO_USER_DASHBOARD]: '_goToUserDashboard',
[this.Shortcut.GO_TO_OPENED_CHANGES]: '_goToOpenedChanges',
[this.Shortcut.GO_TO_MERGED_CHANGES]: '_goToMergedChanges',
[this.Shortcut.GO_TO_ABANDONED_CHANGES]: '_goToAbandonedChanges',
+ [this.Shortcut.GO_TO_WATCHED_CHANGES]: '_goToWatchedChanges',
};
},
@@ -181,11 +183,15 @@
this.bindShortcut(
this.Shortcut.OPEN_SHORTCUT_HELP_DIALOG, '?');
this.bindShortcut(
+ this.Shortcut.GO_TO_USER_DASHBOARD, this.GO_KEY, 'i');
+ this.bindShortcut(
this.Shortcut.GO_TO_OPENED_CHANGES, this.GO_KEY, 'o');
this.bindShortcut(
this.Shortcut.GO_TO_MERGED_CHANGES, this.GO_KEY, 'm');
this.bindShortcut(
this.Shortcut.GO_TO_ABANDONED_CHANGES, this.GO_KEY, 'a');
+ this.bindShortcut(
+ this.Shortcut.GO_TO_WATCHED_CHANGES, this.GO_KEY, 'w');
this.bindShortcut(
this.Shortcut.CURSOR_NEXT_CHANGE, 'j');
@@ -414,6 +420,10 @@
return isShadowDom ? 'shadow' : '';
},
+ _goToUserDashboard() {
+ Gerrit.Nav.navigateToUserDashboard();
+ },
+
_goToOpenedChanges() {
Gerrit.Nav.navigateToStatusSearch('open');
},
@@ -426,6 +436,11 @@
Gerrit.Nav.navigateToStatusSearch('abandoned');
},
+ _goToWatchedChanges() {
+ // The query is hardcoded, and doesn't respect custom menu entries
+ Gerrit.Nav.navigateToSearchQuery('is:watched is:open');
+ },
+
_computePluginScreenName({plugin, screen}) {
return Gerrit._getPluginScreenName(plugin, screen);
},