From 92058de698706537d8bc0a20a61360a569fda1b1 Mon Sep 17 00:00:00 2001 From: Kasper Nilsson Date: Tue, 10 Jul 2018 11:15:07 -0700 Subject: [PATCH] Add host to change list URL generation Change-Id: I3628e307b6ea7ccd3fad38451af749f63bcc8b5e --- .../gr-change-list-item.html | 4 ++-- .../gr-change-list-item.js | 10 ++++---- .../gr-change-list-item_test.html | 24 +++++++++++++++++++ .../core/gr-navigation/gr-navigation.html | 13 +++++++--- 4 files changed, 42 insertions(+), 9 deletions(-) diff --git a/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item.html b/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item.html index 6ea7cf3325..332121fed9 100644 --- a/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item.html +++ b/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item.html @@ -171,10 +171,10 @@ limitations under the License. - + [[change.project]] - + [[_computeTruncatedProject(change.project)]] diff --git a/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item.js b/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item.js index 259580b342..53cc990d27 100644 --- a/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item.js +++ b/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item.js @@ -122,17 +122,19 @@ return ''; }, - _computeProjectURL(project) { - return Gerrit.Nav.getUrlForProjectChanges(project, true); + _computeProjectURL(change) { + return Gerrit.Nav.getUrlForProjectChanges(change.project, true, + change.internalHost); }, _computeProjectBranchURL(change) { - return Gerrit.Nav.getUrlForBranch(change.branch, change.project); + return Gerrit.Nav.getUrlForBranch(change.branch, change.project, null, + change.internalHost); }, _computeTopicURL(change) { if (!change.topic) { return ''; } - return Gerrit.Nav.getUrlForTopic(change.topic); + return Gerrit.Nav.getUrlForTopic(change.topic, change.internalHost); }, _computeTruncatedProject(project) { diff --git a/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item_test.html b/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item_test.html index 81e1034de1..4fa6ff59aa 100644 --- a/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item_test.html +++ b/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item_test.html @@ -37,8 +37,10 @@ limitations under the License. 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 e217b4b9e5..dfe5410fb1 100644 --- a/polygerrit-ui/app/elements/core/gr-navigation/gr-navigation.html +++ b/polygerrit-ui/app/elements/core/gr-navigation/gr-navigation.html @@ -177,13 +177,15 @@ limitations under the License. * @param {!string} project The name of the project. * @param {boolean=} opt_openOnly When true, only search open changes in * the project. + * @param {string=} opt_host The host in which to search. * @return {string} */ - getUrlForProjectChanges(project, opt_openOnly) { + getUrlForProjectChanges(project, opt_openOnly, opt_host) { return this._getUrlFor({ view: Gerrit.Nav.View.SEARCH, project, statuses: opt_openOnly ? ['open'] : [], + host: opt_host, }); }, @@ -191,26 +193,30 @@ limitations under the License. * @param {string} branch The name of the branch. * @param {string} project The name of the project. * @param {string=} opt_status The status to search. + * @param {string=} opt_host The host in which to search. * @return {string} */ - getUrlForBranch(branch, project, opt_status) { + getUrlForBranch(branch, project, opt_status, opt_host) { return this._getUrlFor({ view: Gerrit.Nav.View.SEARCH, branch, project, statuses: opt_status ? [opt_status] : undefined, + host: opt_host, }); }, /** * @param {string} topic The name of the topic. + * @param {string=} opt_host The host in which to search. * @return {string} */ - getUrlForTopic(topic) { + getUrlForTopic(topic, opt_host) { return this._getUrlFor({ view: Gerrit.Nav.View.SEARCH, topic, statuses: ['open', 'merged'], + host: opt_host, }); }, @@ -267,6 +273,7 @@ limitations under the License. patchNum: opt_patchNum, basePatchNum: opt_basePatchNum, edit: opt_isEdit, + host: change.internalHost || undefined, }); },