@antelopejs/dms-database 0.2.2 → 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.
Files changed (40) hide show
  1. package/dist/frontend-module.d.ts +2 -0
  2. package/dist/frontend-module.js +17 -0
  3. package/dist/frontend-module.js.map +1 -0
  4. package/dist/index.js +2 -11
  5. package/dist/index.js.map +1 -1
  6. package/dist/pages/overview.d.ts +0 -1
  7. package/dist/pages/overview.js +0 -14
  8. package/dist/pages/overview.js.map +1 -1
  9. package/dist/pages/schemas.js +3 -0
  10. package/dist/pages/schemas.js.map +1 -1
  11. package/frontend-vue/app/build/composables/useDatabaseHealth.ts +11 -7
  12. package/frontend-vue/app/build/composables/useDatabaseSchemas.ts +8 -1
  13. package/frontend-vue/app/build/data/cellValues.ts +50 -0
  14. package/frontend-vue/app/build/diagram/graph.ts +211 -47
  15. package/frontend-vue/app/build/diagram/packing.ts +283 -0
  16. package/frontend-vue/app/build/utils/fieldTypes.ts +16 -1
  17. package/frontend-vue/app/components/ConnectionStatus.vue +5 -1
  18. package/frontend-vue/app/components/DataBrowser.vue +2 -2
  19. package/frontend-vue/app/components/DataBrowserSidebar.vue +1 -1
  20. package/frontend-vue/app/components/DataGrid.vue +44 -34
  21. package/frontend-vue/app/components/DiagramTableNode.vue +25 -1
  22. package/frontend-vue/app/components/DrawerTabs.vue +57 -0
  23. package/frontend-vue/app/components/JsonCellPanel.vue +81 -85
  24. package/frontend-vue/app/components/QueryConsole.vue +6 -1
  25. package/frontend-vue/app/components/RowDrawer.vue +98 -124
  26. package/frontend-vue/app/components/SchemaDiagram.vue +134 -17
  27. package/frontend-vue/app/components/TableInspector.vue +122 -149
  28. package/frontend-vue/i18n/locales/database-en-GB.json +8 -12
  29. package/frontend-vue/i18n/locales/database-fr-FR.json +8 -12
  30. package/frontend-vue/package.json +1 -1
  31. package/frontend-vue/tests/clientNavigation.test.ts +93 -0
  32. package/frontend-vue/tests/dataBrowser.test.ts +91 -1
  33. package/frontend-vue/tests/diagramLayout.test.ts +383 -0
  34. package/frontend-vue/tests/fixtures/serverRender.ts +114 -0
  35. package/frontend-vue/tests/locales.test.ts +48 -0
  36. package/frontend-vue/tests/onDemandReads.test.ts +81 -0
  37. package/frontend-vue/tests/serverRender.test.ts +83 -1
  38. package/frontend-vue/vitest.config.ts +8 -1
  39. package/package.json +7 -6
  40. package/skills/dms-database/SKILL.md +1 -0
@@ -12,7 +12,9 @@ import { DiagramAutosave, type SaveStatus } from '../build/diagram/autosave'
12
12
  import {
13
13
  buildGraph,
14
14
  type DiagramNode,
15
+ expandForSearch,
15
16
  freeSpot,
17
+ type LayoutOptions,
16
18
  layOutSchema,
17
19
  NODE_WIDTH,
18
20
  nodeHeight,
@@ -21,7 +23,6 @@ import {
21
23
  neighbourIds,
22
24
  noteNodeId,
23
25
  RELATION_EDGE_TYPE,
24
- type Rect,
25
26
  type Sides,
26
27
  STUB_NODE_TYPE,
27
28
  searchTables,
@@ -35,6 +36,12 @@ import {
35
36
  type DiagramOperation,
36
37
  type DiagramState,
37
38
  } from '../build/diagram/history'
39
+ import {
40
+ boundsOf,
41
+ fitZoom,
42
+ type Rect,
43
+ startViewport,
44
+ } from '../build/diagram/packing'
38
45
  import {
39
46
  canvasOwnsKey,
40
47
  type DiagramCommand,
@@ -60,6 +67,10 @@ const NOTE_HEIGHT = 140
60
67
  const MINUTE_MS = 60_000
61
68
  // Room around the tables for the floating toolbars.
62
69
  const FIT_PADDING = 0.25
70
+ // Below this zoom a table cannot be read: a diagram too large to fit at it
71
+ // starts there, on its top-left corner, clear of the toolbars.
72
+ const START_MIN_ZOOM = 0.4
73
+ const START_INSET = { x: 32, y: 80 }
63
74
  // Above this many tables the canvas suggests focusing on one of them.
64
75
  const LARGE_SCHEMA_TABLES = 40
65
76
  const SEARCH_HINT_ID = 'diagram-search-hint'
@@ -90,7 +101,18 @@ const panMode = ref(false)
90
101
  const search = ref('')
91
102
  const searchIndex = ref(-1)
92
103
  const viewport = ref({ x: 0, y: 0, zoom: RESET_ZOOM })
93
- const preview = ref<{ from: DiagramState['positions'] } | null>(null)
104
+ const preview = ref<{
105
+ from: DiagramState['positions']
106
+ basis: LayoutOptions
107
+ } | null>(null)
108
+ // Tables showing all their columns, per schema: a view setting of this
109
+ // visit, not part of the shared layout.
110
+ const expanded = shallowRef(new Set<string>())
111
+ const expandedBySchema = new Map<string, Set<string>>()
112
+ // The canvas shape and the notes the layout of unsaved tables works around,
113
+ // read when the schema loads and when auto layout runs, so a note moved
114
+ // later does not move them.
115
+ const layoutBasis = shallowRef<LayoutOptions>({})
94
116
  const saveState = ref<SaveStatus>('idle')
95
117
  const savedAt = ref<Date | null>(null)
96
118
  const loaded = ref(false)
@@ -163,12 +185,37 @@ const focusIds = computed(() =>
163
185
  : null,
164
186
  )
165
187
 
166
- // Where dagre puts every table of the schema: the place of a table without a
167
- // saved one, focused or not (D-4).
188
+ // Where the layout puts every table of the schema: the place of a table
189
+ // without a saved one, focused or not (D-4).
168
190
  const fullLayout = computed(() =>
169
- schema.value ? layOutSchema(schema.value) : undefined,
191
+ schema.value ? layOutSchema(schema.value, layoutBasis.value) : undefined,
170
192
  )
171
193
 
194
+ function currentLayoutBasis(): LayoutOptions {
195
+ const rect = canvasWrapper.value?.getBoundingClientRect()
196
+ return {
197
+ aspect: rect?.width && rect.height ? rect.width / rect.height : undefined,
198
+ obstacles: state.notes.map(({ x, y, width, height }) => ({
199
+ x,
200
+ y,
201
+ width,
202
+ height,
203
+ })),
204
+ }
205
+ }
206
+
207
+ function toggleColumns(tableName: string) {
208
+ const next = new Set(expanded.value)
209
+ if (!next.delete(tableName)) next.add(tableName)
210
+ setExpanded(next)
211
+ render()
212
+ }
213
+
214
+ function setExpanded(next: Set<string>) {
215
+ expanded.value = next
216
+ if (schemaId.value) expandedBySchema.set(schemaId.value, next)
217
+ }
218
+
172
219
  function render() {
173
220
  if (!canvas.value || !schema.value || !loaded.value) return
174
221
  const built = buildGraph({
@@ -186,6 +233,8 @@ function render() {
186
233
  onOpenSchema: openTable,
187
234
  routing,
188
235
  layout: fullLayout.value,
236
+ expanded: expanded.value,
237
+ onToggleColumns: toggleColumns,
189
238
  })
190
239
  canvas.value.setNodes(built.nodes)
191
240
  canvas.value.setEdges(built.edges)
@@ -196,13 +245,37 @@ function render() {
196
245
  function onNodesInitialized() {
197
246
  if (!fitPending) return
198
247
  fitPending = false
199
- if (!centerOnQueryTable()) fitAll()
248
+ if (!centerOnQueryTable()) startView()
200
249
  }
201
250
 
202
251
  function fitAll() {
203
252
  canvas.value?.fitView({ padding: FIT_PADDING, maxZoom: RESET_ZOOM })
204
253
  }
205
254
 
255
+ // The whole diagram when it fits at a readable zoom; else its top-left
256
+ // corner at that zoom, the minimap and "Fit view" giving the overview.
257
+ function startView() {
258
+ const flow = canvas.value
259
+ const rect = canvasWrapper.value?.getBoundingClientRect()
260
+ if (!flow || !rect?.width || !rect.height) return fitAll()
261
+ const bounds = boundsOf(
262
+ flow.getNodes.map((node) => ({
263
+ x: node.position.x,
264
+ y: node.position.y,
265
+ width: node.dimensions.width,
266
+ height: node.dimensions.height,
267
+ })),
268
+ )
269
+ const view = startViewport(
270
+ bounds,
271
+ fitZoom(bounds, rect, FIT_PADDING),
272
+ START_MIN_ZOOM,
273
+ START_INSET,
274
+ )
275
+ if (view) flow.setViewport(view)
276
+ else fitAll()
277
+ }
278
+
206
279
  watch([canvas, schema, selectedId, focusIds, loaded], render)
207
280
 
208
281
  // --- loading and saving ---
@@ -272,6 +345,8 @@ async function load(id: string) {
272
345
  state.positions = {}
273
346
  state.notes = []
274
347
  }
348
+ expanded.value = expandedBySchema.get(id) ?? new Set()
349
+ layoutBasis.value = currentLayoutBasis()
275
350
  owner.reset(state)
276
351
  autosave = new DiagramAutosave(
277
352
  owner,
@@ -336,7 +411,7 @@ function redo() {
336
411
  const movedCount = computed(() => {
337
412
  if (!preview.value || !schema.value) return 0
338
413
  return schema.value.tables.filter((table) => {
339
- // A table without a saved position already sat where dagre puts it.
414
+ // A table without a saved position already sat where the layout puts it.
340
415
  const before = preview.value?.from[table.name]
341
416
  const after = state.positions[table.name]
342
417
  return Boolean(
@@ -347,11 +422,16 @@ const movedCount = computed(() => {
347
422
 
348
423
  function startAutoLayout() {
349
424
  if (!fullLayout.value || preview.value) return
350
- preview.value = { from: clonePositions(state.positions) }
425
+ preview.value = {
426
+ from: clonePositions(state.positions),
427
+ basis: layoutBasis.value,
428
+ }
429
+ // Laid out for the canvas and the notes as they are now.
430
+ layoutBasis.value = currentLayoutBasis()
351
431
  state.positions = clonePositions(fullLayout.value.tables)
352
432
  routing.clear()
353
433
  render()
354
- nextTick(fitAll)
434
+ nextTick(startView)
355
435
  }
356
436
 
357
437
  function keepLayout() {
@@ -364,6 +444,8 @@ function keepLayout() {
364
444
  function discardLayout() {
365
445
  if (!preview.value) return
366
446
  state.positions = preview.value.from
447
+ // Unsaved tables go back where they were before the preview.
448
+ layoutBasis.value = preview.value.basis
367
449
  preview.value = null
368
450
  render()
369
451
  }
@@ -430,15 +512,35 @@ function onPaneClick() {
430
512
  selectedId.value = null
431
513
  }
432
514
 
515
+ // The drawer is titled with the table it shows, as the Schemas page's; a
516
+ // relation the inspector follows shows its table in the same drawer. No
517
+ // position nor J / K: the diagram's tables are not a list.
518
+ let inspector: ReturnType<typeof openDrawer> | null = null
519
+
520
+ function inspectorOptions(schema: string, name: string) {
521
+ return {
522
+ componentKey: `${schema}::${name}`,
523
+ title: name,
524
+ componentOptions: {
525
+ rowData: { schema, name },
526
+ showRow: async (row: object | string) => {
527
+ if (typeof row !== 'string') throw new Error('not a table id')
528
+ const [toSchema = '', toName = ''] = row.split('::')
529
+ inspector?.patch(inspectorOptions(toSchema, toName))
530
+ },
531
+ },
532
+ }
533
+ }
534
+
433
535
  function inspect(tableName: string) {
434
536
  if (!schemaId.value) return
435
- openDrawer({
436
- title: t('dms_database.schemas.inspector.title'),
537
+ inspector = openDrawer({
437
538
  direction: 'right',
438
539
  component: TableInspector,
439
- componentOptions: {
440
- rowData: { schema: schemaId.value, name: tableName },
441
- },
540
+ ...inspectorOptions(schemaId.value, tableName),
541
+ })
542
+ inspector.result.finally(() => {
543
+ inspector = null
442
544
  })
443
545
  }
444
546
 
@@ -517,8 +619,22 @@ function runSearch() {
517
619
  const matches = searchMatches.value
518
620
  if (!matches.length || !schemaId.value) return
519
621
  searchIndex.value = (searchIndex.value + 1) % matches.length
520
- const id = tableNodeId(schemaId.value, matches[searchIndex.value] ?? '')
622
+ const tableName = matches[searchIndex.value] ?? ''
623
+ const id = tableNodeId(schemaId.value, tableName)
521
624
  if (focusIds.value && !focusIds.value.has(id)) focusId.value = null
625
+ // A column found in a folded table unfolds it.
626
+ if (schema.value) {
627
+ const next = expandForSearch(
628
+ schema.value,
629
+ tableName,
630
+ search.value,
631
+ expanded.value,
632
+ )
633
+ if (next !== expanded.value) {
634
+ setExpanded(next)
635
+ render()
636
+ }
637
+ }
522
638
  nextTick(() => centerOn(id))
523
639
  }
524
640
 
@@ -532,13 +648,14 @@ function leaveSearch() {
532
648
  function takenRects(): Rect[] {
533
649
  const tables = (canvas.value?.getNodes ?? []).flatMap((node) => {
534
650
  if (node.type !== TABLE_NODE_TYPE) return []
535
- const { table } = node.data as TableNodeData
651
+ const { table, expanded: open } = node.data as TableNodeData
652
+ if (!schema.value) return []
536
653
  return [
537
654
  {
538
655
  x: node.position.x,
539
656
  y: node.position.y,
540
657
  width: NODE_WIDTH,
541
- height: nodeHeight(table),
658
+ height: nodeHeight(schema.value, table, open),
542
659
  },
543
660
  ]
544
661
  })
@@ -24,33 +24,26 @@ import {
24
24
  describeField,
25
25
  describeModifier,
26
26
  isPrimaryKey,
27
+ valueDescriptor,
27
28
  } from '../build/utils/fieldTypes'
28
29
  import { CROSS_INSTANCE_VALUE } from '../build/composables/useDataBrowserTabs'
29
30
  import { ALL_INSTANCES_PARAM, tableLink } from '../build/utils/databaseLinks'
31
+ import DrawerTabs from './DrawerTabs.vue'
30
32
 
31
33
  // The Schemas page's row drawer (D-07), also opened from the diagram: the
32
34
  // facts of one table, its columns, indexes and relations both ways, and a
33
- // sample row. The table view hands it the row and the means to step to the
34
- // next one (J / K), or to show another row in place; a relation opens the
35
- // table it names in its place.
35
+ // sample row. The container draws the header naming the table and, on the
36
+ // Schemas page, its position and the steps to the next one (J / K); it
37
+ // hands the inspector the row, and the means to show another row in place:
38
+ // a relation opens the table it names in its place.
36
39
 
37
40
  interface TableRow {
38
41
  schema: string
39
42
  name: string
40
43
  }
41
44
 
42
- interface RowNavigation {
43
- index: number
44
- total: number
45
- hasPrev: boolean
46
- hasNext: boolean
47
- prev: () => void
48
- next: () => void
49
- }
50
-
51
45
  const props = defineProps<{
52
46
  rowData?: TableRow
53
- navigation?: RowNavigation
54
47
  showRow?: (row: object | string) => Promise<void>
55
48
  }>()
56
49
 
@@ -101,15 +94,13 @@ const failed = computed(
101
94
  () => schemasSettled.value && schemas.value === undefined,
102
95
  )
103
96
 
104
- // The table a relation was followed to, in place of the row's, where the
105
- // container cannot show another row (the diagram's drawer).
97
+ // The table a relation was followed to, in place of the row's, should the
98
+ // container fail to show it as its own row.
106
99
  const followed = ref<TableRow | null>(null)
107
100
  const shown = computed(() => followed.value ?? props.rowData)
108
- // J / K step from the row the table view opened: its position is not the
109
- // followed table's.
110
- const rowNavigation = computed(() =>
111
- followed.value ? undefined : props.navigation,
112
- )
101
+ // The drawer's header names the row's table; one followed in place is named
102
+ // in the body.
103
+ const namedInBody = computed(() => followed.value !== null)
113
104
 
114
105
  const schemaId = computed(() => shown.value?.schema ?? '')
115
106
  const tableName = computed(() => shown.value?.name ?? '')
@@ -149,7 +140,9 @@ const columns = computed(() => {
149
140
  const relation = relationByField.value.get(name)
150
141
  const key = isPrimaryKey(name, current.indexes ?? {})
151
142
  const role: ColumnRole = key ? 'key' : relation ? 'relation' : 'plain'
152
- const type = describeField(descriptor, name)
143
+ // Whether it takes null is the Null column's: `string | null` reads
144
+ // `string`, with the string's icon.
145
+ const type = describeField(valueDescriptor(descriptor), name)
153
146
  return {
154
147
  name,
155
148
  role,
@@ -201,10 +194,10 @@ const incoming = computed(() =>
201
194
  ),
202
195
  )
203
196
 
204
- // The table view shows the relation's table as its own row: the URL, the
205
- // position and J / K follow it. Elsewhere, or should it fail to read the
206
- // row, the inspector shows it itself, and the row's own table again closes
207
- // the detour.
197
+ // The container shows the relation's table as its own row: on the Schemas
198
+ // page, the URL, the position and J / K follow it. Should it fail to read
199
+ // the row, the inspector shows it itself, and the row's own table again
200
+ // closes the detour.
208
201
  async function follow(target: TableRow) {
209
202
  if (props.showRow) {
210
203
  try {
@@ -257,26 +250,28 @@ const structureFacts = computed(() =>
257
250
  ].join(' · '),
258
251
  )
259
252
 
260
- const tabs = computed(() => [
261
- {
262
- value: 'columns',
263
- label: t('dms_database.inspector.tabs.columns'),
264
- badge: loading.value ? undefined : columns.value.length,
265
- },
266
- {
267
- value: 'indexes',
268
- label: t('dms_database.inspector.tabs.indexes'),
269
- badge: loading.value ? undefined : indexes.value.length,
270
- },
271
- {
272
- value: 'relations',
273
- label: t('dms_database.inspector.tabs.relations'),
274
- badge: loading.value
275
- ? undefined
276
- : outgoing.value.length + incoming.value.length,
277
- },
278
- { value: 'sample', label: t('dms_database.inspector.tabs.sample') },
279
- ])
253
+ const tabs = computed<{ value: InspectorTab; label: string; badge?: number }[]>(
254
+ () => [
255
+ {
256
+ value: 'columns',
257
+ label: t('dms_database.inspector.tabs.columns'),
258
+ badge: loading.value ? undefined : columns.value.length,
259
+ },
260
+ {
261
+ value: 'indexes',
262
+ label: t('dms_database.inspector.tabs.indexes'),
263
+ badge: loading.value ? undefined : indexes.value.length,
264
+ },
265
+ {
266
+ value: 'relations',
267
+ label: t('dms_database.inspector.tabs.relations'),
268
+ badge: loading.value
269
+ ? undefined
270
+ : outgoing.value.length + incoming.value.length,
271
+ },
272
+ { value: 'sample', label: t('dms_database.inspector.tabs.sample') },
273
+ ],
274
+ )
280
275
 
281
276
  // --- sample row: the latest row, or the next one on demand ---
282
277
  interface SamplePage {
@@ -425,47 +420,15 @@ async function copyName() {
425
420
  </script>
426
421
 
427
422
  <template>
428
- <!-- As wide as the side drawer, whatever the open tab holds. -->
429
- <div class="flex h-full w-full min-w-0 flex-col gap-4">
423
+ <!-- As wide as the side drawer, whatever the open tab holds. The drawer's
424
+ body scrolls, its header (the table's name, position, steps) in view. -->
425
+ <div class="flex w-full min-w-0 flex-col gap-4">
430
426
  <header class="grid grid-cols-[minmax(0,1fr)] gap-3">
431
- <div class="flex min-w-0 items-center gap-2">
427
+ <div class="flex min-w-0 flex-wrap items-center gap-2">
432
428
  <DmsEyebrow
433
429
  class="min-w-0 truncate"
434
430
  :label="t('dms_database.inspector.eyebrow', { schema: schemaId })"
435
431
  />
436
- <span class="flex-1" />
437
- <template v-if="rowNavigation">
438
- <span class="text-dimmed shrink-0 font-mono text-[11px] tabular-nums">
439
- {{ rowNavigation.index + 1 }} / {{ rowNavigation.total }}
440
- </span>
441
- <UButton
442
- icon="i-ph-caret-up"
443
- color="neutral"
444
- variant="ghost"
445
- size="xs"
446
- :disabled="!rowNavigation.hasPrev"
447
- :aria-label="t('dms_database.inspector.previous')"
448
- :title="t('dms_database.inspector.previous')"
449
- @click="rowNavigation.prev()"
450
- />
451
- <UButton
452
- icon="i-ph-caret-down"
453
- color="neutral"
454
- variant="ghost"
455
- size="xs"
456
- :disabled="!rowNavigation.hasNext"
457
- :aria-label="t('dms_database.inspector.next')"
458
- :title="t('dms_database.inspector.next')"
459
- @click="rowNavigation.next()"
460
- />
461
- </template>
462
- </div>
463
- <div class="flex min-w-0 flex-wrap items-center gap-2">
464
- <h3
465
- class="text-highlighted min-w-0 break-all font-mono text-lg font-semibold"
466
- >
467
- {{ tableName }}
468
- </h3>
469
432
  <UBadge
470
433
  v-if="!loading"
471
434
  color="neutral"
@@ -485,6 +448,12 @@ async function copyName() {
485
448
  @click="copyName"
486
449
  />
487
450
  </div>
451
+ <h3
452
+ v-if="namedInBody"
453
+ class="text-highlighted min-w-0 break-all font-mono text-lg font-semibold"
454
+ >
455
+ {{ tableName }}
456
+ </h3>
488
457
  <div v-if="loading" class="grid gap-2" aria-busy="true">
489
458
  <USkeleton class="h-4 w-40" />
490
459
  <USkeleton class="h-4 w-64 max-w-full" />
@@ -534,19 +503,12 @@ async function copyName() {
534
503
  :label="t('dms_database.inspector.actions.diagram')"
535
504
  />
536
505
  </div>
537
- <!-- The tab list scrolls sideways on its own: held to the header's
538
- width, the four tabs scroll on a phone rather than overflow. -->
539
- <UTabs
540
- v-model="tab"
541
- :items="tabs"
542
- variant="link"
543
- size="sm"
544
- :content="false"
545
- class="min-w-0"
546
- />
506
+ <!-- Held to the header's width, the four tabs scroll sideways on a
507
+ phone, a fade on the side the others hide in. -->
508
+ <DrawerTabs v-model="tab" :items="tabs" />
547
509
  </header>
548
510
 
549
- <div class="min-h-0 min-w-0 flex-1 overflow-auto">
511
+ <div class="min-w-0">
550
512
  <div v-if="loading" class="grid gap-3" aria-busy="true">
551
513
  <USkeleton v-for="line in 6" :key="line" class="h-7 w-full" />
552
514
  </div>
@@ -574,65 +536,76 @@ async function copyName() {
574
536
  :description="`${schemaId}.${tableName}`"
575
537
  />
576
538
 
577
- <table v-else-if="tab === 'columns'" class="w-full text-sm">
578
- <thead>
579
- <tr class="border-default border-b text-left">
580
- <th class="text-dimmed py-2 pr-3 text-xs font-semibold">
581
- {{ t('dms_database.inspector.cols.column') }}
582
- </th>
583
- <th class="text-dimmed px-3 py-2 text-xs font-semibold">
584
- {{ t('dms_database.inspector.cols.type') }}
585
- </th>
586
- <th class="text-dimmed px-3 py-2 text-xs font-semibold">
587
- {{ t('dms_database.inspector.cols.null') }}
588
- </th>
589
- <th class="text-dimmed py-2 pl-3 text-xs font-semibold">
590
- {{ t('dms_database.inspector.cols.notes') }}
591
- </th>
592
- </tr>
593
- </thead>
594
- <tbody>
595
- <tr
596
- v-for="column in columns"
597
- :key="column.name"
598
- class="border-default/60 border-b last:border-0"
599
- >
600
- <td
601
- class="text-highlighted break-all py-2 pr-3 font-mono text-[12.5px]"
539
+ <!-- Its columns keep their width: narrower than them, the table
540
+ scrolls sideways. -->
541
+ <div
542
+ v-else-if="tab === 'columns'"
543
+ class="min-w-0 overflow-x-auto"
544
+ data-columns-scroller
545
+ >
546
+ <table class="w-full min-w-[30rem] text-sm">
547
+ <thead>
548
+ <tr class="border-default border-b text-left">
549
+ <th class="text-dimmed py-2 pr-3 text-xs font-semibold">
550
+ {{ t('dms_database.inspector.cols.column') }}
551
+ </th>
552
+ <th class="text-dimmed px-3 py-2 text-xs font-semibold">
553
+ {{ t('dms_database.inspector.cols.type') }}
554
+ </th>
555
+ <th class="text-dimmed px-3 py-2 text-xs font-semibold">
556
+ {{ t('dms_database.inspector.cols.null') }}
557
+ </th>
558
+ <th class="text-dimmed py-2 pl-3 text-xs font-semibold">
559
+ {{ t('dms_database.inspector.cols.notes') }}
560
+ </th>
561
+ </tr>
562
+ </thead>
563
+ <tbody>
564
+ <tr
565
+ v-for="column in columns"
566
+ :key="column.name"
567
+ class="border-default/60 border-b last:border-0"
602
568
  >
603
- {{ column.name }}
604
- </td>
605
- <td class="px-3 py-2">
606
- <span
607
- class="inline-flex items-center gap-1.5 font-mono text-[11.5px]"
608
- :class="COLUMN_ROLE_CLASSES[column.role]"
609
- >
610
- <UIcon :name="column.icon" class="size-3.5 shrink-0" />
611
- {{ column.label }}
612
- </span>
613
- </td>
614
- <td class="px-3 py-2">
615
- <span
616
- v-if="column.nullable"
617
- class="text-dimmed rounded border border-dashed border-current px-1 font-mono text-[10.5px]"
569
+ <td
570
+ class="text-highlighted break-all py-2 pr-3 font-mono text-[12.5px]"
618
571
  >
619
- null
620
- </span>
621
- <span v-else class="text-dimmed">—</span>
622
- </td>
623
- <td class="text-muted py-2 pl-3 text-xs">
624
- <span
625
- v-for="modifier in column.modifiers"
626
- :key="modifier.id"
627
- class="mr-2 inline-flex items-center gap-1"
628
- >
629
- <UIcon :name="modifier.icon" class="size-3.5" />
630
- {{ modifier.labelKey ? t(modifier.labelKey) : modifier.id }}
631
- </span>
632
- </td>
633
- </tr>
634
- </tbody>
635
- </table>
572
+ {{ column.name }}
573
+ </td>
574
+ <td class="px-3 py-2">
575
+ <span
576
+ class="inline-flex items-center gap-1.5 whitespace-nowrap font-mono text-[11.5px]"
577
+ :class="COLUMN_ROLE_CLASSES[column.role]"
578
+ >
579
+ <UIcon :name="column.icon" class="size-3.5 shrink-0" />
580
+ {{ column.label }}
581
+ </span>
582
+ </td>
583
+ <td class="px-3 py-2">
584
+ <span
585
+ class="font-mono text-[11.5px]"
586
+ :class="column.nullable ? 'text-toned' : 'text-dimmed'"
587
+ >
588
+ {{
589
+ column.nullable
590
+ ? t('dms_database.inspector.cols.nullable')
591
+ : t('dms_database.inspector.cols.not_nullable')
592
+ }}
593
+ </span>
594
+ </td>
595
+ <td class="text-muted py-2 pl-3 text-xs">
596
+ <span
597
+ v-for="modifier in column.modifiers"
598
+ :key="modifier.id"
599
+ class="mr-2 inline-flex items-center gap-1"
600
+ >
601
+ <UIcon :name="modifier.icon" class="size-3.5" />
602
+ {{ modifier.labelKey ? t(modifier.labelKey) : modifier.id }}
603
+ </span>
604
+ </td>
605
+ </tr>
606
+ </tbody>
607
+ </table>
608
+ </div>
636
609
 
637
610
  <div v-else-if="tab === 'indexes'" class="grid gap-2">
638
611
  <div