qarpeo 0.1.18 → 0.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +96 -96
- package/dist/chunks/auth-schema.mjs +3 -1
- package/dist/chunks/wrangler.mjs +22 -3
- package/dist/cli/index.mjs +448 -221
- package/dist/fate/index.d.ts +29 -22
- package/dist/fate/index.mjs +1 -3
- package/dist/module.d.ts +1 -1
- package/dist/module.mjs +103 -82
- package/dist/runtime/ai.d.ts +2 -2
- package/dist/runtime/app/components/BlobImage.vue +119 -107
- package/dist/runtime/app/components/CMSBlocks.vue +104 -93
- package/dist/runtime/app/components/CMSContent.vue +24 -23
- package/dist/runtime/app/components/CMSImage.vue +49 -49
- package/dist/runtime/app/components/CMSLocaleSwitcher.vue +110 -110
- package/dist/runtime/app/components/CMSPreviewBanner.vue +83 -79
- package/dist/runtime/app/components/CMSVersionBanner.vue +53 -49
- package/dist/runtime/app/components/CMSVersionSwitcher.vue +140 -140
- package/dist/runtime/app/components/ContentRenderer.vue +83 -80
- package/dist/runtime/app/components/FileUpload.vue +200 -196
- package/dist/runtime/app/components/ImpersonationBanner.vue +61 -57
- package/dist/runtime/app/components/QarpeoWelcome.vue +84 -84
- package/dist/runtime/app/components/SignedIn.vue +13 -13
- package/dist/runtime/app/components/SignedOut.vue +13 -13
- package/dist/runtime/app/components/shiki.css +34 -34
- package/dist/runtime/app/composables/ai.d.ts +22 -22
- package/dist/runtime/app/composables/ai.mjs +3 -7
- package/dist/runtime/app/composables/analytics.mjs +1 -1
- package/dist/runtime/app/composables/api-tokens.mjs +1 -1
- package/dist/runtime/app/composables/auth.d.ts +6 -7
- package/dist/runtime/app/composables/auth.mjs +6 -3
- package/dist/runtime/app/composables/chat.mjs +3 -7
- package/dist/runtime/app/composables/cms-preview.d.ts +3 -3
- package/dist/runtime/app/composables/cms-preview.mjs +1 -1
- package/dist/runtime/app/composables/cms.d.ts +3 -5
- package/dist/runtime/app/composables/cms.mjs +2 -2
- package/dist/runtime/app/composables/docs-version.d.ts +8 -7
- package/dist/runtime/app/composables/docs-version.mjs +3 -3
- package/dist/runtime/app/composables/impersonation.mjs +1 -1
- package/dist/runtime/app/composables/notifications.d.ts +5 -5
- package/dist/runtime/app/composables/notifications.mjs +4 -5
- package/dist/runtime/app/composables/organization.mjs +1 -1
- package/dist/runtime/app/composables/passkey.mjs +1 -1
- package/dist/runtime/app/composables/passwordless.mjs +1 -1
- package/dist/runtime/app/composables/payments.d.ts +2 -1
- package/dist/runtime/app/composables/payments.mjs +1 -1
- package/dist/runtime/app/composables/realtime.d.ts +13 -13
- package/dist/runtime/app/composables/realtime.mjs +2 -2
- package/dist/runtime/app/composables/resumable-upload.d.ts +11 -11
- package/dist/runtime/app/composables/resumable-upload.mjs +1 -1
- package/dist/runtime/app/composables/site.mjs +1 -1
- package/dist/runtime/app/composables/storage.d.ts +151 -11
- package/dist/runtime/app/composables/storage.mjs +291 -33
- package/dist/runtime/app/composables/turnstile.mjs +1 -1
- package/dist/runtime/app/composables/two-factor.mjs +1 -1
- package/dist/runtime/app/pages/devtools/agents.vue +716 -716
- package/dist/runtime/app/pages/devtools/analytics.vue +616 -616
- package/dist/runtime/app/pages/devtools/auth.vue +381 -350
- package/dist/runtime/app/pages/devtools/blob.vue +743 -744
- package/dist/runtime/app/pages/devtools/db.vue +545 -545
- package/dist/runtime/app/pages/devtools/domains.vue +771 -771
- package/dist/runtime/app/pages/devtools/kv.vue +827 -828
- package/dist/runtime/app/pages/devtools/logs.vue +649 -653
- package/dist/runtime/app/pages/devtools/mail.vue +388 -388
- package/dist/runtime/app/pages/devtools/overview.vue +391 -389
- package/dist/runtime/app/pages/devtools/realtime.vue +89 -27
- package/dist/runtime/app/pages/devtools/security.vue +20 -5
- package/dist/runtime/app/pages/devtools/settings.vue +559 -559
- package/dist/runtime/app/pages/devtools/tasks.vue +26 -10
- package/dist/runtime/app/pages/devtools.vue +176 -176
- package/dist/runtime/app/plugins/seo.mjs +1 -1
- package/dist/runtime/app/plugins/shortcuts.client.d.ts +1 -4
- package/dist/runtime/app/public/sw-notifications.mjs +47 -52
- package/dist/runtime/blob.mjs +11 -4
- package/dist/runtime/browser.d.ts +1 -1
- package/dist/runtime/browser.mjs +12 -2
- package/dist/runtime/cache.d.ts +2 -1
- package/dist/runtime/kv.mjs +4 -1
- package/dist/runtime/providers/qarpeo.d.ts +3 -3
- package/dist/runtime/server/durable-objects/agent.mjs +1 -1
- package/dist/runtime/server/durable-objects/room.d.ts +2 -2
- package/dist/runtime/server/durable-objects/room.mjs +5 -5
- package/dist/runtime/server/middleware/devtools.mjs +6 -2
- package/dist/runtime/server/plugins/cms.d.ts +4 -2
- package/dist/runtime/server/plugins/dev-proxy.mjs +1 -1
- package/dist/runtime/server/routes/__qarpeo/agents/chat.post.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/agents/chat.post.mjs +4 -1
- package/dist/runtime/server/routes/__qarpeo/analytics/events.get.d.ts +1 -4
- package/dist/runtime/server/routes/__qarpeo/analytics/summary.get.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/analytics/summary.get.mjs +5 -1
- package/dist/runtime/server/routes/__qarpeo/db/tables.get.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/db/tables.get.mjs +1 -1
- package/dist/runtime/server/routes/__qarpeo/logs.get.d.ts +4 -1
- package/dist/runtime/server/routes/__qarpeo/mail/track/click/[id].get.mjs +1 -1
- package/dist/runtime/server/routes/__qarpeo/mail/track/open/[id].get.mjs +2 -2
- package/dist/runtime/server/routes/__qarpeo/overview.get.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/realtime/broadcast.post.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/realtime/broadcast.post.mjs +1 -1
- package/dist/runtime/server/routes/__qarpeo/realtime/clear.post.d.ts +1 -4
- package/dist/runtime/server/routes/__qarpeo/realtime/clear.post.mjs +1 -1
- package/dist/runtime/server/routes/__qarpeo/realtime/disconnect.post.d.ts +1 -4
- package/dist/runtime/server/routes/__qarpeo/realtime/disconnect.post.mjs +1 -1
- package/dist/runtime/server/routes/__qarpeo/realtime/room.get.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/realtime/rooms.get.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/security/analytics.get.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/security/ban.post.d.ts +1 -4
- package/dist/runtime/server/routes/__qarpeo/security/clear.post.d.ts +1 -4
- package/dist/runtime/server/routes/__qarpeo/security/unban.post.d.ts +1 -4
- package/dist/runtime/server/routes/__qarpeo/settings.get.mjs +1 -1
- package/dist/runtime/server/routes/__qarpeo/tasks/run.post.mjs +3 -1
- package/dist/runtime/server/routes/agents/[agent]/chat.post.mjs +8 -2
- package/dist/runtime/server/routes/agents/[agent]/clear.post.mjs +8 -2
- package/dist/runtime/server/routes/agents/[agent]/history.get.mjs +8 -2
- package/dist/runtime/server/routes/ai/embed.post.d.ts +1 -4
- package/dist/runtime/server/routes/ai/search.post.d.ts +2 -2
- package/dist/runtime/server/routes/auth/account.delete.mjs +1 -1
- package/dist/runtime/server/routes/auth/handler.mjs +6 -1
- package/dist/runtime/server/routes/auth/magic-link/verify.get.mjs +1 -1
- package/dist/runtime/server/routes/auth/organization/members/[id].delete.mjs +7 -1
- package/dist/runtime/server/routes/auth/otp/verify.post.mjs +1 -1
- package/dist/runtime/server/routes/auth/sso/login.get.mjs +7 -1
- package/dist/runtime/server/routes/auth/sso/oidc/callback.get.mjs +8 -2
- package/dist/runtime/server/routes/auth/sso/saml/acs.post.mjs +7 -2
- package/dist/runtime/server/routes/auth/webauthn/login/options.post.mjs +1 -1
- package/dist/runtime/server/routes/auth/webauthn/login/verify.post.mjs +7 -2
- package/dist/runtime/server/routes/auth/webauthn/register/options.post.mjs +6 -1
- package/dist/runtime/server/routes/auth/webauthn/register/verify.post.mjs +6 -1
- package/dist/runtime/server/routes/browser/crawl.post.d.ts +1 -2
- package/dist/runtime/server/routes/browser/invoice.post.d.ts +1 -2
- package/dist/runtime/server/routes/browser/og-image.post.d.ts +2 -2
- package/dist/runtime/server/routes/browser/pdf.post.d.ts +1 -2
- package/dist/runtime/server/routes/browser/pdf.post.mjs +6 -1
- package/dist/runtime/server/routes/browser/screenshot.post.d.ts +2 -2
- package/dist/runtime/server/routes/browser/screenshot.post.mjs +5 -1
- package/dist/runtime/server/routes/cms/components/index.get.d.ts +2 -2
- package/dist/runtime/server/routes/cms/preview/disable.get.d.ts +4 -3
- package/dist/runtime/server/routes/cms/preview/enable.get.d.ts +8 -8
- package/dist/runtime/server/routes/cms/search.get.mjs +1 -1
- package/dist/runtime/server/routes/cms/webhooks/[provider].post.d.ts +7 -7
- package/dist/runtime/server/routes/cms/webhooks/[provider].post.mjs +9 -2
- package/dist/runtime/server/routes/docs/search.get.d.ts +9 -9
- package/dist/runtime/server/routes/fate.mjs +5 -8
- package/dist/runtime/server/routes/mail/bounce.post.d.ts +2 -2
- package/dist/runtime/server/routes/mail/unsubscribe.d.ts +2 -2
- package/dist/runtime/server/routes/mail/webhooks.post.d.ts +2 -2
- package/dist/runtime/server/routes/mail/webhooks.post.mjs +7 -1
- package/dist/runtime/server/routes/payments/usage.get.d.ts +8 -8
- package/dist/runtime/server/routes/payments/usage.post.d.ts +2 -2
- package/dist/runtime/server/routes/realtime/history.delete.d.ts +4 -3
- package/dist/runtime/server/routes/realtime/history.get.d.ts +7 -6
- package/dist/runtime/server/routes/realtime/ws.get.mjs +6 -1
- package/dist/runtime/server/routes/robots.txt.get.mjs +1 -1
- package/dist/runtime/server/routes/sitemap.xml.get.mjs +2 -1
- package/dist/runtime/server/routes/storage/multipart/abort.post.d.ts +2 -2
- package/dist/runtime/server/routes/storage/multipart/complete.post.d.ts +2 -2
- package/dist/runtime/server/routes/storage/multipart/complete.post.mjs +2 -2
- package/dist/runtime/server/routes/storage/multipart/create.post.d.ts +2 -2
- package/dist/runtime/server/routes/storage/multipart/create.post.mjs +7 -3
- package/dist/runtime/server/routes/storage/multipart/part.put.d.ts +2 -2
- package/dist/runtime/server/routes/storage/multipart/part.put.mjs +1 -1
- package/dist/runtime/server/routes/tenants/[tenant]/domains/[domain]/index.delete.mjs +2 -4
- package/dist/runtime/server/routes/tenants/[tenant]/domains/[domain]/verify.post.mjs +2 -4
- package/dist/runtime/server/routes/tenants/[tenant]/domains/index.get.mjs +1 -1
- package/dist/runtime/server/routes/tenants/[tenant]/domains/index.post.mjs +2 -4
- package/dist/runtime/server/tasks/cms/publish.mjs +1 -1
- package/dist/runtime/server/utils/ai.d.ts +9 -9
- package/dist/runtime/server/utils/ai.mjs +3 -3
- package/dist/runtime/server/utils/auth.d.ts +12 -16
- package/dist/runtime/server/utils/auth.mjs +15 -9
- package/dist/runtime/server/utils/bots.mjs +21 -7
- package/dist/runtime/server/utils/browser-utils.d.ts +44 -41
- package/dist/runtime/server/utils/browser-utils.mjs +14 -4
- package/dist/runtime/server/utils/cache.d.ts +5 -5
- package/dist/runtime/server/utils/cms/common.d.ts +26 -0
- package/dist/runtime/server/utils/cms/common.mjs +68 -0
- package/dist/runtime/server/utils/cms/git.d.ts +24 -0
- package/dist/runtime/server/utils/cms/git.mjs +240 -0
- package/dist/runtime/server/utils/cms/markdown.d.ts +22 -0
- package/dist/runtime/server/utils/cms/markdown.mjs +92 -0
- package/dist/runtime/server/utils/cms/path.d.ts +51 -0
- package/dist/runtime/server/utils/cms/path.mjs +127 -0
- package/dist/runtime/server/utils/cms/search.d.ts +22 -0
- package/dist/runtime/server/utils/cms/search.mjs +221 -0
- package/dist/runtime/server/utils/cms-events.d.ts +1 -1
- package/dist/runtime/server/utils/cms-events.mjs +2 -2
- package/dist/runtime/server/utils/cms-filter.mjs +2 -2
- package/dist/runtime/server/utils/cms.d.ts +17 -149
- package/dist/runtime/server/utils/cms.mjs +52 -761
- package/dist/runtime/server/utils/config.d.ts +5 -4
- package/dist/runtime/server/utils/domains.mjs +7 -4
- package/dist/runtime/server/utils/email-templates.d.ts +10 -7
- package/dist/runtime/server/utils/email-templates.mjs +20 -5
- package/dist/runtime/server/utils/feed.d.ts +2 -2
- package/dist/runtime/server/utils/feed.mjs +3 -1
- package/dist/runtime/server/utils/mail-suppression.d.ts +8 -24
- package/dist/runtime/server/utils/mail-suppression.mjs +2 -2
- package/dist/runtime/server/utils/mail.d.ts +7 -8
- package/dist/runtime/server/utils/mail.mjs +17 -12
- package/dist/runtime/server/utils/multipart-store.d.ts +2 -2
- package/dist/runtime/server/utils/notifications.d.ts +9 -23
- package/dist/runtime/server/utils/organization.mjs +4 -12
- package/dist/runtime/server/utils/passwordless.mjs +1 -1
- package/dist/runtime/server/utils/payments.d.ts +2 -6
- package/dist/runtime/server/utils/payments.mjs +1 -1
- package/dist/runtime/server/utils/queue.d.ts +21 -31
- package/dist/runtime/server/utils/rag.d.ts +4 -4
- package/dist/runtime/server/utils/rag.mjs +8 -8
- package/dist/runtime/server/utils/realtime-store.d.ts +2 -2
- package/dist/runtime/server/utils/realtime.d.ts +26 -28
- package/dist/runtime/server/utils/scheduled-task.d.ts +1 -3
- package/dist/runtime/server/utils/security-store.d.ts +2 -2
- package/dist/runtime/server/utils/session.d.ts +9 -11
- package/dist/runtime/server/utils/sso.d.ts +9 -15
- package/dist/runtime/server/utils/sso.mjs +4 -8
- package/dist/runtime/server/utils/storage.d.ts +19 -2
- package/dist/runtime/server/utils/storage.mjs +36 -7
- package/dist/runtime/server/utils/tenant.mjs +3 -1
- package/dist/runtime/server/utils/turnstile.d.ts +3 -5
- package/dist/runtime/server/utils/vapid.d.ts +5 -8
- package/dist/runtime/server/utils/vapid.mjs +26 -13
- package/dist/runtime/service.d.ts +13 -13
- package/dist/runtime/service.mjs +4 -2
- package/dist/runtime/test-utils.d.ts +20 -30
- package/dist/runtime/test-utils.mjs +5 -4
- package/dist/runtime/types/auth-globals.d.ts +14 -14
- package/dist/runtime/types/imports.d.ts +82 -82
- package/dist/runtime/types/index.d.ts +2 -2
- package/dist/runtime/types/r2.d.ts +5 -0
- package/dist/runtime/types/service.d.ts +11 -18
- package/dist/types.d.ts +100 -107
- package/dist/utils/auth-schema.d.ts +2 -2
- package/dist/utils/cms-sources.d.ts +3 -3
- package/dist/utils/local-db.d.ts +3 -3
- package/dist/utils/notifications-schema.d.ts +1 -3
- package/dist/utils/pkg.d.ts +7 -0
- package/dist/utils/queue.d.ts +3 -3
- package/dist/utils/tasks.d.ts +3 -2
- package/package.json +11 -8
|
@@ -1,545 +1,545 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import { computed, onMounted, ref, watch } from "vue"
|
|
5
|
-
|
|
6
|
-
const route = useRoute()
|
|
7
|
-
|
|
8
|
-
const {
|
|
9
|
-
data: dbData,
|
|
10
|
-
status: dbStatus,
|
|
11
|
-
pending: dbPending,
|
|
12
|
-
execute: executeLoadTables,
|
|
13
|
-
} = useFetch<any>("/_qarpeo/api/db/tables", {
|
|
14
|
-
immediate: false,
|
|
15
|
-
lazy: true,
|
|
16
|
-
default: () => ({ tables: [] }),
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
const dbTablesLoading = computed(
|
|
20
|
-
() => dbPending.value || dbStatus.value === "idle" || dbStatus.value === "pending",
|
|
21
|
-
)
|
|
22
|
-
|
|
23
|
-
const dbTables = computed(() => dbData.value?.tables || [])
|
|
24
|
-
const sqlQuery = ref("")
|
|
25
|
-
const sqlResult = ref<any>(null)
|
|
26
|
-
const sqlRunning = ref(false)
|
|
27
|
-
const sqlError = ref<string | null>(null)
|
|
28
|
-
const tableSearch = ref("")
|
|
29
|
-
|
|
30
|
-
// selectedTable is derived from the ?table= query param
|
|
31
|
-
const selectedTable = computed(() => (route.query.table as string) || null)
|
|
32
|
-
|
|
33
|
-
const filteredTables = computed(() => {
|
|
34
|
-
if (!tableSearch.value.trim()) return dbTables.value
|
|
35
|
-
const q = tableSearch.value.toLowerCase()
|
|
36
|
-
return dbTables.value.filter((t: any) => t.name.toLowerCase().includes(q))
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
const tableNavItems = computed<NavigationMenuItem[]>(() =>
|
|
40
|
-
filteredTables.value.map((t: any) => ({
|
|
41
|
-
label: t.name,
|
|
42
|
-
icon: "i-lucide-table-2",
|
|
43
|
-
value: t.name,
|
|
44
|
-
badge: {
|
|
45
|
-
label: String(t.rows ?? 0),
|
|
46
|
-
size: "sm" as const,
|
|
47
|
-
color: "neutral" as const,
|
|
48
|
-
variant: "subtle" as const,
|
|
49
|
-
},
|
|
50
|
-
to: { query: { ...route.query, table: t.name } },
|
|
51
|
-
active: route.query.table == t.name,
|
|
52
|
-
})),
|
|
53
|
-
)
|
|
54
|
-
|
|
55
|
-
const currentTableColumns = computed(() => {
|
|
56
|
-
if (!selectedTable.value) return []
|
|
57
|
-
return dbTables.value.find((t: any) => t.name === selectedTable.value)?.columns || []
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
-
const resultRows = computed(() => {
|
|
61
|
-
if (!sqlResult.value) return []
|
|
62
|
-
return sqlResult.value.rows || sqlResult.value.results || []
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
const resultColumns = computed(() => {
|
|
66
|
-
if (!resultRows.value.length) return []
|
|
67
|
-
return Object.keys(resultRows.value[0])
|
|
68
|
-
})
|
|
69
|
-
|
|
70
|
-
// Re-run default query whenever the URL ?table= param changes
|
|
71
|
-
watch(selectedTable, (name) => {
|
|
72
|
-
if (name && dbTables.value.some((t: any) => t.name === name)) {
|
|
73
|
-
sqlQuery.value = `SELECT * FROM "${name}" LIMIT 20;`
|
|
74
|
-
runQuery()
|
|
75
|
-
} else {
|
|
76
|
-
sqlQuery.value = ""
|
|
77
|
-
sqlResult.value = null
|
|
78
|
-
sqlError.value = null
|
|
79
|
-
}
|
|
80
|
-
})
|
|
81
|
-
|
|
82
|
-
// Insert Row State
|
|
83
|
-
const showInsertModal = ref(false)
|
|
84
|
-
const insertForm = ref<Record<string, any>>({})
|
|
85
|
-
const insertLoading = ref(false)
|
|
86
|
-
const insertError = ref<string | null>(null)
|
|
87
|
-
|
|
88
|
-
// Delete Row State
|
|
89
|
-
const deletingRowId = ref<string | number | null>(null)
|
|
90
|
-
|
|
91
|
-
const primaryKeyColumn = computed(() => {
|
|
92
|
-
const pk = currentTableColumns.value.find((c: any) => c.primaryKey)
|
|
93
|
-
if (pk) return pk.name
|
|
94
|
-
if (currentTableColumns.value.some((c: any) => c.name.toLowerCase() === "id")) return "id"
|
|
95
|
-
return currentTableColumns.value[0]?.name || null
|
|
96
|
-
})
|
|
97
|
-
|
|
98
|
-
function openInsertModal() {
|
|
99
|
-
insertForm.value = {}
|
|
100
|
-
insertError.value = null
|
|
101
|
-
for (const col of currentTableColumns.value) {
|
|
102
|
-
insertForm.value[col.name] = col.defaultValue != null ? String(col.defaultValue) : ""
|
|
103
|
-
}
|
|
104
|
-
showInsertModal.value = true
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
async function insertRow() {
|
|
108
|
-
if (!selectedTable.value) return
|
|
109
|
-
insertLoading.value = true
|
|
110
|
-
insertError.value = null
|
|
111
|
-
|
|
112
|
-
try {
|
|
113
|
-
const entries = Object.entries(insertForm.value).filter(
|
|
114
|
-
([_, v]) => v !== "" && v !== undefined && v !== null,
|
|
115
|
-
)
|
|
116
|
-
if (entries.length === 0) {
|
|
117
|
-
insertError.value = "Please provide at least one column value."
|
|
118
|
-
return
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
// Parameterized INSERT — values are bound server-side (d1.prepare(sql).bind(...params))
|
|
122
|
-
// instead of interpolated into the SQL string, eliminating SQL-injection from user input.
|
|
123
|
-
const colNames = entries.map(([k]) => `"${k}"`).join(", ")
|
|
124
|
-
const placeholders = entries.map(() => "?").join(", ")
|
|
125
|
-
const params = entries.map(([, v]) => {
|
|
126
|
-
const s = String(v)
|
|
127
|
-
// Preserve numeric affinity for numeric input (matches prior behavior).
|
|
128
|
-
if (/^-?\d+(\.\d+)?$/.test(s) && !isNaN(Number(s))) return Number(s)
|
|
129
|
-
return s
|
|
130
|
-
})
|
|
131
|
-
|
|
132
|
-
const sql = `INSERT INTO "${selectedTable.value}" (${colNames}) VALUES (${placeholders});`
|
|
133
|
-
const res = await $fetch<any>("/_qarpeo/api/db/query", {
|
|
134
|
-
method: "POST",
|
|
135
|
-
body: { sql, params },
|
|
136
|
-
})
|
|
137
|
-
|
|
138
|
-
if (res?.error) {
|
|
139
|
-
insertError.value = res.error
|
|
140
|
-
} else {
|
|
141
|
-
showInsertModal.value = false
|
|
142
|
-
runQuery()
|
|
143
|
-
loadTables()
|
|
144
|
-
}
|
|
145
|
-
} catch (err: any) {
|
|
146
|
-
insertError.value = err?.data?.message || err?.message || "Failed to insert row"
|
|
147
|
-
} finally {
|
|
148
|
-
insertLoading.value = false
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
async function deleteRow(row: any) {
|
|
153
|
-
if (!selectedTable.value || !primaryKeyColumn.value) return
|
|
154
|
-
const pkVal = row[primaryKeyColumn.value]
|
|
155
|
-
if (pkVal == null) return
|
|
156
|
-
|
|
157
|
-
if (
|
|
158
|
-
typeof window !== "undefined" &&
|
|
159
|
-
!window.confirm(
|
|
160
|
-
`Are you sure you want to delete this row where ${primaryKeyColumn.value} = '${pkVal}'?`,
|
|
161
|
-
)
|
|
162
|
-
) {
|
|
163
|
-
return
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
deletingRowId.value = pkVal
|
|
167
|
-
try {
|
|
168
|
-
const escapedVal = typeof pkVal === "number" ? pkVal : `'${String(pkVal).replace(/'/g, "''")}'`
|
|
169
|
-
const sql = `DELETE FROM "${selectedTable.value}" WHERE "${primaryKeyColumn.value}" = ${escapedVal};`
|
|
170
|
-
await $fetch<any>("/_qarpeo/api/db/query", {
|
|
171
|
-
method: "POST",
|
|
172
|
-
body: { sql },
|
|
173
|
-
})
|
|
174
|
-
runQuery()
|
|
175
|
-
loadTables()
|
|
176
|
-
} catch (err: any) {
|
|
177
|
-
if (typeof window !== "undefined") {
|
|
178
|
-
window.alert(`Failed to delete row: ${err?.data?.message || err?.message}`)
|
|
179
|
-
}
|
|
180
|
-
} finally {
|
|
181
|
-
deletingRowId.value = null
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
async function loadTables() {
|
|
186
|
-
await executeLoadTables()
|
|
187
|
-
// If ?table= is already in URL on mount, trigger query
|
|
188
|
-
if (selectedTable.value && dbTables.value.some((t: any) => t.name === selectedTable.value)) {
|
|
189
|
-
sqlQuery.value = `SELECT * FROM "${selectedTable.value}" LIMIT 20;`
|
|
190
|
-
runQuery()
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
function setSqlSnippet(type: "select" | "count" | "schema") {
|
|
195
|
-
if (!selectedTable.value) return
|
|
196
|
-
if (type === "select") {
|
|
197
|
-
sqlQuery.value = `SELECT * FROM "${selectedTable.value}" LIMIT 20;`
|
|
198
|
-
} else if (type === "count") {
|
|
199
|
-
sqlQuery.value = `SELECT count(*) as total_rows FROM "${selectedTable.value}";`
|
|
200
|
-
} else if (type === "schema") {
|
|
201
|
-
sqlQuery.value = `PRAGMA table_info("${selectedTable.value}");`
|
|
202
|
-
}
|
|
203
|
-
runQuery()
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
async function runQuery() {
|
|
207
|
-
const query = sqlQuery.value.trim()
|
|
208
|
-
if (!query) return
|
|
209
|
-
|
|
210
|
-
sqlRunning.value = true
|
|
211
|
-
sqlError.value = null
|
|
212
|
-
sqlResult.value = null
|
|
213
|
-
|
|
214
|
-
try {
|
|
215
|
-
const data = await $fetch<any>("/_qarpeo/api/db/query", {
|
|
216
|
-
method: "POST",
|
|
217
|
-
body: { sql: query },
|
|
218
|
-
})
|
|
219
|
-
|
|
220
|
-
if (data?.error) {
|
|
221
|
-
sqlError.value = data.error
|
|
222
|
-
} else {
|
|
223
|
-
sqlResult.value = data
|
|
224
|
-
}
|
|
225
|
-
} catch (err: any) {
|
|
226
|
-
sqlError.value = err?.data?.message || err?.message || "Failed to execute query"
|
|
227
|
-
} finally {
|
|
228
|
-
sqlRunning.value = false
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
onMounted(() => {
|
|
233
|
-
loadTables()
|
|
234
|
-
})
|
|
235
|
-
</script>
|
|
236
|
-
|
|
237
|
-
<template>
|
|
238
|
-
<!-- ── Panel 1: Tables List ─────────────────────────────────────────── -->
|
|
239
|
-
<UDashboardPanel id="db-tables" :default-size="25" :min-size="20" :max-size="40" resizable>
|
|
240
|
-
<template #header>
|
|
241
|
-
<UDashboardNavbar>
|
|
242
|
-
<template #title>
|
|
243
|
-
<div class="flex items-center gap-2">
|
|
244
|
-
<UIcon name="i-lucide-database" class="w-4 h-4 text-primary" />
|
|
245
|
-
<span class="font-bold text-sm text-highlighted">Tables</span>
|
|
246
|
-
<UBadge size="xs" color="neutral" variant="subtle">
|
|
247
|
-
{{ filteredTables.length }}
|
|
248
|
-
</UBadge>
|
|
249
|
-
</div>
|
|
250
|
-
</template>
|
|
251
|
-
<template #right>
|
|
252
|
-
<UButton
|
|
253
|
-
icon="i-lucide-refresh-cw"
|
|
254
|
-
size="xs"
|
|
255
|
-
color="neutral"
|
|
256
|
-
variant="ghost"
|
|
257
|
-
title="Refresh tables"
|
|
258
|
-
:loading="dbTablesLoading"
|
|
259
|
-
@click="loadTables"
|
|
260
|
-
/>
|
|
261
|
-
</template>
|
|
262
|
-
</UDashboardNavbar>
|
|
263
|
-
<UDashboardToolbar>
|
|
264
|
-
<UInput
|
|
265
|
-
v-model="tableSearch"
|
|
266
|
-
icon="i-lucide-search"
|
|
267
|
-
placeholder="Search tables…"
|
|
268
|
-
class="w-full"
|
|
269
|
-
/>
|
|
270
|
-
</UDashboardToolbar>
|
|
271
|
-
</template>
|
|
272
|
-
|
|
273
|
-
<template #body>
|
|
274
|
-
<!-- Loading Skeleton/State -->
|
|
275
|
-
<div v-if="dbTablesLoading" class="p-3 space-y-2">
|
|
276
|
-
<div
|
|
277
|
-
v-for="i in 5"
|
|
278
|
-
:key="i"
|
|
279
|
-
class="h-7 rounded bg-muted/60 animate-pulse flex items-center px-3"
|
|
280
|
-
>
|
|
281
|
-
<div class="h-3 w-3 rounded bg-muted/40 mr-2.5"></div>
|
|
282
|
-
<div class="h-3 w-24 rounded bg-muted/40"></div>
|
|
283
|
-
</div>
|
|
284
|
-
</div>
|
|
285
|
-
|
|
286
|
-
<template v-else>
|
|
287
|
-
<UNavigationMenu
|
|
288
|
-
v-model="selectedTable"
|
|
289
|
-
:items="tableNavItems"
|
|
290
|
-
orientation="vertical"
|
|
291
|
-
variant="pill"
|
|
292
|
-
/>
|
|
293
|
-
<div v-if="!filteredTables.length" class="text-xs text-muted p-6 text-center">
|
|
294
|
-
No tables found
|
|
295
|
-
</div>
|
|
296
|
-
</template>
|
|
297
|
-
</template>
|
|
298
|
-
</UDashboardPanel>
|
|
299
|
-
|
|
300
|
-
<!-- ── Panel 2: Table Data & Direct Query Console ────────────────────── -->
|
|
301
|
-
<UDashboardPanel id="db-data" class="hidden lg:flex flex-1">
|
|
302
|
-
<template #header>
|
|
303
|
-
<UDashboardNavbar>
|
|
304
|
-
<template #title>
|
|
305
|
-
<div v-if="selectedTable" class="flex items-center gap-2">
|
|
306
|
-
<UIcon name="i-lucide-table" class="w-4 h-4 text-primary" />
|
|
307
|
-
<span class="font-mono font-bold text-sm text-highlighted">{{ selectedTable }}</span>
|
|
308
|
-
<UBadge size="xs" color="primary" variant="subtle">D1 SQLite</UBadge>
|
|
309
|
-
</div>
|
|
310
|
-
<span v-else class="text-sm font-semibold text-muted">Select a table</span>
|
|
311
|
-
</template>
|
|
312
|
-
|
|
313
|
-
<template #right>
|
|
314
|
-
<div v-if="selectedTable" class="flex items-center gap-1.5">
|
|
315
|
-
<UButton
|
|
316
|
-
label="Insert Row"
|
|
317
|
-
icon="i-lucide-plus"
|
|
318
|
-
size="xs"
|
|
319
|
-
color="primary"
|
|
320
|
-
variant="subtle"
|
|
321
|
-
@click="openInsertModal"
|
|
322
|
-
/>
|
|
323
|
-
<UButton
|
|
324
|
-
label="SELECT 20"
|
|
325
|
-
size="xs"
|
|
326
|
-
color="neutral"
|
|
327
|
-
variant="subtle"
|
|
328
|
-
@click="setSqlSnippet('select')"
|
|
329
|
-
/>
|
|
330
|
-
<UButton
|
|
331
|
-
label="COUNT"
|
|
332
|
-
size="xs"
|
|
333
|
-
color="neutral"
|
|
334
|
-
variant="subtle"
|
|
335
|
-
@click="setSqlSnippet('count')"
|
|
336
|
-
/>
|
|
337
|
-
<UButton
|
|
338
|
-
label="SCHEMA"
|
|
339
|
-
size="xs"
|
|
340
|
-
color="neutral"
|
|
341
|
-
variant="subtle"
|
|
342
|
-
@click="setSqlSnippet('schema')"
|
|
343
|
-
/>
|
|
344
|
-
</div>
|
|
345
|
-
</template>
|
|
346
|
-
</UDashboardNavbar>
|
|
347
|
-
</template>
|
|
348
|
-
|
|
349
|
-
<template #body>
|
|
350
|
-
<div v-if="selectedTable" class="flex flex-col h-full p-6 space-y-4 overflow-hidden">
|
|
351
|
-
<!-- Columns chips -->
|
|
352
|
-
<div v-if="currentTableColumns.length" class="flex flex-wrap gap-1.5 shrink-0">
|
|
353
|
-
<UBadge
|
|
354
|
-
v-for="col in currentTableColumns"
|
|
355
|
-
:key="col.name"
|
|
356
|
-
size="xs"
|
|
357
|
-
color="neutral"
|
|
358
|
-
variant="subtle"
|
|
359
|
-
class="font-mono"
|
|
360
|
-
>
|
|
361
|
-
<span :class="col.primaryKey ? 'text-primary font-bold' : 'text-default'">{{
|
|
362
|
-
col.name
|
|
363
|
-
}}</span>
|
|
364
|
-
<span class="text-muted ml-1 text-[10px]">{{ col.type }}</span>
|
|
365
|
-
<span v-if="col.primaryKey" class="text-primary ml-1 text-[9px] font-bold">PK</span>
|
|
366
|
-
</UBadge>
|
|
367
|
-
</div>
|
|
368
|
-
|
|
369
|
-
<!-- SQL Query Box -->
|
|
370
|
-
<UCard>
|
|
371
|
-
<template #header>
|
|
372
|
-
<div class="flex items-center justify-between">
|
|
373
|
-
<span class="text-xs font-semibold text-muted flex items-center gap-1.5">
|
|
374
|
-
<UIcon name="i-lucide-terminal" class="w-3.5 h-3.5 text-primary" />
|
|
375
|
-
SQL Query
|
|
376
|
-
</span>
|
|
377
|
-
<div class="flex items-center gap-2">
|
|
378
|
-
<span class="text-[10px] text-muted hidden sm:inline">Ctrl + Enter to run</span>
|
|
379
|
-
<UButton
|
|
380
|
-
label="Execute"
|
|
381
|
-
icon="i-lucide-play"
|
|
382
|
-
size="xs"
|
|
383
|
-
color="primary"
|
|
384
|
-
:loading="sqlRunning"
|
|
385
|
-
@click="runQuery"
|
|
386
|
-
/>
|
|
387
|
-
</div>
|
|
388
|
-
</div>
|
|
389
|
-
</template>
|
|
390
|
-
<UTextarea
|
|
391
|
-
v-model="sqlQuery"
|
|
392
|
-
placeholder="SELECT * FROM table LIMIT 20;"
|
|
393
|
-
:rows="3"
|
|
394
|
-
class="font-mono w-full text-xs border-0 rounded-none focus:ring-0"
|
|
395
|
-
@keydown.ctrl.enter.prevent="runQuery"
|
|
396
|
-
@keydown.meta.enter.prevent="runQuery"
|
|
397
|
-
/>
|
|
398
|
-
</UCard>
|
|
399
|
-
|
|
400
|
-
<!-- Error alert -->
|
|
401
|
-
<div
|
|
402
|
-
v-if="sqlError"
|
|
403
|
-
class="p-3 bg-error/10 border border-error/20 rounded-md text-error text-xs font-mono"
|
|
404
|
-
>
|
|
405
|
-
{{ sqlError }}
|
|
406
|
-
</div>
|
|
407
|
-
|
|
408
|
-
<!-- Results Table -->
|
|
409
|
-
<div
|
|
410
|
-
v-if="sqlResult"
|
|
411
|
-
class="flex-1 flex flex-col min-h-0 bg-default border border-default rounded-md overflow-hidden"
|
|
412
|
-
>
|
|
413
|
-
<div
|
|
414
|
-
class="flex items-center justify-between px-3 py-2 bg-muted/50 border-b border-default text-xs text-muted"
|
|
415
|
-
>
|
|
416
|
-
<span>{{ resultRows.length }} rows returned</span>
|
|
417
|
-
<div class="flex items-center gap-3">
|
|
418
|
-
<span class="font-mono text-[11px]"
|
|
419
|
-
>{{ sqlResult.durationMs?.toFixed(2) ?? "?" }} ms</span
|
|
420
|
-
>
|
|
421
|
-
<UButton
|
|
422
|
-
icon="i-lucide-refresh-cw"
|
|
423
|
-
size="xs"
|
|
424
|
-
color="neutral"
|
|
425
|
-
variant="ghost"
|
|
426
|
-
title="Rerun query"
|
|
427
|
-
:loading="sqlRunning"
|
|
428
|
-
@click="runQuery"
|
|
429
|
-
/>
|
|
430
|
-
</div>
|
|
431
|
-
</div>
|
|
432
|
-
|
|
433
|
-
<div class="flex-1 overflow-auto">
|
|
434
|
-
<table v-if="resultRows.length" class="w-full text-left text-xs">
|
|
435
|
-
<thead>
|
|
436
|
-
<tr class="border-b border-default bg-muted/30 text-muted font-mono">
|
|
437
|
-
<th
|
|
438
|
-
v-for="col in resultColumns"
|
|
439
|
-
:key="col"
|
|
440
|
-
class="py-2 px-3 whitespace-nowrap font-semibold"
|
|
441
|
-
>
|
|
442
|
-
{{ col }}
|
|
443
|
-
</th>
|
|
444
|
-
<th
|
|
445
|
-
v-if="primaryKeyColumn"
|
|
446
|
-
class="py-2 px-3 whitespace-nowrap font-semibold text-right"
|
|
447
|
-
>
|
|
448
|
-
Actions
|
|
449
|
-
</th>
|
|
450
|
-
</tr>
|
|
451
|
-
</thead>
|
|
452
|
-
<tbody class="divide-y divide-default font-mono">
|
|
453
|
-
<tr v-for="(row, idx) in resultRows" :key="idx" class="hover:bg-elevated/50 group">
|
|
454
|
-
<td
|
|
455
|
-
v-for="col in resultColumns"
|
|
456
|
-
:key="col"
|
|
457
|
-
class="py-2 px-3 whitespace-nowrap text-default"
|
|
458
|
-
>
|
|
459
|
-
<span v-if="row[col] == null" class="text-muted/60 italic text-[11px]"
|
|
460
|
-
>NULL</span
|
|
461
|
-
>
|
|
462
|
-
<span v-else>{{ String(row[col]) }}</span>
|
|
463
|
-
</td>
|
|
464
|
-
<td v-if="primaryKeyColumn" class="py-2 px-3 whitespace-nowrap text-right">
|
|
465
|
-
<UButton
|
|
466
|
-
icon="i-lucide-trash"
|
|
467
|
-
size="xs"
|
|
468
|
-
color="neutral"
|
|
469
|
-
variant="ghost"
|
|
470
|
-
class="opacity-0 group-hover:opacity-100 transition-opacity hover:text-error"
|
|
471
|
-
title="Delete row"
|
|
472
|
-
:loading="deletingRowId === row[primaryKeyColumn]"
|
|
473
|
-
@click="deleteRow(row)"
|
|
474
|
-
/>
|
|
475
|
-
</td>
|
|
476
|
-
</tr>
|
|
477
|
-
</tbody>
|
|
478
|
-
</table>
|
|
479
|
-
<div v-else class="text-xs text-muted p-8 text-center">Query returned 0 rows.</div>
|
|
480
|
-
</div>
|
|
481
|
-
</div>
|
|
482
|
-
</div>
|
|
483
|
-
|
|
484
|
-
<div
|
|
485
|
-
v-else
|
|
486
|
-
class="flex-1 flex flex-col items-center justify-center text-muted text-xs p-12 text-center"
|
|
487
|
-
>
|
|
488
|
-
<UIcon name="i-lucide-database" class="w-8 h-8 mb-2 opacity-50 text-muted" />
|
|
489
|
-
Select a table from the list to view its columns and query records.
|
|
490
|
-
</div>
|
|
491
|
-
</template>
|
|
492
|
-
</UDashboardPanel>
|
|
493
|
-
|
|
494
|
-
<!-- ── Insert Row Modal ─────────────────────────────────────────────── -->
|
|
495
|
-
<UModal
|
|
496
|
-
v-model:open="showInsertModal"
|
|
497
|
-
:title="`Insert Row into ${selectedTable}`"
|
|
498
|
-
description="Enter values for each column. Auto-generated columns can be left blank."
|
|
499
|
-
>
|
|
500
|
-
<template #body>
|
|
501
|
-
<div class="space-y-3 max-h-[60vh] overflow-y-auto p-1">
|
|
502
|
-
<div
|
|
503
|
-
v-if="insertError"
|
|
504
|
-
class="p-2.5 bg-error/10 border border-error/20 rounded text-error text-xs font-mono"
|
|
505
|
-
>
|
|
506
|
-
{{ insertError }}
|
|
507
|
-
</div>
|
|
508
|
-
|
|
509
|
-
<UFormField
|
|
510
|
-
v-for="col in currentTableColumns"
|
|
511
|
-
:key="col.name"
|
|
512
|
-
:label="col.name"
|
|
513
|
-
:name="col.name"
|
|
514
|
-
:required="col.notNull && !col.primaryKey"
|
|
515
|
-
:help="`${col.type}${col.primaryKey ? ' · PRIMARY KEY' : ''}${col.notNull ? ' · NOT NULL' : ''}`"
|
|
516
|
-
>
|
|
517
|
-
<UInput
|
|
518
|
-
v-model="insertForm[col.name]"
|
|
519
|
-
:placeholder="
|
|
520
|
-
col.defaultValue != null ? String(col.defaultValue) : `Enter ${col.name}...`
|
|
521
|
-
"
|
|
522
|
-
class="w-full font-mono text-xs"
|
|
523
|
-
/>
|
|
524
|
-
</UFormField>
|
|
525
|
-
</div>
|
|
526
|
-
</template>
|
|
527
|
-
|
|
528
|
-
<template #footer>
|
|
529
|
-
<div class="flex justify-end gap-2 w-full">
|
|
530
|
-
<UButton size="xs" color="neutral" variant="ghost" @click="showInsertModal = false">
|
|
531
|
-
Cancel
|
|
532
|
-
</UButton>
|
|
533
|
-
<UButton
|
|
534
|
-
size="xs"
|
|
535
|
-
color="primary"
|
|
536
|
-
icon="i-lucide-plus"
|
|
537
|
-
:loading="insertLoading"
|
|
538
|
-
@click="insertRow"
|
|
539
|
-
>
|
|
540
|
-
Insert Row
|
|
541
|
-
</UButton>
|
|
542
|
-
</div>
|
|
543
|
-
</template>
|
|
544
|
-
</UModal>
|
|
545
|
-
</template>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { NavigationMenuItem } from "@nuxt/ui"
|
|
3
|
+
import { useRoute, useFetch } from "nuxt/app"
|
|
4
|
+
import { computed, onMounted, ref, watch } from "vue"
|
|
5
|
+
|
|
6
|
+
const route = useRoute()
|
|
7
|
+
|
|
8
|
+
const {
|
|
9
|
+
data: dbData,
|
|
10
|
+
status: dbStatus,
|
|
11
|
+
pending: dbPending,
|
|
12
|
+
execute: executeLoadTables,
|
|
13
|
+
} = useFetch<any>("/_qarpeo/api/db/tables", {
|
|
14
|
+
immediate: false,
|
|
15
|
+
lazy: true,
|
|
16
|
+
default: () => ({ tables: [] }),
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
const dbTablesLoading = computed(
|
|
20
|
+
() => dbPending.value || dbStatus.value === "idle" || dbStatus.value === "pending",
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
const dbTables = computed(() => dbData.value?.tables || [])
|
|
24
|
+
const sqlQuery = ref("")
|
|
25
|
+
const sqlResult = ref<any>(null)
|
|
26
|
+
const sqlRunning = ref(false)
|
|
27
|
+
const sqlError = ref<string | null>(null)
|
|
28
|
+
const tableSearch = ref("")
|
|
29
|
+
|
|
30
|
+
// selectedTable is derived from the ?table= query param
|
|
31
|
+
const selectedTable = computed(() => (route.query.table as string) || null)
|
|
32
|
+
|
|
33
|
+
const filteredTables = computed(() => {
|
|
34
|
+
if (!tableSearch.value.trim()) return dbTables.value
|
|
35
|
+
const q = tableSearch.value.toLowerCase()
|
|
36
|
+
return dbTables.value.filter((t: any) => t.name.toLowerCase().includes(q))
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
const tableNavItems = computed<NavigationMenuItem[]>(() =>
|
|
40
|
+
filteredTables.value.map((t: any) => ({
|
|
41
|
+
label: t.name,
|
|
42
|
+
icon: "i-lucide-table-2",
|
|
43
|
+
value: t.name,
|
|
44
|
+
badge: {
|
|
45
|
+
label: String(t.rows ?? 0),
|
|
46
|
+
size: "sm" as const,
|
|
47
|
+
color: "neutral" as const,
|
|
48
|
+
variant: "subtle" as const,
|
|
49
|
+
},
|
|
50
|
+
to: { query: { ...route.query, table: t.name } },
|
|
51
|
+
active: route.query.table == t.name,
|
|
52
|
+
})),
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
const currentTableColumns = computed(() => {
|
|
56
|
+
if (!selectedTable.value) return []
|
|
57
|
+
return dbTables.value.find((t: any) => t.name === selectedTable.value)?.columns || []
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
const resultRows = computed(() => {
|
|
61
|
+
if (!sqlResult.value) return []
|
|
62
|
+
return sqlResult.value.rows || sqlResult.value.results || []
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
const resultColumns = computed(() => {
|
|
66
|
+
if (!resultRows.value.length) return []
|
|
67
|
+
return Object.keys(resultRows.value[0])
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
// Re-run default query whenever the URL ?table= param changes
|
|
71
|
+
watch(selectedTable, (name) => {
|
|
72
|
+
if (name && dbTables.value.some((t: any) => t.name === name)) {
|
|
73
|
+
sqlQuery.value = `SELECT * FROM "${name}" LIMIT 20;`
|
|
74
|
+
runQuery()
|
|
75
|
+
} else {
|
|
76
|
+
sqlQuery.value = ""
|
|
77
|
+
sqlResult.value = null
|
|
78
|
+
sqlError.value = null
|
|
79
|
+
}
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
// Insert Row State
|
|
83
|
+
const showInsertModal = ref(false)
|
|
84
|
+
const insertForm = ref<Record<string, any>>({})
|
|
85
|
+
const insertLoading = ref(false)
|
|
86
|
+
const insertError = ref<string | null>(null)
|
|
87
|
+
|
|
88
|
+
// Delete Row State
|
|
89
|
+
const deletingRowId = ref<string | number | null>(null)
|
|
90
|
+
|
|
91
|
+
const primaryKeyColumn = computed(() => {
|
|
92
|
+
const pk = currentTableColumns.value.find((c: any) => c.primaryKey)
|
|
93
|
+
if (pk) return pk.name
|
|
94
|
+
if (currentTableColumns.value.some((c: any) => c.name.toLowerCase() === "id")) return "id"
|
|
95
|
+
return currentTableColumns.value[0]?.name || null
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
function openInsertModal() {
|
|
99
|
+
insertForm.value = {}
|
|
100
|
+
insertError.value = null
|
|
101
|
+
for (const col of currentTableColumns.value) {
|
|
102
|
+
insertForm.value[col.name] = col.defaultValue != null ? String(col.defaultValue) : ""
|
|
103
|
+
}
|
|
104
|
+
showInsertModal.value = true
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
async function insertRow() {
|
|
108
|
+
if (!selectedTable.value) return
|
|
109
|
+
insertLoading.value = true
|
|
110
|
+
insertError.value = null
|
|
111
|
+
|
|
112
|
+
try {
|
|
113
|
+
const entries = Object.entries(insertForm.value).filter(
|
|
114
|
+
([_, v]) => v !== "" && v !== undefined && v !== null,
|
|
115
|
+
)
|
|
116
|
+
if (entries.length === 0) {
|
|
117
|
+
insertError.value = "Please provide at least one column value."
|
|
118
|
+
return
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// Parameterized INSERT — values are bound server-side (d1.prepare(sql).bind(...params))
|
|
122
|
+
// instead of interpolated into the SQL string, eliminating SQL-injection from user input.
|
|
123
|
+
const colNames = entries.map(([k]) => `"${k}"`).join(", ")
|
|
124
|
+
const placeholders = entries.map(() => "?").join(", ")
|
|
125
|
+
const params = entries.map(([, v]) => {
|
|
126
|
+
const s = String(v)
|
|
127
|
+
// Preserve numeric affinity for numeric input (matches prior behavior).
|
|
128
|
+
if (/^-?\d+(\.\d+)?$/.test(s) && !isNaN(Number(s))) return Number(s)
|
|
129
|
+
return s
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
const sql = `INSERT INTO "${selectedTable.value}" (${colNames}) VALUES (${placeholders});`
|
|
133
|
+
const res = await $fetch<any>("/_qarpeo/api/db/query", {
|
|
134
|
+
method: "POST",
|
|
135
|
+
body: { sql, params },
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
if (res?.error) {
|
|
139
|
+
insertError.value = res.error
|
|
140
|
+
} else {
|
|
141
|
+
showInsertModal.value = false
|
|
142
|
+
runQuery()
|
|
143
|
+
loadTables()
|
|
144
|
+
}
|
|
145
|
+
} catch (err: any) {
|
|
146
|
+
insertError.value = err?.data?.message || err?.message || "Failed to insert row"
|
|
147
|
+
} finally {
|
|
148
|
+
insertLoading.value = false
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
async function deleteRow(row: any) {
|
|
153
|
+
if (!selectedTable.value || !primaryKeyColumn.value) return
|
|
154
|
+
const pkVal = row[primaryKeyColumn.value]
|
|
155
|
+
if (pkVal == null) return
|
|
156
|
+
|
|
157
|
+
if (
|
|
158
|
+
typeof window !== "undefined" &&
|
|
159
|
+
!window.confirm(
|
|
160
|
+
`Are you sure you want to delete this row where ${primaryKeyColumn.value} = '${pkVal}'?`,
|
|
161
|
+
)
|
|
162
|
+
) {
|
|
163
|
+
return
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
deletingRowId.value = pkVal
|
|
167
|
+
try {
|
|
168
|
+
const escapedVal = typeof pkVal === "number" ? pkVal : `'${String(pkVal).replace(/'/g, "''")}'`
|
|
169
|
+
const sql = `DELETE FROM "${selectedTable.value}" WHERE "${primaryKeyColumn.value}" = ${escapedVal};`
|
|
170
|
+
await $fetch<any>("/_qarpeo/api/db/query", {
|
|
171
|
+
method: "POST",
|
|
172
|
+
body: { sql },
|
|
173
|
+
})
|
|
174
|
+
runQuery()
|
|
175
|
+
loadTables()
|
|
176
|
+
} catch (err: any) {
|
|
177
|
+
if (typeof window !== "undefined") {
|
|
178
|
+
window.alert(`Failed to delete row: ${err?.data?.message || err?.message}`)
|
|
179
|
+
}
|
|
180
|
+
} finally {
|
|
181
|
+
deletingRowId.value = null
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
async function loadTables() {
|
|
186
|
+
await executeLoadTables()
|
|
187
|
+
// If ?table= is already in URL on mount, trigger query
|
|
188
|
+
if (selectedTable.value && dbTables.value.some((t: any) => t.name === selectedTable.value)) {
|
|
189
|
+
sqlQuery.value = `SELECT * FROM "${selectedTable.value}" LIMIT 20;`
|
|
190
|
+
runQuery()
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
function setSqlSnippet(type: "select" | "count" | "schema") {
|
|
195
|
+
if (!selectedTable.value) return
|
|
196
|
+
if (type === "select") {
|
|
197
|
+
sqlQuery.value = `SELECT * FROM "${selectedTable.value}" LIMIT 20;`
|
|
198
|
+
} else if (type === "count") {
|
|
199
|
+
sqlQuery.value = `SELECT count(*) as total_rows FROM "${selectedTable.value}";`
|
|
200
|
+
} else if (type === "schema") {
|
|
201
|
+
sqlQuery.value = `PRAGMA table_info("${selectedTable.value}");`
|
|
202
|
+
}
|
|
203
|
+
runQuery()
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
async function runQuery() {
|
|
207
|
+
const query = sqlQuery.value.trim()
|
|
208
|
+
if (!query) return
|
|
209
|
+
|
|
210
|
+
sqlRunning.value = true
|
|
211
|
+
sqlError.value = null
|
|
212
|
+
sqlResult.value = null
|
|
213
|
+
|
|
214
|
+
try {
|
|
215
|
+
const data = await $fetch<any>("/_qarpeo/api/db/query", {
|
|
216
|
+
method: "POST",
|
|
217
|
+
body: { sql: query },
|
|
218
|
+
})
|
|
219
|
+
|
|
220
|
+
if (data?.error) {
|
|
221
|
+
sqlError.value = data.error
|
|
222
|
+
} else {
|
|
223
|
+
sqlResult.value = data
|
|
224
|
+
}
|
|
225
|
+
} catch (err: any) {
|
|
226
|
+
sqlError.value = err?.data?.message || err?.message || "Failed to execute query"
|
|
227
|
+
} finally {
|
|
228
|
+
sqlRunning.value = false
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
onMounted(() => {
|
|
233
|
+
loadTables()
|
|
234
|
+
})
|
|
235
|
+
</script>
|
|
236
|
+
|
|
237
|
+
<template>
|
|
238
|
+
<!-- ── Panel 1: Tables List ─────────────────────────────────────────── -->
|
|
239
|
+
<UDashboardPanel id="db-tables" :default-size="25" :min-size="20" :max-size="40" resizable>
|
|
240
|
+
<template #header>
|
|
241
|
+
<UDashboardNavbar>
|
|
242
|
+
<template #title>
|
|
243
|
+
<div class="flex items-center gap-2">
|
|
244
|
+
<UIcon name="i-lucide-database" class="w-4 h-4 text-primary" />
|
|
245
|
+
<span class="font-bold text-sm text-highlighted">Tables</span>
|
|
246
|
+
<UBadge size="xs" color="neutral" variant="subtle">
|
|
247
|
+
{{ filteredTables.length }}
|
|
248
|
+
</UBadge>
|
|
249
|
+
</div>
|
|
250
|
+
</template>
|
|
251
|
+
<template #right>
|
|
252
|
+
<UButton
|
|
253
|
+
icon="i-lucide-refresh-cw"
|
|
254
|
+
size="xs"
|
|
255
|
+
color="neutral"
|
|
256
|
+
variant="ghost"
|
|
257
|
+
title="Refresh tables"
|
|
258
|
+
:loading="dbTablesLoading"
|
|
259
|
+
@click="loadTables"
|
|
260
|
+
/>
|
|
261
|
+
</template>
|
|
262
|
+
</UDashboardNavbar>
|
|
263
|
+
<UDashboardToolbar>
|
|
264
|
+
<UInput
|
|
265
|
+
v-model="tableSearch"
|
|
266
|
+
icon="i-lucide-search"
|
|
267
|
+
placeholder="Search tables…"
|
|
268
|
+
class="w-full"
|
|
269
|
+
/>
|
|
270
|
+
</UDashboardToolbar>
|
|
271
|
+
</template>
|
|
272
|
+
|
|
273
|
+
<template #body>
|
|
274
|
+
<!-- Loading Skeleton/State -->
|
|
275
|
+
<div v-if="dbTablesLoading" class="p-3 space-y-2">
|
|
276
|
+
<div
|
|
277
|
+
v-for="i in 5"
|
|
278
|
+
:key="i"
|
|
279
|
+
class="h-7 rounded bg-muted/60 animate-pulse flex items-center px-3"
|
|
280
|
+
>
|
|
281
|
+
<div class="h-3 w-3 rounded bg-muted/40 mr-2.5"></div>
|
|
282
|
+
<div class="h-3 w-24 rounded bg-muted/40"></div>
|
|
283
|
+
</div>
|
|
284
|
+
</div>
|
|
285
|
+
|
|
286
|
+
<template v-else>
|
|
287
|
+
<UNavigationMenu
|
|
288
|
+
v-model="selectedTable"
|
|
289
|
+
:items="tableNavItems"
|
|
290
|
+
orientation="vertical"
|
|
291
|
+
variant="pill"
|
|
292
|
+
/>
|
|
293
|
+
<div v-if="!filteredTables.length" class="text-xs text-muted p-6 text-center">
|
|
294
|
+
No tables found
|
|
295
|
+
</div>
|
|
296
|
+
</template>
|
|
297
|
+
</template>
|
|
298
|
+
</UDashboardPanel>
|
|
299
|
+
|
|
300
|
+
<!-- ── Panel 2: Table Data & Direct Query Console ────────────────────── -->
|
|
301
|
+
<UDashboardPanel id="db-data" class="hidden lg:flex flex-1">
|
|
302
|
+
<template #header>
|
|
303
|
+
<UDashboardNavbar>
|
|
304
|
+
<template #title>
|
|
305
|
+
<div v-if="selectedTable" class="flex items-center gap-2">
|
|
306
|
+
<UIcon name="i-lucide-table" class="w-4 h-4 text-primary" />
|
|
307
|
+
<span class="font-mono font-bold text-sm text-highlighted">{{ selectedTable }}</span>
|
|
308
|
+
<UBadge size="xs" color="primary" variant="subtle">D1 SQLite</UBadge>
|
|
309
|
+
</div>
|
|
310
|
+
<span v-else class="text-sm font-semibold text-muted">Select a table</span>
|
|
311
|
+
</template>
|
|
312
|
+
|
|
313
|
+
<template #right>
|
|
314
|
+
<div v-if="selectedTable" class="flex items-center gap-1.5">
|
|
315
|
+
<UButton
|
|
316
|
+
label="Insert Row"
|
|
317
|
+
icon="i-lucide-plus"
|
|
318
|
+
size="xs"
|
|
319
|
+
color="primary"
|
|
320
|
+
variant="subtle"
|
|
321
|
+
@click="openInsertModal"
|
|
322
|
+
/>
|
|
323
|
+
<UButton
|
|
324
|
+
label="SELECT 20"
|
|
325
|
+
size="xs"
|
|
326
|
+
color="neutral"
|
|
327
|
+
variant="subtle"
|
|
328
|
+
@click="setSqlSnippet('select')"
|
|
329
|
+
/>
|
|
330
|
+
<UButton
|
|
331
|
+
label="COUNT"
|
|
332
|
+
size="xs"
|
|
333
|
+
color="neutral"
|
|
334
|
+
variant="subtle"
|
|
335
|
+
@click="setSqlSnippet('count')"
|
|
336
|
+
/>
|
|
337
|
+
<UButton
|
|
338
|
+
label="SCHEMA"
|
|
339
|
+
size="xs"
|
|
340
|
+
color="neutral"
|
|
341
|
+
variant="subtle"
|
|
342
|
+
@click="setSqlSnippet('schema')"
|
|
343
|
+
/>
|
|
344
|
+
</div>
|
|
345
|
+
</template>
|
|
346
|
+
</UDashboardNavbar>
|
|
347
|
+
</template>
|
|
348
|
+
|
|
349
|
+
<template #body>
|
|
350
|
+
<div v-if="selectedTable" class="flex flex-col h-full p-6 space-y-4 overflow-hidden">
|
|
351
|
+
<!-- Columns chips -->
|
|
352
|
+
<div v-if="currentTableColumns.length" class="flex flex-wrap gap-1.5 shrink-0">
|
|
353
|
+
<UBadge
|
|
354
|
+
v-for="col in currentTableColumns"
|
|
355
|
+
:key="col.name"
|
|
356
|
+
size="xs"
|
|
357
|
+
color="neutral"
|
|
358
|
+
variant="subtle"
|
|
359
|
+
class="font-mono"
|
|
360
|
+
>
|
|
361
|
+
<span :class="col.primaryKey ? 'text-primary font-bold' : 'text-default'">{{
|
|
362
|
+
col.name
|
|
363
|
+
}}</span>
|
|
364
|
+
<span class="text-muted ml-1 text-[10px]">{{ col.type }}</span>
|
|
365
|
+
<span v-if="col.primaryKey" class="text-primary ml-1 text-[9px] font-bold">PK</span>
|
|
366
|
+
</UBadge>
|
|
367
|
+
</div>
|
|
368
|
+
|
|
369
|
+
<!-- SQL Query Box -->
|
|
370
|
+
<UCard>
|
|
371
|
+
<template #header>
|
|
372
|
+
<div class="flex items-center justify-between">
|
|
373
|
+
<span class="text-xs font-semibold text-muted flex items-center gap-1.5">
|
|
374
|
+
<UIcon name="i-lucide-terminal" class="w-3.5 h-3.5 text-primary" />
|
|
375
|
+
SQL Query
|
|
376
|
+
</span>
|
|
377
|
+
<div class="flex items-center gap-2">
|
|
378
|
+
<span class="text-[10px] text-muted hidden sm:inline">Ctrl + Enter to run</span>
|
|
379
|
+
<UButton
|
|
380
|
+
label="Execute"
|
|
381
|
+
icon="i-lucide-play"
|
|
382
|
+
size="xs"
|
|
383
|
+
color="primary"
|
|
384
|
+
:loading="sqlRunning"
|
|
385
|
+
@click="runQuery"
|
|
386
|
+
/>
|
|
387
|
+
</div>
|
|
388
|
+
</div>
|
|
389
|
+
</template>
|
|
390
|
+
<UTextarea
|
|
391
|
+
v-model="sqlQuery"
|
|
392
|
+
placeholder="SELECT * FROM table LIMIT 20;"
|
|
393
|
+
:rows="3"
|
|
394
|
+
class="font-mono w-full text-xs border-0 rounded-none focus:ring-0"
|
|
395
|
+
@keydown.ctrl.enter.prevent="runQuery"
|
|
396
|
+
@keydown.meta.enter.prevent="runQuery"
|
|
397
|
+
/>
|
|
398
|
+
</UCard>
|
|
399
|
+
|
|
400
|
+
<!-- Error alert -->
|
|
401
|
+
<div
|
|
402
|
+
v-if="sqlError"
|
|
403
|
+
class="p-3 bg-error/10 border border-error/20 rounded-md text-error text-xs font-mono"
|
|
404
|
+
>
|
|
405
|
+
{{ sqlError }}
|
|
406
|
+
</div>
|
|
407
|
+
|
|
408
|
+
<!-- Results Table -->
|
|
409
|
+
<div
|
|
410
|
+
v-if="sqlResult"
|
|
411
|
+
class="flex-1 flex flex-col min-h-0 bg-default border border-default rounded-md overflow-hidden"
|
|
412
|
+
>
|
|
413
|
+
<div
|
|
414
|
+
class="flex items-center justify-between px-3 py-2 bg-muted/50 border-b border-default text-xs text-muted"
|
|
415
|
+
>
|
|
416
|
+
<span>{{ resultRows.length }} rows returned</span>
|
|
417
|
+
<div class="flex items-center gap-3">
|
|
418
|
+
<span class="font-mono text-[11px]"
|
|
419
|
+
>{{ sqlResult.durationMs?.toFixed(2) ?? "?" }} ms</span
|
|
420
|
+
>
|
|
421
|
+
<UButton
|
|
422
|
+
icon="i-lucide-refresh-cw"
|
|
423
|
+
size="xs"
|
|
424
|
+
color="neutral"
|
|
425
|
+
variant="ghost"
|
|
426
|
+
title="Rerun query"
|
|
427
|
+
:loading="sqlRunning"
|
|
428
|
+
@click="runQuery"
|
|
429
|
+
/>
|
|
430
|
+
</div>
|
|
431
|
+
</div>
|
|
432
|
+
|
|
433
|
+
<div class="flex-1 overflow-auto">
|
|
434
|
+
<table v-if="resultRows.length" class="w-full text-left text-xs">
|
|
435
|
+
<thead>
|
|
436
|
+
<tr class="border-b border-default bg-muted/30 text-muted font-mono">
|
|
437
|
+
<th
|
|
438
|
+
v-for="col in resultColumns"
|
|
439
|
+
:key="col"
|
|
440
|
+
class="py-2 px-3 whitespace-nowrap font-semibold"
|
|
441
|
+
>
|
|
442
|
+
{{ col }}
|
|
443
|
+
</th>
|
|
444
|
+
<th
|
|
445
|
+
v-if="primaryKeyColumn"
|
|
446
|
+
class="py-2 px-3 whitespace-nowrap font-semibold text-right"
|
|
447
|
+
>
|
|
448
|
+
Actions
|
|
449
|
+
</th>
|
|
450
|
+
</tr>
|
|
451
|
+
</thead>
|
|
452
|
+
<tbody class="divide-y divide-default font-mono">
|
|
453
|
+
<tr v-for="(row, idx) in resultRows" :key="idx" class="hover:bg-elevated/50 group">
|
|
454
|
+
<td
|
|
455
|
+
v-for="col in resultColumns"
|
|
456
|
+
:key="col"
|
|
457
|
+
class="py-2 px-3 whitespace-nowrap text-default"
|
|
458
|
+
>
|
|
459
|
+
<span v-if="row[col] == null" class="text-muted/60 italic text-[11px]"
|
|
460
|
+
>NULL</span
|
|
461
|
+
>
|
|
462
|
+
<span v-else>{{ String(row[col]) }}</span>
|
|
463
|
+
</td>
|
|
464
|
+
<td v-if="primaryKeyColumn" class="py-2 px-3 whitespace-nowrap text-right">
|
|
465
|
+
<UButton
|
|
466
|
+
icon="i-lucide-trash"
|
|
467
|
+
size="xs"
|
|
468
|
+
color="neutral"
|
|
469
|
+
variant="ghost"
|
|
470
|
+
class="opacity-0 group-hover:opacity-100 transition-opacity hover:text-error"
|
|
471
|
+
title="Delete row"
|
|
472
|
+
:loading="deletingRowId === row[primaryKeyColumn]"
|
|
473
|
+
@click="deleteRow(row)"
|
|
474
|
+
/>
|
|
475
|
+
</td>
|
|
476
|
+
</tr>
|
|
477
|
+
</tbody>
|
|
478
|
+
</table>
|
|
479
|
+
<div v-else class="text-xs text-muted p-8 text-center">Query returned 0 rows.</div>
|
|
480
|
+
</div>
|
|
481
|
+
</div>
|
|
482
|
+
</div>
|
|
483
|
+
|
|
484
|
+
<div
|
|
485
|
+
v-else
|
|
486
|
+
class="flex-1 flex flex-col items-center justify-center text-muted text-xs p-12 text-center"
|
|
487
|
+
>
|
|
488
|
+
<UIcon name="i-lucide-database" class="w-8 h-8 mb-2 opacity-50 text-muted" />
|
|
489
|
+
Select a table from the list to view its columns and query records.
|
|
490
|
+
</div>
|
|
491
|
+
</template>
|
|
492
|
+
</UDashboardPanel>
|
|
493
|
+
|
|
494
|
+
<!-- ── Insert Row Modal ─────────────────────────────────────────────── -->
|
|
495
|
+
<UModal
|
|
496
|
+
v-model:open="showInsertModal"
|
|
497
|
+
:title="`Insert Row into ${selectedTable}`"
|
|
498
|
+
description="Enter values for each column. Auto-generated columns can be left blank."
|
|
499
|
+
>
|
|
500
|
+
<template #body>
|
|
501
|
+
<div class="space-y-3 max-h-[60vh] overflow-y-auto p-1">
|
|
502
|
+
<div
|
|
503
|
+
v-if="insertError"
|
|
504
|
+
class="p-2.5 bg-error/10 border border-error/20 rounded text-error text-xs font-mono"
|
|
505
|
+
>
|
|
506
|
+
{{ insertError }}
|
|
507
|
+
</div>
|
|
508
|
+
|
|
509
|
+
<UFormField
|
|
510
|
+
v-for="col in currentTableColumns"
|
|
511
|
+
:key="col.name"
|
|
512
|
+
:label="col.name"
|
|
513
|
+
:name="col.name"
|
|
514
|
+
:required="col.notNull && !col.primaryKey"
|
|
515
|
+
:help="`${col.type}${col.primaryKey ? ' · PRIMARY KEY' : ''}${col.notNull ? ' · NOT NULL' : ''}`"
|
|
516
|
+
>
|
|
517
|
+
<UInput
|
|
518
|
+
v-model="insertForm[col.name]"
|
|
519
|
+
:placeholder="
|
|
520
|
+
col.defaultValue != null ? String(col.defaultValue) : `Enter ${col.name}...`
|
|
521
|
+
"
|
|
522
|
+
class="w-full font-mono text-xs"
|
|
523
|
+
/>
|
|
524
|
+
</UFormField>
|
|
525
|
+
</div>
|
|
526
|
+
</template>
|
|
527
|
+
|
|
528
|
+
<template #footer>
|
|
529
|
+
<div class="flex justify-end gap-2 w-full">
|
|
530
|
+
<UButton size="xs" color="neutral" variant="ghost" @click="showInsertModal = false">
|
|
531
|
+
Cancel
|
|
532
|
+
</UButton>
|
|
533
|
+
<UButton
|
|
534
|
+
size="xs"
|
|
535
|
+
color="primary"
|
|
536
|
+
icon="i-lucide-plus"
|
|
537
|
+
:loading="insertLoading"
|
|
538
|
+
@click="insertRow"
|
|
539
|
+
>
|
|
540
|
+
Insert Row
|
|
541
|
+
</UButton>
|
|
542
|
+
</div>
|
|
543
|
+
</template>
|
|
544
|
+
</UModal>
|
|
545
|
+
</template>
|