Merge "Fix repo dashboard to use gr-navigation"

This commit is contained in:
Paladox none
2018-04-09 23:42:07 +00:00
committed by Gerrit Code Review
3 changed files with 19 additions and 1 deletions

View File

@@ -16,6 +16,7 @@ limitations under the License.
--> -->
<link rel="import" href="../../../bower_components/polymer/polymer.html"> <link rel="import" href="../../../bower_components/polymer/polymer.html">
<link rel="import" href="../../../styles/shared-styles.html"> <link rel="import" href="../../../styles/shared-styles.html">
<link rel="import" href="../../core/gr-navigation/gr-navigation.html">
<link rel="import" href="../../shared/gr-rest-api-interface/gr-rest-api-interface.html"> <link rel="import" href="../../shared/gr-rest-api-interface/gr-rest-api-interface.html">
<dom-module id="gr-repo-dashboards"> <dom-module id="gr-repo-dashboards">
@@ -52,7 +53,7 @@ limitations under the License.
</tr> </tr>
<template is="dom-repeat" items="[[item.dashboards]]"> <template is="dom-repeat" items="[[item.dashboards]]">
<tr class="table"> <tr class="table">
<td class="name"><a href$="[[item.url]]">[[item.path]]</a></td> <td class="name"><a href$="[[_getUrl(item.url)]]">[[item.path]]</a></td>
<td class="title">[[item.title]]</td> <td class="title">[[item.title]]</td>
<td class="desc">[[item.description]]</td> <td class="desc">[[item.description]]</td>
<td class="inherited">[[_computeInheritedFrom(item.project, item.defining_project)]]</td> <td class="inherited">[[_computeInheritedFrom(item.project, item.defining_project)]]</td>

View File

@@ -68,6 +68,12 @@
}); });
}, },
_getUrl(url) {
if (!url) { return ''; }
return Gerrit.Nav.navigateToRelativeUrl(url);
},
_computeLoadingClass(loading) { _computeLoadingClass(loading) {
return loading ? 'loading' : ''; return loading ? 'loading' : '';
}, },

View File

@@ -243,6 +243,17 @@ limitations under the License.
}); });
}); });
suite('test url', () => {
test('_getUrl', () => {
sandbox.stub(Gerrit.Nav, 'navigateToRelativeUrl',
() => '/r/dashboard/test');
assert.equal(element._getUrl('/dashboard/test'), '/r/dashboard/test');
assert.equal(element._getUrl(undefined), '');
});
});
suite('404', () => { suite('404', () => {
test('fires page-error', done => { test('fires page-error', done => {
const response = {status: 404}; const response = {status: 404};