perf(ui): trim install policy review copy

This commit is contained in:
Jesse Merhi
2026-08-10 15:29:17 +10:00
committed by jesse-merhi
parent d1b42ff38e
commit 10256a172c
5 changed files with 13 additions and 44 deletions
+5 -10
View File
@@ -2798,19 +2798,14 @@ export const en: TranslationMap = {
acknowledgeRisk: "Acknowledge risk and install",
defaultRiskWarning: "Review the ClawHub warning before installing this plugin.",
policyReviewTitle: "Security review needed",
policyReviewBodyUnknown: "Your install policy flagged this plugin. It has not been installed.",
policyReviewBodyOne: "Your install policy found 1 warning. This plugin has not been installed.",
policyReviewBodyMany:
"Your install policy found {count} warnings. This plugin has not been installed.",
policyReviewReason: "Why it was flagged",
policyReviewFindings: "Policy findings",
policyReviewFindingCount: "{count} found",
policyReviewTechnicalDetails: "Scan details",
policyReviewPolicyResponse: "Policy response",
policyReviewBodyUnknown: "Policy flagged this plugin. Not installed.",
policyReviewBodyKnown: "Policy warnings: {count}. Not installed.",
policyReviewFindings: "Findings",
policyReviewTechnicalDetails: "Details",
policyReviewPolicyResponse: "Reason",
policyReviewRule: "Rule {count}",
policyReviewLocation: "Location",
policyReviewEvidence: "Evidence",
policyReviewGuidance: "Continue only if you trust this plugin.",
installAnyway: "Install anyway",
connectToChange: "Connect to the gateway to change plugins.",
adminRequired: "Browsing only. Plugin changes require operator.admin access.",
+2 -2
View File
@@ -689,8 +689,8 @@ describeControlUiE2e("Control UI Plugins mocked Gateway E2E", () => {
const review = row.getByRole("alert");
await review.waitFor({ state: "visible" });
expect(await review.textContent()).toContain("Security review needed");
expect(await review.textContent()).toContain("Your install policy found 1 warning");
expect(await review.textContent()).toContain("This plugin has not been installed");
expect(await review.textContent()).toContain("Policy warnings: 1");
expect(await review.textContent()).toContain("Not installed");
expect(await review.textContent()).toContain("Semgrep found a risky command.");
expect(await review.textContent()).not.toContain("raw terminal install-policy output");
await captureScreenshot(page, "09-policy-review-desktop.png");
+4 -4
View File
@@ -715,16 +715,16 @@ describe("renderPlugins", () => {
);
const alert = expectDefined(row.querySelector('[role="alert"]'), "install policy warning");
expect(normalizedText(alert)).toContain("Security review needed");
expect(normalizedText(alert)).toContain("Your install policy found 1 warning");
expect(normalizedText(alert)).toContain("This plugin has not been installed");
expect(normalizedText(alert)).toContain("Policy findings");
expect(normalizedText(alert)).toContain("Policy warnings: 1");
expect(normalizedText(alert)).toContain("Not installed");
expect(normalizedText(alert)).toContain("Findings");
expect(normalizedText(alert)).toContain("Semgrep found a risky command.");
const technicalDetails = expectDefined(
alert.querySelector<HTMLDetailsElement>(".plugins-policy-review__details"),
"install policy scan details",
);
expect(technicalDetails.open).toBe(false);
expect(normalizedText(technicalDetails.querySelector("summary"))).toBe("Scan details");
expect(normalizedText(technicalDetails.querySelector("summary"))).toBe("Details");
expect(
technicalDetails?.querySelector(".plugins-policy-review__details-chevron svg"),
).not.toBeNull();
+1 -14
View File
@@ -390,9 +390,7 @@ function renderRowMessage(
const reviewBody =
findings.length === 0
? t("pluginsPage.policyReviewBodyUnknown")
: findings.length === 1
? t("pluginsPage.policyReviewBodyOne")
: t("pluginsPage.policyReviewBodyMany", { count: String(findings.length) });
: t("pluginsPage.policyReviewBodyKnown", { count: String(findings.length) });
return html`
<div class="plugins-row-message plugins-row-message--warning" role="alert">
<div class="plugins-policy-review__header">
@@ -409,11 +407,6 @@ function renderRowMessage(
<section class="plugins-policy-review__findings-panel">
<div class="plugins-policy-review__findings-heading">
<span>${t("pluginsPage.policyReviewFindings")}</span>
<span class="plugins-policy-review__count"
>${t("pluginsPage.policyReviewFindingCount", {
count: String(findings.length),
})}</span
>
</div>
<ul class="plugins-policy-review__findings">
${findings.map(
@@ -429,9 +422,6 @@ function renderRowMessage(
`
: html`
<section class="plugins-policy-review__findings-panel">
<span class="plugins-policy-review__findings-heading"
>${t("pluginsPage.policyReviewReason")}</span
>
<p class="plugins-policy-review__reason">${details.reason}</p>
</section>
`}
@@ -482,9 +472,6 @@ function renderRowMessage(
`
: nothing}
<div class="plugins-policy-review__footer">
<span class="plugins-policy-review__guidance"
>${t("pluginsPage.policyReviewGuidance")}</span
>
<div class="plugins-policy-review__actions">
<button
type="button"
+1 -14
View File
@@ -509,8 +509,7 @@ h3.plugins-subheader {
line-height: 1.3;
}
.plugins-policy-review__header span,
.plugins-policy-review__guidance {
.plugins-policy-review__header span {
color: var(--muted);
}
@@ -529,18 +528,6 @@ h3.plugins-subheader {
font-weight: 600;
}
.plugins-policy-review__count {
color: var(--muted);
font-size: var(--control-ui-text-xs);
font-weight: 600;
}
.plugins-policy-review__count::before {
margin-right: var(--space-2);
color: var(--border-hover);
content: "·";
}
.plugins-policy-review__findings {
display: grid;
margin: 0;