Repo admin UI: Add a "General" section for repo admin view
We create a separate section for the repo's general config and make the
repository title non-clickable.
This change includes the following modifications:
1) Add a separate "General" sub-section for admin repo view. This
is accessible through the new URL /admin\/repos\/$repo,general$/.
2) Remove the hyperlink from repo name.
3) Redirect requests from /admin/repos/$repo to
/admin/repos/$repo,general.
Change-Id: Ief7e12a9be1ebe3751911b3386715fa55186909c
diff --git a/polygerrit-ui/app/elements/core/gr-router/gr-router.ts b/polygerrit-ui/app/elements/core/gr-router/gr-router.ts
index 7532101..ad1b02d 100644
--- a/polygerrit-ui/app/elements/core/gr-router/gr-router.ts
+++ b/polygerrit-ui/app/elements/core/gr-router/gr-router.ts
@@ -131,6 +131,8 @@
// Matches /admin/repos/<repo>,commands.
REPO_COMMANDS: /^\/admin\/repos\/(.+),commands$/,
+ REPO_GENERAL: /^\/admin\/repos\/(.+),general$/,
+
// Matches /admin/repos/<repos>,access.
REPO_ACCESS: /^\/admin\/repos\/(.+),access$/,
@@ -638,7 +640,9 @@
_generateRepoUrl(params: GenerateUrlRepoViewParameters) {
let url = `/admin/repos/${encodeURL(`${params.repoName}`, true)}`;
- if (params.detail === RepoDetailView.ACCESS) {
+ if (params.detail === RepoDetailView.GENERAL) {
+ url += ',general';
+ } else if (params.detail === RepoDetailView.ACCESS) {
url += ',access';
} else if (params.detail === RepoDetailView.BRANCHES) {
url += ',branches';
@@ -990,6 +994,8 @@
true
);
+ this._mapRoute(RoutePattern.REPO_GENERAL, '_handleRepoGeneralRoute');
+
this._mapRoute(RoutePattern.REPO_ACCESS, '_handleRepoAccessRoute');
this._mapRoute(RoutePattern.REPO_DASHBOARDS, '_handleRepoDashboardsRoute');
@@ -1403,6 +1409,16 @@
this.reporting.setRepoName(repo);
}
+ _handleRepoGeneralRoute(data: PageContextWithQueryMap) {
+ const repo = data.params[0] as RepoName;
+ this._setParams({
+ view: GerritView.REPO,
+ detail: RepoDetailView.GENERAL,
+ repo,
+ });
+ this.reporting.setRepoName(repo);
+ }
+
_handleRepoAccessRoute(data: PageContextWithQueryMap) {
const repo = data.params[0] as RepoName;
this._setParams({
@@ -1521,12 +1537,7 @@
}
_handleRepoRoute(data: PageContextWithQueryMap) {
- const repo = data.params[0] as RepoName;
- this._setParams({
- view: GerritView.REPO,
- repo,
- });
- this.reporting.setRepoName(repo);
+ this._redirect(data.path + ',general');
}
_handlePluginListOffsetRoute(data: PageContextWithQueryMap) {