@contractspec/example.analytics-dashboard 3.8.0 → 3.9.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 +3 -1
- package/dist/browser/docs/analytics-dashboard.docblock.js +2 -1
- package/dist/browser/docs/index.js +2 -1
- package/dist/browser/index.js +170 -81
- package/dist/browser/ui/AnalyticsDashboard.js +170 -81
- package/dist/browser/ui/AnalyticsQueriesTable.js +170 -81
- package/dist/browser/ui/index.js +170 -81
- package/dist/docs/analytics-dashboard.docblock.js +2 -1
- package/dist/docs/index.js +2 -1
- package/dist/index.js +170 -81
- package/dist/node/docs/analytics-dashboard.docblock.js +2 -1
- package/dist/node/docs/index.js +2 -1
- package/dist/node/index.js +170 -81
- package/dist/node/ui/AnalyticsDashboard.js +170 -81
- package/dist/node/ui/AnalyticsQueriesTable.js +170 -81
- package/dist/node/ui/index.js +170 -81
- package/dist/ui/AnalyticsDashboard.js +170 -81
- package/dist/ui/AnalyticsQueriesTable.js +170 -81
- package/dist/ui/AnalyticsQueriesTable.smoke.test.d.ts +1 -0
- package/dist/ui/index.js +170 -81
- package/package.json +11 -9
package/dist/index.js
CHANGED
|
@@ -1684,99 +1684,188 @@ function gridSpanClass(gridWidth) {
|
|
|
1684
1684
|
}
|
|
1685
1685
|
|
|
1686
1686
|
// src/ui/AnalyticsQueriesTable.tsx
|
|
1687
|
+
import { DataTable } from "@contractspec/lib.design-system";
|
|
1688
|
+
import { useContractTable } from "@contractspec/lib.presentation-runtime-react";
|
|
1689
|
+
import { Badge } from "@contractspec/lib.ui-kit-web/ui/badge";
|
|
1690
|
+
import { HStack, VStack } from "@contractspec/lib.ui-kit-web/ui/stack";
|
|
1691
|
+
import { Text } from "@contractspec/lib.ui-kit-web/ui/text";
|
|
1687
1692
|
import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
|
|
1688
1693
|
"use client";
|
|
1689
1694
|
var QUERY_TYPE_COLORS = {
|
|
1690
|
-
SQL: "
|
|
1691
|
-
METRIC: "
|
|
1692
|
-
AGGREGATION: "
|
|
1693
|
-
CUSTOM: "
|
|
1695
|
+
SQL: "default",
|
|
1696
|
+
METRIC: "secondary",
|
|
1697
|
+
AGGREGATION: "secondary",
|
|
1698
|
+
CUSTOM: "outline"
|
|
1694
1699
|
};
|
|
1700
|
+
function formatJson(value) {
|
|
1701
|
+
return JSON.stringify(value, null, 2);
|
|
1702
|
+
}
|
|
1695
1703
|
function AnalyticsQueriesTable({ queries }) {
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
className: "px-4 py-3 text-left font-medium text-sm",
|
|
1707
|
-
children: "Query"
|
|
1708
|
-
}, undefined, false, undefined, this),
|
|
1709
|
-
/* @__PURE__ */ jsxDEV2("th", {
|
|
1710
|
-
className: "px-4 py-3 text-left font-medium text-sm",
|
|
1711
|
-
children: "Type"
|
|
1712
|
-
}, undefined, false, undefined, this),
|
|
1713
|
-
/* @__PURE__ */ jsxDEV2("th", {
|
|
1714
|
-
className: "px-4 py-3 text-left font-medium text-sm",
|
|
1715
|
-
children: "Cache TTL"
|
|
1716
|
-
}, undefined, false, undefined, this),
|
|
1717
|
-
/* @__PURE__ */ jsxDEV2("th", {
|
|
1718
|
-
className: "px-4 py-3 text-left font-medium text-sm",
|
|
1719
|
-
children: "Shared"
|
|
1720
|
-
}, undefined, false, undefined, this)
|
|
1721
|
-
]
|
|
1722
|
-
}, undefined, true, undefined, this)
|
|
1723
|
-
}, undefined, false, undefined, this),
|
|
1724
|
-
/* @__PURE__ */ jsxDEV2("tbody", {
|
|
1725
|
-
className: "divide-y divide-border",
|
|
1704
|
+
const controller = useContractTable({
|
|
1705
|
+
data: queries,
|
|
1706
|
+
columns: [
|
|
1707
|
+
{
|
|
1708
|
+
id: "query",
|
|
1709
|
+
header: "Query",
|
|
1710
|
+
label: "Query",
|
|
1711
|
+
accessor: (query) => query.name,
|
|
1712
|
+
cell: ({ item }) => /* @__PURE__ */ jsxDEV2(VStack, {
|
|
1713
|
+
gap: "xs",
|
|
1726
1714
|
children: [
|
|
1727
|
-
|
|
1728
|
-
className: "
|
|
1715
|
+
/* @__PURE__ */ jsxDEV2(Text, {
|
|
1716
|
+
className: "font-medium text-sm",
|
|
1717
|
+
children: item.name
|
|
1718
|
+
}, undefined, false, undefined, this),
|
|
1719
|
+
/* @__PURE__ */ jsxDEV2(Text, {
|
|
1720
|
+
className: "text-muted-foreground text-xs",
|
|
1729
1721
|
children: [
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
children: [
|
|
1733
|
-
/* @__PURE__ */ jsxDEV2("div", {
|
|
1734
|
-
className: "font-medium",
|
|
1735
|
-
children: query.name
|
|
1736
|
-
}, undefined, false, undefined, this),
|
|
1737
|
-
/* @__PURE__ */ jsxDEV2("div", {
|
|
1738
|
-
className: "text-muted-foreground text-sm",
|
|
1739
|
-
children: query.description
|
|
1740
|
-
}, undefined, false, undefined, this)
|
|
1741
|
-
]
|
|
1742
|
-
}, undefined, true, undefined, this),
|
|
1743
|
-
/* @__PURE__ */ jsxDEV2("td", {
|
|
1744
|
-
className: "px-4 py-3",
|
|
1745
|
-
children: /* @__PURE__ */ jsxDEV2("span", {
|
|
1746
|
-
className: `inline-flex rounded-full px-2 py-0.5 font-medium text-xs ${QUERY_TYPE_COLORS[query.type] ?? ""}`,
|
|
1747
|
-
children: query.type
|
|
1748
|
-
}, undefined, false, undefined, this)
|
|
1749
|
-
}, undefined, false, undefined, this),
|
|
1750
|
-
/* @__PURE__ */ jsxDEV2("td", {
|
|
1751
|
-
className: "px-4 py-3 text-muted-foreground text-sm",
|
|
1752
|
-
children: [
|
|
1753
|
-
query.cacheTtlSeconds,
|
|
1754
|
-
"s"
|
|
1755
|
-
]
|
|
1756
|
-
}, undefined, true, undefined, this),
|
|
1757
|
-
/* @__PURE__ */ jsxDEV2("td", {
|
|
1758
|
-
className: "px-4 py-3",
|
|
1759
|
-
children: query.isShared ? /* @__PURE__ */ jsxDEV2("span", {
|
|
1760
|
-
className: "text-green-600 dark:text-green-400",
|
|
1761
|
-
children: "\u2713"
|
|
1762
|
-
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV2("span", {
|
|
1763
|
-
className: "text-muted-foreground",
|
|
1764
|
-
children: "\u2014"
|
|
1765
|
-
}, undefined, false, undefined, this)
|
|
1766
|
-
}, undefined, false, undefined, this)
|
|
1722
|
+
"Updated ",
|
|
1723
|
+
item.updatedAt.toLocaleDateString()
|
|
1767
1724
|
]
|
|
1768
|
-
},
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1725
|
+
}, undefined, true, undefined, this)
|
|
1726
|
+
]
|
|
1727
|
+
}, undefined, true, undefined, this),
|
|
1728
|
+
size: 240,
|
|
1729
|
+
minSize: 180,
|
|
1730
|
+
canSort: true,
|
|
1731
|
+
canPin: true,
|
|
1732
|
+
canResize: true
|
|
1733
|
+
},
|
|
1734
|
+
{
|
|
1735
|
+
id: "description",
|
|
1736
|
+
header: "Description",
|
|
1737
|
+
label: "Description",
|
|
1738
|
+
accessor: (query) => query.description ?? "",
|
|
1739
|
+
cell: ({ value }) => /* @__PURE__ */ jsxDEV2(Text, {
|
|
1740
|
+
className: "line-clamp-2 text-muted-foreground text-sm",
|
|
1741
|
+
children: String(value || "No description")
|
|
1742
|
+
}, undefined, false, undefined, this),
|
|
1743
|
+
size: 300,
|
|
1744
|
+
minSize: 220,
|
|
1745
|
+
canSort: false,
|
|
1746
|
+
canHide: true,
|
|
1747
|
+
canResize: true
|
|
1748
|
+
},
|
|
1749
|
+
{
|
|
1750
|
+
id: "type",
|
|
1751
|
+
header: "Type",
|
|
1752
|
+
label: "Type",
|
|
1753
|
+
accessorKey: "type",
|
|
1754
|
+
cell: ({ value }) => /* @__PURE__ */ jsxDEV2(Badge, {
|
|
1755
|
+
variant: QUERY_TYPE_COLORS[String(value)],
|
|
1756
|
+
children: String(value)
|
|
1757
|
+
}, undefined, false, undefined, this),
|
|
1758
|
+
size: 150,
|
|
1759
|
+
canSort: true,
|
|
1760
|
+
canHide: true,
|
|
1761
|
+
canResize: true
|
|
1762
|
+
},
|
|
1763
|
+
{
|
|
1764
|
+
id: "cacheTtlSeconds",
|
|
1765
|
+
header: "Cache TTL",
|
|
1766
|
+
label: "Cache TTL",
|
|
1767
|
+
accessorKey: "cacheTtlSeconds",
|
|
1768
|
+
cell: ({ value }) => `${String(value)}s`,
|
|
1769
|
+
align: "right",
|
|
1770
|
+
size: 140,
|
|
1771
|
+
canSort: true,
|
|
1772
|
+
canResize: true
|
|
1773
|
+
},
|
|
1774
|
+
{
|
|
1775
|
+
id: "isShared",
|
|
1776
|
+
header: "Shared",
|
|
1777
|
+
label: "Shared",
|
|
1778
|
+
accessorKey: "isShared",
|
|
1779
|
+
cell: ({ value }) => /* @__PURE__ */ jsxDEV2(Badge, {
|
|
1780
|
+
variant: value ? "default" : "outline",
|
|
1781
|
+
children: value ? "Shared" : "Private"
|
|
1782
|
+
}, undefined, false, undefined, this),
|
|
1783
|
+
size: 140,
|
|
1784
|
+
canSort: true,
|
|
1785
|
+
canHide: true,
|
|
1786
|
+
canResize: true
|
|
1787
|
+
}
|
|
1788
|
+
],
|
|
1789
|
+
initialState: {
|
|
1790
|
+
pagination: { pageIndex: 0, pageSize: 3 },
|
|
1791
|
+
columnVisibility: { description: false },
|
|
1792
|
+
columnPinning: { left: ["query"], right: [] }
|
|
1793
|
+
},
|
|
1794
|
+
renderExpandedContent: (query) => /* @__PURE__ */ jsxDEV2(VStack, {
|
|
1795
|
+
gap: "sm",
|
|
1796
|
+
className: "py-2",
|
|
1797
|
+
children: [
|
|
1798
|
+
/* @__PURE__ */ jsxDEV2(VStack, {
|
|
1799
|
+
gap: "xs",
|
|
1800
|
+
children: [
|
|
1801
|
+
/* @__PURE__ */ jsxDEV2(Text, {
|
|
1802
|
+
className: "font-medium text-sm",
|
|
1803
|
+
children: "Description"
|
|
1804
|
+
}, undefined, false, undefined, this),
|
|
1805
|
+
/* @__PURE__ */ jsxDEV2(Text, {
|
|
1806
|
+
className: "text-muted-foreground text-sm",
|
|
1807
|
+
children: query.description ?? "No description"
|
|
1808
|
+
}, undefined, false, undefined, this)
|
|
1809
|
+
]
|
|
1810
|
+
}, undefined, true, undefined, this),
|
|
1811
|
+
query.sql ? /* @__PURE__ */ jsxDEV2(VStack, {
|
|
1812
|
+
gap: "xs",
|
|
1813
|
+
children: [
|
|
1814
|
+
/* @__PURE__ */ jsxDEV2(Text, {
|
|
1815
|
+
className: "font-medium text-sm",
|
|
1816
|
+
children: "SQL"
|
|
1817
|
+
}, undefined, false, undefined, this),
|
|
1818
|
+
/* @__PURE__ */ jsxDEV2("pre", {
|
|
1819
|
+
className: "overflow-auto rounded-md bg-muted/40 p-3 text-xs",
|
|
1820
|
+
children: query.sql
|
|
1775
1821
|
}, undefined, false, undefined, this)
|
|
1776
1822
|
]
|
|
1823
|
+
}, undefined, true, undefined, this) : null,
|
|
1824
|
+
/* @__PURE__ */ jsxDEV2(VStack, {
|
|
1825
|
+
gap: "xs",
|
|
1826
|
+
children: [
|
|
1827
|
+
/* @__PURE__ */ jsxDEV2(Text, {
|
|
1828
|
+
className: "font-medium text-sm",
|
|
1829
|
+
children: "Definition"
|
|
1830
|
+
}, undefined, false, undefined, this),
|
|
1831
|
+
/* @__PURE__ */ jsxDEV2("pre", {
|
|
1832
|
+
className: "overflow-auto rounded-md bg-muted/40 p-3 text-xs",
|
|
1833
|
+
children: formatJson(query.definition)
|
|
1834
|
+
}, undefined, false, undefined, this)
|
|
1835
|
+
]
|
|
1836
|
+
}, undefined, true, undefined, this)
|
|
1837
|
+
]
|
|
1838
|
+
}, undefined, true, undefined, this),
|
|
1839
|
+
getCanExpand: () => true
|
|
1840
|
+
});
|
|
1841
|
+
return /* @__PURE__ */ jsxDEV2(DataTable, {
|
|
1842
|
+
controller,
|
|
1843
|
+
title: "Saved Queries",
|
|
1844
|
+
description: "Client-mode table using the shared ContractSpec controller and renderer.",
|
|
1845
|
+
toolbar: /* @__PURE__ */ jsxDEV2(HStack, {
|
|
1846
|
+
gap: "sm",
|
|
1847
|
+
className: "flex-wrap",
|
|
1848
|
+
children: [
|
|
1849
|
+
/* @__PURE__ */ jsxDEV2(Text, {
|
|
1850
|
+
className: "text-muted-foreground text-sm",
|
|
1851
|
+
children: [
|
|
1852
|
+
queries.length,
|
|
1853
|
+
" queries"
|
|
1854
|
+
]
|
|
1855
|
+
}, undefined, true, undefined, this),
|
|
1856
|
+
/* @__PURE__ */ jsxDEV2(Text, {
|
|
1857
|
+
className: "text-muted-foreground text-sm",
|
|
1858
|
+
children: [
|
|
1859
|
+
queries.filter((query) => query.isShared).length,
|
|
1860
|
+
" shared"
|
|
1861
|
+
]
|
|
1777
1862
|
}, undefined, true, undefined, this)
|
|
1778
1863
|
]
|
|
1779
|
-
}, undefined, true, undefined, this)
|
|
1864
|
+
}, undefined, true, undefined, this),
|
|
1865
|
+
emptyState: /* @__PURE__ */ jsxDEV2("div", {
|
|
1866
|
+
className: "rounded-md border border-dashed p-8 text-center text-muted-foreground text-sm",
|
|
1867
|
+
children: "No queries saved"
|
|
1868
|
+
}, undefined, false, undefined, this)
|
|
1780
1869
|
}, undefined, false, undefined, this);
|
|
1781
1870
|
}
|
|
1782
1871
|
|
|
@@ -26,7 +26,7 @@ var analyticsDashboardDocBlocks = [
|
|
|
26
26
|
|
|
27
27
|
## UI / Presentations
|
|
28
28
|
|
|
29
|
-
- Dashboard list, dashboard view, query builder, widget gallery.
|
|
29
|
+
- Dashboard list, dashboard view, query builder, widget gallery, and a shared ContractSpec table for saved queries.
|
|
30
30
|
- Registered under \`analytics-dashboard\` template in Template Registry.
|
|
31
31
|
|
|
32
32
|
## Notes
|
|
@@ -34,6 +34,7 @@ var analyticsDashboardDocBlocks = [
|
|
|
34
34
|
- Enforce org scoping for multi-tenant isolation.
|
|
35
35
|
- Use Feature Flags for beta widgets; Metering to track query volume.
|
|
36
36
|
- PostHog datasource can back query execution via HogQL for dashboard widgets.
|
|
37
|
+
- The saved-queries table demonstrates client-mode sorting, pagination, visibility, resizing, pinning, and row expansion on the shared table stack.
|
|
37
38
|
`
|
|
38
39
|
},
|
|
39
40
|
{
|
package/dist/node/docs/index.js
CHANGED
|
@@ -26,7 +26,7 @@ var analyticsDashboardDocBlocks = [
|
|
|
26
26
|
|
|
27
27
|
## UI / Presentations
|
|
28
28
|
|
|
29
|
-
- Dashboard list, dashboard view, query builder, widget gallery.
|
|
29
|
+
- Dashboard list, dashboard view, query builder, widget gallery, and a shared ContractSpec table for saved queries.
|
|
30
30
|
- Registered under \`analytics-dashboard\` template in Template Registry.
|
|
31
31
|
|
|
32
32
|
## Notes
|
|
@@ -34,6 +34,7 @@ var analyticsDashboardDocBlocks = [
|
|
|
34
34
|
- Enforce org scoping for multi-tenant isolation.
|
|
35
35
|
- Use Feature Flags for beta widgets; Metering to track query volume.
|
|
36
36
|
- PostHog datasource can back query execution via HogQL for dashboard widgets.
|
|
37
|
+
- The saved-queries table demonstrates client-mode sorting, pagination, visibility, resizing, pinning, and row expansion on the shared table stack.
|
|
37
38
|
`
|
|
38
39
|
},
|
|
39
40
|
{
|
package/dist/node/index.js
CHANGED
|
@@ -1683,99 +1683,188 @@ function gridSpanClass(gridWidth) {
|
|
|
1683
1683
|
}
|
|
1684
1684
|
|
|
1685
1685
|
// src/ui/AnalyticsQueriesTable.tsx
|
|
1686
|
+
import { DataTable } from "@contractspec/lib.design-system";
|
|
1687
|
+
import { useContractTable } from "@contractspec/lib.presentation-runtime-react";
|
|
1688
|
+
import { Badge } from "@contractspec/lib.ui-kit-web/ui/badge";
|
|
1689
|
+
import { HStack, VStack } from "@contractspec/lib.ui-kit-web/ui/stack";
|
|
1690
|
+
import { Text } from "@contractspec/lib.ui-kit-web/ui/text";
|
|
1686
1691
|
import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
|
|
1687
1692
|
"use client";
|
|
1688
1693
|
var QUERY_TYPE_COLORS = {
|
|
1689
|
-
SQL: "
|
|
1690
|
-
METRIC: "
|
|
1691
|
-
AGGREGATION: "
|
|
1692
|
-
CUSTOM: "
|
|
1694
|
+
SQL: "default",
|
|
1695
|
+
METRIC: "secondary",
|
|
1696
|
+
AGGREGATION: "secondary",
|
|
1697
|
+
CUSTOM: "outline"
|
|
1693
1698
|
};
|
|
1699
|
+
function formatJson(value) {
|
|
1700
|
+
return JSON.stringify(value, null, 2);
|
|
1701
|
+
}
|
|
1694
1702
|
function AnalyticsQueriesTable({ queries }) {
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
className: "px-4 py-3 text-left font-medium text-sm",
|
|
1706
|
-
children: "Query"
|
|
1707
|
-
}, undefined, false, undefined, this),
|
|
1708
|
-
/* @__PURE__ */ jsxDEV2("th", {
|
|
1709
|
-
className: "px-4 py-3 text-left font-medium text-sm",
|
|
1710
|
-
children: "Type"
|
|
1711
|
-
}, undefined, false, undefined, this),
|
|
1712
|
-
/* @__PURE__ */ jsxDEV2("th", {
|
|
1713
|
-
className: "px-4 py-3 text-left font-medium text-sm",
|
|
1714
|
-
children: "Cache TTL"
|
|
1715
|
-
}, undefined, false, undefined, this),
|
|
1716
|
-
/* @__PURE__ */ jsxDEV2("th", {
|
|
1717
|
-
className: "px-4 py-3 text-left font-medium text-sm",
|
|
1718
|
-
children: "Shared"
|
|
1719
|
-
}, undefined, false, undefined, this)
|
|
1720
|
-
]
|
|
1721
|
-
}, undefined, true, undefined, this)
|
|
1722
|
-
}, undefined, false, undefined, this),
|
|
1723
|
-
/* @__PURE__ */ jsxDEV2("tbody", {
|
|
1724
|
-
className: "divide-y divide-border",
|
|
1703
|
+
const controller = useContractTable({
|
|
1704
|
+
data: queries,
|
|
1705
|
+
columns: [
|
|
1706
|
+
{
|
|
1707
|
+
id: "query",
|
|
1708
|
+
header: "Query",
|
|
1709
|
+
label: "Query",
|
|
1710
|
+
accessor: (query) => query.name,
|
|
1711
|
+
cell: ({ item }) => /* @__PURE__ */ jsxDEV2(VStack, {
|
|
1712
|
+
gap: "xs",
|
|
1725
1713
|
children: [
|
|
1726
|
-
|
|
1727
|
-
className: "
|
|
1714
|
+
/* @__PURE__ */ jsxDEV2(Text, {
|
|
1715
|
+
className: "font-medium text-sm",
|
|
1716
|
+
children: item.name
|
|
1717
|
+
}, undefined, false, undefined, this),
|
|
1718
|
+
/* @__PURE__ */ jsxDEV2(Text, {
|
|
1719
|
+
className: "text-muted-foreground text-xs",
|
|
1728
1720
|
children: [
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
children: [
|
|
1732
|
-
/* @__PURE__ */ jsxDEV2("div", {
|
|
1733
|
-
className: "font-medium",
|
|
1734
|
-
children: query.name
|
|
1735
|
-
}, undefined, false, undefined, this),
|
|
1736
|
-
/* @__PURE__ */ jsxDEV2("div", {
|
|
1737
|
-
className: "text-muted-foreground text-sm",
|
|
1738
|
-
children: query.description
|
|
1739
|
-
}, undefined, false, undefined, this)
|
|
1740
|
-
]
|
|
1741
|
-
}, undefined, true, undefined, this),
|
|
1742
|
-
/* @__PURE__ */ jsxDEV2("td", {
|
|
1743
|
-
className: "px-4 py-3",
|
|
1744
|
-
children: /* @__PURE__ */ jsxDEV2("span", {
|
|
1745
|
-
className: `inline-flex rounded-full px-2 py-0.5 font-medium text-xs ${QUERY_TYPE_COLORS[query.type] ?? ""}`,
|
|
1746
|
-
children: query.type
|
|
1747
|
-
}, undefined, false, undefined, this)
|
|
1748
|
-
}, undefined, false, undefined, this),
|
|
1749
|
-
/* @__PURE__ */ jsxDEV2("td", {
|
|
1750
|
-
className: "px-4 py-3 text-muted-foreground text-sm",
|
|
1751
|
-
children: [
|
|
1752
|
-
query.cacheTtlSeconds,
|
|
1753
|
-
"s"
|
|
1754
|
-
]
|
|
1755
|
-
}, undefined, true, undefined, this),
|
|
1756
|
-
/* @__PURE__ */ jsxDEV2("td", {
|
|
1757
|
-
className: "px-4 py-3",
|
|
1758
|
-
children: query.isShared ? /* @__PURE__ */ jsxDEV2("span", {
|
|
1759
|
-
className: "text-green-600 dark:text-green-400",
|
|
1760
|
-
children: "✓"
|
|
1761
|
-
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV2("span", {
|
|
1762
|
-
className: "text-muted-foreground",
|
|
1763
|
-
children: "—"
|
|
1764
|
-
}, undefined, false, undefined, this)
|
|
1765
|
-
}, undefined, false, undefined, this)
|
|
1721
|
+
"Updated ",
|
|
1722
|
+
item.updatedAt.toLocaleDateString()
|
|
1766
1723
|
]
|
|
1767
|
-
},
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1724
|
+
}, undefined, true, undefined, this)
|
|
1725
|
+
]
|
|
1726
|
+
}, undefined, true, undefined, this),
|
|
1727
|
+
size: 240,
|
|
1728
|
+
minSize: 180,
|
|
1729
|
+
canSort: true,
|
|
1730
|
+
canPin: true,
|
|
1731
|
+
canResize: true
|
|
1732
|
+
},
|
|
1733
|
+
{
|
|
1734
|
+
id: "description",
|
|
1735
|
+
header: "Description",
|
|
1736
|
+
label: "Description",
|
|
1737
|
+
accessor: (query) => query.description ?? "",
|
|
1738
|
+
cell: ({ value }) => /* @__PURE__ */ jsxDEV2(Text, {
|
|
1739
|
+
className: "line-clamp-2 text-muted-foreground text-sm",
|
|
1740
|
+
children: String(value || "No description")
|
|
1741
|
+
}, undefined, false, undefined, this),
|
|
1742
|
+
size: 300,
|
|
1743
|
+
minSize: 220,
|
|
1744
|
+
canSort: false,
|
|
1745
|
+
canHide: true,
|
|
1746
|
+
canResize: true
|
|
1747
|
+
},
|
|
1748
|
+
{
|
|
1749
|
+
id: "type",
|
|
1750
|
+
header: "Type",
|
|
1751
|
+
label: "Type",
|
|
1752
|
+
accessorKey: "type",
|
|
1753
|
+
cell: ({ value }) => /* @__PURE__ */ jsxDEV2(Badge, {
|
|
1754
|
+
variant: QUERY_TYPE_COLORS[String(value)],
|
|
1755
|
+
children: String(value)
|
|
1756
|
+
}, undefined, false, undefined, this),
|
|
1757
|
+
size: 150,
|
|
1758
|
+
canSort: true,
|
|
1759
|
+
canHide: true,
|
|
1760
|
+
canResize: true
|
|
1761
|
+
},
|
|
1762
|
+
{
|
|
1763
|
+
id: "cacheTtlSeconds",
|
|
1764
|
+
header: "Cache TTL",
|
|
1765
|
+
label: "Cache TTL",
|
|
1766
|
+
accessorKey: "cacheTtlSeconds",
|
|
1767
|
+
cell: ({ value }) => `${String(value)}s`,
|
|
1768
|
+
align: "right",
|
|
1769
|
+
size: 140,
|
|
1770
|
+
canSort: true,
|
|
1771
|
+
canResize: true
|
|
1772
|
+
},
|
|
1773
|
+
{
|
|
1774
|
+
id: "isShared",
|
|
1775
|
+
header: "Shared",
|
|
1776
|
+
label: "Shared",
|
|
1777
|
+
accessorKey: "isShared",
|
|
1778
|
+
cell: ({ value }) => /* @__PURE__ */ jsxDEV2(Badge, {
|
|
1779
|
+
variant: value ? "default" : "outline",
|
|
1780
|
+
children: value ? "Shared" : "Private"
|
|
1781
|
+
}, undefined, false, undefined, this),
|
|
1782
|
+
size: 140,
|
|
1783
|
+
canSort: true,
|
|
1784
|
+
canHide: true,
|
|
1785
|
+
canResize: true
|
|
1786
|
+
}
|
|
1787
|
+
],
|
|
1788
|
+
initialState: {
|
|
1789
|
+
pagination: { pageIndex: 0, pageSize: 3 },
|
|
1790
|
+
columnVisibility: { description: false },
|
|
1791
|
+
columnPinning: { left: ["query"], right: [] }
|
|
1792
|
+
},
|
|
1793
|
+
renderExpandedContent: (query) => /* @__PURE__ */ jsxDEV2(VStack, {
|
|
1794
|
+
gap: "sm",
|
|
1795
|
+
className: "py-2",
|
|
1796
|
+
children: [
|
|
1797
|
+
/* @__PURE__ */ jsxDEV2(VStack, {
|
|
1798
|
+
gap: "xs",
|
|
1799
|
+
children: [
|
|
1800
|
+
/* @__PURE__ */ jsxDEV2(Text, {
|
|
1801
|
+
className: "font-medium text-sm",
|
|
1802
|
+
children: "Description"
|
|
1803
|
+
}, undefined, false, undefined, this),
|
|
1804
|
+
/* @__PURE__ */ jsxDEV2(Text, {
|
|
1805
|
+
className: "text-muted-foreground text-sm",
|
|
1806
|
+
children: query.description ?? "No description"
|
|
1807
|
+
}, undefined, false, undefined, this)
|
|
1808
|
+
]
|
|
1809
|
+
}, undefined, true, undefined, this),
|
|
1810
|
+
query.sql ? /* @__PURE__ */ jsxDEV2(VStack, {
|
|
1811
|
+
gap: "xs",
|
|
1812
|
+
children: [
|
|
1813
|
+
/* @__PURE__ */ jsxDEV2(Text, {
|
|
1814
|
+
className: "font-medium text-sm",
|
|
1815
|
+
children: "SQL"
|
|
1816
|
+
}, undefined, false, undefined, this),
|
|
1817
|
+
/* @__PURE__ */ jsxDEV2("pre", {
|
|
1818
|
+
className: "overflow-auto rounded-md bg-muted/40 p-3 text-xs",
|
|
1819
|
+
children: query.sql
|
|
1774
1820
|
}, undefined, false, undefined, this)
|
|
1775
1821
|
]
|
|
1822
|
+
}, undefined, true, undefined, this) : null,
|
|
1823
|
+
/* @__PURE__ */ jsxDEV2(VStack, {
|
|
1824
|
+
gap: "xs",
|
|
1825
|
+
children: [
|
|
1826
|
+
/* @__PURE__ */ jsxDEV2(Text, {
|
|
1827
|
+
className: "font-medium text-sm",
|
|
1828
|
+
children: "Definition"
|
|
1829
|
+
}, undefined, false, undefined, this),
|
|
1830
|
+
/* @__PURE__ */ jsxDEV2("pre", {
|
|
1831
|
+
className: "overflow-auto rounded-md bg-muted/40 p-3 text-xs",
|
|
1832
|
+
children: formatJson(query.definition)
|
|
1833
|
+
}, undefined, false, undefined, this)
|
|
1834
|
+
]
|
|
1835
|
+
}, undefined, true, undefined, this)
|
|
1836
|
+
]
|
|
1837
|
+
}, undefined, true, undefined, this),
|
|
1838
|
+
getCanExpand: () => true
|
|
1839
|
+
});
|
|
1840
|
+
return /* @__PURE__ */ jsxDEV2(DataTable, {
|
|
1841
|
+
controller,
|
|
1842
|
+
title: "Saved Queries",
|
|
1843
|
+
description: "Client-mode table using the shared ContractSpec controller and renderer.",
|
|
1844
|
+
toolbar: /* @__PURE__ */ jsxDEV2(HStack, {
|
|
1845
|
+
gap: "sm",
|
|
1846
|
+
className: "flex-wrap",
|
|
1847
|
+
children: [
|
|
1848
|
+
/* @__PURE__ */ jsxDEV2(Text, {
|
|
1849
|
+
className: "text-muted-foreground text-sm",
|
|
1850
|
+
children: [
|
|
1851
|
+
queries.length,
|
|
1852
|
+
" queries"
|
|
1853
|
+
]
|
|
1854
|
+
}, undefined, true, undefined, this),
|
|
1855
|
+
/* @__PURE__ */ jsxDEV2(Text, {
|
|
1856
|
+
className: "text-muted-foreground text-sm",
|
|
1857
|
+
children: [
|
|
1858
|
+
queries.filter((query) => query.isShared).length,
|
|
1859
|
+
" shared"
|
|
1860
|
+
]
|
|
1776
1861
|
}, undefined, true, undefined, this)
|
|
1777
1862
|
]
|
|
1778
|
-
}, undefined, true, undefined, this)
|
|
1863
|
+
}, undefined, true, undefined, this),
|
|
1864
|
+
emptyState: /* @__PURE__ */ jsxDEV2("div", {
|
|
1865
|
+
className: "rounded-md border border-dashed p-8 text-center text-muted-foreground text-sm",
|
|
1866
|
+
children: "No queries saved"
|
|
1867
|
+
}, undefined, false, undefined, this)
|
|
1779
1868
|
}, undefined, false, undefined, this);
|
|
1780
1869
|
}
|
|
1781
1870
|
|