Update the JavaScript Plugin API documentation
Bug: Issue 14421
Change-Id: I5869c8168fe27bea81226b0b8f1dc40b271c2454
diff --git a/Documentation/config-gerrit.txt b/Documentation/config-gerrit.txt
index a144a67..1e4a4b1 100644
--- a/Documentation/config-gerrit.txt
+++ b/Documentation/config-gerrit.txt
@@ -504,10 +504,10 @@
+
When `auth.type` does not normally enable this URL administrators may
set this to `login/`, allowing users to begin a new web session. This value
-is used as an href in PolyGerrit, so absolute URLs like
+is used as an href in the Gerrit web app, so absolute URLs like
`https://someotherhost/login` work as well.
+
-If a ${path} parameter is included, then PolyGerrit will substitute the
+If a ${path} parameter is included, then the Gerrit web app will substitute the
currently viewed path in the link. Be aware that this path will include
a leading slash, so a value like this might be appropriate: `/login${path}`.
@@ -2340,11 +2340,11 @@
[[gerrit.cdnPath]]gerrit.cdnPath::
+
-Path prefix for PolyGerrit's static resources if using a CDN.
+Path prefix for Gerrit's static resources if using a CDN.
[[gerrit.faviconPath]]gerrit.faviconPath::
+
-Path for PolyGerrit's favicon after link:#gerrit.canonicalWebUrl[default URL],
+Path for Gerrit's favicon after link:#gerrit.canonicalWebUrl[default URL],
including icon name and extension (.ico should be used).
[[gerrit.instanceId]]gerrit.instanceId::
diff --git a/Documentation/config-plugins.txt b/Documentation/config-plugins.txt
index 272c4eb..3433c15 100644
--- a/Documentation/config-plugins.txt
+++ b/Documentation/config-plugins.txt
@@ -49,7 +49,7 @@
[[codemirror-editor]]
=== codemirror-editor
-CodeMirror plugin for polygerrit.
+CodeMirror JavaScript plugin for Gerrit.
link:https://gerrit-review.googlesource.com/admin/repos/plugins/codemirror-editor[
Project,role=external,window=_blank] |
diff --git a/Documentation/dev-bazel.txt b/Documentation/dev-bazel.txt
index 747f761..f5fcf95 100644
--- a/Documentation/dev-bazel.txt
+++ b/Documentation/dev-bazel.txt
@@ -138,7 +138,7 @@
[[release]]
=== Gerrit Release WAR File
-To build the Gerrit web application that includes the PolyGerrit UI,
+To build the Gerrit web application that includes the Gerrit UI,
core plugins and documentation:
----
@@ -153,8 +153,7 @@
=== Headless Mode
-To build Gerrit in headless mode, i.e. without the PolyGerrit UI:
-Web UI:
+To build Gerrit in headless mode, i.e. without the Gerrit UI:
----
bazel build headless
@@ -559,10 +558,10 @@
[[npm-binary]]
== NPM Binaries
-Parts of the PolyGerrit build require running NPM-based JavaScript programs as
-"binaries". We don't attempt to resolve and download NPM dependencies at build
-time, but instead use pre-built bundles of the NPM binary along with all its
-dependencies. Some packages on
+Parts of the Gerrit web app build require running NPM-based JavaScript programs
+as "binaries". We don't attempt to resolve and download NPM dependencies at
+build time, but instead use pre-built bundles of the NPM binary along with all
+its dependencies. Some packages on
link:https://docs.npmjs.com/misc/registry[registry.npmjs.org,role=external,window=_blank] come with their
dependencies bundled, but this is the exception rather than the rule. More
commonly, to add a new binary to this list, you will need to bundle the binary
@@ -625,8 +624,8 @@
If a npm package has transitive dependencies (or just several files) with a not allowed
license and you can't avoid use it in release, then you can add this package.
For example some packages contain demo-code with a different license. Another example - optional
-dependencies, which are not needed to build polygerrit, but they are installed together with
-the package anyway.
+dependencies, which are not needed to build the Gerrit web app, but they are installed together
+with the package anyway.
In this case you should exclude all files and/or transitive dependencies with a not allowed license.
Adding such package requires additional updates:
diff --git a/Documentation/dev-community.txt b/Documentation/dev-community.txt
index 53829c9..70fda87 100644
--- a/Documentation/dev-community.txt
+++ b/Documentation/dev-community.txt
@@ -52,7 +52,7 @@
* link:dev-plugins-lifecycle.html[Plugin Lifecycle]
* link:dev-plugins.html[Developing Plugins]
* link:dev-build-plugins.html[Building Gerrit plugins]
-* link:js-api.html[JavaScript Plugin API]
+* link:pg-plugin-dev.html[JavaScript Plugin Development and API]
* link:config-validation.html[Validation Interfaces]
* link:dev-stars.html[Starring Changes]
* link:quota.html[Quota Enforcement]
diff --git a/Documentation/dev-design.txt b/Documentation/dev-design.txt
index a41c9ea..5636dfd 100644
--- a/Documentation/dev-design.txt
+++ b/Documentation/dev-design.txt
@@ -80,10 +80,10 @@
== Infrastructure
End-user web browsers make HTTP requests directly to Gerrit's
-HTTP server. As nearly all of the user interface is implemented
-through PolyGerrit, the majority of these requests are transmitting
-compressed JSON payloads, with all HTML being generated within the
-browser.
+HTTP server. As nearly all of the Gerrit user interface is implemented
+in a JavaScript based web app, the majority of these requests are
+transmitting compressed JSON payloads, with all HTML being generated
+within the browser.
Gerrit's HTTP server side component is implemented as a standard Java
servlet, and thus runs within any link:install-j2ee.html[J2EE servlet
diff --git a/Documentation/dev-eclipse.txt b/Documentation/dev-eclipse.txt
index bbe227a..e18d7b0 100644
--- a/Documentation/dev-eclipse.txt
+++ b/Documentation/dev-eclipse.txt
@@ -118,7 +118,7 @@
== Testing
-=== PolyGerrit UI is served by `server.go` process. To launch it,
+=== The Gerrit web app UI is served by `server.go` process. To launch it,
run this command:
----
diff --git a/Documentation/dev-plugins.txt b/Documentation/dev-plugins.txt
index fb17e5c..f2a3e12 100644
--- a/Documentation/dev-plugins.txt
+++ b/Documentation/dev-plugins.txt
@@ -5,8 +5,8 @@
This page describes how plugins for Gerrit can be developed and hosted
on gerrit-review.googlesource.com.
-For PolyGerrit-specific plugin development, consult with
-link:pg-plugin-dev.html[PolyGerrit Plugin Development] guide.
+For JavaScript plugin development, consult with
+link:pg-plugin-dev.html[JavaScript Plugin Development] guide.
Depending on how tightly the extension code is coupled with the Gerrit
server code, there is a distinction between `plugins` and `extensions`.
@@ -1456,141 +1456,7 @@
that is implemented in Prolog submit rules, signal for triggering an action
like running CI etc.), as it allows the plugin to tell users about this meaning
in the change message. This makes the effect of a given approval more
-transparent to the user.
-
-[[ui_extension]]
-== UI Extension
-
-[[panels]]
-=== Panels
-
-UI plugins can contribute panels to Gerrit screens.
-
-Gerrit screens define extension points where plugins can add GWT
-panels with custom controls:
-
-* Change Screen:
-** `GerritUiExtensionPoint.CHANGE_SCREEN_HEADER`:
-+
-Panel will be shown in the header bar to the right of the change
-status.
-
-** `GerritUiExtensionPoint.CHANGE_SCREEN_HEADER_RIGHT_OF_BUTTONS`:
-+
-Panel will be shown in the header bar on the right side of the buttons.
-
-** `GerritUiExtensionPoint.CHANGE_SCREEN_HEADER_RIGHT_OF_POP_DOWNS`:
-+
-Panel will be shown in the header bar on the right side of the pop down
-buttons.
-
-** `GerritUiExtensionPoint.CHANGE_SCREEN_BELOW_COMMIT_INFO_BLOCK`:
-+
-Panel will be shown below the commit info block.
-
-** `GerritUiExtensionPoint.CHANGE_SCREEN_BELOW_CHANGE_INFO_BLOCK`:
-+
-Panel will be shown below the change info block.
-
-** `GerritUiExtensionPoint.CHANGE_SCREEN_BELOW_RELATED_INFO_BLOCK`:
-+
-Panel will be shown below the related info block.
-
-** `GerritUiExtensionPoint.CHANGE_SCREEN_HISTORY_RIGHT_OF_BUTTONS`:
-+
-Panel will be shown in the history bar on the right side of the buttons.
-
-** The following parameters are provided:
-*** `GerritUiExtensionPoint.Key.CHANGE_INFO`:
-+
-The link:rest-api-changes.html#change-info[ChangeInfo] entity for the
-current change.
-+
-The link:rest-api-changes.html#revision-info[RevisionInfo] entity for
-the current patch set.
-
-* Project Info Screen:
-** `GerritUiExtensionPoint.PROJECT_INFO_SCREEN_TOP`:
-+
-Panel will be shown at the top of the screen.
-
-** `GerritUiExtensionPoint.PROJECT_INFO_SCREEN_BOTTOM`:
-+
-Panel will be shown at the bottom of the screen.
-
-** The following parameters are provided:
-*** `GerritUiExtensionPoint.Key.PROJECT_NAME`:
-+
-The name of the project.
-
-* User Password Screen:
-** `GerritUiExtensionPoint.PASSWORD_SCREEN_BOTTOM`:
-+
-Panel will be shown at the bottom of the screen.
-
-** The following parameters are provided:
-*** `GerritUiExtensionPoint.Key.ACCOUNT_INFO`:
-+
-The link:rest-api-accounts.html#account-info[AccountInfo] entity for
-the current user.
-
-* User Preferences Screen:
-** `GerritUiExtensionPoint.PREFERENCES_SCREEN_BOTTOM`:
-+
-Panel will be shown at the bottom of the screen.
-
-** The following parameters are provided:
-*** `GerritUiExtensionPoint.Key.ACCOUNT_INFO`:
-+
-The link:rest-api-accounts.html#account-info[AccountInfo] entity for
-the current user.
-
-* User Profile Screen:
-** `GerritUiExtensionPoint.PROFILE_SCREEN_BOTTOM`:
-+
-Panel will be shown at the bottom of the screen below the grid with the
-profile data.
-
-** The following parameters are provided:
-*** `GerritUiExtensionPoint.Key.ACCOUNT_INFO`:
-+
-The link:rest-api-accounts.html#account-info[AccountInfo] entity for
-the current user.
-
-Example panel:
-[source,java]
-----
-public class MyPlugin extends PluginEntryPoint {
- @Override
- public void onPluginLoad() {
- Plugin.get().panel(GerritUiExtensionPoint.CHANGE_SCREEN_BELOW_CHANGE_INFO_BLOCK,
- "my_panel_name",
- new Panel.EntryPoint() {
- @Override
- public void onLoad(Panel panel) {
- panel.setWidget(new InlineLabel("My Panel for change "
- + panel.getInt(GerritUiExtensionPoint.Key.CHANGE_ID, -1));
- }
- });
- }
-}
-----
-
-Change Screen panel ordering may be specified in the
-project config. Values may be either "plugin name" or
-"plugin name"."panel name".
-Panels not specified in the config will be added
-to the end in load order. Panels specified in the config that
-are not found will be ignored.
-
-Example config:
-----
-[extension-panels "CHANGE_SCREEN_BELOW_CHANGE_INFO_BLOCK"]
- panel = helloworld.change_id
- panel = myotherplugin
- panel = myplugin.my_panel_name
-----
-
+transparent to the user.
[[actions]]
@@ -2557,11 +2423,7 @@
manifest attribute will be used, if provided, otherwise the name of
the file, minus the `.jar` extension, will be used.
-For Web UI plugins, the plugin version is derived from the filename.
-If the filename contains one or more hyphens, the version is taken
-from the portion following the last hyphen. For example if the plugin
-filename is `my-plugin-1.0.js` the version will be `1.0`. For JAR
-plugins, the version is taken from the `Version` attribute in the
+For JAR plugins, the version is taken from the `Version` attribute in the
manifest.
Unless disabled, servers periodically scan the `$site_path/plugins`
@@ -2989,7 +2851,7 @@
== SEE ALSO
-* link:js-api.html[JavaScript API]
+* link:pg-plugin-dev.html[JavaScript Plugin API]
* link:dev-rest-api.html[REST API Developers' Notes]
GERRIT
diff --git a/Documentation/intro-project-owner.txt b/Documentation/intro-project-owner.txt
index 7f932da..8a3b10e 100644
--- a/Documentation/intro-project-owner.txt
+++ b/Documentation/intro-project-owner.txt
@@ -634,9 +634,9 @@
The Gerrit functionality can be extended by plugins and there are many
extension points, e.g. plugins can
+
-** link:dev-plugins.html#top-menu-extensions[add new menu entries]
-** link:dev-plugins.html#ui_extension[extend existing screens] and
- link:dev-plugins.html#screen[add new screens]
+** link:pg-plugin-admin-api.html[add new menu entries]
+** link:pg-plugin-endpoints.html[hook into DOM elements] and
+ link:pg-plugin-dev.html#plugin-screen[add new pages]
** link:config-validation.html[do validation], e.g. of new commits
** add new REST endpoints and link:dev-plugins.html#ssh[SSH commands]
diff --git a/Documentation/js-api.txt b/Documentation/js-api.txt
deleted file mode 100644
index 893ab36..0000000
--- a/Documentation/js-api.txt
+++ /dev/null
@@ -1,486 +0,0 @@
-= Gerrit Code Review - JavaScript API
-
-Gerrit Code Review supports an API for JavaScript plugins to interact
-with the web UI and the server process.
-
-== Entry Point
-
-JavaScript is loaded using a standard `<script src='...'>` HTML tag.
-Plugins should protect the global namespace by defining their code
-within an anonymous function passed to `Gerrit.install()`. The plugin
-will be passed an object describing its registration with Gerrit:
-
-[source,javascript]
-----
-Gerrit.install(function (self) {
- // ... plugin JavaScript code here ...
-});
-----
-
-
-[[self]]
-== Plugin Instance
-
-The plugin instance is passed to the plugin's initialization function
-and provides a number of utility services to plugin authors.
-
-[[self_getServerInfo]]
-=== self.getServerInfo()
-Returns the server's link:rest-api-config.html#server-info[ServerInfo]
-data.
-
-[[self_getPluginName]]
-=== self.getPluginName()
-Returns the name this plugin was installed as by the server
-administrator. The plugin name is required to access REST API
-views installed by the plugin, or to access resources.
-
-[[self_on]]
-=== self.on()
-Register a JavaScript callback to be invoked when events occur within
-the web interface.
-
-.Signature
-[source,javascript]
-----
-self.on(event, callback);
-----
-
-* event: A supported event type. See below for description.
-
-* callback: JavaScript function to be invoked when event happens.
- Arguments may be passed to this function, depending on the event.
-
-Supported events:
-
-* `history`: Invoked when the view is changed to a new screen within
- the Gerrit web application. The token after "#" is passed as the
- argument to the callback function, for example "/c/42/" while
- showing change 42.
-
-* `showchange`: Invoked when a change is made visible. A
- link:rest-api-changes.html#change-info[ChangeInfo] and
- link:rest-api-changes.html#revision-info[RevisionInfo]
- are passed as arguments. PolyGerrit provides a third parameter which
- is an object with a `mergeable` boolean.
-
-* `submitchange`: Invoked when the submit button is clicked
- on a change. A link:rest-api-changes.html#change-info[ChangeInfo]
- and link:rest-api-changes.html#revision-info[RevisionInfo] are
- passed as arguments. Similar to a form submit validation, the
- function must return true to allow the operation to continue, or
- false to prevent it. The function may be called multiple times, for
- example, if submitting a change shows a confirmation dialog, this
- event may be called to validate that the check whether dialog can be
- shown, and called again when the submit is confirmed to check whether
- the actual submission action can proceed.
-
-* `comment`: Invoked when a DOM element that represents a comment is
- created. This DOM element is passed as argument. This DOM element
- contains nested elements that Gerrit uses to format the comment. The
- DOM structure may differ between comment types such as inline
- comments, file-level comments and summary comments, and it may change
- with new Gerrit versions.
-
-* `highlightjs-loaded`: Invoked when the highlight.js library has
- finished loading. The global `hljs` object (also now accessible via
- `window.hljs`) is passed as an argument to the callback function.
- This event can be used to register a new language highlighter with
- the highlight.js library before syntax highlighting begins.
-
-[[self_changeActions]]
-=== self.changeActions()
-Returns an instance of ChangeActions API.
-
-.Signature
-[source,javascript]
-----
-self.changeActions();
-----
-
-[[self_screen]]
-=== self.screen()
-Register a module to be attached when the user navigates
-to an extension screen provided by the plugin. Extension screens are
-usually linked from the link:dev-plugins.html#top-menu-extensions[top menu].
-
-.Signature
-[source,javascript]
-----
-self.screen(pattern, opt_moduleName);
-----
-
-* pattern: URL token pattern to identify the screen. Argument can be
- either a string (`'index'`) or a RegExp object (`/list\/(.*)/`).
- If a RegExp is used the matching groups will be available inside of
- the context as `token_match`.
-
-* opt_moduleName: The module to load when the user navigates to
- the screen. The function will be passed a link:#ScreenContext[screen context].
-
-[[self_settings]]
-=== self.settings()
-Returns the Settings API.
-
-.Signature
-[source,javascript]
-----
-self.settings();
-----
-
-[[self_registerCustomComponent]]
-=== self.registerCustomComponent()
-Register a custom component to a specific endpoint.
-
-.Signature
-[source,javascript]
-----
-self.registerCustomComponent(endpointName, opt_moduleName, opt_options);
-----
-
-* endpointName: The endpoint this plugin should be reigistered to.
-
-* opt_moduleName: The module name the custom component will use.
-
-* opt_options: Options to register this custom component.
-
-[[self_url]]
-=== self.url()
-Returns a URL within the plugin's URL space. If invoked with no
-parameter the URL of the plugin is returned. If passed a string
-the argument is appended to the plugin URL.
-
-A plugin's URL is where this plugin is loaded, it doesn't
-necessary to be the same as the Gerrit host. Use `window.location`
-if you need to access the Gerrit host info.
-
-For preloaded plugins, the plugin url is based on a global
-configuration of where to load all plugins, default to current host.
-
-[source,javascript]
-----
-self.url(); // "https://gerrit-review.googlesource.com/plugins/demo/"
-self.url('/static/icon.png'); // "https://gerrit-review.googlesource.com/plugins/demo/static/icon.png"
-----
-
-[[self_restApi]]
-=== self.restApi()
-Returns an instance of the Plugin REST API.
-
-.Signature
-[source,javascript]
-----
-self.restApi(prefix_url)
-----
-
-* prefix_url: Base url for subsequent .get(), .post() etc requests.
-
-[[PluginRestAPI]]
-== Plugin Rest API
-
-[[plugin_rest_delete]]
-=== restApi.delete()
-Issues a DELETE REST API request to the Gerrit server.
-Returns a promise with the response of the request.
-
-.Signature
-[source,javascript]
-----
-restApi.delete(url)
-----
-
-* url: URL relative to the base url.
-
-[[plugin_rest_get]]
-=== restApi.get()
-Issues a GET REST API request to the Gerrit server.
-Returns a promise with the response of the request.
-
-.Signature
-[source,javascript]
-----
-restApi.get(url)
-----
-
-* url: URL relative to the base url.
-
-[[plugin_rest_post]]
-=== restApi.post()
-Issues a POST REST API request to the Gerrit server.
-Returns a promise with the response of the request.
-
-.Signature
-[source,javascript]
-----
-restApi.post(url, opt_payload, opt_errFn, opt_contentType)
-----
-
-* url: URL relative to the base url.
-
-* opt_payload: JavaScript object to serialize as the request payload.
-
-* opt_errFn: JavaScript function to be invoked when error occured.
-
-* opt_contentType: Content-Type to be sent along with the request.
-
-[source,javascript]
-----
-restApi.post(
- '/my-servlet',
- {start_build: true, platform_type: 'Linux'});
-----
-
-[[plugin_rest_put]]
-=== restApi.put()
-Issues a PUT REST API request to the Gerrit server.
-Returns a promise with the response of the request.
-
-.Signature
-[source,javascript]
-----
-restApi.put(url, opt_payload, opt_errFn, opt_contentType)
-----
-
-* url: URL relative to the base url.
-
-* opt_payload: JavaScript object to serialize as the request payload.
-
-* opt_errFn: JavaScript function to be invoked when error occured.
-
-* opt_contentType: Content-Type to be sent along with the request.
-
-[source,javascript]
-----
-restApi.put(
- '/builds',
- {start_build: true, platform_type: 'Linux'});
-----
-
-[[ChangeActions]]
-== Change Actions API
-A new Change Actions API instance will be created when `changeActions()`
-is invoked.
-
-[[change_actions_add]]
-=== changeActions.add()
-Adds a new action to the change actions section.
-Returns the key of the newly added action.
-
-.Signature
-[source,javascript]
-----
-changeActions.add(type, label)
-----
-
-* type: The type of the action, either `change` or `revision`.
-
-* label: The label to be used in UI for this action.
-
-[source,javascript]
-----
-changeActions.add("change", "test")
-----
-
-[[change_actions_remove]]
-=== changeActions.remove()
-Removes an action from the change actions section.
-
-.Signature
-[source,javascript]
-----
-changeActions.remove(key)
-----
-
-* key: The key of the action.
-
-[[change_actions_addTapListener]]
-=== changeActions.addTapListener()
-Adds a tap listener to an action that will be invoked when the action
-is tapped.
-
-.Signature
-[source,javascript]
-----
-changeActions.addTapListener(key, callback)
-----
-
-* key: The key of the action.
-
-* callback: JavaScript function to be invoked when action tapped.
-
-[source,javascript]
-----
-changeActions.addTapListener("__key_for_my_action__", () => {
- // do something when my action gets clicked
-})
-----
-
-[[change_actions_removeTapListener]]
-=== changeActions.removeTapListener()
-Removes an existing tap listener on an action.
-
-.Signature
-[source,javascript]
-----
-changeActions.removeTapListener(key, callback)
-----
-
-* key: The key of the action.
-
-* callback: JavaScript function to be removed.
-
-[[change_actions_setLabel]]
-=== changeActions.setLabel()
-Sets the label for an action.
-
-.Signature
-[source,javascript]
-----
-changeActions.setLabel(key, label)
-----
-
-* key: The key of the action.
-
-* label: The label of the action.
-
-[[change_actions_setTitle]]
-=== changeActions.setTitle()
-Sets the title for an action.
-
-.Signature
-[source,javascript]
-----
-changeActions.setTitle(key, title)
-----
-
-* key: The key of the action.
-
-* title: The title of the action.
-
-[[change_actions_setIcon]]
-=== changeActions.setIcon()
-Sets an icon for an action.
-
-.Signature
-[source,javascript]
-----
-changeActions.setIcon(key, icon)
-----
-
-* key: The key of the action.
-
-* icon: The name of the icon.
-
-[[change_actions_setEnabled]]
-=== changeActions.setEnabled()
-Sets an action to enabled or disabled.
-
-.Signature
-[source,javascript]
-----
-changeActions.setEnabled(key, enabled)
-----
-
-* key: The key of the action.
-
-* enabled: The status of the action, true to enable.
-
-[[change_actions_setActionHidden]]
-=== changeActions.setActionHidden()
-Sets an action to be hidden.
-
-.Signature
-[source,javascript]
-----
-changeActions.setActionHidden(type, key, hidden)
-----
-
-* type: The type of the action.
-
-* key: The key of the action.
-
-* hidden: True to hide the action, false to show the action.
-
-[[change_actions_setActionOverflow]]
-=== changeActions.setActionOverflow()
-Sets an action to show in overflow menu.
-
-.Signature
-[source,javascript]
-----
-changeActions.setActionOverflow(type, key, overflow)
-----
-
-* type: The type of the action.
-
-* key: The key of the action.
-
-* overflow: True to move the action to overflow menu, false to move
- the action out of the overflow menu.
-
-[[PanelContext]]
-== Panel Context
-A new panel context is passed to the `panel` callback function each
-time a screen with the given extension point is loaded.
-
-[[panel_body]]
-=== panel.body
-Empty HTML `<div>` node the plugin should add the panel content to.
-The node is already attached to the document.
-
-[[PanelProperties]]
-=== Properties
-
-The extension panel parameters that are described in the
-link:dev-plugins.html#panels[plugin development documentation] are
-contained in the context as properties. Which properties are available
-depends on the extension point.
-
-[[Gerrit]]
-== Gerrit
-
-The `Gerrit` object is the only symbol provided into the global
-namespace by Gerrit Code Review. All top-level functions can be
-accessed through this name.
-
-[[Gerrit_css]]
-=== Gerrit.css()
-[WARNING]
-This method is deprecated. It doesn't work with Shadow DOM and
-will be removed in the future. Please, use link:pg-plugin-dev.html#plugin-styles[plugin.styles] instead.
-
-Creates a new unique CSS class and injects it into the document.
-The name of the class is returned and can be used by the plugin.
-
-Classes created with this function should be created once at install
-time and reused throughout the plugin. Repeatedly creating the same
-class will explode the global stylesheet.
-
-.Signature
-[source,javascript]
-----
-Gerrit.install(function(self)) {
- var style = {
- name: Gerrit.css('background: #fff; color: #000;'),
- };
-});
-----
-
-[[Gerrit_install]]
-=== Gerrit.install()
-Registers a new plugin by invoking the supplied initialization
-function. The function is passed the link:#self[plugin instance].
-
-[source,javascript]
-----
-Gerrit.install(function (self) {
- // ... plugin JavaScript code here ...
-});
-----
-
-GERRIT
-------
-Part of link:index.html[Gerrit Code Review]
-
-SEARCHBOX
----------
diff --git a/Documentation/pg-plugin-admin-api.txt b/Documentation/pg-plugin-admin-api.txt
index 1a41778..be31117 100644
--- a/Documentation/pg-plugin-admin-api.txt
+++ b/Documentation/pg-plugin-admin-api.txt
@@ -1,4 +1,4 @@
-= Gerrit Code Review - Admin customization API
+= Gerrit Code Review - JavaScript Plugin Admin API
This API is provided by link:pg-plugin-dev.html#plugin-admin[plugin.admin()]
and provides customization of the admin menu.
@@ -18,4 +18,4 @@
create a link to open changes, use the value `/q/status:open`.
See more about capability from
-link:rest-api-accounts.html#list-account-capabilities[List Account Capabilities].
\ No newline at end of file
+link:rest-api-accounts.html#list-account-capabilities[List Account Capabilities].
diff --git a/Documentation/pg-plugin-change-metadata-api.txt b/Documentation/pg-plugin-change-metadata-api.txt
deleted file mode 100644
index 8348da8..0000000
--- a/Documentation/pg-plugin-change-metadata-api.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-= Gerrit Code Review - Change metadata plugin API
-
-This API is provided by
-link:pg-plugin-dev.html#change-metadata[plugin.changeMetadata()] and provides
-interface for customization and data updates of change metadata.
-
-== onLabelsChanged
-`changeMetadataApi.onLabelsChanged(callback)`
-
-.Params
-- *callback* function that's executed when labels changed on the server.
-Callback receives labels with scores applied to the change, map of the label
-names to link:rest-api-changes.html#label-info[LabelInfo] entries
-
-.Returns
-- `GrChangeMetadataApi` for chaining.
diff --git a/Documentation/pg-plugin-dev.txt b/Documentation/pg-plugin-dev.txt
index 91bc476..9c565da 100644
--- a/Documentation/pg-plugin-dev.txt
+++ b/Documentation/pg-plugin-dev.txt
@@ -1,35 +1,30 @@
:linkattrs:
-= Gerrit Code Review - PolyGerrit Plugin Development
+= Gerrit Code Review - JavaScript Plugin Development and API
-CAUTION: Work in progress. Hard hat area. Please
-link:https://bugs.chromium.org/p/gerrit/issues/entry?template=PolyGerrit%20plugins[send
-feedback,role=external,window=_blank] if something's not right.
-
-For migrating existing GWT UI plugins, please check out the
-link:pg-plugin-migration.html#migration[migration guide].
+Gerrit Code Review supports an API for JavaScript plugins to interact
+with the web UI and the server process.
[[loading]]
== Plugin loading and initialization
-link:js-api.html#_entry_point[Entry point] for the plugin.
+JavaScript is loaded using a standard `<script src='...'>` HTML tag.
+Plugins should protect the global namespace by defining their code
+within an anonymous function passed to `Gerrit.install()`. The plugin
+will be passed an object describing its registration with Gerrit.
* The plugin provides pluginname.js, and can be a standalone file or a static
asset in a jar as a link:dev-plugins.html#deployment[Web UI plugin].
* pluginname.js contains a call to `Gerrit.install()`. There should
- only be single `Gerrit.install()` per file.
-* PolyGerrit imports pluginname.js.
+ only be a single `Gerrit.install()` call per file.
+* The Gerrit web app imports pluginname.js.
* For standalone plugins, the entry point file is a `pluginname.js` file
located in `gerrit-site/plugins` folder, where `pluginname` is an alphanumeric
plugin name.
-Note: Code examples target modern browsers (Chrome, Firefox, Safari, Edge).
-
Here's a recommended starter `myplugin.js`:
``` js
Gerrit.install(plugin => {
- 'use strict';
-
// Your code here.
});
```
@@ -41,7 +36,7 @@
decorating, replacing, and styling DOM elements exposed through a set of
link:pg-plugin-endpoints.html[endpoints].
-PolyGerrit provides a simple way for accessing the DOM via DOM hooks API. A DOM
+Gerrit provides a simple way for accessing the DOM via DOM hooks API. A DOM
hook is a custom element that is instantiated for the plugin endpoint. In the
decoration case, a hook is set with a `content` attribute that points to the DOM
element.
@@ -64,7 +59,7 @@
[[low-level-decorating]]
=== Decorating DOM Elements
-For each endpoint, PolyGerrit provides a list of DOM properties (such as
+For each endpoint, Gerrit provides a list of DOM properties (such as
attributes and events) that are supported in the long-term.
``` js
@@ -149,42 +144,83 @@
See `samples/bind-parameters.js` for examples on both Polymer data bindings
and `attibuteHelper` usage.
-=== eventHelper
-`plugin.eventHelper(element)`
-
-Note: TODO
-
=== hook
`plugin.hook(endpointName, opt_options)`
-See list of supported link:pg-plugin-endpoints.html[endpoints].
-
-Note: TODO
+See link:pg-plugin-endpoints.html[endpoints].
=== registerCustomComponent
`plugin.registerCustomComponent(endpointName, opt_moduleName, opt_options)`
-See list of supported link:pg-plugin-endpoints.html[endpoints].
-
-Note: TODO
+See link:pg-plugin-endpoints.html[endpoints].
=== registerDynamicCustomComponent
`plugin.registerDynamicCustomComponent(dynamicEndpointName, opt_moduleName,
opt_options)`
-See list of supported link:pg-plugin-endpoints.html[endpoints].
-
-Note: TODO
+See link:pg-plugin-endpoints.html[endpoints].
=== registerStyleModule
`plugin.registerStyleModule(endpointName, moduleName)`
-Note: TODO
+See link:#low-level-style[above].
+
+=== on
+Register a JavaScript callback to be invoked when events occur within
+the web interface. Signature
+
+``` js
+self.on(event, callback);
+```
+
+Parameters
+
+* event: A supported event type. See below for description.
+
+* callback: JavaScript function to be invoked when event happens.
+ Arguments may be passed to this function, depending on the event.
+
+Supported events:
+
+* `history`: Invoked when the view is changed to a new screen within
+ the Gerrit web application. The token after "#" is passed as the
+ argument to the callback function, for example "/c/42/" while
+ showing change 42.
+
+* `showchange`: Invoked when a change is made visible. A
+ link:rest-api-changes.html#change-info[ChangeInfo] and
+ link:rest-api-changes.html#revision-info[RevisionInfo]
+ are passed as arguments. Gerrit provides a third parameter which
+ is an object with a `mergeable` boolean.
+
+* `submitchange`: Invoked when the submit button is clicked
+ on a change. A link:rest-api-changes.html#change-info[ChangeInfo]
+ and link:rest-api-changes.html#revision-info[RevisionInfo] are
+ passed as arguments. Similar to a form submit validation, the
+ function must return true to allow the operation to continue, or
+ false to prevent it. The function may be called multiple times, for
+ example, if submitting a change shows a confirmation dialog, this
+ event may be called to validate that the check whether dialog can be
+ shown, and called again when the submit is confirmed to check whether
+ the actual submission action can proceed.
+
+* `comment`: Invoked when a DOM element that represents a comment is
+ created. This DOM element is passed as argument. This DOM element
+ contains nested elements that Gerrit uses to format the comment. The
+ DOM structure may differ between comment types such as inline
+ comments, file-level comments and summary comments, and it may change
+ with new Gerrit versions.
+
+* `highlightjs-loaded`: Invoked when the highlight.js library has
+ finished loading. The global `hljs` object (also now accessible via
+ `window.hljs`) is passed as an argument to the callback function.
+ This event can be used to register a new language highlighter with
+ the highlight.js library before syntax highlighting begins.
[[high-level-api]]
== High-level API
-Plugin instance provides access to number of more specific APIs and methods
+Plugin instance provides access to a number of more specific APIs and methods
to be used by plugin authors.
=== admin
@@ -196,95 +232,161 @@
.Returns:
- Instance of link:pg-plugin-admin-api.html[GrAdminApi].
+=== changeActions
+`self.changeActions()`
+
+Returns an instance of the
+link:https://gerrit.googlesource.com/gerrit/+/master/polygerrit-ui/app/api/change-actions.ts[ChangeActionsPluginApi].
+
+==== changeActions.add()
+Adds a new action to the change actions section. Returns the key of the newly
+added action.
+
+``` js
+changeActions.add(type, label)
+```
+
+* type: The type of the action, either `change` or `revision`.
+
+* label: The label to be used in UI for this action.
+
+
+==== changeActions.remove()
+Removes an action from the change actions section.
+
+``` js
+changeActions.remove(key)
+```
+
+* key: The key of the action.
+
+
+==== changeActions.addTapListener()
+Adds a tap listener to an action that will be invoked when the action
+is tapped.
+
+``` js
+changeActions.addTapListener(key, callback)
+```
+
+* key: The key of the action.
+
+* callback: JavaScript function to be invoked when action tapped.
+
+
+==== changeActions.removeTapListener()
+Removes an existing tap listener on an action.
+
+``` js
+changeActions.removeTapListener(key, callback)
+```
+
+* key: The key of the action.
+
+* callback: JavaScript function to be removed.
+
+
+==== changeActions.setLabel()
+Sets the label for an action.
+
+``` js
+changeActions.setLabel(key, label)
+```
+
+* key: The key of the action.
+
+* label: The label of the action.
+
+
+==== changeActions.setTitle()
+Sets the title for an action.
+
+``` js
+changeActions.setTitle(key, title)
+```
+
+* key: The key of the action.
+
+* title: The title of the action.
+
+
+==== changeActions.setIcon()
+Sets an icon for an action.
+
+``` js
+changeActions.setIcon(key, icon)
+```
+
+* key: The key of the action.
+
+* icon: The name of the icon.
+
+
+==== changeActions.setEnabled()
+Sets an action to enabled or disabled.
+
+``` js
+changeActions.setEnabled(key, enabled)
+```
+
+* key: The key of the action.
+
+* enabled: The status of the action, true to enable.
+
+
+==== changeActions.setActionHidden()
+Sets an action to be hidden.
+
+``` js
+changeActions.setActionHidden(type, key, hidden)
+```
+
+* type: The type of the action.
+
+* key: The key of the action.
+
+* hidden: True to hide the action, false to show the action.
+
+
+==== changeActions.setActionOverflow()
+Sets an action to show in overflow menu.
+
+``` js
+changeActions.setActionOverflow(type, key, overflow)
+```
+
+* type: The type of the action.
+
+* key: The key of the action.
+
+* overflow: True to move the action to overflow menu, false to move
+ the action out of the overflow menu.
+
+
=== changeReply
`plugin.changeReply()`
-Note: TODO
-
-=== delete
-`plugin.delete(url, opt_callback)`
-
-Note: TODO
-
-=== get
-`plugin.get(url, opt_callback)`
-
-Note: TODO
+Returns an instance of the
+link:https://gerrit.googlesource.com/gerrit/+/master/polygerrit-ui/app/api/change-reply.ts[ChangeReplyPluginApi].
=== getPluginName
`plugin.getPluginName()`
-Note: TODO
+Returns the name this plugin was installed as by the server
+administrator. The plugin name is required to access REST API
+views installed by the plugin, or to access resources.
=== getServerInfo
`plugin.getServerInfo()`
-Note: TODO
-
-=== on
-`plugin.on(eventName, callback)`
-
-Note: TODO
-
-=== panel
-`plugin.panel(extensionpoint, callback)`
-
-Deprecated. Use `plugin.registerCustomComponent()` instead.
-
-``` js
-Gerrit.install(function(self) {
- self.panel('CHANGE_SCREEN_BELOW_COMMIT_INFO_BLOCK', function(context) {
- context.body.innerHTML =
- 'Sample link: <a href="http://some.com/foo">Foo</a>';
- context.show();
- });
-});
-```
-
-Here's the recommended approach that uses Polymer for generating custom elements:
-
-``` js
-class SomeCiModule extends Polymer.Element {
- static get is() {
- return "some-ci-module";
- }
- static get template() {
- return Polymer.html`
- Sample link: <a href="http://some.com/foo">Foo</a>
- `;
- }
-}
-
-// Register this element
-customElements.define(SomeCiModule.is, SomeCiModule);
-
-// Install the plugin
-Gerrit.install(plugin => {
- plugin.registerCustomComponent('change-view-integration', 'some-ci-module');
-});
-```
-
-See `samples/` for more examples.
-
-Here's a minimal example that uses low-level DOM Hooks API for the same purpose:
-
-``` js
-Gerrit.install(plugin => {
- plugin.hook('change-view-integration', el => {
- el.innerHTML = 'Sample link: <a href="http://some.com/foo">Foo</a>';
- });
-});
-```
+Returns the host config as a link:rest-api-config.html#server-info[ServerInfo]
+object.
=== popup
`plugin.popup(moduleName)`
-Note: TODO
-
-=== post
-`plugin.post(url, payload, opt_callback)`
-
-Note: TODO
+Creates a popup that contains the given web components. Can be controlled with
+calling `open()` and `close()` on the return value.
[[plugin-rest-api]]
=== restApi
@@ -295,26 +397,17 @@
e.g. `changes/1/revisions/1/cookbook~say-hello`
.Returns:
-- Instance of link:pg-plugin-rest-api.html[GrPluginRestApi].
+- Instance of link:pg-plugin-rest-api.html[RestPluginApi].
-[[plugin-repo]]
-=== repo
-`plugin.repo()`
-
-.Params:
-- none
-
-.Returns:
-- Instance of link:pg-plugin-repo-api.html[GrRepoApi].
-
-=== put
-`plugin.put(url, payload, opt_callback)`
-
-Note: TODO
-
+[[plugin-screen]]
=== screen
`plugin.screen(screenName, opt_moduleName)`
+Registers a web component as a dedicated top-level page that the router
+understands and that has a URL (/x/pluginname/screenname) that can be navigated
+to. Extension screens are usually linked from the
+link:dev-plugins.html#top-menu-extensions[top menu].
+
.Params:
- `*string* screenName` URL path fragment of the screen, e.g.
`/x/pluginname/*screenname*`
@@ -322,57 +415,20 @@
screen.
.Returns:
-- Instance of GrDomHook.
-
-=== screenUrl
-`plugin.url(opt_screenName)`
-
-.Params:
-- `*string* screenName` (optional) URL path fragment of the screen, e.g.
-`/x/pluginname/*screenname*`
-
-.Returns:
-- Absolute URL for the screen, e.g. `http://localhost/base/x/pluginname/screenname`
-
-[[plugin-settings]]
-=== settings
-`plugin.settings()`
-
-.Params:
-- none
-
-.Returns:
-- Instance of link:pg-plugin-settings-api.html[GrSettingsApi].
-
-=== settingsScreen
-`plugin.settingsScreen(path, menu, callback)`
-
-Deprecated. Use link:#plugin-settings[`plugin.settings()`] instead.
-
-[[plugin-styles]]
-=== styles
-`plugin.styles()`
-
-.Params:
-- none
-
-.Returns:
-- Instance of link:pg-plugin-styles-api.html[GrStylesApi]
-
-=== changeMetadata
-`plugin.changeMetadata()`
-
-.Params:
-- none
-
-.Returns:
-- Instance of link:pg-plugin-change-metadata-api.html[GrChangeMetadataApi].
-
-=== theme
-`plugin.theme()`
-
-
-Note: TODO
+- Instance of HookApi.
=== url
-`plugin.url(opt_path)`
\ No newline at end of file
+`plugin.url(opt_path)`
+
+Returns a URL within the plugin's URL space. If invoked with no
+parameter the URL of the plugin is returned. If passed a string
+the argument is appended to the plugin URL.
+
+A plugin's URL is where this plugin is loaded, it doesn't
+necessary to be the same as the Gerrit host. Use `window.location`
+if you need to access the Gerrit host info.
+
+``` js
+self.url(); // "https://gerrit-review.googlesource.com/plugins/demo/"
+self.url('/static/icon.png'); // "https://gerrit-review.googlesource.com/plugins/demo/static/icon.png"
+```
diff --git a/Documentation/pg-plugin-endpoints.txt b/Documentation/pg-plugin-endpoints.txt
index a8b3330..c16d0d4 100644
--- a/Documentation/pg-plugin-endpoints.txt
+++ b/Documentation/pg-plugin-endpoints.txt
@@ -1,16 +1,24 @@
-= Gerrit Code Review - PolyGerrit Plugin Styling
+= Gerrit Code Review - JavaScript Plugin Endpoints
-Plugins should be html-based and imported following PolyGerrit's
-link:pg-plugin-dev.html#loading[dev guide].
+This document describes Gerrit JavaScript plugin endpoints that you can hook
+into for customizing the UI. It is assumed that you are familiar with
+link:pg-plugin-dev.html#loading[the general dev guide].
-Sample code for testing endpoints:
+You can either hook into an endpoint by calling `plugin.hook(endpoint)` and
+then interact with the returned `HookApi`, which has `onAttached(callback)` and
+`onDetached(callback)` methods.
+
+Or you can define a
+link:https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements[Web Component,role=external,window=_blank]
+and register it directly using
+`plugin.registerCustomComponent(endpoint, elementName)`.
+
+Sample code for using an endpoint:
``` 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;';
@@ -42,9 +50,8 @@
=== 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 Log` section on the change view page, and it may take full page's
+width.
* `change`
+
@@ -174,7 +181,8 @@
== Dynamic Plugin endpoints
-The following endpoints are available to plugins.
+The following dynamic endpoints are available to plugins by calling
+`plugin.registerDynamicCustomComponent(endpoint, elementName)`.
=== change-list-header
The `change-list-header` extension point adds a header to the change list view.
diff --git a/Documentation/pg-plugin-migration.txt b/Documentation/pg-plugin-migration.txt
deleted file mode 100644
index 061c687..0000000
--- a/Documentation/pg-plugin-migration.txt
+++ /dev/null
@@ -1,148 +0,0 @@
-:linkattrs:
-= Gerrit Code Review - PolyGerrit Plugin Development
-
-CAUTION: Work in progress. Hard hat area. Please
-link:https://bugs.chromium.org/p/gerrit/issues/entry?template=PolyGerrit%20plugins[send
-feedback,role=external,window=_blank] if something's not right.
-
-[[migration]]
-== Incremental migration of existing GWT UI plugins
-
-link:pg-plugin-dev.html[PolyGerrit plugin API] is based on different concepts and
-provides a different type of API compared to the one available to GWT
-plugins. Depending on the plugin, it might require significant modifications to
-existing UI scripts to fully take advantage of the benefits provided by the PolyGerrit API.
-
-To make migration easier, PolyGerrit recommends an incremental migration
-strategy. Starting with a .js file that works for GWT UI, plugin author can
-incrementally migrate deprecated APIs to the new plugin API.
-
-The goal for this guide is to provide a migration path from .js-based UI script to
-a html based implementation
-
-NOTE: Web UI plugins distributed as a single .js file are not covered in this
-guide.
-
-Let's start with a basic plugin that has an UI module. Commonly, file tree
-should look like this:
-
- ├── BUILD
- ├── LICENSE
- └── src
- └── main
- ├── java
- │ └── com
- │ └── foo
- │ └── SamplePluginModule.java
- └── resources
- └── static
- └── sampleplugin.js
-
-For simplicity's sake, let's assume SamplePluginModule.java has following
-content:
-
-``` java
-public class SamplePluginModule extends AbstractModule {
-
- @Override
- protected void configure() {
- DynamicSet.bind(binder(), WebUiPlugin.class)
- .toInstance(new JavaScriptPlugin("sampleplugin.js"));
- }
-}
-```
-
-=== Step 1: Create `sampleplugin.html`
-
-As a first step, create `sampleplugin.html` and include the UI script in the
-module file.
-
-NOTE: GWT UI ignores html files which it doesn't support.
-
-``` java
- @Override
- protected void configure() {
- DynamicSet.bind(binder(), WebUiPlugin.class)
- .toInstance(new JavaScriptPlugin("sampleplugin.js"));
- DynamicSet.bind(binder(), WebUiPlugin.class)
- .toInstance(new JavaScriptPlugin("sampleplugin.html"));
- }
-```
-
-Here's recommended starter code for `sampleplugin.html`:
-
-NOTE: By specification, the `id` attribute of `dom-module` *must* contain a dash
-(-).
-
-``` html
-<dom-module id="sample-plugin">
- <script>
- Gerrit.install(plugin => {
- // Setup block, is executed before sampleplugin.js
- });
- </script>
-
- <script src="./sampleplugin.js"></script>
-
- <script>
- Gerrit.install(plugin => {
- // Cleanup block, is executed after sampleplugin.js
- });
- </script>
-</dom-module>
-```
-
-Here's how this works:
-
-- PolyGerrit detects migration scenario because UI scripts have same filename
-and different extensions
- * PolyGerrit will load `sampleplugin.html` and skip `sampleplugin.js`
- * PolyGerrit will reuse `plugin` (aka `self`) instance for `Gerrit.install()`
-callbacks
-- `sampleplugin.js` is loaded since it's referenced in `sampleplugin.html`
-- setup script tag code is executed before `sampleplugin.js`
-- cleanup script tag code is executed after `sampleplugin.js`
-
-This means the plugin instance is shared between .html-based and .js-based
-code. This allows to gradually and incrementally transfer code to the new API.
-
-=== Step 2: Create cut-off marker in `sampleplugin.js`
-
-Commonly, window.Polymer is being used to detect in GWT UI script if it's being
-executed inside PolyGerrit. This could be used to separate code that was already
-migrated to new APIs from old not yet migrated code.
-
-During incremental migration, some of the UI code will be reimplemented using
-the PolyGerrit plugin API. However, old code still could be required for the plugin
-to work in GWT UI.
-
-To handle this case, add the following code at the end of the installation
-callback in `sampleplugin.js`
-
-``` js
-Gerrit.install(function(self) {
-
- // Existing code here, not modified.
-
- if (window.Polymer) { return; } // Cut-off marker
-
- // Everything below was migrated to PolyGerrit plugin API.
- // Code below is still needed for the plugin to work in GWT UI.
-});
-```
-
-=== Step 3: Migrate!
-
-The code that uses deprecated APIs should be eventually rewritten using
-non-deprecated counterparts. Duplicated pieces could be kept under cut-off
-marker to work in GWT UI.
-
-If some data or functions needs to be shared between code in .html and .js, it
-could be stored in the `plugin` (aka `self`) object that's shared between both
-
-=== Step 4: Cleanup
-
-Once deprecated APIs are migrated, `sampleplugin.js` will only contain
-duplicated code that's required for GWT UI to work. As soon as GWT support is removed from Gerrit
-that file can be simply deleted, along with the script tag loading it.
-
diff --git a/Documentation/pg-plugin-repo-api.txt b/Documentation/pg-plugin-repo-api.txt
deleted file mode 100644
index 1272ea6..0000000
--- a/Documentation/pg-plugin-repo-api.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-= Gerrit Code Review - Repo admin customization API
-
-This API is provided by link:pg-plugin-dev.html#plugin-repo[plugin.repo()]
-and provides customization to admin page.
-
-== createCommand
-`repoApi.createCommand(title, checkVisibleCallback)`
-
-Create a repo command in the admin panel.
-
-.Params
-- *title* String title.
-- *checkVisibleCallback* function to configure command visibility.
-
-.Returns
-- GrRepoApi for chaining.
-
-`checkVisibleCallback(repoName, repoConfig)`
-
-.Params
-- *repoName* String project name.
-- *repoConfig* Object REST API response for repo config.
-
-.Returns
-- `false` to hide the command for the specific project.
-
-== onTap
-`repoApi.onTap(tapCalback)`
-
-Add a command tap callback.
-
-.Params
-- *tapCallback* function that's excuted on command tap.
-
-.Returns
-- Nothing
diff --git a/Documentation/pg-plugin-rest-api.txt b/Documentation/pg-plugin-rest-api.txt
index 0d42bf6..4771fbb 100644
--- a/Documentation/pg-plugin-rest-api.txt
+++ b/Documentation/pg-plugin-rest-api.txt
@@ -1,4 +1,4 @@
-= Gerrit Code Review - Repo admin customization API
+= Gerrit Code Review - JavaScript Plugin Rest API
This API is provided by link:pg-plugin-dev.html#plugin-rest-api[plugin.restApi()]
and provides interface for Gerrit REST API.
@@ -28,13 +28,14 @@
== getConfig
`repoApi.getConfig()`
-Get server config.
+Returns the host config as a link:rest-api-config.html#server-info[ServerInfo]
+object.
.Params
- None
.Returns
-- Promise<Object>
+- Promise<ServerInfo>
== get
`repoApi.get(url)`
diff --git a/Documentation/pg-plugin-settings-api.txt b/Documentation/pg-plugin-settings-api.txt
deleted file mode 100644
index 985809d..0000000
--- a/Documentation/pg-plugin-settings-api.txt
+++ /dev/null
@@ -1,40 +0,0 @@
-= Gerrit Code Review - Settings admin customization API
-
-This API is provided by link:pg-plugin-dev.html#plugin-settings[plugin.settings()]
-and provides customization to settings page.
-
-== title
-`settingsApi.title(title)`
-
-.Params
-- `*string* title` Menu item and settings section title
-
-.Returns
-- `GrSettingsApi` for chaining.
-
-== token
-`settingsApi.token(token)`
-
-.Params
-- `*string* token` URL path fragment of the screen for direct link, e.g.
-`settings/#x/some-plugin/*token*`
-
-.Returns
-- `GrSettingsApi` for chaining.
-
-== module
-`settingsApi.module(token)`
-
-.Params
-- `*string* module` Custom element name for instantiating in the settings plugin
-area.
-
-.Returns
-- `GrSettingsApi` for chaining.
-
-== build
-
-.Params
-- none
-
-Apply all other configuration parameters and create required UI elements.
diff --git a/Documentation/pg-plugin-style-object.txt b/Documentation/pg-plugin-style-object.txt
deleted file mode 100644
index cdcfb55..0000000
--- a/Documentation/pg-plugin-style-object.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-= Gerrit Code Review - GrStyleObject
-
-Store information about css style properties. You can't create this object
-directly. Instead you should use the link:pg-plugin-styles-api.html#css[css] method.
-This object allows to apply style correctly to elements within different shadow
-subtree.
-
-[[get-class-name]]
-== getClassName
-`styleObject.getClassName(element)`
-
-.Params
-- `element` - an HTMLElement.
-
-.Returns
-- `string` - class name. The class name is valid only within the shadow root of `element`.
-
-Creates a new unique CSS class and injects it into the appropriate place
-in DOM (it can be document or shadow root for element). This class can be later
-added to the element or to any other element in the same shadow root. It is guarantee,
-that method adds CSS class only once for each shadow root.
-
-== apply
-`styleObject.apply(element)`
-
-.Params
-- `element` - element to apply style.
-
-Create a new unique CSS class (see link:#get-class-name[getClassName]) and
-adds class to the element.
-
-
-
diff --git a/Documentation/pg-plugin-styles-api.txt b/Documentation/pg-plugin-styles-api.txt
deleted file mode 100644
index a829325..0000000
--- a/Documentation/pg-plugin-styles-api.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-= Gerrit Code Review - Plugin styles API
-
-This API is provided by link:pg-plugin-dev.html#plugin-styles[plugin.styles()]
-and provides a way to apply dynamically created styles to elements in a
-document.
-
-[[css]]
-== css
-`styles.css(rulesStr)`
-
-.Params
-- `*string* rulesStr` string with CSS styling declarations.
-
-Example:
-----
-const styleObject = plugin.styles().css('background: black; color: white;');
-...
-const className = styleObject.getClassName(element)
-...
-element.classList.add(className);
-...
-styleObject.apply(someOtherElement);
-----
-
-.Returns
-- Instance of link:pg-plugin-style-object.html[GrStyleObject].
-
-
-
diff --git a/Documentation/pg-plugin-styling.txt b/Documentation/pg-plugin-styling.txt
deleted file mode 100644
index f600376..0000000
--- a/Documentation/pg-plugin-styling.txt
+++ /dev/null
@@ -1,72 +0,0 @@
-:linkattrs:
-= Gerrit Code Review - PolyGerrit Plugin Styling
-
-== Plugin styles
-
-Plugins may provide
-link:https://www.polymer-project.org/2.0/docs/devguide/style-shadow-dom#style-modules[Polymer
-style modules,role=external,window=_blank] for UI CSS-based customization.
-
-PolyGerrit UI implements number of styling endpoints, which apply CSS mixins
-link:https://tabatkins.github.io/specs/css-apply-rule/[using @apply,role=external,window=_blank] to its
-direct contents.
-
-NOTE: Only items (i.e. CSS properties and mixin targets) documented here are
-guaranteed to work in the long term, since they are covered by integration
-tests. + When there is a need to add new property or endpoint, please
-link:https://bugs.chromium.org/p/gerrit/issues/entry?template=PolyGerrit%20Issue[file
-a bug,role=external,window=_blank] stating your use case to track and maintain for future releases.
-
-Plugins should be html-based and imported following PolyGerrit's
-link:pg-plugin-dev.html#loading[dev guide].
-
-Plugins should provide Style Module, for example:
-
-``` html
- <dom-module id="some-style">
- <template>
- <style>
- html {
- --css-mixin-name: {
- property: value;
- }
- }
- </style>
- </template>
- </dom-module>
-```
-
-Plugins should register style module with a styling endpoint using
-`Plugin.prototype.registerStyleModule(endpointName, styleModuleName)`, for
-example:
-
-``` js
- Gerrit.install(function(plugin) {
- plugin.registerStyleModule('some-endpoint', 'some-style');
- });
-```
-
-== Available styling endpoints
-=== change-metadata
-Following custom CSS mixins are recognized:
-
-* `--change-metadata-assignee`
-+
-is applied to `gr-change-metadata section.assignee`
-* `--change-metadata-label-status`
-+
-is applied to `gr-change-metadata section.labelStatus`
-* `--change-metadata-strategy`
-+
-is applied to `gr-change-metadata section.strategy`
-* `--change-metadata-topic`
-+
-is applied to `gr-change-metadata section.topic`
-
-Following CSS properties have
-link:https://gerrit.googlesource.com/gerrit/+/master/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata-it_test.html[long-term
-support via integration test,role=external,window=_blank]:
-
-* `display`
-+
-can be set to `none` to hide a section.
diff --git a/Documentation/rest-api-accounts.txt b/Documentation/rest-api-accounts.txt
index c8d58a7..8aa3173 100644
--- a/Documentation/rest-api-accounts.txt
+++ b/Documentation/rest-api-accounts.txt
@@ -2773,7 +2773,7 @@
Allowed values are `DARK` or `LIGHT`.
|`expand_inline_diffs` |not set if `false`|
Whether to expand diffs inline instead of opening as separate page
-(PolyGerrit only).
+(Gerrit web app UI only).
|`download_scheme` |optional|
The type of download URL the user prefers to use. May be any key from
the `schemes` map in
@@ -2802,8 +2802,8 @@
The menu items of the `MY` top menu as a list of
link:rest-api-config.html#top-menu-item-info[TopMenuItemInfo] entities.
|`change_table` ||
-The columns to display in the change table (PolyGerrit only). The default is
-empty, which will default columns as determined by the frontend.
+The columns to display in the change table (Gerrit web app UI only). The
+default is empty, which will default columns as determined by the frontend.
|`email_strategy` ||
The type of email strategy to use. On `ENABLED`, the user will receive emails
from Gerrit. On `CC_ON_OWN_COMMENTS` the user will also receive emails for
@@ -2842,7 +2842,7 @@
Allowed values are `DARK` or `LIGHT`.
|`expand_inline_diffs` |not set if `false`|
Whether to expand diffs inline instead of opening as separate page
-(PolyGerrit only).
+(Gerrit web app UI only).
|`download_scheme` |optional|
The type of download URL the user prefers to use.
|`date_format` |optional|
@@ -2869,8 +2869,8 @@
The menu items of the `MY` top menu as a list of
link:rest-api-config.html#top-menu-item-info[TopMenuItemInfo] entities.
|`change_table` ||
-The columns to display in the change table (PolyGerrit only). The default is
-empty, which will default columns as determined by the frontend.
+The columns to display in the change table (Gerrit web app UI only). The
+default is empty, which will default columns as determined by the frontend.
|`email_strategy` |optional|
The type of email strategy to use. On `ENABLED`, the user will receive emails
from Gerrit. On `CC_ON_OWN_COMMENTS` the user will also receive emails for
diff --git a/Documentation/rest-api-config.txt b/Documentation/rest-api-config.txt
index 6ca2b46..41a8729 100644
--- a/Documentation/rest-api-config.txt
+++ b/Documentation/rest-api-config.txt
@@ -2012,7 +2012,7 @@
link:config-gerrit.html#user[user] section as link:#user-config-info[
UserConfigInfo] entity.
|`default_theme` |optional|
-URL to a default PolyGerrit UI theme plugin, if available.
+URL to a default Gerrit UI theme plugin, if available.
Located in `/static/gerrit-theme.js` by default.
|=======================================
diff --git a/Documentation/rest-api-documentation.txt b/Documentation/rest-api-documentation.txt
index 0a7ff16..e69750d 100644
--- a/Documentation/rest-api-documentation.txt
+++ b/Documentation/rest-api-documentation.txt
@@ -47,10 +47,6 @@
"url": "Documentation/rest-api.html"
},
{
- "title": "Gerrit Code Review - JavaScript API",
- "url": "Documentation/js-api.html"
- },
- {
"title": "Gerrit Code Review - /plugins/ REST API",
"url": "Documentation/rest-api-plugins.html"
},
@@ -67,10 +63,14 @@
"url": "Documentation/rest-api-access.html"
},
{
- "title": "Gerrit Code Review - Plugin Development",
+ "title": "Gerrit Code Review - Java Plugin Development",
"url": "Documentation/dev-plugins.html"
},
{
+ "title": "Gerrit Code Review - JavaScript Plugin Development and API",
+ "url": "Documentation/pg-plugin-dev.html"
+ },
+ {
"title": "Gerrit Code Review - Developer Setup",
"url": "Documentation/dev-readme.html"
},