feat: add SQL library history query entry points

This commit is contained in:
SuLea-IT authored and GitHub committed 2026-06-11 10:53:54 +08:00
1 parent 634e26e8e7
commit 806d7c758b
16 files changed
+345 -8

No files matched your search

@@ -439,6 +439,7 @@ function openFile(file: SavedSqlFile) {
if (suppressNextRowClick.value) return;
queryStore.openSavedSql(file);
connectionStore.activeConnectionId = file.connectionId;
void savedSqlStore.recordFileUsage(file.id);
}
const contextTarget = ref<SavedSqlFolder | SavedSqlFile | "panel" | null>(null);
@@ -5,15 +5,26 @@ import DatabaseIcon from "@/components/icons/DatabaseIcon.vue";
import { connectionDriverLabel, connectionIconType, connectionRedactedNameLabel, connectionRedactedOptionSubtitle } from "@/lib/connectionPresentation";
import type { ConnectionConfig } from "@/types/database";
export interface WelcomeSavedSqlHistoryItem {
id: string;
name: string;
connectionName: string;
database?: string;
folderName?: string;
openCount?: number;
}
defineProps<{
connectionStats: { total: number; connected: number; types: number };
recentConnections: ConnectionConfig[];
savedSqlHistoryItems: WelcomeSavedSqlHistoryItem[];
appVersion: string;
hasConnections: boolean;
}>();
const emit = defineEmits<{
"open-connection-query": [connectionId: string];
"open-saved-sql": [fileId: string];
"new-connection": [];
"new-query": [];
"show-history": [];
@@ -83,6 +94,30 @@ const { t } = useI18n();
</div>
</div>
<div class="rounded-lg border">
<div class="flex items-center justify-between border-b px-4 py-3">
<div class="flex items-center gap-2 text-sm font-medium"><History class="h-4 w-4" /> {{ t("welcome.sqlHistory") }}</div>
</div>
<div class="divide-y">
<button v-for="item in savedSqlHistoryItems" :key="item.id" class="flex w-full items-center gap-3 px-4 py-3 text-left hover:bg-muted/40" @click="emit('open-saved-sql', item.id)">
<History class="h-4 w-4 text-muted-foreground" />
<div class="min-w-0 flex-1">
<div class="truncate text-sm font-medium">{{ item.name }}</div>
<div class="truncate text-xs text-muted-foreground">
<span>{{ item.connectionName }}</span>
<span v-if="item.database"> · {{ item.database }}</span>
<span v-if="item.folderName"> · {{ item.folderName }}</span>
<span v-if="item.openCount"> · {{ t("welcome.sqlHistoryOpenCount", { count: item.openCount }) }}</span>
</div>
</div>
<FilePlus2 class="h-4 w-4 text-muted-foreground" />
</button>
<div v-if="savedSqlHistoryItems.length === 0" class="px-4 py-8 text-sm text-muted-foreground">
{{ t("welcome.sqlHistoryEmpty") }}
</div>
</div>
</div>
<!-- MCP Integration Hint -->
<div class="rounded-lg border bg-muted/10 px-5 py-4">
<div class="flex items-start gap-3">