mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-12 21:53:00 -06:00
fix(ui): retain policy warning outcome
This commit is contained in:
@@ -2799,6 +2799,7 @@ export const en: TranslationMap = {
|
||||
defaultRiskWarning: "Review the ClawHub warning before installing this plugin.",
|
||||
policyReviewTitle: "Security review needed",
|
||||
policyReviewBodyKnown: "Policy warnings: {count}. Not installed.",
|
||||
policyReviewBodyReason: "{reason} Not installed.",
|
||||
policyReviewFindings: "Findings",
|
||||
policyReviewSeverityInfo: "Info",
|
||||
policyReviewSeverityWarn: "Warning",
|
||||
|
||||
@@ -760,6 +760,47 @@ describe("renderPlugins", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("keeps the not-installed outcome visible for reason-only policy warnings", () => {
|
||||
const plugin = createPlugin({
|
||||
id: "reason-only",
|
||||
name: "Reason Only",
|
||||
installed: false,
|
||||
enabled: false,
|
||||
state: "disabled",
|
||||
install: { source: "official", pluginId: "reason-only" },
|
||||
});
|
||||
const key = pluginRowKey(plugin.id);
|
||||
const container = mount(
|
||||
createProps({
|
||||
activeTab: "discover",
|
||||
result: createResult([plugin]),
|
||||
messages: {
|
||||
[key]: {
|
||||
kind: "warning",
|
||||
text: "Review this package source.",
|
||||
installPolicyWarning: {
|
||||
request: { source: "official", pluginId: "reason-only" },
|
||||
details: {
|
||||
installPolicyCode: "install_policy_warning_acknowledgement_required",
|
||||
targetName: "reason-only",
|
||||
targetType: "plugin",
|
||||
requestMode: "install",
|
||||
reason: "Review this package source.",
|
||||
acknowledgementToken: "reason-only-token",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
const alert = expectDefined(
|
||||
container.querySelector('[data-plugin-id="reason-only"] [role="alert"]'),
|
||||
"reason-only install policy warning",
|
||||
);
|
||||
expect(normalizedText(alert)).toContain("Review this package source. Not installed.");
|
||||
});
|
||||
|
||||
it("correlates installed ClawHub packages without a search runtime id", () => {
|
||||
const packageName = "@community/calendar-plus";
|
||||
const installed = createPlugin({
|
||||
|
||||
@@ -404,7 +404,7 @@ function renderRowMessage(
|
||||
const findings = details.findings ?? [];
|
||||
const reviewBody =
|
||||
findings.length === 0
|
||||
? details.reason
|
||||
? t("pluginsPage.policyReviewBodyReason", { reason: details.reason })
|
||||
: t("pluginsPage.policyReviewBodyKnown", { count: String(findings.length) });
|
||||
return html`
|
||||
<div
|
||||
|
||||
Reference in New Issue
Block a user