@antelopejs/dms-database 0.4.3 → 0.5.0
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 +12 -10
- package/dist/automation/tableWatch.d.ts +2 -2
- package/dist/automation/tableWatch.js +3 -3
- package/dist/automation/tableWatch.js.map +1 -1
- package/dist/config.d.ts +11 -0
- package/dist/config.js +12 -0
- package/dist/config.js.map +1 -1
- package/dist/connectionAccess.d.ts +3 -0
- package/dist/connectionAccess.js +20 -0
- package/dist/connectionAccess.js.map +1 -0
- package/dist/db/models/connection_selections.model.d.ts +27 -0
- package/dist/db/models/connection_selections.model.js +17 -0
- package/dist/db/models/connection_selections.model.js.map +1 -0
- package/dist/db/models/diagram_layouts.model.d.ts +4 -4
- package/dist/db/models/diagram_layouts.model.js +14 -12
- package/dist/db/models/diagram_layouts.model.js.map +1 -1
- package/dist/db/models/diagram_notes.model.d.ts +3 -3
- package/dist/db/models/index.d.ts +1 -0
- package/dist/db/models/index.js +1 -0
- package/dist/db/models/index.js.map +1 -1
- package/dist/db/models/query_history.model.d.ts +3 -3
- package/dist/db/models/saved_queries.model.d.ts +3 -3
- package/dist/db/tables/connection_selections.table.d.ts +6 -0
- package/dist/db/tables/connection_selections.table.js +30 -0
- package/dist/db/tables/connection_selections.table.js.map +1 -0
- package/dist/db/tables/index.d.ts +1 -0
- package/dist/db/tables/index.js +1 -0
- package/dist/db/tables/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/pages/externalLock.d.ts +8 -0
- package/dist/pages/externalLock.js +32 -0
- package/dist/pages/externalLock.js.map +1 -0
- package/dist/pages/overview.js +6 -3
- package/dist/pages/overview.js.map +1 -1
- package/dist/pages/schemas.js +6 -2
- package/dist/pages/schemas.js.map +1 -1
- package/dist/routes/connections.d.ts +14 -0
- package/dist/routes/connections.js +116 -0
- package/dist/routes/connections.js.map +1 -0
- package/dist/routes/data.d.ts +10 -9
- package/dist/routes/data.js +43 -62
- package/dist/routes/data.js.map +1 -1
- package/dist/routes/diagram.d.ts +6 -6
- package/dist/routes/diagram.js +16 -6
- package/dist/routes/diagram.js.map +1 -1
- package/dist/routes/health.d.ts +1 -1
- package/dist/routes/health.js +3 -2
- package/dist/routes/health.js.map +1 -1
- package/dist/routes/index.d.ts +1 -0
- package/dist/routes/index.js +1 -0
- package/dist/routes/index.js.map +1 -1
- package/dist/routes/overview.d.ts +2 -2
- package/dist/routes/overview.js +11 -4
- package/dist/routes/overview.js.map +1 -1
- package/dist/routes/query.d.ts +1 -1
- package/dist/routes/query.js +26 -10
- package/dist/routes/query.js.map +1 -1
- package/dist/routes/schemas.d.ts +1 -1
- package/dist/routes/schemas.js +4 -2
- package/dist/routes/schemas.js.map +1 -1
- package/dist/routes/tables.d.ts +2 -1
- package/dist/routes/tables.js +29 -21
- package/dist/routes/tables.js.map +1 -1
- package/dist/service/browse.d.ts +14 -6
- package/dist/service/browse.js +120 -18
- package/dist/service/browse.js.map +1 -1
- package/dist/service/catalog.js +2 -1
- package/dist/service/catalog.js.map +1 -1
- package/dist/service/connectionState.d.ts +29 -0
- package/dist/service/connectionState.js +157 -0
- package/dist/service/connectionState.js.map +1 -0
- package/dist/service/connections.d.ts +12 -0
- package/dist/service/connections.js +72 -0
- package/dist/service/connections.js.map +1 -0
- package/dist/service/database.d.ts +12 -0
- package/dist/service/database.js +30 -0
- package/dist/service/database.js.map +1 -0
- package/dist/service/declaredFields.d.ts +3 -2
- package/dist/service/declaredFields.js +6 -7
- package/dist/service/declaredFields.js.map +1 -1
- package/dist/service/health.d.ts +2 -1
- package/dist/service/health.js +48 -21
- package/dist/service/health.js.map +1 -1
- package/dist/service/introspect.d.ts +7 -5
- package/dist/service/introspect.js +50 -47
- package/dist/service/introspect.js.map +1 -1
- package/dist/service/overview.d.ts +3 -2
- package/dist/service/overview.js +4 -4
- package/dist/service/overview.js.map +1 -1
- package/dist/service/queryInspection.js +6 -3
- package/dist/service/queryInspection.js.map +1 -1
- package/dist/service/references.d.ts +3 -2
- package/dist/service/references.js +9 -8
- package/dist/service/references.js.map +1 -1
- package/dist/service/rowEdit.d.ts +3 -0
- package/dist/service/rowEdit.js +36 -3
- package/dist/service/rowEdit.js.map +1 -1
- package/dist/service/stagedSerialization.js +5 -2
- package/dist/service/stagedSerialization.js.map +1 -1
- package/dist/service/types.d.ts +1 -1
- package/dist/utils/deadline.d.ts +2 -0
- package/dist/utils/deadline.js +18 -0
- package/dist/utils/deadline.js.map +1 -0
- package/dist/utils/guards.d.ts +2 -0
- package/dist/utils/guards.js +8 -0
- package/dist/utils/guards.js.map +1 -1
- package/dist/utils/query.js +5 -4
- package/dist/utils/query.js.map +1 -1
- package/frontend-vue/app/build/components/DataBrowserAccessBar.vue +88 -0
- package/frontend-vue/app/build/components/DataGridToolbar.vue +10 -5
- package/frontend-vue/app/build/components/FeatureLocked.vue +16 -0
- package/frontend-vue/app/build/components/QueryConsoleBoard.vue +601 -0
- package/frontend-vue/app/build/components/SchemaDiagramBoard.vue +691 -0
- package/frontend-vue/app/build/composables/registerDatabaseSwitcher.ts +16 -0
- package/frontend-vue/app/build/composables/reloadForSelection.ts +13 -0
- package/frontend-vue/app/build/composables/useDataBrowserTabs.ts +9 -0
- package/frontend-vue/app/build/composables/useDatabaseConnections.ts +164 -0
- package/frontend-vue/app/build/composables/useGridAccess.ts +25 -0
- package/frontend-vue/app/build/composables/useLockedPages.ts +53 -0
- package/frontend-vue/app/build/composables/useQueryRuntime.ts +4 -4
- package/frontend-vue/app/build/composables/useSelectionRecheck.ts +23 -0
- package/frontend-vue/app/build/data/assistantOnboarding.ts +12 -0
- package/frontend-vue/app/build/data/readOnlyReason.ts +30 -0
- package/frontend-vue/app/build/data/recentTables.ts +6 -0
- package/frontend-vue/app/build/data/staleDatabase.ts +58 -0
- package/frontend-vue/app/build/data/useStagedSave.ts +10 -1
- package/frontend-vue/app/components/DataBrowser.vue +9 -1
- package/frontend-vue/app/components/DataBrowserSidebar.vue +23 -13
- package/frontend-vue/app/components/DataGrid.vue +17 -6
- package/frontend-vue/app/components/DataGridCell.vue +5 -2
- package/frontend-vue/app/components/DatabaseSwitcher.vue +103 -0
- package/frontend-vue/app/components/QueryBuilderPanel.vue +4 -4
- package/frontend-vue/app/components/QueryConsole.vue +11 -592
- package/frontend-vue/app/components/QueryLibrary.vue +3 -3
- package/frontend-vue/app/components/QueryResultPanel.vue +14 -12
- package/frontend-vue/app/components/RowDrawer.vue +21 -14
- package/frontend-vue/app/components/SchemaDiagram.vue +10 -683
- package/frontend-vue/app/components/SchemasFilterBar.vue +3 -0
- package/frontend-vue/app/components/TableInspector.vue +8 -4
- package/frontend-vue/build/backend-boundary.ts +8 -3
- package/frontend-vue/dms.frontend.ts +2 -0
- package/frontend-vue/eslint.config.mjs +0 -1
- package/frontend-vue/i18n/locales/database-en-GB.json +31 -1
- package/frontend-vue/i18n/locales/database-fr-FR.json +31 -1
- package/frontend-vue/package.json +3 -3
- package/frontend-vue/pnpm-lock.yaml +14 -11
- package/frontend-vue/tests/accessBar.test.ts +196 -0
- package/frontend-vue/tests/backend-boundary.test.ts +15 -7
- package/frontend-vue/tests/databaseSwitcher.test.ts +339 -0
- package/frontend-vue/tests/editRequest.test.ts +146 -0
- package/frontend-vue/tests/externalBrowser.test.ts +193 -0
- package/frontend-vue/tests/fixtures/connections.ts +73 -0
- package/frontend-vue/tests/fixtures/serverRender.ts +135 -12
- package/frontend-vue/tests/lockedPages.test.ts +68 -0
- package/frontend-vue/tests/onDemandReads.test.ts +1 -1
- package/frontend-vue/tests/registration.test.ts +15 -1
- package/frontend-vue/tests/serverRender.test.ts +58 -4
- package/frontend-vue/tsconfig.json +1 -2
- package/frontend-vue/vitest.config.ts +11 -1
- package/package.json +20 -16
- package/dist/service/schemaRegistry.d.ts +0 -2
- package/dist/service/schemaRegistry.js +0 -8
- package/dist/service/schemaRegistry.js.map +0 -1
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
isStructured,
|
|
7
7
|
} from '../build/data/cellValues'
|
|
8
8
|
import type { StagedCell } from '../build/data/stagedEdits'
|
|
9
|
+
import { READ_ONLY_REASON } from '../build/data/readOnlyReason'
|
|
9
10
|
import type { ColumnRole } from '../build/utils/fieldTypes'
|
|
10
11
|
|
|
11
12
|
// One cell of the data grid. A staged cell is tinted, with the stored value
|
|
@@ -32,6 +33,7 @@ const emit = defineEmits<{
|
|
|
32
33
|
cancel: []
|
|
33
34
|
}>()
|
|
34
35
|
|
|
36
|
+
const readOnlyReason = inject(READ_ONLY_REASON, ref<string | null>(null))
|
|
35
37
|
const shown = computed(() => (props.staged ? props.staged.after : props.value))
|
|
36
38
|
const isNull = computed(() => shown.value === null || shown.value === undefined)
|
|
37
39
|
const isEmptyText = computed(() => shown.value === '')
|
|
@@ -83,7 +85,7 @@ function cancel() {
|
|
|
83
85
|
|
|
84
86
|
<template>
|
|
85
87
|
<td
|
|
86
|
-
class="border-default relative
|
|
88
|
+
class="border-default relative border-b border-r p-0 align-middle"
|
|
87
89
|
:class="[
|
|
88
90
|
invalid
|
|
89
91
|
? 'ring-error ring-2 ring-inset'
|
|
@@ -91,13 +93,14 @@ function cancel() {
|
|
|
91
93
|
? 'ring-primary ring-2 ring-inset'
|
|
92
94
|
: '',
|
|
93
95
|
staged ? 'bg-warning/10' : editing ? 'bg-primary/5' : '',
|
|
96
|
+
readOnlyReason ? 'cursor-not-allowed' : 'cursor-default',
|
|
94
97
|
]"
|
|
95
98
|
:title="
|
|
96
99
|
staged
|
|
97
100
|
? $t('dms_database.data.grid.staged_title', {
|
|
98
101
|
before: cellLabel(staged.before),
|
|
99
102
|
})
|
|
100
|
-
: undefined
|
|
103
|
+
: (readOnlyReason ?? undefined)
|
|
101
104
|
"
|
|
102
105
|
@click="emit('select')"
|
|
103
106
|
@dblclick="editable && emit('start-edit')"
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { DropdownMenuItem } from '@nuxt/ui'
|
|
3
|
+
import {
|
|
4
|
+
OWN_CONNECTION,
|
|
5
|
+
useDatabaseConnections,
|
|
6
|
+
type DatabaseConnection,
|
|
7
|
+
} from '../build/composables/useDatabaseConnections'
|
|
8
|
+
import { confirmLeave } from '#dms-ui/app/entries/composables/unsaved-changes/registry'
|
|
9
|
+
import { forgetBrowserTabs } from '../build/composables/useDataBrowserTabs'
|
|
10
|
+
import { useLockedPages } from '../build/composables/useLockedPages'
|
|
11
|
+
import { useSelectionRecheck } from '../build/composables/useSelectionRecheck'
|
|
12
|
+
import { forgetRecentTables } from '../build/data/recentTables'
|
|
13
|
+
import {
|
|
14
|
+
ONBOARDING_KEY,
|
|
15
|
+
type PublicOnboarding,
|
|
16
|
+
} from '../build/data/assistantOnboarding'
|
|
17
|
+
|
|
18
|
+
defineProps<{ collapsed?: boolean }>()
|
|
19
|
+
|
|
20
|
+
const { t } = useI18n()
|
|
21
|
+
const route = useDmsRoute()
|
|
22
|
+
const { connections, selected, select, recheck } = useDatabaseConnections()
|
|
23
|
+
const onboarding = inject<PublicOnboarding | null>(ONBOARDING_KEY, null)
|
|
24
|
+
useLockedPages(selected)
|
|
25
|
+
useSelectionRecheck(recheck)
|
|
26
|
+
|
|
27
|
+
const switching = ref(false)
|
|
28
|
+
|
|
29
|
+
function nameOf(connection: DatabaseConnection): string {
|
|
30
|
+
return connection.id === OWN_CONNECTION
|
|
31
|
+
? t('dms_database.connections.own')
|
|
32
|
+
: connection.label
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const selectedName = computed(() =>
|
|
36
|
+
selected.value ? nameOf(selected.value) : '',
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
async function pick(id: string) {
|
|
40
|
+
if (switching.value || id === selected.value?.id) return
|
|
41
|
+
switching.value = true
|
|
42
|
+
if (!(await confirmLeave()) || !(await select(id))) {
|
|
43
|
+
switching.value = false
|
|
44
|
+
return
|
|
45
|
+
}
|
|
46
|
+
forgetBrowserTabs()
|
|
47
|
+
forgetRecentTables()
|
|
48
|
+
window.location.assign(route.path)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const items = computed<DropdownMenuItem[][]>(() => {
|
|
52
|
+
const databases: DropdownMenuItem[] = connections.value.map((connection) => ({
|
|
53
|
+
label: nameOf(connection),
|
|
54
|
+
description: connection.engine ?? undefined,
|
|
55
|
+
type: 'checkbox',
|
|
56
|
+
checked: connection.id === selected.value?.id,
|
|
57
|
+
icon: connection.kind === 'own' ? 'i-ph-database' : 'i-ph-plugs-connected',
|
|
58
|
+
external: connection.kind === 'external',
|
|
59
|
+
onSelect: () => void pick(connection.id),
|
|
60
|
+
}))
|
|
61
|
+
if (onboarding?.isAvailable !== true) return [databases]
|
|
62
|
+
return [
|
|
63
|
+
databases,
|
|
64
|
+
[
|
|
65
|
+
{
|
|
66
|
+
label: t('dms_database.connections.switcher.connect'),
|
|
67
|
+
icon: 'i-ph-plus',
|
|
68
|
+
onSelect: () => onboarding.open('connect-database'),
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
]
|
|
72
|
+
})
|
|
73
|
+
</script>
|
|
74
|
+
|
|
75
|
+
<template>
|
|
76
|
+
<div v-if="connections.length > 0" class="px-2 pb-2" data-database-switcher>
|
|
77
|
+
<UDropdownMenu
|
|
78
|
+
:items="items"
|
|
79
|
+
:content="{ align: 'start' }"
|
|
80
|
+
:ui="{ content: 'min-w-56' }"
|
|
81
|
+
>
|
|
82
|
+
<UButton
|
|
83
|
+
color="neutral"
|
|
84
|
+
variant="outline"
|
|
85
|
+
:block="!collapsed"
|
|
86
|
+
:icon="
|
|
87
|
+
selected?.kind === 'external'
|
|
88
|
+
? 'i-ph-plugs-connected'
|
|
89
|
+
: 'i-ph-database'
|
|
90
|
+
"
|
|
91
|
+
:trailing-icon="collapsed ? undefined : 'i-ph-caret-up-down'"
|
|
92
|
+
:label="collapsed ? undefined : selectedName"
|
|
93
|
+
:loading="switching"
|
|
94
|
+
:aria-label="`${t('dms_database.connections.switcher.label')}: ${selectedName}`"
|
|
95
|
+
/>
|
|
96
|
+
<template #item-trailing="{ item }">
|
|
97
|
+
<UBadge v-if="item.external" color="primary" variant="subtle" size="sm">
|
|
98
|
+
{{ t('dms_database.connections.external') }}
|
|
99
|
+
</UBadge>
|
|
100
|
+
</template>
|
|
101
|
+
</UDropdownMenu>
|
|
102
|
+
</div>
|
|
103
|
+
</template>
|
|
@@ -319,7 +319,7 @@ const themeCompartment = new Compartment()
|
|
|
319
319
|
const placeholderCompartment = new Compartment()
|
|
320
320
|
const colorMode = useColorMode()
|
|
321
321
|
|
|
322
|
-
// Transparent surfaces so the editor blends into the
|
|
322
|
+
// Transparent surfaces so the editor blends into the DmsCardPanel (bg-default).
|
|
323
323
|
const baseTheme = EditorView.theme({
|
|
324
324
|
'&': { backgroundColor: 'transparent', height: '100%', fontSize: '13px' },
|
|
325
325
|
'&.cm-focused': { outline: 'none' },
|
|
@@ -444,7 +444,7 @@ defineExpose({ focus: () => view?.focus() })
|
|
|
444
444
|
</script>
|
|
445
445
|
|
|
446
446
|
<template>
|
|
447
|
-
<
|
|
447
|
+
<DmsCardPanel :padded="false" class="overflow-hidden">
|
|
448
448
|
<div
|
|
449
449
|
class="border-default flex flex-wrap items-center gap-2 border-b px-3.5 py-2.5"
|
|
450
450
|
>
|
|
@@ -524,7 +524,7 @@ defineExpose({ focus: () => view?.focus() })
|
|
|
524
524
|
<div
|
|
525
525
|
class="border-default text-dimmed flex flex-wrap items-center gap-2 border-t px-3.5 py-2 text-[11.5px]"
|
|
526
526
|
>
|
|
527
|
-
<
|
|
527
|
+
<DmsEyebrowLabel :label="t('dms_database.query.editor.insert')" />
|
|
528
528
|
<button
|
|
529
529
|
v-for="snippet in SNIPPETS"
|
|
530
530
|
:key="snippet.label"
|
|
@@ -550,5 +550,5 @@ defineExpose({ focus: () => view?.focus() })
|
|
|
550
550
|
}}
|
|
551
551
|
</span>
|
|
552
552
|
</div>
|
|
553
|
-
</
|
|
553
|
+
</DmsCardPanel>
|
|
554
554
|
</template>
|