From 7b82696578c5c563c17e9fc5f55be5b0d172b239 Mon Sep 17 00:00:00 2001 From: Thomas Draebing Date: Wed, 30 Oct 2019 11:10:30 +0100 Subject: [PATCH] Add "readOnly"-endpoint parameter to repo-config endpoint The repo-config endpoint allows plugins to add new config sections to the repository configuration. So far, each plugin had to determine itself, whether the options were changeable by the logged in user. Thus, each plugin that wanted to disable form fields, if the user was not the owner of the repo, had to perform the same REST-request, which led to an unnecessarily high number of requests. This change adds a parameter to the repo-config endpoint, which forwards the boolean _readOnly variable to the plugin to be used to decide, whether an option should be enabled to the logged in user. Change-Id: Id1d7db2184d84d4ded157bed9a0492f516eeb53e --- Documentation/pg-plugin-endpoints.txt | 4 ++++ polygerrit-ui/app/elements/admin/gr-repo/gr-repo.html | 1 + 2 files changed, 5 insertions(+) diff --git a/Documentation/pg-plugin-endpoints.txt b/Documentation/pg-plugin-endpoints.txt index c0d78542ac..14e62eacd2 100644 --- a/Documentation/pg-plugin-endpoints.txt +++ b/Documentation/pg-plugin-endpoints.txt @@ -114,6 +114,10 @@ In addition to default parameters, the following are available: + String name of the repository currently being configured. +* `readOnly` ++ +Boolean whether the repository configuration is read only by the logged in user. + === settings-menu-item This endpoint is situated at the end of the navigation menu in the settings screen. diff --git a/polygerrit-ui/app/elements/admin/gr-repo/gr-repo.html b/polygerrit-ui/app/elements/admin/gr-repo/gr-repo.html index 6ce1a09c5e..186740eb14 100644 --- a/polygerrit-ui/app/elements/admin/gr-repo/gr-repo.html +++ b/polygerrit-ui/app/elements/admin/gr-repo/gr-repo.html @@ -353,6 +353,7 @@ limitations under the License. +