@antelopejs/dms-database 0.2.3 → 0.3.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/dist/frontend-module.d.ts +2 -0
- package/dist/frontend-module.js +17 -0
- package/dist/frontend-module.js.map +1 -0
- package/dist/index.js +2 -11
- package/dist/index.js.map +1 -1
- package/dist/pages/overview.d.ts +0 -1
- package/dist/pages/overview.js +0 -14
- package/dist/pages/overview.js.map +1 -1
- package/dist/pages/schemas.js +3 -0
- package/dist/pages/schemas.js.map +1 -1
- package/frontend-vue/app/build/composables/useDatabaseHealth.ts +11 -7
- package/frontend-vue/app/build/composables/useDatabaseSchemas.ts +8 -1
- package/frontend-vue/app/build/data/cellValues.ts +50 -0
- package/frontend-vue/app/build/diagram/graph.ts +211 -47
- package/frontend-vue/app/build/diagram/packing.ts +283 -0
- package/frontend-vue/app/build/utils/fieldTypes.ts +16 -1
- package/frontend-vue/app/components/ConnectionStatus.vue +5 -1
- package/frontend-vue/app/components/DataBrowser.vue +2 -2
- package/frontend-vue/app/components/DataBrowserSidebar.vue +1 -1
- package/frontend-vue/app/components/DataGrid.vue +44 -34
- package/frontend-vue/app/components/DiagramTableNode.vue +25 -1
- package/frontend-vue/app/components/DrawerTabs.vue +57 -0
- package/frontend-vue/app/components/JsonCellPanel.vue +81 -85
- package/frontend-vue/app/components/QueryConsole.vue +6 -1
- package/frontend-vue/app/components/RowDrawer.vue +98 -124
- package/frontend-vue/app/components/SchemaDiagram.vue +134 -17
- package/frontend-vue/app/components/TableInspector.vue +122 -149
- package/frontend-vue/i18n/locales/database-en-GB.json +8 -12
- package/frontend-vue/i18n/locales/database-fr-FR.json +8 -12
- package/frontend-vue/package.json +1 -1
- package/frontend-vue/tests/clientNavigation.test.ts +93 -0
- package/frontend-vue/tests/dataBrowser.test.ts +91 -1
- package/frontend-vue/tests/diagramLayout.test.ts +383 -0
- package/frontend-vue/tests/fixtures/serverRender.ts +114 -0
- package/frontend-vue/tests/locales.test.ts +48 -0
- package/frontend-vue/tests/onDemandReads.test.ts +81 -0
- package/frontend-vue/tests/serverRender.test.ts +83 -1
- package/frontend-vue/vitest.config.ts +8 -1
- package/package.json +7 -6
- package/skills/dms-database/SKILL.md +1 -0
|
@@ -3,6 +3,7 @@ import { defineComponent, h } from 'vue'
|
|
|
3
3
|
import { serverRender, type BackendRead } from './fixtures/serverRender'
|
|
4
4
|
import ConnectionStatus from '../app/components/ConnectionStatus.vue'
|
|
5
5
|
import DataBrowser from '../app/components/DataBrowser.vue'
|
|
6
|
+
import DataGrid from '../app/components/DataGrid.vue'
|
|
6
7
|
import QueryConsole from '../app/components/QueryConsole.vue'
|
|
7
8
|
import SchemaDiagram from '../app/components/SchemaDiagram.vue'
|
|
8
9
|
import SchemasFilterBar from '../app/components/SchemasFilterBar.vue'
|
|
@@ -14,7 +15,10 @@ import TableInspector from '../app/components/TableInspector.vue'
|
|
|
14
15
|
|
|
15
16
|
const table = (name: string) => ({
|
|
16
17
|
name,
|
|
17
|
-
fields: {
|
|
18
|
+
fields: {
|
|
19
|
+
_id: { kind: 'string' },
|
|
20
|
+
note: { kind: 'union', members: [{ kind: 'string' }, { kind: 'null' }] },
|
|
21
|
+
},
|
|
18
22
|
indexes: {},
|
|
19
23
|
relations: [],
|
|
20
24
|
})
|
|
@@ -119,6 +123,38 @@ describe('server render: every read is handed to the browser', () => {
|
|
|
119
123
|
expect(page.html).toContain('>7<')
|
|
120
124
|
})
|
|
121
125
|
|
|
126
|
+
it('data browser: the table list stacks above the grid below md', async () => {
|
|
127
|
+
const page = await render(DataBrowser, {}, '/modules/database/data')
|
|
128
|
+
const root = page.html.match(/^<div class="([^"]*)"/)?.[1]?.split(' ')
|
|
129
|
+
const aside = page.html.match(/<aside class="([^"]*)"/)?.[1]?.split(' ')
|
|
130
|
+
expect(root).toEqual(expect.arrayContaining(['flex-col', 'md:flex-row']))
|
|
131
|
+
expect(aside).toEqual(
|
|
132
|
+
expect.arrayContaining(['w-full', 'max-h-[40vh]', 'border-b']),
|
|
133
|
+
)
|
|
134
|
+
expect(aside).toEqual(
|
|
135
|
+
expect.arrayContaining(['md:w-[264px]', 'md:max-h-none', 'md:border-r']),
|
|
136
|
+
)
|
|
137
|
+
expect(aside).not.toContain('w-[264px]')
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
it('data browser: the stacked grid keeps a usable height below md', async () => {
|
|
141
|
+
const browser = await render(DataBrowser, {}, '/modules/database/data')
|
|
142
|
+
const root = browser.html.match(/^<div class="([^"]*)"/)?.[1]?.split(' ')
|
|
143
|
+
expect(root).toEqual(expect.arrayContaining(['min-h-fit', 'md:min-h-0']))
|
|
144
|
+
expect(root).not.toContain('min-h-0')
|
|
145
|
+
|
|
146
|
+
const grid = await render(
|
|
147
|
+
DataGrid,
|
|
148
|
+
{ tab: { id: 'shop.orders', schema: 'shop', instance: '', table: 'orders' } },
|
|
149
|
+
'/modules/database/data?schema=shop&table=orders',
|
|
150
|
+
)
|
|
151
|
+
const scroller = grid.html
|
|
152
|
+
.match(/<div class="([^"]*scroll-pl-14[^"]*)"/)?.[1]
|
|
153
|
+
?.split(' ')
|
|
154
|
+
expect(scroller).toEqual(expect.arrayContaining(['min-h-80', 'md:min-h-0']))
|
|
155
|
+
expect(scroller).not.toContain('min-h-0')
|
|
156
|
+
})
|
|
157
|
+
|
|
122
158
|
it('query console: the library, saved, shared and run', async () => {
|
|
123
159
|
const page = await render(QueryConsole, {}, '/modules/database/query')
|
|
124
160
|
expect(page.reads.map((read) => read.url).sort()).toEqual([
|
|
@@ -170,6 +206,52 @@ describe('server render: every read is handed to the browser', () => {
|
|
|
170
206
|
expect(page.html).toContain('9876')
|
|
171
207
|
})
|
|
172
208
|
|
|
209
|
+
it('table inspector: leaves the position and steps to the DMS header', async () => {
|
|
210
|
+
const page = await render(
|
|
211
|
+
TableInspector,
|
|
212
|
+
{
|
|
213
|
+
rowData: { schema: 'shop', name: 'orders' },
|
|
214
|
+
navigation: {
|
|
215
|
+
index: 2,
|
|
216
|
+
total: 87,
|
|
217
|
+
hasPrev: true,
|
|
218
|
+
hasNext: true,
|
|
219
|
+
prev: () => {},
|
|
220
|
+
next: () => {},
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
'/modules/database/schemas',
|
|
224
|
+
)
|
|
225
|
+
expect(page.html).toContain('orders')
|
|
226
|
+
expect(page.html).not.toMatch(/3\s*\/\s*87/)
|
|
227
|
+
expect(page.html).not.toContain('i-ph-caret-up')
|
|
228
|
+
expect(page.html).not.toContain('i-ph-caret-down')
|
|
229
|
+
})
|
|
230
|
+
|
|
231
|
+
it('table inspector: the name in the header only, the columns at their width', async () => {
|
|
232
|
+
const page = await render(
|
|
233
|
+
TableInspector,
|
|
234
|
+
{ rowData: { schema: 'shop', name: 'orders' } },
|
|
235
|
+
'/modules/database/schemas',
|
|
236
|
+
)
|
|
237
|
+
// The DMS header names the table: no heading of its own in the body.
|
|
238
|
+
expect(page.html).not.toMatch(/<h3[^>]*>\s*orders/)
|
|
239
|
+
// Narrower than its columns, the table scrolls sideways; the types
|
|
240
|
+
// and the tabs stay on one line.
|
|
241
|
+
expect(page.html).toMatch(
|
|
242
|
+
/data-columns-scroller[^>]*overflow-x-auto|overflow-x-auto[^>]*data-columns-scroller/,
|
|
243
|
+
)
|
|
244
|
+
expect(page.html).toContain('min-w-[30rem]')
|
|
245
|
+
expect(page.html).toContain('whitespace-nowrap')
|
|
246
|
+
expect(page.html).toContain('data-drawer-tabs')
|
|
247
|
+
// `string | null` reads `string`, with its icon; the Null column
|
|
248
|
+
// answers the same way for every column.
|
|
249
|
+
expect(page.html).not.toContain('string | null')
|
|
250
|
+
expect(page.html).not.toContain('border-dashed')
|
|
251
|
+
expect(page.html).toContain('dms_database.inspector.cols.nullable')
|
|
252
|
+
expect(page.html).toContain('dms_database.inspector.cols.not_nullable')
|
|
253
|
+
})
|
|
254
|
+
|
|
173
255
|
it('schemas filter bar: the tables listed out of all', async () => {
|
|
174
256
|
const page = await render(
|
|
175
257
|
SchemasFilterBar,
|
|
@@ -25,5 +25,12 @@ export default defineConfig({
|
|
|
25
25
|
'vue-i18n': resolve(__dirname, 'tests/fixtures/vueI18n.ts'),
|
|
26
26
|
},
|
|
27
27
|
},
|
|
28
|
-
test: {
|
|
28
|
+
test: {
|
|
29
|
+
environment: 'node',
|
|
30
|
+
include: ['tests/**/*.test.ts'],
|
|
31
|
+
// Still Node, but the components compiled for a browser (a client
|
|
32
|
+
// `render`, not the server's `ssrRender`): what a client navigation
|
|
33
|
+
// mounts.
|
|
34
|
+
testTransformMode: { web: ['**/clientNavigation.test.ts'] },
|
|
35
|
+
},
|
|
29
36
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antelopejs/dms-database",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Database console for the AntelopeJS DMS: schemas, relation diagrams, a data browser and an AQL query console.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"admin",
|
|
@@ -64,12 +64,12 @@
|
|
|
64
64
|
"@antelopejs/interface-core": ">=0.2.4 <1.0.0",
|
|
65
65
|
"@antelopejs/interface-database": ">=0.1.10 <1.0.0",
|
|
66
66
|
"@antelopejs/interface-database-decorators": ">=0.1.9 <1.0.0",
|
|
67
|
-
"@antelopejs/interface-dms": ">=0.
|
|
67
|
+
"@antelopejs/interface-dms": ">=0.8.0 <1.0.0"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
|
-
"@antelopejs/core": ">=1.
|
|
71
|
-
"@antelopejs/dms": ">=0.
|
|
72
|
-
"@antelopejs/dms-frontend": ">=0.
|
|
70
|
+
"@antelopejs/core": ">=1.17.0 <2",
|
|
71
|
+
"@antelopejs/dms": ">=0.10.0 <1.0.0",
|
|
72
|
+
"@antelopejs/dms-frontend": ">=0.8.0 <0.9.0",
|
|
73
73
|
"@antelopejs/tooling-configs": ">=0.0.9 <1.0.0",
|
|
74
74
|
"@types/chai": "^5.2.3",
|
|
75
75
|
"@types/mocha": "^10.0.10",
|
|
@@ -98,5 +98,6 @@
|
|
|
98
98
|
"skills": [
|
|
99
99
|
"./skills"
|
|
100
100
|
]
|
|
101
|
-
}
|
|
101
|
+
},
|
|
102
|
+
"dmsFrontend": "dist/frontend-module.js"
|
|
102
103
|
}
|
|
@@ -32,4 +32,5 @@ A read-mostly database console for the platform owner. It has no API for other m
|
|
|
32
32
|
- Owner-only: pages and `/api/database/*` routes answer the platform owner alone.
|
|
33
33
|
- The data browser is read-only on **All instances**; a saved edit can be undone for 10 seconds only.
|
|
34
34
|
- Write queries in the console always run a dry run and need the table name typed to confirm.
|
|
35
|
+
- Diagram: a table with more than 12 columns is drawn folded (key and relation columns stay visible); folding is per viewer, not saved. Auto layout keeps related tables together and sets the others in rows by `<prefix>__` name; it overwrites the team's saved layout once kept.
|
|
35
36
|
- `table-watch` needs a change feed: MongoDB must run as a replica set.
|