Link to project dashboards instead of custom

The admin page that lists project dashboards constructs custom dashboard
links that only approximate the intended behavior of each dashboard.

Bug: Issue 9903
Change-Id: Ic911d307416ee4e5eab6020e6c12e6d0554204fb
This commit is contained in:
Logan Hanks
2018-11-12 15:01:31 -08:00
committed by Paladox
parent fa6433fdb9
commit 4d86635d50
5 changed files with 12 additions and 10 deletions

View File

@@ -53,7 +53,7 @@ limitations under the License.
</tr>
<template is="dom-repeat" items="[[item.dashboards]]">
<tr class="table">
<td class="name"><a href$="[[_getUrl(item.project, item.sections)]]">[[item.path]]</a></td>
<td class="name"><a href$="[[_getUrl(item.project, item.id)]]">[[item.path]]</a></td>
<td class="title">[[item.title]]</td>
<td class="desc">[[item.description]]</td>
<td class="inherited">[[_computeInheritedFrom(item.project, item.defining_project)]]</td>

View File

@@ -68,10 +68,10 @@
});
},
_getUrl(project, sections) {
if (!project || !sections) { return ''; }
_getUrl(project, id) {
if (!project || !id) { return ''; }
return Gerrit.Nav.getUrlForCustomDashboard(project, sections);
return Gerrit.Nav.getUrlForRepoDashboard(project, id);
},
_computeLoadingClass(loading) {

View File

@@ -245,7 +245,7 @@ limitations under the License.
suite('test url', () => {
test('_getUrl', () => {
sandbox.stub(Gerrit.Nav, 'getUrlForCustomDashboard',
sandbox.stub(Gerrit.Nav, 'getUrlForRepoDashboard',
() => '/r/dashboard/test');
assert.equal(element._getUrl('/dashboard/test', {}), '/r/dashboard/test');

View File

@@ -517,14 +517,15 @@ limitations under the License.
/**
* @param {string} repo The name of the repo.
* @param {!Array} sections The sections to display in the dashboard
* @param {string} dashboard The ID of the dashboard, in the form of
* '<ref>:<path>'.
* @return {string}
*/
getUrlForCustomDashboard(repo, sections) {
getUrlForRepoDashboard(repo, dashboard) {
return this._getUrlFor({
repo,
view: Gerrit.Nav.View.DASHBOARD,
sections,
repo,
dashboard,
});
},

View File

@@ -424,7 +424,8 @@
return `/dashboard/${user}?${queryParams.join('&')}`;
} else if (repoName) {
// Project dashboard.
return `/p/${repoName}/+/dashboard/${params.dashboard}`;
const encodedRepo = this.encodeURL(repoName, true);
return `/p/${encodedRepo}/+/dashboard/${params.dashboard}`;
} else {
// User dashboard.
return `/dashboard/${params.user || 'self'}`;