Add a basic screen to invoke the Check Code Owner REST endpoint

It happens frequently that users have questions about code owners, e.g.
why a certain user is or isn't a code owner of a certain file. In this
case admins can use the Check Code Owner REST endpoint to get insights
into the code owner computation.

Invoking the Check Code Owner REST endpoint is a bit cumbersome though
and hence takes more time than it should:

* one needs to lookup the URL from the documentation and then assemble
  the URL manually
* identifiers in the URL (e.g. project names and files names) need to be
  URL-encoded
* to make the JSON output readable pretty-printing (pp=1) should be
  requested
* one needs to know how to call the REST endpoint with authentication
  (e.g. through curl or by opening the URL in the browser)

To simplify this we add a very basic screen with a form that allows to
call the Check Code Owner REST endpoint from the UI. This form takes
care of the pain-points above and also provides links to the
documentation.

The new screen is available at:
<GERRIT_URL>/x/code-owners/check-code-owner

Screenshot: https://i.imgur.com/6CFDFpH.png

The implementation of the screen followed the example of the service
user creation screen from the serviceuser plugin:
https://gerrit.googlesource.com/plugins/serviceuser/+/master/web/gr-serviceuser-create.ts

Bug: Google b/345161989
Change-Id: I25cff9f08ee3c8eb3a11dc4cd2d262fc8be1a6e3
Signed-off-by: Edwin Kempin <ekempin@google.com>
Reviewed-on: https://gerrit-review.googlesource.com/c/plugins/code-owners/+/434457
Tested-by: Zuul <zuul-63@gerritcodereview-ci.iam.gserviceaccount.com>
Reviewed-by: Kamil Musin <kamilm@google.com>
2 files changed
tree: 911bdb295857a68c9415135cb63a3323765e6149
  1. java/
  2. javatests/
  3. proto/
  4. resources/
  5. web/
  6. .gitignore
  7. .gitreview
  8. BUILD
  9. LICENSE
  10. README.md
README.md

Gerrit Code Review code-owners plugin

This plugin provides support for defining code owners for files in a repository.

If the code-owners plugin is enabled, changes can only be submitted if all touched files are covered by approvals from code owners.

For a detailed description of the plugin functionality please refer to the plugin documentation.

IMPORTANT: Before installing/enabling the plugin follow the instructions from the setup guide.

NOTE: The plugin documentation only renders correctly when the plugin is installed in Gerrit and the documentation is accessed via https:///plugins/code-owners/Documentation/index.html. If you want to read the documentation before installing the plugin, you can find it properly rendered here.

JavaScript Plugin

From the root of the gerrit repository.

bazel test //plugins/code-owners/web:karma_test

For testing the plugin with the Gerrit FE Dev Helper the command below builds

    bazel build //plugins/code-owners/web:code-owners
    ln -s bazel-bin/plugins/code-owners/web/code-owners.js polygerrit-ui/app/plugins/

and let the Dev Helper redirect from .+/plugins/code-owners/static/code-owners.js to http://localhost:8081/plugins/code-owners.js.