Files
gerrit/Documentation/pg-plugin-endpoints.txt
David Pursehouse 85b54c955e Merge branch 'stable-3.0' into stable-3.1
* stable-3.0:
  OperatingSystemMXBeanFactory: Add a default constructor
  Remove unnecessary @SuppressWarnings("restriction")
  Set version to 2.16.19-SNAPSHOT
  Set version to 2.16.18
  Update git submodules
  Update git submodules
  Update git submodules
  Update git submodules
  Add mirror for downloading Bazel rules.
  Update git submodules
  Upgrade gwtjsonrpc to 1.12
  CommitValidators: Use ImmutableList.Builder instead of ImmutableList.of
  Update git submodules
  Update git submodules
  Update git submodules
  Always verify PolyGerrit if bazel related files are changed
  Always run all tests, if bazel-related files are changed
  Add test that verifies 'visibleto' predicate for group
  Make cache disk stat metric computation optional
  ReceiveCommits: Log "update failed" at severe level
  Revert "Insert Change-Id at start of trailers"
  Revert "commit-msg: Remove obsolete comments"
  Remove obsolete UpgradeFrom2_0_x init step
  Update git submodules
  Update git submodules
  Improve documentation of change refs
  Remove duplicate test method removeAnonymousRead
  Make the build pipeline fail if cannot post Checks feedback
  Switch to using no-AOP guice distribution
  Bazel: Use canonical_id for artifacts cached by http_file
  Fix for Memory leak in gr-plugin-endpoints
  Documentation: Clarify how to log e2e http details
  Make legacy version of the commit-msg hook available
  commit-msg: Remove obsolete comments
  Upgrade testcontainers to 1.14.0
  Bump asm to version 7.2
  Upgrade guice to 4.2.3
  PostReview: Avoid multiple notifications for existing reviewers
  ChangeApi: Remove deprecated getEdit method
  ChangeApi: Remove useless @Deprecated annotation in NotImplemented
  Plugin API: Remove deprecated draft workflow methods
  ErrorProne: Enable ObjectToString check at ERROR severity
  Project: Add implementation of toString
  Account: Add implementation of toString
  LegacyChangeNoteWrite: Remove unused newIdent method
  PolyGerrit: Document commit-container extension endpoint
  e2e-tests: Make all current scenario names unique
  e2e-tests: Make http request name unique
  e2e-tests: Fix CloneUsingBothProtocols wait times
  e2e-tests: Create/delete ReplayRecordsFromFeeder project
  e2e-tests: Unhardcode ReplayRecordsFromFeeder data
  e2e-tests: Stabilize the ReplayRecordsFromFeeder scenario
  Remove obsolete FindBugs configuration
  Elasticsearch: Remove support for EOL 6.x versions
  REST: Allow to create annotated tag with only CREATE_TAG
  Upgrade recommended version of buildifier to 2.2.1
  Bump Bazel version to 3.0.0
  CreateRefControl: Pass CurrentUser to Reachable

Change-Id: I0db526840b5d9322bd72a3a8e180ec08a5ef656b
2020-04-24 19:44:51 +09:00

223 lines
6.3 KiB
Plaintext

= Gerrit Code Review - PolyGerrit Plugin Styling
Plugins should be html-based and imported following PolyGerrit's
link:pg-plugin-dev.html#loading[dev guide].
Sample code for testing endpoints:
``` js
Gerrit.install(plugin => {
// Change endpoint below
const endpoint = 'change-metadata-item';
plugin.hook(endpoint).onAttached(element => {
console.log(endpoint, element);
const el = element.appendChild(document.createElement('div'));
el.textContent = 'Ah, there it is. Lovely.';
el.style = 'background: pink; line-height: 4em; text-align: center;';
});
});
```
== Default parameters
All endpoints receive the following parameters, set as attributes to custom
components that are instantiated at the endpoint:
* `plugin`
+
the current plugin instance, the one that is used by `Gerrit.install()`.
* `content`
+
decorated DOM Element, is only set for registrations that decorate existing
components.
== Plugin endpoints
The following endpoints are available to plugins.
=== banner
The `banner` extension point is located at the top of all pages. The purpose
is to allow plugins to show outage information and important announcements to
all users.
=== change-view-integration
The `change-view-integration` extension point is located between `Files` and
`Messages` section on the change view page, and it may take full page's
width. Primary purpose is to enable plugins to display custom CI-related
information (build status, etc).
* `change`
+
current change displayed, an instance of
link:rest-api-changes.html#change-info[ChangeInfo]
* `revision`
+
current revision displayed, an instance of
link:rest-api-changes.html#revision-info[RevisionInfo]
=== change-metadata-item
The `change-metadata-item` extension point is located on the bottom of the
change view left panel, under the `Label Status` and `Links` sections. Its width
is equal to the left panel's, and its primary purpose is to allow plugins to add
sections of metadata to the left panel.
In addition to default parameters, the following are available:
* `change`
+
current change displayed, an instance of
link:rest-api-changes.html#change-info[ChangeInfo]
* `revision`
+
current revision displayed, an instance of
link:rest-api-changes.html#revision-info[RevisionInfo]
* `labels`
+
labels with scores applied to the change, map of the label names to
link:rest-api-changes.html#label-info[LabelInfo] entries
=== robot-comment-controls
The `robot-comment-controls` extension point is located inside each comment
rendered on the diff page, and is only visible when the comment is a robot
comment, specifically if the comment has a `robot_id` property.
In addition to default parameters, the following are available:
* `comment`
+
current comment displayed, an instance of
link:rest-api-changes.html#comment-info[CommentInfo]
=== repo-command
This endpoint is situated among the repository commands.
In addition to default parameters, the following are available:
* `repoName`
+
String name of the repository currently being configured.
* `config`
+
The object representing the repo config.
=== repo-config
The `repo-config` extension point is located at the bottom of the repository
configuration settings screen.
In addition to default parameters, the following are available:
* `repoName`
+
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.
=== settings-screen
This endpoint is situated at the end of the body of the settings screen.
=== reply-text
This endpoint wraps the textarea in the reply dialog.
=== reply-label-scores
This endpoint decorator wraps the voting buttons in the reply dialog.
=== header-title
This endpoint wraps the title-text in the application header.
=== confirm-revert-change
This endpoint is inside the confirm revert dialog. By default it displays a
generic confirmation message regarding reverting the change. Plugins may add
content to this message or replace it entirely.
=== confirm-submit-change
This endpoint is inside the confirm submit dialog. By default it displays a
generic confirmation message regarding submission of the change. Plugins may add
content to this message or replace it entirely.
In addition to default parameters, the following are available:
* `change`
+
The change beinng potentially submitted, an instance of
link:rest-api-changes.html#change-info[ChangeInfo]
* `action`
+
The submit action, including the title and label, an instance of
link:rest-api-changes.html#action-info[ActionInfo]
=== commit-container
The `commit-container` extension point adds content at the end of the commit
message to the change view.
In addition to default parameters, the following are available:
* `change`
+
current change displayed, an instance of
link:rest-api-changes.html#change-info[ChangeInfo]
* `revision`
+
current revision displayed, an instance of
link:rest-api-changes.html#revision-info[RevisionInfo]
== Dynamic Plugin endpoints
The following endpoints are available to plugins.
=== change-list-header
The `change-list-header` extension point adds a header to the change list view.
=== change-list-item-cell
The `change-list-item-cell` extension point adds a cell to the change list item.
In addition to default parameters, the following are available:
* `change`
+
current change of the row, an instance of
link:rest-api-changes.html#change-info[ChangeInfo]
=== change-view-tab-header
The `change-view-tab-header` extension point adds a primary tab to the change
view. This must be used in conjunction with `change-view-tab-content`.
In addition to default parameters, the following are available:
* `change`
+
current change displayed, an instance of
link:rest-api-changes.html#change-info[ChangeInfo]
* `revision`
+
current revision displayed, an instance of
link:rest-api-changes.html#revision-info[RevisionInfo]
=== change-view-tab-content
The `change-view-tab-content` extension point adds primary tab content to
the change view. This must be used in conjunction with `change-view-tab-header`.
In addition to default parameters, the following are available:
* `change`
+
current change displayed, an instance of
link:rest-api-changes.html#change-info[ChangeInfo]
* `revision`
+
current revision displayed, an instance of
link:rest-api-changes.html#revision-info[RevisionInfo]