@contractspec/example.integration-hub 3.7.6 → 3.8.2
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 +73 -183
- package/dist/connection/index.d.ts +1 -1
- package/dist/docs/index.js +2 -1
- package/dist/docs/integration-hub.docblock.js +2 -1
- package/dist/events.js +1 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.js +1243 -749
- package/dist/integration/index.d.ts +1 -1
- package/dist/integration-hub.feature.js +202 -0
- package/dist/node/docs/index.js +2 -1
- package/dist/node/docs/integration-hub.docblock.js +2 -1
- package/dist/node/events.js +1 -1
- package/dist/node/index.js +1243 -749
- package/dist/node/integration-hub.feature.js +202 -0
- package/dist/node/ui/IntegrationDashboard.js +654 -180
- package/dist/node/ui/IntegrationDashboard.visualizations.js +250 -0
- package/dist/node/ui/hooks/index.js +1 -1
- package/dist/node/ui/hooks/useIntegrationData.js +1 -1
- package/dist/node/ui/index.js +970 -485
- package/dist/node/ui/renderers/index.js +216 -5
- package/dist/node/ui/renderers/integration.markdown.js +216 -5
- package/dist/node/ui/tables/ConnectionsTable.js +211 -0
- package/dist/node/ui/tables/IntegrationTables.js +361 -0
- package/dist/node/ui/tables/SyncConfigsTable.js +230 -0
- package/dist/node/ui/tables/integration-table.shared.js +84 -0
- package/dist/node/visualizations/catalog.js +137 -0
- package/dist/node/visualizations/index.js +211 -0
- package/dist/node/visualizations/selectors.js +204 -0
- package/dist/sync/index.d.ts +3 -3
- package/dist/ui/IntegrationDashboard.js +654 -180
- package/dist/ui/IntegrationDashboard.visualizations.d.ts +6 -0
- package/dist/ui/IntegrationDashboard.visualizations.js +251 -0
- package/dist/ui/hooks/index.d.ts +1 -1
- package/dist/ui/hooks/index.js +1 -1
- package/dist/ui/hooks/useIntegrationData.js +1 -1
- package/dist/ui/index.d.ts +2 -2
- package/dist/ui/index.js +970 -485
- package/dist/ui/renderers/index.d.ts +1 -1
- package/dist/ui/renderers/index.js +216 -5
- package/dist/ui/renderers/integration.markdown.js +216 -5
- package/dist/ui/tables/ConnectionsTable.d.ts +4 -0
- package/dist/ui/tables/ConnectionsTable.js +212 -0
- package/dist/ui/tables/IntegrationTables.d.ts +2 -0
- package/dist/ui/tables/IntegrationTables.js +362 -0
- package/dist/ui/tables/IntegrationTables.smoke.test.d.ts +1 -0
- package/dist/ui/tables/SyncConfigsTable.d.ts +4 -0
- package/dist/ui/tables/SyncConfigsTable.js +231 -0
- package/dist/ui/tables/integration-table.shared.d.ts +18 -0
- package/dist/ui/tables/integration-table.shared.js +85 -0
- package/dist/visualizations/catalog.d.ts +11 -0
- package/dist/visualizations/catalog.js +138 -0
- package/dist/visualizations/index.d.ts +2 -0
- package/dist/visualizations/index.js +212 -0
- package/dist/visualizations/selectors.d.ts +10 -0
- package/dist/visualizations/selectors.js +205 -0
- package/dist/visualizations/selectors.test.d.ts +1 -0
- package/package.json +110 -12
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/ui/tables/integration-table.shared.tsx
|
|
3
|
+
import { Button } from "@contractspec/lib.design-system";
|
|
4
|
+
import { Badge } from "@contractspec/lib.ui-kit-web/ui/badge";
|
|
5
|
+
import { HStack } from "@contractspec/lib.ui-kit-web/ui/stack";
|
|
6
|
+
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
7
|
+
"use client";
|
|
8
|
+
var STATUS_VARIANTS = {
|
|
9
|
+
ACTIVE: "default",
|
|
10
|
+
CONNECTED: "default",
|
|
11
|
+
SUCCESS: "default",
|
|
12
|
+
PENDING: "secondary",
|
|
13
|
+
PAUSED: "secondary",
|
|
14
|
+
ERROR: "destructive",
|
|
15
|
+
DISCONNECTED: "outline"
|
|
16
|
+
};
|
|
17
|
+
function formatDateTime(value) {
|
|
18
|
+
return value ? value.toLocaleString() : "Never";
|
|
19
|
+
}
|
|
20
|
+
function formatJson(value) {
|
|
21
|
+
return value ? JSON.stringify(value, null, 2) : "No configuration";
|
|
22
|
+
}
|
|
23
|
+
function StatusBadge({ status }) {
|
|
24
|
+
return /* @__PURE__ */ jsxDEV(Badge, {
|
|
25
|
+
variant: STATUS_VARIANTS[status] ?? "outline",
|
|
26
|
+
children: status
|
|
27
|
+
}, undefined, false, undefined, this);
|
|
28
|
+
}
|
|
29
|
+
function IntegrationTableToolbar({
|
|
30
|
+
controller,
|
|
31
|
+
label,
|
|
32
|
+
toggleColumnId,
|
|
33
|
+
toggleVisibleLabel,
|
|
34
|
+
toggleHiddenLabel,
|
|
35
|
+
pinColumnId,
|
|
36
|
+
pinLabel,
|
|
37
|
+
resizeColumnId,
|
|
38
|
+
resizeLabel
|
|
39
|
+
}) {
|
|
40
|
+
const firstRow = controller.rows[0];
|
|
41
|
+
const toggleColumn = controller.columns.find((column) => column.id === toggleColumnId);
|
|
42
|
+
const pinColumn = controller.columns.find((column) => column.id === pinColumnId);
|
|
43
|
+
const resizeColumn = controller.columns.find((column) => column.id === resizeColumnId);
|
|
44
|
+
const pinTarget = pinColumn?.pinState === "left" ? false : "left";
|
|
45
|
+
return /* @__PURE__ */ jsxDEV(HStack, {
|
|
46
|
+
gap: "sm",
|
|
47
|
+
className: "flex-wrap",
|
|
48
|
+
children: [
|
|
49
|
+
/* @__PURE__ */ jsxDEV(Badge, {
|
|
50
|
+
variant: "outline",
|
|
51
|
+
children: label
|
|
52
|
+
}, undefined, false, undefined, this),
|
|
53
|
+
/* @__PURE__ */ jsxDEV(Button, {
|
|
54
|
+
variant: "outline",
|
|
55
|
+
size: "sm",
|
|
56
|
+
onPress: () => firstRow?.toggleExpanded?.(!firstRow?.isExpanded),
|
|
57
|
+
children: "Expand First Row"
|
|
58
|
+
}, undefined, false, undefined, this),
|
|
59
|
+
/* @__PURE__ */ jsxDEV(Button, {
|
|
60
|
+
variant: "outline",
|
|
61
|
+
size: "sm",
|
|
62
|
+
onPress: () => toggleColumn?.toggleVisibility?.(!toggleColumn?.visible),
|
|
63
|
+
children: toggleColumn?.visible ? toggleVisibleLabel : toggleHiddenLabel
|
|
64
|
+
}, undefined, false, undefined, this),
|
|
65
|
+
/* @__PURE__ */ jsxDEV(Button, {
|
|
66
|
+
variant: "outline",
|
|
67
|
+
size: "sm",
|
|
68
|
+
onPress: () => pinColumn?.pin?.(pinTarget),
|
|
69
|
+
children: pinColumn?.pinState === "left" ? `Unpin ${pinLabel}` : `Pin ${pinLabel}`
|
|
70
|
+
}, undefined, false, undefined, this),
|
|
71
|
+
/* @__PURE__ */ jsxDEV(Button, {
|
|
72
|
+
variant: "outline",
|
|
73
|
+
size: "sm",
|
|
74
|
+
onPress: () => resizeColumn?.resizeBy?.(40),
|
|
75
|
+
children: resizeLabel
|
|
76
|
+
}, undefined, false, undefined, this)
|
|
77
|
+
]
|
|
78
|
+
}, undefined, true, undefined, this);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// src/ui/tables/ConnectionsTable.tsx
|
|
82
|
+
import { DataTable } from "@contractspec/lib.design-system";
|
|
83
|
+
import { useContractTable } from "@contractspec/lib.presentation-runtime-react";
|
|
84
|
+
import { VStack } from "@contractspec/lib.ui-kit-web/ui/stack";
|
|
85
|
+
import { Text } from "@contractspec/lib.ui-kit-web/ui/text";
|
|
86
|
+
import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
|
|
87
|
+
"use client";
|
|
88
|
+
function ConnectionsTable({
|
|
89
|
+
connections
|
|
90
|
+
}) {
|
|
91
|
+
const controller = useContractTable({
|
|
92
|
+
data: connections,
|
|
93
|
+
columns: [
|
|
94
|
+
{
|
|
95
|
+
id: "connection",
|
|
96
|
+
header: "Connection",
|
|
97
|
+
label: "Connection",
|
|
98
|
+
accessor: (connection) => connection.name,
|
|
99
|
+
cell: ({ item }) => /* @__PURE__ */ jsxDEV2(VStack, {
|
|
100
|
+
gap: "xs",
|
|
101
|
+
children: [
|
|
102
|
+
/* @__PURE__ */ jsxDEV2(Text, {
|
|
103
|
+
className: "font-medium text-sm",
|
|
104
|
+
children: item.name
|
|
105
|
+
}, undefined, false, undefined, this),
|
|
106
|
+
/* @__PURE__ */ jsxDEV2(Text, {
|
|
107
|
+
className: "text-muted-foreground text-xs",
|
|
108
|
+
children: [
|
|
109
|
+
"Created ",
|
|
110
|
+
item.createdAt.toLocaleDateString()
|
|
111
|
+
]
|
|
112
|
+
}, undefined, true, undefined, this)
|
|
113
|
+
]
|
|
114
|
+
}, undefined, true, undefined, this),
|
|
115
|
+
size: 240,
|
|
116
|
+
minSize: 180,
|
|
117
|
+
canSort: true,
|
|
118
|
+
canPin: true,
|
|
119
|
+
canResize: true
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
id: "status",
|
|
123
|
+
header: "Status",
|
|
124
|
+
label: "Status",
|
|
125
|
+
accessorKey: "status",
|
|
126
|
+
cell: ({ value }) => /* @__PURE__ */ jsxDEV2(StatusBadge, {
|
|
127
|
+
status: String(value)
|
|
128
|
+
}, undefined, false, undefined, this),
|
|
129
|
+
size: 150,
|
|
130
|
+
canSort: true,
|
|
131
|
+
canPin: true,
|
|
132
|
+
canResize: true
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
id: "lastSyncAt",
|
|
136
|
+
header: "Last Sync",
|
|
137
|
+
label: "Last Sync",
|
|
138
|
+
accessor: (connection) => connection.lastSyncAt?.getTime() ?? 0,
|
|
139
|
+
cell: ({ item }) => formatDateTime(item.lastSyncAt),
|
|
140
|
+
size: 200,
|
|
141
|
+
canSort: true,
|
|
142
|
+
canHide: true,
|
|
143
|
+
canResize: true
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
id: "errorMessage",
|
|
147
|
+
header: "Errors",
|
|
148
|
+
label: "Errors",
|
|
149
|
+
accessor: (connection) => connection.errorMessage ?? "",
|
|
150
|
+
cell: ({ value }) => String(value || "No errors"),
|
|
151
|
+
size: 240,
|
|
152
|
+
canHide: true,
|
|
153
|
+
canResize: true
|
|
154
|
+
}
|
|
155
|
+
],
|
|
156
|
+
initialState: {
|
|
157
|
+
pagination: { pageIndex: 0, pageSize: 3 },
|
|
158
|
+
columnVisibility: { errorMessage: false },
|
|
159
|
+
columnPinning: { left: ["connection"], right: [] }
|
|
160
|
+
},
|
|
161
|
+
renderExpandedContent: (connection) => /* @__PURE__ */ jsxDEV2(VStack, {
|
|
162
|
+
gap: "sm",
|
|
163
|
+
className: "py-2",
|
|
164
|
+
children: [
|
|
165
|
+
/* @__PURE__ */ jsxDEV2(Text, {
|
|
166
|
+
className: "font-medium text-sm",
|
|
167
|
+
children: "Credentials"
|
|
168
|
+
}, undefined, false, undefined, this),
|
|
169
|
+
/* @__PURE__ */ jsxDEV2("pre", {
|
|
170
|
+
className: "overflow-auto rounded-md bg-muted/40 p-3 text-xs",
|
|
171
|
+
children: formatJson(connection.credentials)
|
|
172
|
+
}, undefined, false, undefined, this),
|
|
173
|
+
/* @__PURE__ */ jsxDEV2(Text, {
|
|
174
|
+
className: "font-medium text-sm",
|
|
175
|
+
children: "Config"
|
|
176
|
+
}, undefined, false, undefined, this),
|
|
177
|
+
/* @__PURE__ */ jsxDEV2("pre", {
|
|
178
|
+
className: "overflow-auto rounded-md bg-muted/40 p-3 text-xs",
|
|
179
|
+
children: formatJson(connection.config)
|
|
180
|
+
}, undefined, false, undefined, this),
|
|
181
|
+
/* @__PURE__ */ jsxDEV2(Text, {
|
|
182
|
+
className: "text-muted-foreground text-sm",
|
|
183
|
+
children: connection.errorMessage ?? "No sync errors recorded."
|
|
184
|
+
}, undefined, false, undefined, this)
|
|
185
|
+
]
|
|
186
|
+
}, undefined, true, undefined, this),
|
|
187
|
+
getCanExpand: () => true
|
|
188
|
+
});
|
|
189
|
+
return /* @__PURE__ */ jsxDEV2(DataTable, {
|
|
190
|
+
controller,
|
|
191
|
+
title: "Connections",
|
|
192
|
+
description: "Client-mode ContractSpec table with visibility, pinning, resizing, and expanded diagnostics.",
|
|
193
|
+
toolbar: /* @__PURE__ */ jsxDEV2(IntegrationTableToolbar, {
|
|
194
|
+
controller,
|
|
195
|
+
label: `${connections.length} total connections`,
|
|
196
|
+
toggleColumnId: "errorMessage",
|
|
197
|
+
toggleVisibleLabel: "Hide Error Column",
|
|
198
|
+
toggleHiddenLabel: "Show Error Column",
|
|
199
|
+
pinColumnId: "status",
|
|
200
|
+
pinLabel: "Status",
|
|
201
|
+
resizeColumnId: "connection",
|
|
202
|
+
resizeLabel: "Widen Connection"
|
|
203
|
+
}, undefined, false, undefined, this),
|
|
204
|
+
emptyState: /* @__PURE__ */ jsxDEV2("div", {
|
|
205
|
+
className: "rounded-md border border-dashed p-8 text-center text-muted-foreground text-sm",
|
|
206
|
+
children: "No connections found"
|
|
207
|
+
}, undefined, false, undefined, this)
|
|
208
|
+
}, undefined, false, undefined, this);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// src/ui/tables/SyncConfigsTable.tsx
|
|
212
|
+
import { DataTable as DataTable2 } from "@contractspec/lib.design-system";
|
|
213
|
+
import { useContractTable as useContractTable2 } from "@contractspec/lib.presentation-runtime-react";
|
|
214
|
+
import { VStack as VStack2 } from "@contractspec/lib.ui-kit-web/ui/stack";
|
|
215
|
+
import { Text as Text2 } from "@contractspec/lib.ui-kit-web/ui/text";
|
|
216
|
+
import { jsxDEV as jsxDEV3 } from "react/jsx-dev-runtime";
|
|
217
|
+
"use client";
|
|
218
|
+
function SyncConfigsTable({
|
|
219
|
+
syncConfigs
|
|
220
|
+
}) {
|
|
221
|
+
const controller = useContractTable2({
|
|
222
|
+
data: syncConfigs,
|
|
223
|
+
columns: [
|
|
224
|
+
{
|
|
225
|
+
id: "sync",
|
|
226
|
+
header: "Sync Config",
|
|
227
|
+
label: "Sync Config",
|
|
228
|
+
accessor: (sync) => sync.name,
|
|
229
|
+
cell: ({ item }) => /* @__PURE__ */ jsxDEV3(VStack2, {
|
|
230
|
+
gap: "xs",
|
|
231
|
+
children: [
|
|
232
|
+
/* @__PURE__ */ jsxDEV3(Text2, {
|
|
233
|
+
className: "font-medium text-sm",
|
|
234
|
+
children: item.name
|
|
235
|
+
}, undefined, false, undefined, this),
|
|
236
|
+
/* @__PURE__ */ jsxDEV3(Text2, {
|
|
237
|
+
className: "text-muted-foreground text-xs",
|
|
238
|
+
children: [
|
|
239
|
+
item.sourceEntity,
|
|
240
|
+
" \u2192 ",
|
|
241
|
+
item.targetEntity
|
|
242
|
+
]
|
|
243
|
+
}, undefined, true, undefined, this)
|
|
244
|
+
]
|
|
245
|
+
}, undefined, true, undefined, this),
|
|
246
|
+
size: 260,
|
|
247
|
+
minSize: 200,
|
|
248
|
+
canSort: true,
|
|
249
|
+
canPin: true,
|
|
250
|
+
canResize: true
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
id: "frequency",
|
|
254
|
+
header: "Frequency",
|
|
255
|
+
label: "Frequency",
|
|
256
|
+
accessorKey: "frequency",
|
|
257
|
+
size: 160,
|
|
258
|
+
canSort: true,
|
|
259
|
+
canHide: true,
|
|
260
|
+
canResize: true
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
id: "status",
|
|
264
|
+
header: "Status",
|
|
265
|
+
label: "Status",
|
|
266
|
+
accessorKey: "status",
|
|
267
|
+
cell: ({ value }) => /* @__PURE__ */ jsxDEV3(StatusBadge, {
|
|
268
|
+
status: String(value)
|
|
269
|
+
}, undefined, false, undefined, this),
|
|
270
|
+
size: 150,
|
|
271
|
+
canSort: true,
|
|
272
|
+
canPin: true,
|
|
273
|
+
canResize: true
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
id: "recordsSynced",
|
|
277
|
+
header: "Records",
|
|
278
|
+
label: "Records",
|
|
279
|
+
accessorKey: "recordsSynced",
|
|
280
|
+
align: "right",
|
|
281
|
+
size: 140,
|
|
282
|
+
canSort: true,
|
|
283
|
+
canResize: true
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
id: "lastRunAt",
|
|
287
|
+
header: "Last Run",
|
|
288
|
+
label: "Last Run",
|
|
289
|
+
accessor: (sync) => sync.lastRunAt?.getTime() ?? 0,
|
|
290
|
+
cell: ({ item }) => formatDateTime(item.lastRunAt),
|
|
291
|
+
size: 200,
|
|
292
|
+
canSort: true,
|
|
293
|
+
canHide: true,
|
|
294
|
+
canResize: true
|
|
295
|
+
}
|
|
296
|
+
],
|
|
297
|
+
initialState: {
|
|
298
|
+
pagination: { pageIndex: 0, pageSize: 3 },
|
|
299
|
+
columnVisibility: { lastRunAt: false },
|
|
300
|
+
columnPinning: { left: ["sync"], right: [] }
|
|
301
|
+
},
|
|
302
|
+
renderExpandedContent: (sync) => /* @__PURE__ */ jsxDEV3(VStack2, {
|
|
303
|
+
gap: "sm",
|
|
304
|
+
className: "py-2",
|
|
305
|
+
children: [
|
|
306
|
+
/* @__PURE__ */ jsxDEV3(Text2, {
|
|
307
|
+
className: "text-muted-foreground text-sm",
|
|
308
|
+
children: [
|
|
309
|
+
"Connection ",
|
|
310
|
+
sync.connectionId
|
|
311
|
+
]
|
|
312
|
+
}, undefined, true, undefined, this),
|
|
313
|
+
/* @__PURE__ */ jsxDEV3(Text2, {
|
|
314
|
+
className: "text-muted-foreground text-sm",
|
|
315
|
+
children: [
|
|
316
|
+
"Last run: ",
|
|
317
|
+
formatDateTime(sync.lastRunAt)
|
|
318
|
+
]
|
|
319
|
+
}, undefined, true, undefined, this),
|
|
320
|
+
/* @__PURE__ */ jsxDEV3(Text2, {
|
|
321
|
+
className: "text-muted-foreground text-sm",
|
|
322
|
+
children: [
|
|
323
|
+
"Last status: ",
|
|
324
|
+
sync.lastRunStatus ?? "No runs recorded"
|
|
325
|
+
]
|
|
326
|
+
}, undefined, true, undefined, this),
|
|
327
|
+
/* @__PURE__ */ jsxDEV3(Text2, {
|
|
328
|
+
className: "text-muted-foreground text-sm",
|
|
329
|
+
children: [
|
|
330
|
+
"Updated ",
|
|
331
|
+
sync.updatedAt.toLocaleString()
|
|
332
|
+
]
|
|
333
|
+
}, undefined, true, undefined, this)
|
|
334
|
+
]
|
|
335
|
+
}, undefined, true, undefined, this),
|
|
336
|
+
getCanExpand: () => true
|
|
337
|
+
});
|
|
338
|
+
return /* @__PURE__ */ jsxDEV3(DataTable2, {
|
|
339
|
+
controller,
|
|
340
|
+
title: "Sync Configs",
|
|
341
|
+
description: "Shared table primitives applied to sync monitoring without changing the surrounding dashboard layout.",
|
|
342
|
+
toolbar: /* @__PURE__ */ jsxDEV3(IntegrationTableToolbar, {
|
|
343
|
+
controller,
|
|
344
|
+
label: `${syncConfigs.length} syncs`,
|
|
345
|
+
toggleColumnId: "lastRunAt",
|
|
346
|
+
toggleVisibleLabel: "Hide Last Run",
|
|
347
|
+
toggleHiddenLabel: "Show Last Run",
|
|
348
|
+
pinColumnId: "status",
|
|
349
|
+
pinLabel: "Status",
|
|
350
|
+
resizeColumnId: "sync",
|
|
351
|
+
resizeLabel: "Widen Sync"
|
|
352
|
+
}, undefined, false, undefined, this),
|
|
353
|
+
emptyState: /* @__PURE__ */ jsxDEV3("div", {
|
|
354
|
+
className: "rounded-md border border-dashed p-8 text-center text-muted-foreground text-sm",
|
|
355
|
+
children: "No sync configurations found"
|
|
356
|
+
}, undefined, false, undefined, this)
|
|
357
|
+
}, undefined, false, undefined, this);
|
|
358
|
+
}
|
|
359
|
+
export {
|
|
360
|
+
SyncConfigsTable,
|
|
361
|
+
ConnectionsTable
|
|
362
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/ui/tables/integration-table.shared.tsx
|
|
3
|
+
import { Button } from "@contractspec/lib.design-system";
|
|
4
|
+
import { Badge } from "@contractspec/lib.ui-kit-web/ui/badge";
|
|
5
|
+
import { HStack } from "@contractspec/lib.ui-kit-web/ui/stack";
|
|
6
|
+
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
7
|
+
"use client";
|
|
8
|
+
var STATUS_VARIANTS = {
|
|
9
|
+
ACTIVE: "default",
|
|
10
|
+
CONNECTED: "default",
|
|
11
|
+
SUCCESS: "default",
|
|
12
|
+
PENDING: "secondary",
|
|
13
|
+
PAUSED: "secondary",
|
|
14
|
+
ERROR: "destructive",
|
|
15
|
+
DISCONNECTED: "outline"
|
|
16
|
+
};
|
|
17
|
+
function formatDateTime(value) {
|
|
18
|
+
return value ? value.toLocaleString() : "Never";
|
|
19
|
+
}
|
|
20
|
+
function formatJson(value) {
|
|
21
|
+
return value ? JSON.stringify(value, null, 2) : "No configuration";
|
|
22
|
+
}
|
|
23
|
+
function StatusBadge({ status }) {
|
|
24
|
+
return /* @__PURE__ */ jsxDEV(Badge, {
|
|
25
|
+
variant: STATUS_VARIANTS[status] ?? "outline",
|
|
26
|
+
children: status
|
|
27
|
+
}, undefined, false, undefined, this);
|
|
28
|
+
}
|
|
29
|
+
function IntegrationTableToolbar({
|
|
30
|
+
controller,
|
|
31
|
+
label,
|
|
32
|
+
toggleColumnId,
|
|
33
|
+
toggleVisibleLabel,
|
|
34
|
+
toggleHiddenLabel,
|
|
35
|
+
pinColumnId,
|
|
36
|
+
pinLabel,
|
|
37
|
+
resizeColumnId,
|
|
38
|
+
resizeLabel
|
|
39
|
+
}) {
|
|
40
|
+
const firstRow = controller.rows[0];
|
|
41
|
+
const toggleColumn = controller.columns.find((column) => column.id === toggleColumnId);
|
|
42
|
+
const pinColumn = controller.columns.find((column) => column.id === pinColumnId);
|
|
43
|
+
const resizeColumn = controller.columns.find((column) => column.id === resizeColumnId);
|
|
44
|
+
const pinTarget = pinColumn?.pinState === "left" ? false : "left";
|
|
45
|
+
return /* @__PURE__ */ jsxDEV(HStack, {
|
|
46
|
+
gap: "sm",
|
|
47
|
+
className: "flex-wrap",
|
|
48
|
+
children: [
|
|
49
|
+
/* @__PURE__ */ jsxDEV(Badge, {
|
|
50
|
+
variant: "outline",
|
|
51
|
+
children: label
|
|
52
|
+
}, undefined, false, undefined, this),
|
|
53
|
+
/* @__PURE__ */ jsxDEV(Button, {
|
|
54
|
+
variant: "outline",
|
|
55
|
+
size: "sm",
|
|
56
|
+
onPress: () => firstRow?.toggleExpanded?.(!firstRow?.isExpanded),
|
|
57
|
+
children: "Expand First Row"
|
|
58
|
+
}, undefined, false, undefined, this),
|
|
59
|
+
/* @__PURE__ */ jsxDEV(Button, {
|
|
60
|
+
variant: "outline",
|
|
61
|
+
size: "sm",
|
|
62
|
+
onPress: () => toggleColumn?.toggleVisibility?.(!toggleColumn?.visible),
|
|
63
|
+
children: toggleColumn?.visible ? toggleVisibleLabel : toggleHiddenLabel
|
|
64
|
+
}, undefined, false, undefined, this),
|
|
65
|
+
/* @__PURE__ */ jsxDEV(Button, {
|
|
66
|
+
variant: "outline",
|
|
67
|
+
size: "sm",
|
|
68
|
+
onPress: () => pinColumn?.pin?.(pinTarget),
|
|
69
|
+
children: pinColumn?.pinState === "left" ? `Unpin ${pinLabel}` : `Pin ${pinLabel}`
|
|
70
|
+
}, undefined, false, undefined, this),
|
|
71
|
+
/* @__PURE__ */ jsxDEV(Button, {
|
|
72
|
+
variant: "outline",
|
|
73
|
+
size: "sm",
|
|
74
|
+
onPress: () => resizeColumn?.resizeBy?.(40),
|
|
75
|
+
children: resizeLabel
|
|
76
|
+
}, undefined, false, undefined, this)
|
|
77
|
+
]
|
|
78
|
+
}, undefined, true, undefined, this);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// src/ui/tables/SyncConfigsTable.tsx
|
|
82
|
+
import { DataTable } from "@contractspec/lib.design-system";
|
|
83
|
+
import { useContractTable } from "@contractspec/lib.presentation-runtime-react";
|
|
84
|
+
import { VStack } from "@contractspec/lib.ui-kit-web/ui/stack";
|
|
85
|
+
import { Text } from "@contractspec/lib.ui-kit-web/ui/text";
|
|
86
|
+
import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
|
|
87
|
+
"use client";
|
|
88
|
+
function SyncConfigsTable({
|
|
89
|
+
syncConfigs
|
|
90
|
+
}) {
|
|
91
|
+
const controller = useContractTable({
|
|
92
|
+
data: syncConfigs,
|
|
93
|
+
columns: [
|
|
94
|
+
{
|
|
95
|
+
id: "sync",
|
|
96
|
+
header: "Sync Config",
|
|
97
|
+
label: "Sync Config",
|
|
98
|
+
accessor: (sync) => sync.name,
|
|
99
|
+
cell: ({ item }) => /* @__PURE__ */ jsxDEV2(VStack, {
|
|
100
|
+
gap: "xs",
|
|
101
|
+
children: [
|
|
102
|
+
/* @__PURE__ */ jsxDEV2(Text, {
|
|
103
|
+
className: "font-medium text-sm",
|
|
104
|
+
children: item.name
|
|
105
|
+
}, undefined, false, undefined, this),
|
|
106
|
+
/* @__PURE__ */ jsxDEV2(Text, {
|
|
107
|
+
className: "text-muted-foreground text-xs",
|
|
108
|
+
children: [
|
|
109
|
+
item.sourceEntity,
|
|
110
|
+
" \u2192 ",
|
|
111
|
+
item.targetEntity
|
|
112
|
+
]
|
|
113
|
+
}, undefined, true, undefined, this)
|
|
114
|
+
]
|
|
115
|
+
}, undefined, true, undefined, this),
|
|
116
|
+
size: 260,
|
|
117
|
+
minSize: 200,
|
|
118
|
+
canSort: true,
|
|
119
|
+
canPin: true,
|
|
120
|
+
canResize: true
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
id: "frequency",
|
|
124
|
+
header: "Frequency",
|
|
125
|
+
label: "Frequency",
|
|
126
|
+
accessorKey: "frequency",
|
|
127
|
+
size: 160,
|
|
128
|
+
canSort: true,
|
|
129
|
+
canHide: true,
|
|
130
|
+
canResize: true
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
id: "status",
|
|
134
|
+
header: "Status",
|
|
135
|
+
label: "Status",
|
|
136
|
+
accessorKey: "status",
|
|
137
|
+
cell: ({ value }) => /* @__PURE__ */ jsxDEV2(StatusBadge, {
|
|
138
|
+
status: String(value)
|
|
139
|
+
}, undefined, false, undefined, this),
|
|
140
|
+
size: 150,
|
|
141
|
+
canSort: true,
|
|
142
|
+
canPin: true,
|
|
143
|
+
canResize: true
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
id: "recordsSynced",
|
|
147
|
+
header: "Records",
|
|
148
|
+
label: "Records",
|
|
149
|
+
accessorKey: "recordsSynced",
|
|
150
|
+
align: "right",
|
|
151
|
+
size: 140,
|
|
152
|
+
canSort: true,
|
|
153
|
+
canResize: true
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
id: "lastRunAt",
|
|
157
|
+
header: "Last Run",
|
|
158
|
+
label: "Last Run",
|
|
159
|
+
accessor: (sync) => sync.lastRunAt?.getTime() ?? 0,
|
|
160
|
+
cell: ({ item }) => formatDateTime(item.lastRunAt),
|
|
161
|
+
size: 200,
|
|
162
|
+
canSort: true,
|
|
163
|
+
canHide: true,
|
|
164
|
+
canResize: true
|
|
165
|
+
}
|
|
166
|
+
],
|
|
167
|
+
initialState: {
|
|
168
|
+
pagination: { pageIndex: 0, pageSize: 3 },
|
|
169
|
+
columnVisibility: { lastRunAt: false },
|
|
170
|
+
columnPinning: { left: ["sync"], right: [] }
|
|
171
|
+
},
|
|
172
|
+
renderExpandedContent: (sync) => /* @__PURE__ */ jsxDEV2(VStack, {
|
|
173
|
+
gap: "sm",
|
|
174
|
+
className: "py-2",
|
|
175
|
+
children: [
|
|
176
|
+
/* @__PURE__ */ jsxDEV2(Text, {
|
|
177
|
+
className: "text-muted-foreground text-sm",
|
|
178
|
+
children: [
|
|
179
|
+
"Connection ",
|
|
180
|
+
sync.connectionId
|
|
181
|
+
]
|
|
182
|
+
}, undefined, true, undefined, this),
|
|
183
|
+
/* @__PURE__ */ jsxDEV2(Text, {
|
|
184
|
+
className: "text-muted-foreground text-sm",
|
|
185
|
+
children: [
|
|
186
|
+
"Last run: ",
|
|
187
|
+
formatDateTime(sync.lastRunAt)
|
|
188
|
+
]
|
|
189
|
+
}, undefined, true, undefined, this),
|
|
190
|
+
/* @__PURE__ */ jsxDEV2(Text, {
|
|
191
|
+
className: "text-muted-foreground text-sm",
|
|
192
|
+
children: [
|
|
193
|
+
"Last status: ",
|
|
194
|
+
sync.lastRunStatus ?? "No runs recorded"
|
|
195
|
+
]
|
|
196
|
+
}, undefined, true, undefined, this),
|
|
197
|
+
/* @__PURE__ */ jsxDEV2(Text, {
|
|
198
|
+
className: "text-muted-foreground text-sm",
|
|
199
|
+
children: [
|
|
200
|
+
"Updated ",
|
|
201
|
+
sync.updatedAt.toLocaleString()
|
|
202
|
+
]
|
|
203
|
+
}, undefined, true, undefined, this)
|
|
204
|
+
]
|
|
205
|
+
}, undefined, true, undefined, this),
|
|
206
|
+
getCanExpand: () => true
|
|
207
|
+
});
|
|
208
|
+
return /* @__PURE__ */ jsxDEV2(DataTable, {
|
|
209
|
+
controller,
|
|
210
|
+
title: "Sync Configs",
|
|
211
|
+
description: "Shared table primitives applied to sync monitoring without changing the surrounding dashboard layout.",
|
|
212
|
+
toolbar: /* @__PURE__ */ jsxDEV2(IntegrationTableToolbar, {
|
|
213
|
+
controller,
|
|
214
|
+
label: `${syncConfigs.length} syncs`,
|
|
215
|
+
toggleColumnId: "lastRunAt",
|
|
216
|
+
toggleVisibleLabel: "Hide Last Run",
|
|
217
|
+
toggleHiddenLabel: "Show Last Run",
|
|
218
|
+
pinColumnId: "status",
|
|
219
|
+
pinLabel: "Status",
|
|
220
|
+
resizeColumnId: "sync",
|
|
221
|
+
resizeLabel: "Widen Sync"
|
|
222
|
+
}, undefined, false, undefined, this),
|
|
223
|
+
emptyState: /* @__PURE__ */ jsxDEV2("div", {
|
|
224
|
+
className: "rounded-md border border-dashed p-8 text-center text-muted-foreground text-sm",
|
|
225
|
+
children: "No sync configurations found"
|
|
226
|
+
}, undefined, false, undefined, this)
|
|
227
|
+
}, undefined, false, undefined, this);
|
|
228
|
+
}
|
|
229
|
+
export {
|
|
230
|
+
SyncConfigsTable
|
|
231
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ContractTableController } from '@contractspec/lib.presentation-runtime-react';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
export declare function formatDateTime(value?: Date): string;
|
|
4
|
+
export declare function formatJson(value?: Record<string, unknown>): string;
|
|
5
|
+
export declare function StatusBadge({ status }: {
|
|
6
|
+
status: string;
|
|
7
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function IntegrationTableToolbar<TItem>({ controller, label, toggleColumnId, toggleVisibleLabel, toggleHiddenLabel, pinColumnId, pinLabel, resizeColumnId, resizeLabel, }: {
|
|
9
|
+
controller: ContractTableController<TItem, ReactNode>;
|
|
10
|
+
label: string;
|
|
11
|
+
toggleColumnId: string;
|
|
12
|
+
toggleVisibleLabel: string;
|
|
13
|
+
toggleHiddenLabel: string;
|
|
14
|
+
pinColumnId: string;
|
|
15
|
+
pinLabel: string;
|
|
16
|
+
resizeColumnId: string;
|
|
17
|
+
resizeLabel: string;
|
|
18
|
+
}): import("react/jsx-runtime").JSX.Element;
|