fix(updates): show why a plugin update was blocked

This commit is contained in:
zipg authored and GitHub committed 2026-09-22 15:41:25 +08:00
1 parent 72d25273df
commit 6b06522ced
3 files changed
+63 -8

No files matched your search

+10 -1
View File
@@ -27,6 +27,7 @@ import { useTheme } from "@/composables/useTheme";
import { canDownloadAndInstallUpdate, useAppUpdater } from "@/composables/useAppUpdater";
import { useMcpUpdateBadge } from "@/composables/useMcpUpdateBadge";
import { useComponentUpdates, type ComponentUpdateCategory } from "@/composables/useComponentUpdates";
import type { PluginUpdateBlock } from "@/composables/useComponentUpdates";
import { COMPONENT_UPDATES_CHANGED_EVENT, notifyComponentPluginsUpdated, notifyComponentUpdatesChanged } from "@/lib/updates/componentUpdateEvents";
import { driverStoreUpdateBadgeCount, showMcpUpdateBadge, showToolbarUpdateAction } from "@/lib/updates/updateBadges";
import {
@@ -1271,6 +1272,12 @@ function handleComponentUpdatesChanged() {
});
}
function pluginUpdateBlockMessage(block: PluginUpdateBlock): string {
if (block.reason === "connections") return `${block.pluginName}: ${t("pluginPlatform.updateBlockedByConnections", { labels: block.connections })}`;
const key = block.reason === "operations" ? "pluginPlatform.updateBlockedByOperations" : "pluginPlatform.updateInProgress";
return `${block.pluginName}: ${t(key)}`;
}
function reportComponentUpdateResult(result: Awaited<ReturnType<typeof componentUpdates.installCategory>>) {
const updatedComponents = [result.drivers > 0 ? t("settings.updateDrivers") : "", result.jdbc ? t("settings.updateJdbc") : "", result.mcp ? t("settings.updateMcp") : "", result.plugins > 0 ? t("settings.updatePlugins") : ""].filter(Boolean);
// Only a clean refresh is authoritative; a failed registry check must not clear stale toolbar state.
@@ -1278,7 +1285,9 @@ function reportComponentUpdateResult(result: Awaited<ReturnType<typeof component
if (result.plugins > 0) notifyComponentPluginsUpdated();
if (updatedComponents.length) toast(t("updates.componentsAutoUpdated", { components: updatedComponents.join(t("updates.componentListSeparator")) }));
if (result.skippedDrivers > 0) toast(t("updates.componentsAutoUpdateSkipped"), 6000);
if (result.failed.length) toast(t("updates.componentsAutoUpdateFailed", { count: result.failed.length }), 6000);
const otherFailureCount = result.failed.length - result.blockedPlugins.length;
const failureMessages = [result.blockedPlugins.map(pluginUpdateBlockMessage).join("\n"), otherFailureCount > 0 ? t("updates.componentsAutoUpdateFailed", { count: otherFailureCount }) : ""].filter(Boolean);
if (failureMessages.length) toast(failureMessages.join("\n"), 8000);
if (
shouldCloseUpdateCenterAfterComponentUpdate({