feat(mcp): add update notification badge
This commit is contained in:
1 parent
7243f5eb06
commit
62624786dc
15 files changed
+279
-3
No files matched your search
@@ -102,6 +102,7 @@ import { executableStatementRangeCacheForDoc, executableStatementRangeStartingAt
|
||||
import { EMPTY_TABLE_COLUMN_TEMPLATE_DATA_TYPE, parseTableColumnTemplateFields, TABLE_COLUMN_TEMPLATE_DATABASE_TYPES } from "@/lib/table/tableColumnTemplates";
|
||||
import { DEFAULT_SQL_VARIABLE_SYNTAX_TOGGLES, normalizeSqlVariableSyntaxOverrides, SQL_VARIABLE_SYNTAX_DATABASE_TYPES, SQL_VARIABLE_SYNTAX_KEYS, SQL_VARIABLE_SYNTAX_TOKENS, type SqlVariableSyntaxOverrides, type SqlVariableSyntaxToggles } from "@/lib/sql/sqlVariableSyntax";
|
||||
import { buildMcpCherryStudioConfig, buildMcpCodexConfig, buildMcpJsonConfig, buildMcpOpenCodeConfig, buildMcpTraeConfig, buildMcpVsCodeConfig, mcpWebBackendUrl, type McpLaunchConfig } from "@/lib/mcp/mcpConfigTemplates";
|
||||
import { beginMcpStatusRequest, mcpUpdateAvailability } from "@/lib/mcp/mcpUpdateStatus";
|
||||
import { isMcpPolicyMutationBlocked, MCP_CAPABILITY_ROWS, MCP_EXECUTION_MODE_COLUMNS, mcpExecutionModeFromPolicy, mcpPolicyFieldsForExecutionMode, type McpExecutionMode } from "@/lib/mcp/mcpPolicySelection";
|
||||
import { isMacOS, isWindows } from "@/lib/backend/platform";
|
||||
import { combineDataTypeForDatabase, dataTypeLengthInputValue, getDataTypeOptions, getDefaultLengthForType, isDataTypeLengthDisabled, splitDataType } from "@/lib/table/tableStructureEditorState";
|
||||
@@ -185,6 +186,7 @@ const props = defineProps<{
|
||||
variant?: "dialog" | "page";
|
||||
initialTab?: string;
|
||||
initialSection?: string;
|
||||
navigationRequestId?: number;
|
||||
appVersion?: string;
|
||||
}>();
|
||||
|
||||
@@ -1780,8 +1782,15 @@ async function refreshMcpStatus() {
|
||||
if (mcpStatusLoading.value) return;
|
||||
mcpStatusLoading.value = true;
|
||||
mcpStatusError.value = "";
|
||||
const requestId = beginMcpStatusRequest();
|
||||
try {
|
||||
mcpStatus.value = await checkMcpServerStatus();
|
||||
// 通知工具栏徽章同步:携带已获取的 update_available,避免根组件重复查询 npm registry。
|
||||
window.dispatchEvent(
|
||||
new CustomEvent("dbx-mcp-status-changed", {
|
||||
detail: { updateAvailable: mcpUpdateAvailability(mcpStatus.value), requestId },
|
||||
}),
|
||||
);
|
||||
} catch (e: any) {
|
||||
mcpStatusError.value = e?.message || String(e);
|
||||
} finally {
|
||||
@@ -2291,6 +2300,15 @@ watch(
|
||||
},
|
||||
);
|
||||
|
||||
watch(
|
||||
() => props.navigationRequestId,
|
||||
() => {
|
||||
if (!settingsVisible.value || !props.initialTab) return;
|
||||
activeSettingsTab.value = props.initialTab;
|
||||
void scrollToInitialSettingsSection();
|
||||
},
|
||||
);
|
||||
|
||||
watch([webdavEndpoint, webdavUsername], () => {
|
||||
void refreshWebDavPasswordStatus();
|
||||
});
|
||||
|
||||
@@ -35,6 +35,7 @@ const props = defineProps<{
|
||||
checkingUpdates: boolean;
|
||||
hasUpdateAvailable: boolean;
|
||||
agentDriverUpdateCount: number;
|
||||
hasMcpUpdateAvailable: boolean;
|
||||
hasConnections: boolean;
|
||||
hasSqlFileConnections: boolean;
|
||||
}>();
|
||||
@@ -618,11 +619,12 @@ const toolbarStyle = computed(() => {
|
||||
|
||||
<Tooltip>
|
||||
<TooltipTrigger as-child>
|
||||
<Button variant="ghost" size="icon" class="h-8 w-8 shrink-0" :class="{ 'bg-accent': showSettingsPage }" @click="emit('open-settings')">
|
||||
<Button variant="ghost" size="icon" class="relative h-8 w-8 shrink-0" :class="{ 'bg-accent': showSettingsPage }" @click="emit('open-settings')">
|
||||
<Settings class="h-4 w-4" />
|
||||
<span v-if="hasMcpUpdateAvailable" class="absolute right-1.5 top-1.5 h-2 w-2 rounded-full bg-red-500 ring-2 ring-background" :aria-label="t('toolbar.mcpUpdateAvailable')" :title="t('toolbar.mcpUpdateAvailable')" />
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>{{ t("settings.title") }}</TooltipContent>
|
||||
<TooltipContent>{{ hasMcpUpdateAvailable ? t("toolbar.mcpUpdateAvailable") : t("settings.title") }}</TooltipContent>
|
||||
</Tooltip>
|
||||
|
||||
<WindowControls v-if="showControls" :is-maximized="isMaximized" @minimize="minimize" @toggle-maximize="toggleMaximize" @close="close" />
|
||||
|
||||
Reference in new issue
Block a user