@contractspec/example.analytics-dashboard 3.9.9 → 3.9.10
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/browser/dashboard/dashboard.enum.js +1 -34
- package/dist/browser/dashboard/dashboard.operation.js +1 -289
- package/dist/browser/dashboard/dashboard.presentation.js +1 -200
- package/dist/browser/dashboard/dashboard.schema.js +1 -126
- package/dist/browser/dashboard/dashboard.test-spec.js +1 -213
- package/dist/browser/dashboard/index.js +1 -299
- package/dist/browser/dashboard.feature.js +1 -683
- package/dist/browser/datasource/posthog-datasource.js +4 -289
- package/dist/browser/docs/analytics-dashboard.docblock.js +5 -49
- package/dist/browser/docs/index.js +5 -49
- package/dist/browser/events.js +1 -81
- package/dist/browser/example.js +1 -42
- package/dist/browser/handlers/analytics.handlers.js +4 -278
- package/dist/browser/handlers/index.js +7 -571
- package/dist/browser/handlers/query.handlers.js +4 -294
- package/dist/browser/index.js +12 -2317
- package/dist/browser/query/index.js +1 -159
- package/dist/browser/query/query.enum.js +1 -11
- package/dist/browser/query/query.operation.js +1 -154
- package/dist/browser/query/query.presentation.js +1 -122
- package/dist/browser/query/query.schema.js +1 -70
- package/dist/browser/query/query.test-spec.js +1 -113
- package/dist/browser/query-engine/index.js +4 -491
- package/dist/browser/seeders/index.js +2 -20
- package/dist/browser/ui/AnalyticsDashboard.js +1 -1115
- package/dist/browser/ui/AnalyticsDashboard.widgets.js +1 -94
- package/dist/browser/ui/AnalyticsQueriesTable.js +1 -188
- package/dist/browser/ui/hooks/index.js +1 -660
- package/dist/browser/ui/hooks/useAnalyticsData.js +1 -657
- package/dist/browser/ui/index.js +5 -1283
- package/dist/browser/ui/renderers/analytics.markdown.js +5 -756
- package/dist/browser/ui/renderers/index.js +5 -756
- package/dist/browser/visualizations/catalog.js +1 -457
- package/dist/browser/visualizations/index.js +1 -611
- package/dist/browser/visualizations/specs.breakdown.js +1 -140
- package/dist/browser/visualizations/specs.performance.js +1 -198
- package/dist/browser/visualizations/widgets.js +1 -595
- package/dist/dashboard/dashboard.enum.js +1 -34
- package/dist/dashboard/dashboard.operation.js +1 -289
- package/dist/dashboard/dashboard.presentation.js +1 -200
- package/dist/dashboard/dashboard.schema.js +1 -126
- package/dist/dashboard/dashboard.test-spec.js +1 -213
- package/dist/dashboard/index.js +1 -299
- package/dist/dashboard.feature.js +1 -683
- package/dist/datasource/posthog-datasource.js +4 -289
- package/dist/docs/analytics-dashboard.docblock.js +5 -49
- package/dist/docs/index.js +5 -49
- package/dist/events.js +1 -81
- package/dist/example.js +1 -42
- package/dist/handlers/analytics.handlers.js +4 -278
- package/dist/handlers/index.js +7 -571
- package/dist/handlers/query.handlers.js +4 -294
- package/dist/index.js +12 -2317
- package/dist/node/dashboard/dashboard.enum.js +1 -34
- package/dist/node/dashboard/dashboard.operation.js +1 -289
- package/dist/node/dashboard/dashboard.presentation.js +1 -200
- package/dist/node/dashboard/dashboard.schema.js +1 -126
- package/dist/node/dashboard/dashboard.test-spec.js +1 -213
- package/dist/node/dashboard/index.js +1 -299
- package/dist/node/dashboard.feature.js +1 -683
- package/dist/node/datasource/posthog-datasource.js +4 -289
- package/dist/node/docs/analytics-dashboard.docblock.js +5 -49
- package/dist/node/docs/index.js +5 -49
- package/dist/node/events.js +1 -81
- package/dist/node/example.js +1 -42
- package/dist/node/handlers/analytics.handlers.js +4 -278
- package/dist/node/handlers/index.js +7 -571
- package/dist/node/handlers/query.handlers.js +4 -294
- package/dist/node/index.js +12 -2317
- package/dist/node/query/index.js +1 -159
- package/dist/node/query/query.enum.js +1 -11
- package/dist/node/query/query.operation.js +1 -154
- package/dist/node/query/query.presentation.js +1 -122
- package/dist/node/query/query.schema.js +1 -70
- package/dist/node/query/query.test-spec.js +1 -113
- package/dist/node/query-engine/index.js +4 -491
- package/dist/node/seeders/index.js +2 -20
- package/dist/node/ui/AnalyticsDashboard.js +1 -1115
- package/dist/node/ui/AnalyticsDashboard.widgets.js +1 -94
- package/dist/node/ui/AnalyticsQueriesTable.js +1 -188
- package/dist/node/ui/hooks/index.js +1 -660
- package/dist/node/ui/hooks/useAnalyticsData.js +1 -657
- package/dist/node/ui/index.js +5 -1283
- package/dist/node/ui/renderers/analytics.markdown.js +5 -756
- package/dist/node/ui/renderers/index.js +5 -756
- package/dist/node/visualizations/catalog.js +1 -457
- package/dist/node/visualizations/index.js +1 -611
- package/dist/node/visualizations/specs.breakdown.js +1 -140
- package/dist/node/visualizations/specs.performance.js +1 -198
- package/dist/node/visualizations/widgets.js +1 -595
- package/dist/query/index.js +1 -159
- package/dist/query/query.enum.js +1 -11
- package/dist/query/query.operation.js +1 -154
- package/dist/query/query.presentation.js +1 -122
- package/dist/query/query.schema.js +1 -70
- package/dist/query/query.test-spec.js +1 -113
- package/dist/query-engine/index.js +4 -491
- package/dist/seeders/index.js +2 -20
- package/dist/ui/AnalyticsDashboard.js +1 -1115
- package/dist/ui/AnalyticsDashboard.widgets.js +1 -94
- package/dist/ui/AnalyticsQueriesTable.js +1 -188
- package/dist/ui/hooks/index.js +1 -660
- package/dist/ui/hooks/useAnalyticsData.js +1 -657
- package/dist/ui/index.js +5 -1283
- package/dist/ui/renderers/analytics.markdown.js +5 -756
- package/dist/ui/renderers/index.js +5 -756
- package/dist/visualizations/catalog.js +1 -457
- package/dist/visualizations/index.js +1 -611
- package/dist/visualizations/specs.breakdown.js +1 -140
- package/dist/visualizations/specs.performance.js +1 -198
- package/dist/visualizations/widgets.js +1 -595
- package/package.json +10 -10
|
@@ -1,94 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
ComparisonView,
|
|
4
|
-
TimelineView,
|
|
5
|
-
VisualizationCard,
|
|
6
|
-
VisualizationGrid
|
|
7
|
-
} from "@contractspec/lib.design-system";
|
|
8
|
-
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
9
|
-
"use client";
|
|
10
|
-
function AnalyticsWidgetBoard({
|
|
11
|
-
dashboardName,
|
|
12
|
-
widgets
|
|
13
|
-
}) {
|
|
14
|
-
if (!widgets.length) {
|
|
15
|
-
return /* @__PURE__ */ jsxDEV("div", {
|
|
16
|
-
className: "rounded-lg border border-dashed p-10 text-center text-muted-foreground",
|
|
17
|
-
children: [
|
|
18
|
-
'No visualization widgets configured for "',
|
|
19
|
-
dashboardName,
|
|
20
|
-
'".'
|
|
21
|
-
]
|
|
22
|
-
}, undefined, true, undefined, this);
|
|
23
|
-
}
|
|
24
|
-
return /* @__PURE__ */ jsxDEV("div", {
|
|
25
|
-
children: [
|
|
26
|
-
/* @__PURE__ */ jsxDEV("h3", {
|
|
27
|
-
className: "mb-4 font-semibold text-lg",
|
|
28
|
-
children: [
|
|
29
|
-
'Widgets in "',
|
|
30
|
-
dashboardName,
|
|
31
|
-
'"'
|
|
32
|
-
]
|
|
33
|
-
}, undefined, true, undefined, this),
|
|
34
|
-
/* @__PURE__ */ jsxDEV(VisualizationGrid, {
|
|
35
|
-
children: widgets.map((widget) => /* @__PURE__ */ jsxDEV("div", {
|
|
36
|
-
className: gridSpanClass(widget.gridWidth),
|
|
37
|
-
children: renderVisualizationWidget(widget)
|
|
38
|
-
}, widget.id, false, undefined, this))
|
|
39
|
-
}, undefined, false, undefined, this)
|
|
40
|
-
]
|
|
41
|
-
}, undefined, true, undefined, this);
|
|
42
|
-
}
|
|
43
|
-
function renderVisualizationWidget(widget) {
|
|
44
|
-
const footer = /* @__PURE__ */ jsxDEV("span", {
|
|
45
|
-
className: "text-muted-foreground text-xs",
|
|
46
|
-
children: [
|
|
47
|
-
"Position: (",
|
|
48
|
-
widget.gridX,
|
|
49
|
-
", ",
|
|
50
|
-
widget.gridY,
|
|
51
|
-
") • ",
|
|
52
|
-
widget.gridWidth,
|
|
53
|
-
"x",
|
|
54
|
-
widget.gridHeight
|
|
55
|
-
]
|
|
56
|
-
}, undefined, true, undefined, this);
|
|
57
|
-
if (widget.layout === "comparison") {
|
|
58
|
-
return /* @__PURE__ */ jsxDEV(ComparisonView, {
|
|
59
|
-
description: widget.description,
|
|
60
|
-
items: widget.bindings.map((binding2) => ({ ...binding2, footer })),
|
|
61
|
-
title: widget.name
|
|
62
|
-
}, undefined, false, undefined, this);
|
|
63
|
-
}
|
|
64
|
-
if (widget.layout === "timeline") {
|
|
65
|
-
return /* @__PURE__ */ jsxDEV(TimelineView, {
|
|
66
|
-
description: widget.description,
|
|
67
|
-
items: widget.bindings.map((binding2) => ({ ...binding2, footer })),
|
|
68
|
-
title: widget.name
|
|
69
|
-
}, undefined, false, undefined, this);
|
|
70
|
-
}
|
|
71
|
-
const binding = widget.bindings[0];
|
|
72
|
-
if (!binding)
|
|
73
|
-
return null;
|
|
74
|
-
return /* @__PURE__ */ jsxDEV(VisualizationCard, {
|
|
75
|
-
data: binding.data,
|
|
76
|
-
description: widget.description ?? binding.description,
|
|
77
|
-
footer,
|
|
78
|
-
height: binding.height,
|
|
79
|
-
spec: binding.spec,
|
|
80
|
-
title: widget.name
|
|
81
|
-
}, undefined, false, undefined, this);
|
|
82
|
-
}
|
|
83
|
-
function gridSpanClass(gridWidth) {
|
|
84
|
-
if (gridWidth >= 12)
|
|
85
|
-
return "md:col-span-2 xl:col-span-3";
|
|
86
|
-
if (gridWidth >= 8)
|
|
87
|
-
return "xl:col-span-2";
|
|
88
|
-
if (gridWidth >= 6)
|
|
89
|
-
return "md:col-span-2";
|
|
90
|
-
return "";
|
|
91
|
-
}
|
|
92
|
-
export {
|
|
93
|
-
AnalyticsWidgetBoard
|
|
94
|
-
};
|
|
1
|
+
import{ComparisonView as a,TimelineView as s,VisualizationCard as l,VisualizationGrid as d}from"@contractspec/lib.design-system";import{jsx as t,jsxs as r}from"react/jsx-runtime";function p({dashboardName:i,widgets:e}){if(!e.length)return r("div",{className:"rounded-lg border border-dashed p-10 text-center text-muted-foreground",children:['No visualization widgets configured for "',i,'".']});return r("div",{children:[r("h3",{className:"mb-4 font-semibold text-lg",children:['Widgets in "',i,'"']}),t(d,{children:e.map((n)=>t("div",{className:u(n.gridWidth),children:c(n)},n.id))})]})}function c(i){let e=r("span",{className:"text-muted-foreground text-xs",children:["Position: (",i.gridX,", ",i.gridY,") • ",i.gridWidth,"x",i.gridHeight]});if(i.layout==="comparison")return t(a,{description:i.description,items:i.bindings.map((o)=>({...o,footer:e})),title:i.name});if(i.layout==="timeline")return t(s,{description:i.description,items:i.bindings.map((o)=>({...o,footer:e})),title:i.name});let n=i.bindings[0];if(!n)return null;return t(l,{data:n.data,description:i.description??n.description,footer:e,height:n.height,spec:n.spec,title:i.name})}function u(i){if(i>=12)return"md:col-span-2 xl:col-span-3";if(i>=8)return"xl:col-span-2";if(i>=6)return"md:col-span-2";return""}export{p as AnalyticsWidgetBoard};
|
|
@@ -1,188 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { DataTable } from "@contractspec/lib.design-system";
|
|
3
|
-
import { useContractTable } from "@contractspec/lib.presentation-runtime-react";
|
|
4
|
-
import { Badge } from "@contractspec/lib.ui-kit-web/ui/badge";
|
|
5
|
-
import { HStack, VStack } from "@contractspec/lib.ui-kit-web/ui/stack";
|
|
6
|
-
import { Text } from "@contractspec/lib.ui-kit-web/ui/text";
|
|
7
|
-
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
8
|
-
"use client";
|
|
9
|
-
var QUERY_TYPE_COLORS = {
|
|
10
|
-
SQL: "default",
|
|
11
|
-
METRIC: "secondary",
|
|
12
|
-
AGGREGATION: "secondary",
|
|
13
|
-
CUSTOM: "outline"
|
|
14
|
-
};
|
|
15
|
-
function formatJson(value) {
|
|
16
|
-
return JSON.stringify(value, null, 2);
|
|
17
|
-
}
|
|
18
|
-
function AnalyticsQueriesTable({ queries }) {
|
|
19
|
-
const controller = useContractTable({
|
|
20
|
-
data: queries,
|
|
21
|
-
columns: [
|
|
22
|
-
{
|
|
23
|
-
id: "query",
|
|
24
|
-
header: "Query",
|
|
25
|
-
label: "Query",
|
|
26
|
-
accessor: (query) => query.name,
|
|
27
|
-
cell: ({ item }) => /* @__PURE__ */ jsxDEV(VStack, {
|
|
28
|
-
gap: "xs",
|
|
29
|
-
children: [
|
|
30
|
-
/* @__PURE__ */ jsxDEV(Text, {
|
|
31
|
-
className: "font-medium text-sm",
|
|
32
|
-
children: item.name
|
|
33
|
-
}, undefined, false, undefined, this),
|
|
34
|
-
/* @__PURE__ */ jsxDEV(Text, {
|
|
35
|
-
className: "text-muted-foreground text-xs",
|
|
36
|
-
children: [
|
|
37
|
-
"Updated ",
|
|
38
|
-
item.updatedAt.toLocaleDateString()
|
|
39
|
-
]
|
|
40
|
-
}, undefined, true, undefined, this)
|
|
41
|
-
]
|
|
42
|
-
}, undefined, true, undefined, this),
|
|
43
|
-
size: 240,
|
|
44
|
-
minSize: 180,
|
|
45
|
-
canSort: true,
|
|
46
|
-
canPin: true,
|
|
47
|
-
canResize: true
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
id: "description",
|
|
51
|
-
header: "Description",
|
|
52
|
-
label: "Description",
|
|
53
|
-
accessor: (query) => query.description ?? "",
|
|
54
|
-
cell: ({ value }) => /* @__PURE__ */ jsxDEV(Text, {
|
|
55
|
-
className: "line-clamp-2 text-muted-foreground text-sm",
|
|
56
|
-
children: String(value || "No description")
|
|
57
|
-
}, undefined, false, undefined, this),
|
|
58
|
-
size: 300,
|
|
59
|
-
minSize: 220,
|
|
60
|
-
canSort: false,
|
|
61
|
-
canHide: true,
|
|
62
|
-
canResize: true
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
id: "type",
|
|
66
|
-
header: "Type",
|
|
67
|
-
label: "Type",
|
|
68
|
-
accessorKey: "type",
|
|
69
|
-
cell: ({ value }) => /* @__PURE__ */ jsxDEV(Badge, {
|
|
70
|
-
variant: QUERY_TYPE_COLORS[String(value)],
|
|
71
|
-
children: String(value)
|
|
72
|
-
}, undefined, false, undefined, this),
|
|
73
|
-
size: 150,
|
|
74
|
-
canSort: true,
|
|
75
|
-
canHide: true,
|
|
76
|
-
canResize: true
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
id: "cacheTtlSeconds",
|
|
80
|
-
header: "Cache TTL",
|
|
81
|
-
label: "Cache TTL",
|
|
82
|
-
accessorKey: "cacheTtlSeconds",
|
|
83
|
-
cell: ({ value }) => `${String(value)}s`,
|
|
84
|
-
align: "right",
|
|
85
|
-
size: 140,
|
|
86
|
-
canSort: true,
|
|
87
|
-
canResize: true
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
id: "isShared",
|
|
91
|
-
header: "Shared",
|
|
92
|
-
label: "Shared",
|
|
93
|
-
accessorKey: "isShared",
|
|
94
|
-
cell: ({ value }) => /* @__PURE__ */ jsxDEV(Badge, {
|
|
95
|
-
variant: value ? "default" : "outline",
|
|
96
|
-
children: value ? "Shared" : "Private"
|
|
97
|
-
}, undefined, false, undefined, this),
|
|
98
|
-
size: 140,
|
|
99
|
-
canSort: true,
|
|
100
|
-
canHide: true,
|
|
101
|
-
canResize: true
|
|
102
|
-
}
|
|
103
|
-
],
|
|
104
|
-
initialState: {
|
|
105
|
-
pagination: { pageIndex: 0, pageSize: 3 },
|
|
106
|
-
columnVisibility: { description: false },
|
|
107
|
-
columnPinning: { left: ["query"], right: [] }
|
|
108
|
-
},
|
|
109
|
-
renderExpandedContent: (query) => /* @__PURE__ */ jsxDEV(VStack, {
|
|
110
|
-
gap: "sm",
|
|
111
|
-
className: "py-2",
|
|
112
|
-
children: [
|
|
113
|
-
/* @__PURE__ */ jsxDEV(VStack, {
|
|
114
|
-
gap: "xs",
|
|
115
|
-
children: [
|
|
116
|
-
/* @__PURE__ */ jsxDEV(Text, {
|
|
117
|
-
className: "font-medium text-sm",
|
|
118
|
-
children: "Description"
|
|
119
|
-
}, undefined, false, undefined, this),
|
|
120
|
-
/* @__PURE__ */ jsxDEV(Text, {
|
|
121
|
-
className: "text-muted-foreground text-sm",
|
|
122
|
-
children: query.description ?? "No description"
|
|
123
|
-
}, undefined, false, undefined, this)
|
|
124
|
-
]
|
|
125
|
-
}, undefined, true, undefined, this),
|
|
126
|
-
query.sql ? /* @__PURE__ */ jsxDEV(VStack, {
|
|
127
|
-
gap: "xs",
|
|
128
|
-
children: [
|
|
129
|
-
/* @__PURE__ */ jsxDEV(Text, {
|
|
130
|
-
className: "font-medium text-sm",
|
|
131
|
-
children: "SQL"
|
|
132
|
-
}, undefined, false, undefined, this),
|
|
133
|
-
/* @__PURE__ */ jsxDEV("pre", {
|
|
134
|
-
className: "overflow-auto rounded-md bg-muted/40 p-3 text-xs",
|
|
135
|
-
children: query.sql
|
|
136
|
-
}, undefined, false, undefined, this)
|
|
137
|
-
]
|
|
138
|
-
}, undefined, true, undefined, this) : null,
|
|
139
|
-
/* @__PURE__ */ jsxDEV(VStack, {
|
|
140
|
-
gap: "xs",
|
|
141
|
-
children: [
|
|
142
|
-
/* @__PURE__ */ jsxDEV(Text, {
|
|
143
|
-
className: "font-medium text-sm",
|
|
144
|
-
children: "Definition"
|
|
145
|
-
}, undefined, false, undefined, this),
|
|
146
|
-
/* @__PURE__ */ jsxDEV("pre", {
|
|
147
|
-
className: "overflow-auto rounded-md bg-muted/40 p-3 text-xs",
|
|
148
|
-
children: formatJson(query.definition)
|
|
149
|
-
}, undefined, false, undefined, this)
|
|
150
|
-
]
|
|
151
|
-
}, undefined, true, undefined, this)
|
|
152
|
-
]
|
|
153
|
-
}, undefined, true, undefined, this),
|
|
154
|
-
getCanExpand: () => true
|
|
155
|
-
});
|
|
156
|
-
return /* @__PURE__ */ jsxDEV(DataTable, {
|
|
157
|
-
controller,
|
|
158
|
-
title: "Saved Queries",
|
|
159
|
-
description: "Client-mode table using the shared ContractSpec controller and renderer.",
|
|
160
|
-
toolbar: /* @__PURE__ */ jsxDEV(HStack, {
|
|
161
|
-
gap: "sm",
|
|
162
|
-
className: "flex-wrap",
|
|
163
|
-
children: [
|
|
164
|
-
/* @__PURE__ */ jsxDEV(Text, {
|
|
165
|
-
className: "text-muted-foreground text-sm",
|
|
166
|
-
children: [
|
|
167
|
-
queries.length,
|
|
168
|
-
" queries"
|
|
169
|
-
]
|
|
170
|
-
}, undefined, true, undefined, this),
|
|
171
|
-
/* @__PURE__ */ jsxDEV(Text, {
|
|
172
|
-
className: "text-muted-foreground text-sm",
|
|
173
|
-
children: [
|
|
174
|
-
queries.filter((query) => query.isShared).length,
|
|
175
|
-
" shared"
|
|
176
|
-
]
|
|
177
|
-
}, undefined, true, undefined, this)
|
|
178
|
-
]
|
|
179
|
-
}, undefined, true, undefined, this),
|
|
180
|
-
emptyState: /* @__PURE__ */ jsxDEV("div", {
|
|
181
|
-
className: "rounded-md border border-dashed p-8 text-center text-muted-foreground text-sm",
|
|
182
|
-
children: "No queries saved"
|
|
183
|
-
}, undefined, false, undefined, this)
|
|
184
|
-
}, undefined, false, undefined, this);
|
|
185
|
-
}
|
|
186
|
-
export {
|
|
187
|
-
AnalyticsQueriesTable
|
|
188
|
-
};
|
|
1
|
+
import{DataTable as N}from"@contractspec/lib.design-system";import{useContractTable as W}from"@contractspec/lib.presentation-runtime-react";import{Badge as K}from"@contractspec/lib.ui-kit-web/ui/badge";import{HStack as X,VStack as I}from"@contractspec/lib.ui-kit-web/ui/stack";import{Text as A}from"@contractspec/lib.ui-kit-web/ui/text";import{jsx as z,jsxs as F}from"react/jsx-runtime";var Z={SQL:"default",METRIC:"secondary",AGGREGATION:"secondary",CUSTOM:"outline"};function $(G){return JSON.stringify(G,null,2)}function J({queries:G}){let M=W({data:G,columns:[{id:"query",header:"Query",label:"Query",accessor:(h)=>h.name,cell:({item:h})=>F(I,{gap:"xs",children:[z(A,{className:"font-medium text-sm",children:h.name}),F(A,{className:"text-muted-foreground text-xs",children:["Updated ",h.updatedAt.toLocaleDateString()]})]}),size:240,minSize:180,canSort:!0,canPin:!0,canResize:!0},{id:"description",header:"Description",label:"Description",accessor:(h)=>h.description??"",cell:({value:h})=>z(A,{className:"line-clamp-2 text-muted-foreground text-sm",children:String(h||"No description")}),size:300,minSize:220,canSort:!1,canHide:!0,canResize:!0},{id:"type",header:"Type",label:"Type",accessorKey:"type",cell:({value:h})=>z(K,{variant:Z[String(h)],children:String(h)}),size:150,canSort:!0,canHide:!0,canResize:!0},{id:"cacheTtlSeconds",header:"Cache TTL",label:"Cache TTL",accessorKey:"cacheTtlSeconds",cell:({value:h})=>`${String(h)}s`,align:"right",size:140,canSort:!0,canResize:!0},{id:"isShared",header:"Shared",label:"Shared",accessorKey:"isShared",cell:({value:h})=>z(K,{variant:h?"default":"outline",children:h?"Shared":"Private"}),size:140,canSort:!0,canHide:!0,canResize:!0}],initialState:{pagination:{pageIndex:0,pageSize:3},columnVisibility:{description:!1},columnPinning:{left:["query"],right:[]}},renderExpandedContent:(h)=>F(I,{gap:"sm",className:"py-2",children:[F(I,{gap:"xs",children:[z(A,{className:"font-medium text-sm",children:"Description"}),z(A,{className:"text-muted-foreground text-sm",children:h.description??"No description"})]}),h.sql?F(I,{gap:"xs",children:[z(A,{className:"font-medium text-sm",children:"SQL"}),z("pre",{className:"overflow-auto rounded-md bg-muted/40 p-3 text-xs",children:h.sql})]}):null,F(I,{gap:"xs",children:[z(A,{className:"font-medium text-sm",children:"Definition"}),z("pre",{className:"overflow-auto rounded-md bg-muted/40 p-3 text-xs",children:$(h.definition)})]})]}),getCanExpand:()=>!0});return z(N,{controller:M,title:"Saved Queries",description:"Client-mode table using the shared ContractSpec controller and renderer.",toolbar:F(X,{gap:"sm",className:"flex-wrap",children:[F(A,{className:"text-muted-foreground text-sm",children:[G.length," queries"]}),F(A,{className:"text-muted-foreground text-sm",children:[G.filter((h)=>h.isShared).length," shared"]})]}),emptyState:z("div",{className:"rounded-md border border-dashed p-8 text-center text-muted-foreground text-sm",children:"No queries saved"})})}export{J as AnalyticsQueriesTable};
|