summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuca Milanesio <luca.milanesio@gmail.com>2023-11-22 16:47:02 +0000
committerLuca Milanesio <luca.milanesio@gmail.com>2023-11-22 16:47:07 +0000
commitfa9e6d3436c02b7c32cbebff2ba2be878702398a (patch)
tree6c07c72bb7f15af1e902866abf19b027a16b5df2
parent0a1a054aa6f5c33ce57ae85151960d092ccf21d4 (diff)
parent0d0cc209ffa3e0383409327b74b0a1f08557158d (diff)
Merge branch 'stable-3.7' into stable-3.8
* stable-3.7: Use project and changeNum for listing files in a patch-set Document ChecksApi.updateResult() Document `check-result-expanded` plugin endpoint Fix type of RevisionInfo.commit_with_footers Release-Notes: skip Change-Id: I2fe2b8f514d62bd565ffe6c50415c0a264c1b5af
-rw-r--r--Documentation/pg-plugin-checks-api.txt20
-rw-r--r--Documentation/pg-plugin-endpoints.txt21
-rw-r--r--java/com/google/gerrit/server/restapi/change/Files.java2
-rw-r--r--polygerrit-ui/app/api/checks.ts8
-rw-r--r--polygerrit-ui/app/api/rest-api.ts2
5 files changed, 47 insertions, 6 deletions
diff --git a/Documentation/pg-plugin-checks-api.txt b/Documentation/pg-plugin-checks-api.txt
index e4cb5d0ed8..39e2c9d4f0 100644
--- a/Documentation/pg-plugin-checks-api.txt
+++ b/Documentation/pg-plugin-checks-api.txt
@@ -46,3 +46,23 @@ Here are some examples of open source plugins that make use of the Checks API:
`checksApi.announceUpdate()`
Tells Gerrit to call `provider.fetch()`.
+
+[[updateResult]]
+== updateResult
+`checksApi.updateResult(run: CheckRun, result: CheckResult)`
+
+Updates an individual result. This can be used for lazy laoding detailled
+information. For example, if you are using the
+link:pg-plugin-endpoints.html#_check_result_expanded[`check-result-expanded`
+endpoint], then you can load more result details when the user expands a result
+row.
+
+The parameter `run` is only used to *find* the correct run for updating the
+result. It will only be used for comparing `change`, `patchset`, `attempt` and
+`checkName`. Its properties other than `results` will not be updated.
+
+For us being able to identify the result that you want to update you have to
+set the `externalId` property. An undefined `externalId` will result in an
+error.
+
+An example usage can be found in link:https://chromium.googlesource.com/infra/gerrit-plugins/buildbucket/+/main/web/checks-result.ts[Chromium Buildbucket Plugin].
diff --git a/Documentation/pg-plugin-endpoints.txt b/Documentation/pg-plugin-endpoints.txt
index dd82f27e45..0429f91723 100644
--- a/Documentation/pg-plugin-endpoints.txt
+++ b/Documentation/pg-plugin-endpoints.txt
@@ -86,6 +86,25 @@ link:rest-api-changes.html#revision-info[RevisionInfo]
labels with scores applied to the change, map of the label names to
link:rest-api-changes.html#label-info[LabelInfo] entries
+=== check-result-expanded
+The `check-result-expanded` extension point is attached to a result
+of the link:pg-plugin-checks-api.html[ChecksAPI] when it is expanded. This can
+be used to attach a Web Component displaying results instead of the
+`CheckResult.message` field which is limited to raw unformatted text.
+
+In addition to default parameters, the following are available:
+
+* `result`
++
+The `CheckResult` object for the currently expanded result row.
+
+* `run`
++
+Same as `result`. The `CheckRun` object is not passed to the endpoint.
+
+The end point contains the `<gr-formatted-text>` element holding the
+`CheckResult.message` (if any was set).
+
=== 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
@@ -246,4 +265,4 @@ In addition to default parameters, the following are available:
* `accountId`
+
-the Id of the account that the status icon should correspond to. \ No newline at end of file
+the Id of the account that the status icon should correspond to.
diff --git a/java/com/google/gerrit/server/restapi/change/Files.java b/java/com/google/gerrit/server/restapi/change/Files.java
index 7699873658..96e5645d4e 100644
--- a/java/com/google/gerrit/server/restapi/change/Files.java
+++ b/java/com/google/gerrit/server/restapi/change/Files.java
@@ -173,7 +173,7 @@ public class Files implements ChildCollection<RevisionResource, FileResource> {
} else if (parentNum != 0) {
int parents =
gApi.changes()
- .id(resource.getChange().getChangeId())
+ .id(resource.getChange().getProject().get(), resource.getChange().getChangeId())
.revision(resource.getPatchSet().id().get())
.commit(false)
.parents
diff --git a/polygerrit-ui/app/api/checks.ts b/polygerrit-ui/app/api/checks.ts
index 98aaa9cca7..f66c3739e6 100644
--- a/polygerrit-ui/app/api/checks.ts
+++ b/polygerrit-ui/app/api/checks.ts
@@ -375,9 +375,11 @@ export declare interface CheckResult {
* responsible for not killing the browser. :-)
*
* For now this is just a plain unformatted string. The only formatting
- * applied is the one that Gerrit also applies to human comments. TBD: Both
- * human comments and check result messages should get richer formatting
- * options.
+ * applied is the one that Gerrit also applies to human comments.
+ *
+ * To provide richer formatting to the check result messages you should use
+ * the `check-result-expanded` plugin endpoint to attach a Web Component.
+ * See `Documentation/pg-plugin-endpoints.txt`.
*/
message?: string;
diff --git a/polygerrit-ui/app/api/rest-api.ts b/polygerrit-ui/app/api/rest-api.ts
index 244002e0bd..993f24dc8c 100644
--- a/polygerrit-ui/app/api/rest-api.ts
+++ b/polygerrit-ui/app/api/rest-api.ts
@@ -987,7 +987,7 @@ export declare interface RevisionInfo {
commit?: CommitInfo;
files?: {[filename: string]: FileInfo};
reviewed?: boolean;
- commit_with_footers?: boolean;
+ commit_with_footers?: string;
push_certificate?: PushCertificateInfo;
description?: string;
basePatchNum?: BasePatchSetNum;