feat(plugins): install marketplace packages via dbx deep link
This commit is contained in:
18 files changed
+223
-1
No files matched your search
@@ -71,6 +71,7 @@ import { rememberExternalSqlFileTarget, resolveExternalSqlFileTarget, unassociat
|
||||
import { externalSqlFileOpenErrorMessage, externalSqlEditorMaxBytes, isSqlFilePath, readBrowserSqlFile, sqlFileTitleFromPath } from "@/lib/sql/sqlFileOpen";
|
||||
import type { ConnectionConfig, DatabaseType, ObjectBrowserFilter, ObjectSourceKind, QueryTab, TabOutputView, TreeNode } from "@/types/database";
|
||||
import type { PluginCenterFocus } from "@/lib/plugins/pluginCenterNavigation";
|
||||
import { parsePluginInstallDeepLink } from "@/lib/plugins/pluginInstallDeepLink";
|
||||
import { parseConnectionDeepLink, type ConnectionDeepLinkDraft } from "@/lib/connection/connectionDeepLink";
|
||||
import { parseAiConfigDeepLink, type AiConfigDeepLinkDraft } from "@/lib/ai/aiConfigDeepLink";
|
||||
import { activeDesktopAiRuns, blockingDesktopAiRunsForQuit } from "@/lib/ai/desktopAiRunRegistry";
|
||||
@@ -999,6 +1000,7 @@ const { setupTauriListeners, cleanupTauriListeners } = useTauriEvents({
|
||||
openConnectionDeepLink,
|
||||
closeActiveSurface,
|
||||
openAiConfigDeepLink,
|
||||
openPluginInstallDeepLink,
|
||||
});
|
||||
const { showCloseActionPrompt, chooseQuit, chooseMinimize, cancelCloseActionPrompt, performCloseAction, setupCloseActionPromptListener, cleanupCloseActionPromptListener } = useCloseActionPrompt({ requestClose: requestAppClose });
|
||||
useVisibilityChange();
|
||||
@@ -2372,6 +2374,37 @@ async function openPendingAiConfigLinks() {
|
||||
}
|
||||
}
|
||||
|
||||
const pluginCenterInstallRequest = ref<{ id: number; url: string } | null>(null);
|
||||
let pluginInstallDeepLinkId = 0;
|
||||
|
||||
async function openPluginInstallDeepLink(url: string) {
|
||||
try {
|
||||
const draft = parsePluginInstallDeepLink(url);
|
||||
if (!draft) return;
|
||||
pluginCenterInstallRequest.value = { id: ++pluginInstallDeepLinkId, url: draft.url };
|
||||
openPluginCenterPage();
|
||||
} catch (e: any) {
|
||||
toast(
|
||||
t("pluginPlatform.deepLinkInvalid", {
|
||||
message: e?.message || String(e),
|
||||
}),
|
||||
5000,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
async function openPendingPluginInstallLinks() {
|
||||
if (!isTauriRuntime()) return;
|
||||
try {
|
||||
const links = await api.pendingOpenPluginInstallLinks();
|
||||
for (const link of links) {
|
||||
await openPluginInstallDeepLink(link);
|
||||
}
|
||||
} catch {
|
||||
/* ignore startup deep-link probing errors */
|
||||
}
|
||||
}
|
||||
|
||||
function setConnectionDialogOpen(value: boolean) {
|
||||
showConnectionDialog.value = value;
|
||||
if (!value) {
|
||||
@@ -3579,6 +3612,7 @@ onMounted(async () => {
|
||||
void openPendingDbFiles();
|
||||
void openPendingConnectionLinks();
|
||||
void openPendingAiConfigLinks();
|
||||
void openPendingPluginInstallLinks();
|
||||
console.log(`[STARTUP] onMounted sync done: ${(performance.now() - mountStart).toFixed(0)}ms`);
|
||||
});
|
||||
|
||||
@@ -3707,7 +3741,7 @@ onUnmounted(() => {
|
||||
@detach-tab="detachTab"
|
||||
>
|
||||
<DriverStorePage v-if="driverStoreTabOpen" v-show="driverStoreActive" v-model:active-tab="driverStoreActiveTab" class="flex-1 min-h-0" :update-notifications-enabled="updateNotificationsEnabled" :focus-target="driverStoreFocus" @update-count-change="updateAgentDriverUpdateCount" />
|
||||
<PluginCenterPage v-if="pluginCenterTabOpen" v-show="pluginCenterActive" class="flex-1 min-h-0" :focus-target="pluginCenterFocus" @new-connection="openPluginConnectionDialog" />
|
||||
<PluginCenterPage v-if="pluginCenterTabOpen" v-show="pluginCenterActive" class="flex-1 min-h-0" :focus-target="pluginCenterFocus" :install-url-request="pluginCenterInstallRequest" @new-connection="openPluginConnectionDialog" />
|
||||
<EditorSettingsPage
|
||||
v-if="settingsPageTabOpen"
|
||||
v-show="settingsStore.settingsPageActive"
|
||||
|
||||
Reference in new issue
Block a user