Files
gerrit/polygerrit-ui/app/behaviors/base-url-behavior/base-url-behavior.html
Logan Hanks c34e0b6cd5 Implement project dashboard view in PolyGerrit
Project dashboards are defined by files at special refs in a project (or
a project's inheritence tree).

https://gerrit-review.googlesource.com/Documentation/user-dashboards.html#project-dashboards

This change includes some refactoring of gr-dashboard-view to better
accommodate the variety of dashboards it supports. It also comes with
more tests and a fix for a minor regression (special suffixes that are
used in the query to populate the items in a dashboard section, but
should be dropped in the href used in the section title hyperlink).

Bug: Issue 7319
Bug: Issue 7335
Change-Id: Iffd7484b0d4628b7a4a483c895c96179d7fbecda
2017-11-21 12:53:31 -08:00

44 lines
1.2 KiB
HTML

<!--
Copyright (C) 2017 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script>
(function(window) {
'use strict';
window.Gerrit = window.Gerrit || {};
const PROJECT_DASHBOARD_PATTERN = /\/p\/(.+)\/\+\/dashboard\/(.*)/;
/** @polymerBehavior Gerrit.BaseUrlBehavior */
Gerrit.BaseUrlBehavior = {
/** @return {string} */
getBaseUrl() {
return window.CANONICAL_PATH || '';
},
computeGwtUrl(path) {
const base = this.getBaseUrl();
let clientPath = path.substring(base.length);
const match = clientPath.match(PROJECT_DASHBOARD_PATTERN);
if (match) {
clientPath = `/projects/${match[1]},dashboards/${match[2]}`;
}
return base + '/?polygerrit=0#' + clientPath;
},
};
})(window);
</script>