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:
		@@ -53,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$="[[_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="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>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -68,10 +68,10 @@
 | 
				
			|||||||
      });
 | 
					      });
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    _getUrl(project, sections) {
 | 
					    _getUrl(project, id) {
 | 
				
			||||||
      if (!project || !sections) { return ''; }
 | 
					      if (!project || !id) { return ''; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      return Gerrit.Nav.getUrlForCustomDashboard(project, sections);
 | 
					      return Gerrit.Nav.getUrlForRepoDashboard(project, id);
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    _computeLoadingClass(loading) {
 | 
					    _computeLoadingClass(loading) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -245,7 +245,7 @@ limitations under the License.
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    suite('test url', () => {
 | 
					    suite('test url', () => {
 | 
				
			||||||
      test('_getUrl', () => {
 | 
					      test('_getUrl', () => {
 | 
				
			||||||
        sandbox.stub(Gerrit.Nav, 'getUrlForCustomDashboard',
 | 
					        sandbox.stub(Gerrit.Nav, 'getUrlForRepoDashboard',
 | 
				
			||||||
            () => '/r/dashboard/test');
 | 
					            () => '/r/dashboard/test');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        assert.equal(element._getUrl('/dashboard/test', {}), '/r/dashboard/test');
 | 
					        assert.equal(element._getUrl('/dashboard/test', {}), '/r/dashboard/test');
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -517,14 +517,15 @@ limitations under the License.
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
      /**
 | 
					      /**
 | 
				
			||||||
       * @param {string} repo The name of the repo.
 | 
					       * @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}
 | 
					       * @return {string}
 | 
				
			||||||
       */
 | 
					       */
 | 
				
			||||||
      getUrlForCustomDashboard(repo, sections) {
 | 
					      getUrlForRepoDashboard(repo, dashboard) {
 | 
				
			||||||
        return this._getUrlFor({
 | 
					        return this._getUrlFor({
 | 
				
			||||||
          repo,
 | 
					 | 
				
			||||||
          view: Gerrit.Nav.View.DASHBOARD,
 | 
					          view: Gerrit.Nav.View.DASHBOARD,
 | 
				
			||||||
          sections,
 | 
					          repo,
 | 
				
			||||||
 | 
					          dashboard,
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -424,7 +424,8 @@
 | 
				
			|||||||
        return `/dashboard/${user}?${queryParams.join('&')}`;
 | 
					        return `/dashboard/${user}?${queryParams.join('&')}`;
 | 
				
			||||||
      } else if (repoName) {
 | 
					      } else if (repoName) {
 | 
				
			||||||
        // Project dashboard.
 | 
					        // Project dashboard.
 | 
				
			||||||
        return `/p/${repoName}/+/dashboard/${params.dashboard}`;
 | 
					        const encodedRepo = this.encodeURL(repoName, true);
 | 
				
			||||||
 | 
					        return `/p/${encodedRepo}/+/dashboard/${params.dashboard}`;
 | 
				
			||||||
      } else {
 | 
					      } else {
 | 
				
			||||||
        // User dashboard.
 | 
					        // User dashboard.
 | 
				
			||||||
        return `/dashboard/${params.user || 'self'}`;
 | 
					        return `/dashboard/${params.user || 'self'}`;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user