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
@@ -19,6 +19,7 @@ import { usePromptTemplateStore } from "@/stores/promptTemplateStore";
|
||||
import { useToast } from "@/composables/useToast";
|
||||
import { useTheme } from "@/composables/useTheme";
|
||||
import { useAppUpdater } from "@/composables/useAppUpdater";
|
||||
import { useMcpUpdateBadge } from "@/composables/useMcpUpdateBadge";
|
||||
import { useExportTracker } from "@/composables/useExportTracker";
|
||||
import { useFileDrop } from "@/composables/useFileDrop";
|
||||
import { usePanelResize } from "@/composables/usePanelResize";
|
||||
@@ -162,6 +163,10 @@ const {
|
||||
const { setupFileDrop } = useFileDrop();
|
||||
|
||||
const isDesktop = isTauriRuntime();
|
||||
const { mcpUpdateAvailable, refreshMcpUpdateStatus, handleMcpStatusChanged } = useMcpUpdateBadge({
|
||||
isDesktop,
|
||||
updateNotificationsEnabled: () => settingsStore.editorSettings.updateNotificationsEnabled,
|
||||
});
|
||||
const drawDesktopWindowFrame = shouldDrawDesktopWindowFrame(isMacOS(), isDesktop, isWindows());
|
||||
const UPDATE_CHECK_INTERVAL_MS = 60 * 60 * 1000;
|
||||
let updateCheckTimer: ReturnType<typeof setInterval> | undefined;
|
||||
@@ -175,6 +180,7 @@ const connectionDialogInitialTab = ref<ConfigTab | undefined>(undefined);
|
||||
const settingsPageTabOpen = ref(false);
|
||||
const settingsInitialTab = ref("appearance");
|
||||
const settingsInitialSection = ref<string | undefined>(undefined);
|
||||
const settingsNavigationRequestId = ref(0);
|
||||
const showQueryEditorDdlDialog = ref(false);
|
||||
const showQueryEditorObjectSourceDialog = ref(false);
|
||||
const driverStoreTabOpen = ref(false);
|
||||
@@ -364,6 +370,7 @@ const updateNotificationsEnabled = computed(() => settingsStore.editorSettings.u
|
||||
function openSettings(initialTab = "appearance", initialSection?: string) {
|
||||
settingsInitialTab.value = initialTab;
|
||||
settingsInitialSection.value = initialSection;
|
||||
settingsNavigationRequestId.value += 1;
|
||||
if (!settingsStore.settingsPageActive) {
|
||||
settingsReturnSurface.value = showDriverStore.value ? "driverStore" : activeTab.value ? "query" : "welcome";
|
||||
}
|
||||
@@ -420,6 +427,7 @@ function closeDriverStorePage() {
|
||||
}
|
||||
const toolbarAgentDriverUpdateCount = computed(() => (updateNotificationsEnabled.value ? agentDriverUpdateCount.value : 0));
|
||||
const toolbarHasUpdateAvailable = computed(() => updateNotificationsEnabled.value && hasUpdateAvailable.value);
|
||||
const toolbarMcpUpdateAvailable = computed(() => updateNotificationsEnabled.value && mcpUpdateAvailable.value);
|
||||
const hasSqlFileConnections = computed(() => connectionStore.connections.some((c) => supportsSqlFileExecution(c.db_type)));
|
||||
const queryEditorDdlDatabaseType = computed(() => {
|
||||
if (!queryEditorDdlTarget.value?.connectionId) return undefined;
|
||||
@@ -2134,11 +2142,13 @@ function runUpdateNotificationChecks() {
|
||||
if (!updateNotificationsEnabled.value) return;
|
||||
checkUpdates({ silent: true });
|
||||
void refreshAgentDriverUpdateCount();
|
||||
void refreshMcpUpdateStatus();
|
||||
}
|
||||
|
||||
watch(updateNotificationsEnabled, (enabled) => {
|
||||
if (!enabled) {
|
||||
agentDriverUpdateCount.value = 0;
|
||||
mcpUpdateAvailable.value = false;
|
||||
if (updateCheckTimer) {
|
||||
clearInterval(updateCheckTimer);
|
||||
updateCheckTimer = undefined;
|
||||
@@ -2162,6 +2172,7 @@ onMounted(async () => {
|
||||
window.addEventListener("keydown", handleNativeSelectAll, true);
|
||||
window.addEventListener("keydown", handleKeydown);
|
||||
window.addEventListener("dbx-open-driver-store", openDriverStoreFromEvent);
|
||||
window.addEventListener("dbx-mcp-status-changed", handleMcpStatusChanged);
|
||||
if (isDesktop) {
|
||||
document.addEventListener("contextmenu", handleContextMenu);
|
||||
}
|
||||
@@ -2229,6 +2240,7 @@ onUnmounted(() => {
|
||||
window.removeEventListener("keydown", handleNativeSelectAll, true);
|
||||
window.removeEventListener("keydown", handleKeydown);
|
||||
window.removeEventListener("dbx-open-driver-store", openDriverStoreFromEvent);
|
||||
window.removeEventListener("dbx-mcp-status-changed", handleMcpStatusChanged);
|
||||
document.removeEventListener("contextmenu", handleContextMenu);
|
||||
});
|
||||
</script>
|
||||
@@ -2250,6 +2262,7 @@ onUnmounted(() => {
|
||||
:checking-updates="checkingUpdates"
|
||||
:has-update-available="toolbarHasUpdateAvailable"
|
||||
:agent-driver-update-count="toolbarAgentDriverUpdateCount"
|
||||
:has-mcp-update-available="toolbarMcpUpdateAvailable"
|
||||
:has-connections="connectionStore.connections.length > 0"
|
||||
:has-sql-file-connections="hasSqlFileConnections"
|
||||
@new-connection="showConnectionDialog = true"
|
||||
@@ -2260,7 +2273,7 @@ onUnmounted(() => {
|
||||
@toggle-sql-library="toggleRightSidebarPanel('sqlLibrary')"
|
||||
@toggle-sql-file-panel="toggleRightSidebarPanel('sqlFile')"
|
||||
@open-github="openGitHub"
|
||||
@open-settings="openSettings()"
|
||||
@open-settings="openSettings(toolbarMcpUpdateAvailable ? 'mcp' : 'appearance')"
|
||||
@open-driver-store="openDriverStorePage"
|
||||
@check-updates="checkUpdates()"
|
||||
@open-transfer="dialogs.showTransferDialog.value = true"
|
||||
@@ -2318,6 +2331,7 @@ onUnmounted(() => {
|
||||
:open="settingsPageTabOpen"
|
||||
:initial-tab="settingsInitialTab"
|
||||
:initial-section="settingsInitialSection"
|
||||
:navigation-request-id="settingsNavigationRequestId"
|
||||
:app-version="appVersion"
|
||||
class="flex-1 min-h-0"
|
||||
@update:open="(open: boolean) => (open ? activateSettingsPage() : closeSettingsPage())"
|
||||
|
||||
Reference in new issue
Block a user