Let reviews be stopped, and fail stuck reviewers automatically
This commit is contained in:
Vendored
+15
-1
@@ -40,7 +40,21 @@ function stateText(r) {
|
||||
}
|
||||
}
|
||||
export function reviewCard(r, taskId) {
|
||||
return h("article", { class: `review ${r.state}` }, h("header", {}, h("span", { class: "review-snapshot" }, `snapshot #${r.snapshot_n}`), h("span", { class: `review-state ${r.state}` }, stateText(r)), h("time", { dateTime: r.created_at, title: r.created_at }, ago(r.created_at))), r.state === "failed" ? h("p", { class: "error-text" }, r.error) : null, r.state === "done" ? reviewResult(r, taskId) : null);
|
||||
return h("article", { class: `review ${r.state}` }, h("header", {}, h("span", { class: "review-snapshot" }, `snapshot #${r.snapshot_n}`), h("span", { class: `review-state ${r.state}` }, stateText(r)), h("time", { dateTime: r.created_at, title: r.created_at }, ago(r.created_at)), r.state === "running" ? stopButton(r) : null), r.state === "failed" ? h("p", { class: "error-text" }, r.error) : null, r.state === "done" ? reviewResult(r, taskId) : null);
|
||||
}
|
||||
function stopButton(r) {
|
||||
const b = h("button", { type: "button", class: "danger review-stop", title: "End the reviewer and record this review as failed" }, "Stop");
|
||||
b.onclick = async () => {
|
||||
b.disabled = true;
|
||||
try {
|
||||
await post("/api/reviews/{reviewId}/stop", { path: { reviewId: r.id } });
|
||||
}
|
||||
catch (err) {
|
||||
b.disabled = false;
|
||||
void showAlert(errorText(err));
|
||||
}
|
||||
};
|
||||
return b;
|
||||
}
|
||||
function reviewResult(r, taskId) {
|
||||
const res = (r.result ?? {});
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user