summaryrefslogtreecommitdiffstats
path: root/polygerrit-ui/app/behaviors/base-url-behavior/base-url-behavior.html
diff options
context:
space:
mode:
Diffstat (limited to 'polygerrit-ui/app/behaviors/base-url-behavior/base-url-behavior.html')
-rw-r--r--polygerrit-ui/app/behaviors/base-url-behavior/base-url-behavior.html12
1 files changed, 11 insertions, 1 deletions
diff --git a/polygerrit-ui/app/behaviors/base-url-behavior/base-url-behavior.html b/polygerrit-ui/app/behaviors/base-url-behavior/base-url-behavior.html
index cda8c53090..48bd10e392 100644
--- a/polygerrit-ui/app/behaviors/base-url-behavior/base-url-behavior.html
+++ b/polygerrit-ui/app/behaviors/base-url-behavior/base-url-behavior.html
@@ -1,4 +1,5 @@
<!--
+@license
Copyright (C) 2017 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
@@ -20,6 +21,9 @@ limitations under the License.
window.Gerrit = window.Gerrit || {};
+ const PROJECT_DASHBOARD_PATTERN = /\/p\/(.+)\/\+\/dashboard\/(.*)/;
+ const REPO_URL_PATTERN = /^\/admin\/repos/;
+ const PROJECT_URL = '/admin/projects';
/** @polymerBehavior Gerrit.BaseUrlBehavior */
Gerrit.BaseUrlBehavior = {
/** @return {string} */
@@ -29,7 +33,13 @@ limitations under the License.
computeGwtUrl(path) {
const base = this.getBaseUrl();
- const clientPath = path.substring(base.length);
+ let clientPath = path.substring(base.length);
+ const match = clientPath.match(PROJECT_DASHBOARD_PATTERN);
+ if (match) {
+ clientPath = `/projects/${match[1]},dashboards/${match[2]}`;
+ }
+ // Replace any '/admin/project' links to '/admin/repo'
+ clientPath = clientPath.replace(REPO_URL_PATTERN, PROJECT_URL);
return base + '/?polygerrit=0#' + clientPath;
},
};