@datarecce/ui 0.1.6 → 0.1.9
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/hooks.js +7078 -34
- package/dist/hooks.js.map +1 -1
- package/dist/hooks.mjs +7026 -21
- package/dist/hooks.mjs.map +1 -1
- package/dist/index.js +1375 -314
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1094 -54
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import CssBaseline from '@mui/material/CssBaseline';
|
|
2
2
|
import { createTheme, ThemeProvider } from '@mui/material/styles';
|
|
3
3
|
import { useTheme } from 'next-themes';
|
|
4
|
-
import
|
|
4
|
+
import React12, { createContext, forwardRef, useRef, useImperativeHandle, useMemo, useState, useContext, useCallback, useEffect, useLayoutEffect, Fragment as Fragment$1 } from 'react';
|
|
5
5
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
6
6
|
import MuiAlert from '@mui/material/Alert';
|
|
7
7
|
import CircularProgress4 from '@mui/material/CircularProgress';
|
|
@@ -18,14 +18,15 @@ import { QueryClient, useMutation, useQuery, useQueryClient } from '@tanstack/re
|
|
|
18
18
|
import axios, { AxiosError, isAxiosError } from 'axios';
|
|
19
19
|
import { FiCopy, FiPackage, FiInfo, FiArrowRight, FiFrown } from 'react-icons/fi';
|
|
20
20
|
import { track as track$1 } from '@amplitude/unified';
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
21
|
+
import MuiDialog from '@mui/material/Dialog';
|
|
22
|
+
import DialogActions from '@mui/material/DialogActions';
|
|
23
|
+
import DialogContent from '@mui/material/DialogContent';
|
|
24
|
+
import DialogTitle from '@mui/material/DialogTitle';
|
|
25
25
|
import IconButton2 from '@mui/material/IconButton';
|
|
26
|
+
import path from 'path';
|
|
26
27
|
import { IoClose, IoBookmarksOutline } from 'react-icons/io5';
|
|
27
|
-
import 'next/link';
|
|
28
|
-
import 'lodash/throttle';
|
|
28
|
+
import NextLink from 'next/link';
|
|
29
|
+
import throttle from 'lodash/throttle';
|
|
29
30
|
import { useRouter, usePathname } from 'next/navigation';
|
|
30
31
|
import Link from '@mui/material/Link';
|
|
31
32
|
import MuiPopover from '@mui/material/Popover';
|
|
@@ -905,8 +906,8 @@ var colorAliases = {
|
|
|
905
906
|
gray: "neutral"
|
|
906
907
|
// Gray is an alias for neutral
|
|
907
908
|
};
|
|
908
|
-
function token(
|
|
909
|
-
const parts =
|
|
909
|
+
function token(path2) {
|
|
910
|
+
const parts = path2.split(".");
|
|
910
911
|
if (parts[0] === "colors" && parts.length >= 3) {
|
|
911
912
|
let colorName = parts[1];
|
|
912
913
|
const variant = parts[2];
|
|
@@ -1163,6 +1164,146 @@ function isLineageGraphNode(node) {
|
|
|
1163
1164
|
function isLineageGraphColumnNode(node) {
|
|
1164
1165
|
return node.type === "lineageGraphColumnNode";
|
|
1165
1166
|
}
|
|
1167
|
+
function buildLineageGraph(base, current, diff) {
|
|
1168
|
+
const nodes = {};
|
|
1169
|
+
const edges = {};
|
|
1170
|
+
const buildNode = (key, from) => {
|
|
1171
|
+
return {
|
|
1172
|
+
id: key,
|
|
1173
|
+
data: {
|
|
1174
|
+
id: key,
|
|
1175
|
+
name: key,
|
|
1176
|
+
from,
|
|
1177
|
+
data: {
|
|
1178
|
+
base: void 0,
|
|
1179
|
+
current: void 0
|
|
1180
|
+
},
|
|
1181
|
+
parents: {},
|
|
1182
|
+
children: {}
|
|
1183
|
+
},
|
|
1184
|
+
type: "lineageGraphNode"
|
|
1185
|
+
// Return as LineageGraphNode for now
|
|
1186
|
+
};
|
|
1187
|
+
};
|
|
1188
|
+
for (const [key, nodeData] of Object.entries(base.nodes)) {
|
|
1189
|
+
nodes[key] = buildNode(key, "base");
|
|
1190
|
+
if (nodeData) {
|
|
1191
|
+
nodes[key].data.data.base = nodeData;
|
|
1192
|
+
nodes[key].data.name = nodeData.name;
|
|
1193
|
+
nodes[key].data.resourceType = nodeData.resource_type;
|
|
1194
|
+
nodes[key].data.packageName = nodeData.package_name;
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
for (const [key, nodeData] of Object.entries(current.nodes)) {
|
|
1198
|
+
if (nodes[key]) {
|
|
1199
|
+
nodes[key].data.from = "both";
|
|
1200
|
+
} else {
|
|
1201
|
+
nodes[key] = buildNode(key, "current");
|
|
1202
|
+
}
|
|
1203
|
+
if (nodeData) {
|
|
1204
|
+
nodes[key].data.data.current = current.nodes[key];
|
|
1205
|
+
nodes[key].data.name = nodeData.name;
|
|
1206
|
+
nodes[key].data.resourceType = nodeData.resource_type;
|
|
1207
|
+
nodes[key].data.packageName = nodeData.package_name;
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
for (const [child, parents] of Object.entries(base.parent_map)) {
|
|
1211
|
+
for (const parent of parents) {
|
|
1212
|
+
const childNode = nodes[child];
|
|
1213
|
+
const parentNode = nodes[parent];
|
|
1214
|
+
const id = `${parent}_${child}`;
|
|
1215
|
+
if (!childNode || !parentNode) {
|
|
1216
|
+
continue;
|
|
1217
|
+
}
|
|
1218
|
+
edges[id] = {
|
|
1219
|
+
id,
|
|
1220
|
+
source: parentNode.id,
|
|
1221
|
+
target: childNode.id,
|
|
1222
|
+
data: {
|
|
1223
|
+
from: "base"
|
|
1224
|
+
}
|
|
1225
|
+
};
|
|
1226
|
+
const edge = edges[id];
|
|
1227
|
+
childNode.data.parents[parent] = edge;
|
|
1228
|
+
parentNode.data.children[child] = edge;
|
|
1229
|
+
}
|
|
1230
|
+
}
|
|
1231
|
+
for (const [child, parents] of Object.entries(current.parent_map)) {
|
|
1232
|
+
for (const parent of parents) {
|
|
1233
|
+
const childNode = nodes[child];
|
|
1234
|
+
const parentNode = nodes[parent];
|
|
1235
|
+
const id = `${parent}_${child}`;
|
|
1236
|
+
if (!childNode || !parentNode) {
|
|
1237
|
+
continue;
|
|
1238
|
+
}
|
|
1239
|
+
const existingEdge = edges[id];
|
|
1240
|
+
if (existingEdge?.data && edges[id].data) {
|
|
1241
|
+
edges[id].data.from = "both";
|
|
1242
|
+
} else {
|
|
1243
|
+
edges[id] = {
|
|
1244
|
+
id,
|
|
1245
|
+
source: parentNode.id,
|
|
1246
|
+
target: childNode.id,
|
|
1247
|
+
data: {
|
|
1248
|
+
from: "current"
|
|
1249
|
+
}
|
|
1250
|
+
};
|
|
1251
|
+
}
|
|
1252
|
+
const edge = edges[id];
|
|
1253
|
+
childNode.data.parents[parent] = edge;
|
|
1254
|
+
parentNode.data.children[child] = edge;
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1257
|
+
const modifiedSet = [];
|
|
1258
|
+
for (const [key, node] of Object.entries(nodes)) {
|
|
1259
|
+
const diffNode = diff?.[key];
|
|
1260
|
+
if (diffNode) {
|
|
1261
|
+
node.data.changeStatus = diffNode.change_status;
|
|
1262
|
+
if (diffNode.change) {
|
|
1263
|
+
node.data.change = {
|
|
1264
|
+
category: diffNode.change.category,
|
|
1265
|
+
columns: diffNode.change.columns
|
|
1266
|
+
};
|
|
1267
|
+
}
|
|
1268
|
+
modifiedSet.push(key);
|
|
1269
|
+
} else if (node.data.from === "base") {
|
|
1270
|
+
node.data.changeStatus = "removed";
|
|
1271
|
+
modifiedSet.push(node.id);
|
|
1272
|
+
} else if (node.data.from === "current") {
|
|
1273
|
+
node.data.changeStatus = "added";
|
|
1274
|
+
modifiedSet.push(node.id);
|
|
1275
|
+
} else {
|
|
1276
|
+
const checksum1 = node.data.data.base?.checksum?.checksum;
|
|
1277
|
+
const checksum2 = node.data.data.current?.checksum?.checksum;
|
|
1278
|
+
if (checksum1 && checksum2 && checksum1 !== checksum2) {
|
|
1279
|
+
node.data.changeStatus = "modified";
|
|
1280
|
+
modifiedSet.push(node.id);
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
for (const [, edge] of Object.entries(edges)) {
|
|
1285
|
+
if (edge.data) {
|
|
1286
|
+
if (edge.data.from === "base") {
|
|
1287
|
+
edge.data.changeStatus = "removed";
|
|
1288
|
+
} else if (edge.data.from === "current") {
|
|
1289
|
+
edge.data.changeStatus = "added";
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
return {
|
|
1294
|
+
nodes,
|
|
1295
|
+
edges,
|
|
1296
|
+
modifiedSet,
|
|
1297
|
+
manifestMetadata: {
|
|
1298
|
+
base: base.manifest_metadata ?? void 0,
|
|
1299
|
+
current: current.manifest_metadata ?? void 0
|
|
1300
|
+
},
|
|
1301
|
+
catalogMetadata: {
|
|
1302
|
+
base: base.catalog_metadata ?? void 0,
|
|
1303
|
+
current: current.catalog_metadata ?? void 0
|
|
1304
|
+
}
|
|
1305
|
+
};
|
|
1306
|
+
}
|
|
1166
1307
|
function selectUpstream(lineageGraph, nodeIds, degree = 1e3) {
|
|
1167
1308
|
return getNeighborSet(
|
|
1168
1309
|
nodeIds,
|
|
@@ -1518,6 +1659,100 @@ function isHistogramDiffRun(run) {
|
|
|
1518
1659
|
// recce-source/js/src/constants/urls.ts
|
|
1519
1660
|
var RECCE_SUPPORT_CALENDAR_URL = "https://cal.com/team/recce/chat";
|
|
1520
1661
|
|
|
1662
|
+
// recce-source/js/src/lib/utils/formatTime.ts
|
|
1663
|
+
function getTimeComponents(totalSeconds) {
|
|
1664
|
+
const seconds = Math.floor(totalSeconds);
|
|
1665
|
+
return {
|
|
1666
|
+
hours: Math.floor(seconds / 3600),
|
|
1667
|
+
minutes: Math.floor(seconds % 3600 / 60),
|
|
1668
|
+
seconds: seconds % 60
|
|
1669
|
+
};
|
|
1670
|
+
}
|
|
1671
|
+
function formatCompact({ hours, minutes, seconds }) {
|
|
1672
|
+
if (hours > 0) {
|
|
1673
|
+
return `${hours}:${minutes.toString().padStart(2, "0")}:${seconds.toString().padStart(2, "0")}`;
|
|
1674
|
+
}
|
|
1675
|
+
return `${minutes}:${seconds.toString().padStart(2, "0")}`;
|
|
1676
|
+
}
|
|
1677
|
+
function formatVerbose({ hours, minutes, seconds }) {
|
|
1678
|
+
const parts = [];
|
|
1679
|
+
if (hours > 0) {
|
|
1680
|
+
parts.push(`${hours} hour${hours !== 1 ? "s" : ""}`);
|
|
1681
|
+
}
|
|
1682
|
+
if (minutes > 0) {
|
|
1683
|
+
parts.push(`${minutes} min${minutes !== 1 ? "s" : ""}`);
|
|
1684
|
+
}
|
|
1685
|
+
if (hours === 0 && (parts.length === 0 || seconds > 0)) {
|
|
1686
|
+
parts.push(`${seconds} second${seconds !== 1 ? "s" : ""}`);
|
|
1687
|
+
}
|
|
1688
|
+
return parts.join(" ");
|
|
1689
|
+
}
|
|
1690
|
+
function formatDuration(totalSeconds, style = "verbose") {
|
|
1691
|
+
const components = getTimeComponents(totalSeconds);
|
|
1692
|
+
if (style === "compact") {
|
|
1693
|
+
return formatCompact(components);
|
|
1694
|
+
}
|
|
1695
|
+
return formatVerbose(components);
|
|
1696
|
+
}
|
|
1697
|
+
function ServerDisconnectedModalContent({
|
|
1698
|
+
connect,
|
|
1699
|
+
idleSeconds
|
|
1700
|
+
}) {
|
|
1701
|
+
const isIdleTimeout = idleSeconds !== void 0 && idleSeconds !== null && idleSeconds > 0;
|
|
1702
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1703
|
+
/* @__PURE__ */ jsx(DialogTitle, { children: "Server Disconnected" }),
|
|
1704
|
+
/* @__PURE__ */ jsx(DialogContent, { children: isIdleTimeout ? /* @__PURE__ */ jsxs(Typography28, { children: [
|
|
1705
|
+
"The server has been idle for ",
|
|
1706
|
+
formatDuration(idleSeconds),
|
|
1707
|
+
" and was automatically stopped. Please restart the Recce server to continue."
|
|
1708
|
+
] }) : /* @__PURE__ */ jsx(Typography28, { children: "The server connection has been lost. Please restart the Recce server and try again." }) }),
|
|
1709
|
+
/* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsx(
|
|
1710
|
+
Button10,
|
|
1711
|
+
{
|
|
1712
|
+
color: "iochmara",
|
|
1713
|
+
variant: "contained",
|
|
1714
|
+
onClick: () => {
|
|
1715
|
+
connect();
|
|
1716
|
+
},
|
|
1717
|
+
children: "Retry"
|
|
1718
|
+
}
|
|
1719
|
+
) })
|
|
1720
|
+
] });
|
|
1721
|
+
}
|
|
1722
|
+
function RecceInstanceDisconnectedModalContent({
|
|
1723
|
+
shareUrl,
|
|
1724
|
+
mode
|
|
1725
|
+
}) {
|
|
1726
|
+
const contents = {
|
|
1727
|
+
"read only": {
|
|
1728
|
+
title: "Share Instance Expired",
|
|
1729
|
+
body: "This Share Instance has expired. Please restart the share instance.",
|
|
1730
|
+
action: "Restart",
|
|
1731
|
+
link: shareUrl
|
|
1732
|
+
},
|
|
1733
|
+
"metadata only": {
|
|
1734
|
+
title: "Preview Instance Expired",
|
|
1735
|
+
body: "This Preview Instance has expired. To browse more, please book a meeting with us.",
|
|
1736
|
+
action: "Contact us",
|
|
1737
|
+
link: RECCE_SUPPORT_CALENDAR_URL
|
|
1738
|
+
}
|
|
1739
|
+
};
|
|
1740
|
+
const content = contents[mode];
|
|
1741
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1742
|
+
/* @__PURE__ */ jsx(DialogTitle, { children: content.title }),
|
|
1743
|
+
/* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(Typography28, { children: content.body }) }),
|
|
1744
|
+
/* @__PURE__ */ jsx(DialogActions, { children: mode === "read only" ? /* @__PURE__ */ jsx(NextLink, { href: content.link, passHref: true, children: /* @__PURE__ */ jsx(Button10, { color: "iochmara", variant: "contained", children: content.action }) }) : /* @__PURE__ */ jsx(
|
|
1745
|
+
Button10,
|
|
1746
|
+
{
|
|
1747
|
+
color: "iochmara",
|
|
1748
|
+
variant: "contained",
|
|
1749
|
+
onClick: () => window.open(content.link, "_blank"),
|
|
1750
|
+
children: content.action
|
|
1751
|
+
}
|
|
1752
|
+
) })
|
|
1753
|
+
] });
|
|
1754
|
+
}
|
|
1755
|
+
|
|
1521
1756
|
// recce-source/js/src/lib/api/cacheKeys.ts
|
|
1522
1757
|
var cacheKeys = {
|
|
1523
1758
|
rowCount: (model) => ["row_count", model],
|
|
@@ -1567,6 +1802,75 @@ var defaultValue = {
|
|
|
1567
1802
|
sessionId: void 0
|
|
1568
1803
|
};
|
|
1569
1804
|
var InstanceInfo = createContext(defaultValue);
|
|
1805
|
+
function RecceInstanceInfoProvider({
|
|
1806
|
+
children
|
|
1807
|
+
}) {
|
|
1808
|
+
const { data: instanceInfo, isLoading } = useRecceInstanceInfo();
|
|
1809
|
+
const [featureToggles, setFeatureToggles] = useState(
|
|
1810
|
+
defaultFeatureToggles
|
|
1811
|
+
);
|
|
1812
|
+
const [singleEnv, setSingleEnv] = useState(false);
|
|
1813
|
+
const [authed, setAuthed] = useState(false);
|
|
1814
|
+
const [lifetimeExpiredAt, setLifetimeExpiredAt] = useState();
|
|
1815
|
+
const [shareUrl, setShareUrl] = useState();
|
|
1816
|
+
const [sessionId, setSessionId] = useState();
|
|
1817
|
+
const [prevInstanceInfo, setPrevInstanceInfo] = useState(instanceInfo);
|
|
1818
|
+
if (!isLoading && instanceInfo && instanceInfo !== prevInstanceInfo) {
|
|
1819
|
+
setPrevInstanceInfo(instanceInfo);
|
|
1820
|
+
setSingleEnv(instanceInfo.single_env);
|
|
1821
|
+
setAuthed(instanceInfo.authed);
|
|
1822
|
+
setShareUrl(instanceInfo.share_url);
|
|
1823
|
+
setSessionId(instanceInfo.session_id);
|
|
1824
|
+
if (instanceInfo.lifetime_expired_at) {
|
|
1825
|
+
setLifetimeExpiredAt(new Date(instanceInfo.lifetime_expired_at));
|
|
1826
|
+
console.log("lifetime expired at", instanceInfo.lifetime_expired_at);
|
|
1827
|
+
}
|
|
1828
|
+
const toggles = { ...defaultFeatureToggles };
|
|
1829
|
+
if (instanceInfo.server_mode === "read-only") {
|
|
1830
|
+
toggles.mode = "read only";
|
|
1831
|
+
toggles.disableSaveToFile = true;
|
|
1832
|
+
toggles.disableExportStateFile = true;
|
|
1833
|
+
toggles.disableImportStateFile = true;
|
|
1834
|
+
toggles.disableUpdateChecklist = true;
|
|
1835
|
+
toggles.disableDatabaseQuery = true;
|
|
1836
|
+
toggles.disableViewActionDropdown = true;
|
|
1837
|
+
toggles.disableNodeActionDropdown = true;
|
|
1838
|
+
toggles.disableShare = true;
|
|
1839
|
+
} else if (instanceInfo.server_mode === "preview") {
|
|
1840
|
+
toggles.mode = "metadata only";
|
|
1841
|
+
toggles.disableSaveToFile = true;
|
|
1842
|
+
toggles.disableExportStateFile = true;
|
|
1843
|
+
toggles.disableImportStateFile = true;
|
|
1844
|
+
toggles.disableUpdateChecklist = false;
|
|
1845
|
+
toggles.disableDatabaseQuery = true;
|
|
1846
|
+
toggles.disableViewActionDropdown = false;
|
|
1847
|
+
toggles.disableNodeActionDropdown = false;
|
|
1848
|
+
toggles.disableShare = true;
|
|
1849
|
+
}
|
|
1850
|
+
if (instanceInfo.single_env) {
|
|
1851
|
+
toggles.disableUpdateChecklist = true;
|
|
1852
|
+
toggles.disableShare = true;
|
|
1853
|
+
}
|
|
1854
|
+
if (instanceInfo.cloud_instance) {
|
|
1855
|
+
toggles.disableShare = true;
|
|
1856
|
+
}
|
|
1857
|
+
setFeatureToggles(toggles);
|
|
1858
|
+
}
|
|
1859
|
+
return /* @__PURE__ */ jsx(
|
|
1860
|
+
InstanceInfo.Provider,
|
|
1861
|
+
{
|
|
1862
|
+
value: {
|
|
1863
|
+
featureToggles,
|
|
1864
|
+
singleEnv,
|
|
1865
|
+
authed,
|
|
1866
|
+
lifetimeExpiredAt,
|
|
1867
|
+
shareUrl,
|
|
1868
|
+
sessionId
|
|
1869
|
+
},
|
|
1870
|
+
children
|
|
1871
|
+
}
|
|
1872
|
+
);
|
|
1873
|
+
}
|
|
1570
1874
|
var useRecceInstanceContext = () => useContext(InstanceInfo);
|
|
1571
1875
|
|
|
1572
1876
|
// recce-source/js/src/lib/api/flag.ts
|
|
@@ -1711,9 +2015,246 @@ async function aggregateRuns() {
|
|
|
1711
2015
|
const response = await axiosClient.post(`/api/runs/aggregate`, {});
|
|
1712
2016
|
return response.data;
|
|
1713
2017
|
}
|
|
1714
|
-
|
|
2018
|
+
|
|
2019
|
+
// recce-source/js/src/lib/api/keepAlive.ts
|
|
2020
|
+
function isDebugEnabled() {
|
|
2021
|
+
return typeof window !== "undefined" && !!window.RECCE_DEBUG_IDLE;
|
|
2022
|
+
}
|
|
2023
|
+
var MIN_KEEP_ALIVE_INTERVAL_MS = 3 * 1e3;
|
|
2024
|
+
var lastKeepAliveTime = 0;
|
|
2025
|
+
var isSending = false;
|
|
2026
|
+
var onKeepAliveSuccess = null;
|
|
2027
|
+
function setKeepAliveCallback(callback) {
|
|
2028
|
+
onKeepAliveSuccess = callback;
|
|
2029
|
+
}
|
|
2030
|
+
async function sendKeepAlive() {
|
|
2031
|
+
const now = Date.now();
|
|
2032
|
+
const elapsed = now - lastKeepAliveTime;
|
|
2033
|
+
if (elapsed < MIN_KEEP_ALIVE_INTERVAL_MS) {
|
|
2034
|
+
return false;
|
|
2035
|
+
}
|
|
2036
|
+
if (isSending) {
|
|
2037
|
+
return false;
|
|
2038
|
+
}
|
|
2039
|
+
try {
|
|
2040
|
+
isSending = true;
|
|
2041
|
+
await axiosClient.post("/api/keep-alive");
|
|
2042
|
+
lastKeepAliveTime = Date.now();
|
|
2043
|
+
if (onKeepAliveSuccess) {
|
|
2044
|
+
onKeepAliveSuccess(lastKeepAliveTime);
|
|
2045
|
+
}
|
|
2046
|
+
return true;
|
|
2047
|
+
} catch (error) {
|
|
2048
|
+
if (isDebugEnabled()) {
|
|
2049
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
2050
|
+
console.log("[Keep-Alive] Failed to send", {
|
|
2051
|
+
error: errorMessage,
|
|
2052
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2053
|
+
willRetryOnNextActivity: true
|
|
2054
|
+
});
|
|
2055
|
+
}
|
|
2056
|
+
return false;
|
|
2057
|
+
} finally {
|
|
2058
|
+
isSending = false;
|
|
2059
|
+
}
|
|
2060
|
+
}
|
|
2061
|
+
function getLastKeepAliveTime() {
|
|
2062
|
+
return lastKeepAliveTime;
|
|
2063
|
+
}
|
|
2064
|
+
function isDebugEnabled2() {
|
|
2065
|
+
return typeof window !== "undefined" && !!window.RECCE_DEBUG_IDLE;
|
|
2066
|
+
}
|
|
2067
|
+
function debugLog(message, data) {
|
|
2068
|
+
if (isDebugEnabled2()) {
|
|
2069
|
+
if (data) {
|
|
2070
|
+
console.log(message, data);
|
|
2071
|
+
} else {
|
|
2072
|
+
console.log(message);
|
|
2073
|
+
}
|
|
2074
|
+
}
|
|
2075
|
+
}
|
|
2076
|
+
var IDLE_DETECTION_CONFIG = {
|
|
2077
|
+
/** Events to listen for user activity */
|
|
2078
|
+
ACTIVITY_EVENTS: ["focus", "mousemove", "keydown", "scroll"],
|
|
2079
|
+
/**
|
|
2080
|
+
* Throttle event handler execution to reduce JS overhead (150ms).
|
|
2081
|
+
* Uses lodash.throttle with { leading: true, trailing: true } to ensure
|
|
2082
|
+
* immediate response on first activity (leading) and also capture the final
|
|
2083
|
+
* event in a burst (trailing), which is important for user experience.
|
|
2084
|
+
*/
|
|
2085
|
+
EVENT_THROTTLE_MS: 150
|
|
2086
|
+
};
|
|
2087
|
+
function useIdleDetection() {
|
|
2088
|
+
const { data: instanceInfo, isLoading, isError } = useRecceInstanceInfo();
|
|
2089
|
+
const idleTimeoutContext = useIdleTimeoutSafe();
|
|
2090
|
+
const isDisconnected = idleTimeoutContext?.isDisconnected ?? false;
|
|
2091
|
+
const idleTimeout = instanceInfo?.idle_timeout;
|
|
2092
|
+
const isEnabled = idleTimeout !== void 0 && idleTimeout > 0 && !isDisconnected;
|
|
2093
|
+
debugLog("[Idle Detection] Instance info", {
|
|
2094
|
+
isLoading,
|
|
2095
|
+
isError,
|
|
2096
|
+
hasIdleTimeout: idleTimeout !== void 0,
|
|
2097
|
+
idleTimeout: idleTimeout !== void 0 ? `${idleTimeout}s` : "not configured",
|
|
2098
|
+
isDisconnected,
|
|
2099
|
+
isEnabled
|
|
2100
|
+
});
|
|
2101
|
+
const sendKeepAliveNow = useCallback(async () => {
|
|
2102
|
+
if (document.hidden) return;
|
|
2103
|
+
const sent = await sendKeepAlive();
|
|
2104
|
+
if (sent) {
|
|
2105
|
+
debugLog("[Idle Detection] Keep-alive sent successfully", {
|
|
2106
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
2107
|
+
});
|
|
2108
|
+
}
|
|
2109
|
+
}, []);
|
|
2110
|
+
const handleActivity = useCallback(
|
|
2111
|
+
(event) => {
|
|
2112
|
+
if (isEnabled && !document.hidden) {
|
|
2113
|
+
debugLog("[Idle Detection] Activity detected", {
|
|
2114
|
+
event: event.type,
|
|
2115
|
+
tabActive: !document.hidden
|
|
2116
|
+
});
|
|
2117
|
+
void sendKeepAliveNow();
|
|
2118
|
+
}
|
|
2119
|
+
},
|
|
2120
|
+
[isEnabled, sendKeepAliveNow]
|
|
2121
|
+
);
|
|
2122
|
+
const handleVisibilityChange = useCallback(() => {
|
|
2123
|
+
if (!isEnabled) return;
|
|
2124
|
+
if (!document.hidden) {
|
|
2125
|
+
debugLog("[Idle Detection] Tab became active", {
|
|
2126
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
2127
|
+
});
|
|
2128
|
+
void sendKeepAliveNow();
|
|
2129
|
+
}
|
|
2130
|
+
}, [isEnabled, sendKeepAliveNow]);
|
|
2131
|
+
const throttledHandler = useMemo(
|
|
2132
|
+
() => throttle(handleActivity, IDLE_DETECTION_CONFIG.EVENT_THROTTLE_MS, {
|
|
2133
|
+
leading: true,
|
|
2134
|
+
trailing: true
|
|
2135
|
+
}),
|
|
2136
|
+
[handleActivity]
|
|
2137
|
+
);
|
|
2138
|
+
useEffect(() => {
|
|
2139
|
+
if (!isEnabled) {
|
|
2140
|
+
debugLog("[Idle Detection] Disabled", {
|
|
2141
|
+
idleTimeout,
|
|
2142
|
+
reason: idleTimeout === void 0 ? "idle_timeout not configured on server" : idleTimeout === 0 ? "idle_timeout is 0" : "disconnected"
|
|
2143
|
+
});
|
|
2144
|
+
return;
|
|
2145
|
+
}
|
|
2146
|
+
debugLog("[Idle Detection] Initialized", {
|
|
2147
|
+
enabled: true,
|
|
2148
|
+
idleTimeout: `${idleTimeout}s`,
|
|
2149
|
+
eventThrottle: `${IDLE_DETECTION_CONFIG.EVENT_THROTTLE_MS}ms`,
|
|
2150
|
+
apiThrottle: "3s (axios layer)",
|
|
2151
|
+
monitoredEvents: IDLE_DETECTION_CONFIG.ACTIVITY_EVENTS.join(", ")
|
|
2152
|
+
});
|
|
2153
|
+
IDLE_DETECTION_CONFIG.ACTIVITY_EVENTS.forEach((eventType) => {
|
|
2154
|
+
window.addEventListener(eventType, throttledHandler, { passive: true });
|
|
2155
|
+
});
|
|
2156
|
+
document.addEventListener("visibilitychange", handleVisibilityChange);
|
|
2157
|
+
return () => {
|
|
2158
|
+
debugLog("[Idle Detection] Cleanup - removing event listeners");
|
|
2159
|
+
IDLE_DETECTION_CONFIG.ACTIVITY_EVENTS.forEach((eventType) => {
|
|
2160
|
+
window.removeEventListener(eventType, throttledHandler);
|
|
2161
|
+
});
|
|
2162
|
+
document.removeEventListener("visibilitychange", handleVisibilityChange);
|
|
2163
|
+
throttledHandler.cancel();
|
|
2164
|
+
};
|
|
2165
|
+
}, [isEnabled, throttledHandler, handleVisibilityChange, idleTimeout]);
|
|
2166
|
+
}
|
|
2167
|
+
var IdleTimeoutContext = createContext(
|
|
1715
2168
|
void 0
|
|
1716
2169
|
);
|
|
2170
|
+
function IdleTimeoutProvider({ children }) {
|
|
2171
|
+
const { data: instanceInfo } = useRecceInstanceInfo();
|
|
2172
|
+
const lastServerSyncRef = useRef(Date.now());
|
|
2173
|
+
const [remainingSeconds, setRemainingSeconds] = useState(null);
|
|
2174
|
+
const [isDisconnected, setIsDisconnected] = useState(false);
|
|
2175
|
+
const idleTimeout = instanceInfo?.idle_timeout ?? null;
|
|
2176
|
+
const isEnabled = idleTimeout !== null && idleTimeout > 0;
|
|
2177
|
+
const isEnabledRef = useRef(isEnabled);
|
|
2178
|
+
useEffect(() => {
|
|
2179
|
+
isEnabledRef.current = isEnabled;
|
|
2180
|
+
}, [isEnabled]);
|
|
2181
|
+
useEffect(() => {
|
|
2182
|
+
if (!isEnabled) {
|
|
2183
|
+
setKeepAliveCallback(null);
|
|
2184
|
+
return;
|
|
2185
|
+
}
|
|
2186
|
+
setKeepAliveCallback((timestamp) => {
|
|
2187
|
+
if (isEnabledRef.current) {
|
|
2188
|
+
lastServerSyncRef.current = timestamp;
|
|
2189
|
+
}
|
|
2190
|
+
});
|
|
2191
|
+
const currentTime = getLastKeepAliveTime();
|
|
2192
|
+
if (currentTime > 0) {
|
|
2193
|
+
lastServerSyncRef.current = currentTime;
|
|
2194
|
+
}
|
|
2195
|
+
return () => {
|
|
2196
|
+
setKeepAliveCallback(null);
|
|
2197
|
+
};
|
|
2198
|
+
}, [isEnabled]);
|
|
2199
|
+
const setDisconnected = useCallback(() => {
|
|
2200
|
+
setIsDisconnected(true);
|
|
2201
|
+
}, []);
|
|
2202
|
+
const resetConnection = useCallback(() => {
|
|
2203
|
+
setIsDisconnected(false);
|
|
2204
|
+
lastServerSyncRef.current = Date.now();
|
|
2205
|
+
}, []);
|
|
2206
|
+
useEffect(() => {
|
|
2207
|
+
if (!isEnabled || idleTimeout === null) {
|
|
2208
|
+
setRemainingSeconds(null);
|
|
2209
|
+
return;
|
|
2210
|
+
}
|
|
2211
|
+
if (isDisconnected) {
|
|
2212
|
+
return;
|
|
2213
|
+
}
|
|
2214
|
+
const updateCountdown = () => {
|
|
2215
|
+
const now = Date.now();
|
|
2216
|
+
const elapsedSeconds = (now - lastServerSyncRef.current) / 1e3;
|
|
2217
|
+
const remaining = Math.max(0, idleTimeout - elapsedSeconds);
|
|
2218
|
+
setRemainingSeconds(remaining);
|
|
2219
|
+
};
|
|
2220
|
+
updateCountdown();
|
|
2221
|
+
const intervalId = setInterval(updateCountdown, 1e3);
|
|
2222
|
+
return () => {
|
|
2223
|
+
clearInterval(intervalId);
|
|
2224
|
+
};
|
|
2225
|
+
}, [isEnabled, idleTimeout, isDisconnected]);
|
|
2226
|
+
return /* @__PURE__ */ jsxs(
|
|
2227
|
+
IdleTimeoutContext.Provider,
|
|
2228
|
+
{
|
|
2229
|
+
value: {
|
|
2230
|
+
remainingSeconds,
|
|
2231
|
+
idleTimeout,
|
|
2232
|
+
isEnabled,
|
|
2233
|
+
setDisconnected,
|
|
2234
|
+
resetConnection,
|
|
2235
|
+
isDisconnected
|
|
2236
|
+
},
|
|
2237
|
+
children: [
|
|
2238
|
+
/* @__PURE__ */ jsx(IdleDetector, {}),
|
|
2239
|
+
children
|
|
2240
|
+
]
|
|
2241
|
+
}
|
|
2242
|
+
);
|
|
2243
|
+
}
|
|
2244
|
+
function IdleDetector() {
|
|
2245
|
+
useIdleDetection();
|
|
2246
|
+
return null;
|
|
2247
|
+
}
|
|
2248
|
+
function useIdleTimeout() {
|
|
2249
|
+
const context = useContext(IdleTimeoutContext);
|
|
2250
|
+
if (!context) {
|
|
2251
|
+
throw new Error("useIdleTimeout must be used within IdleTimeoutProvider");
|
|
2252
|
+
}
|
|
2253
|
+
return context;
|
|
2254
|
+
}
|
|
2255
|
+
function useIdleTimeoutSafe() {
|
|
2256
|
+
return useContext(IdleTimeoutContext) ?? null;
|
|
2257
|
+
}
|
|
1717
2258
|
var useRecceServerFlag = () => {
|
|
1718
2259
|
return useQuery({
|
|
1719
2260
|
queryKey: cacheKeys.flag(),
|
|
@@ -1725,6 +2266,282 @@ var defaultLineageGraphsContext = {
|
|
|
1725
2266
|
isDemoSite: false
|
|
1726
2267
|
};
|
|
1727
2268
|
var LineageGraphContext = createContext(defaultLineageGraphsContext);
|
|
2269
|
+
function useLineageWatcher() {
|
|
2270
|
+
const [artifactsUpdatedToastId, setArtifactsUpdatedToastId] = useState(void 0);
|
|
2271
|
+
const ref = useRef({
|
|
2272
|
+
ws: void 0,
|
|
2273
|
+
status: "pending",
|
|
2274
|
+
artifactsUpdatedToastId: void 0
|
|
2275
|
+
});
|
|
2276
|
+
const [status, setStatus] = useState("pending");
|
|
2277
|
+
const [envStatus, setEnvStatus] = useState(void 0);
|
|
2278
|
+
useEffect(() => {
|
|
2279
|
+
ref.current.status = status;
|
|
2280
|
+
}, [status]);
|
|
2281
|
+
useEffect(() => {
|
|
2282
|
+
ref.current.artifactsUpdatedToastId = artifactsUpdatedToastId;
|
|
2283
|
+
}, [artifactsUpdatedToastId]);
|
|
2284
|
+
const queryClient = useQueryClient();
|
|
2285
|
+
const invalidateCaches = useCallback(() => {
|
|
2286
|
+
void queryClient.invalidateQueries({ queryKey: cacheKeys.lineage() });
|
|
2287
|
+
void queryClient.invalidateQueries({ queryKey: cacheKeys.checks() });
|
|
2288
|
+
void queryClient.invalidateQueries({ queryKey: cacheKeys.runs() });
|
|
2289
|
+
}, [queryClient]);
|
|
2290
|
+
const connect = useCallback(() => {
|
|
2291
|
+
function httpUrlToWebSocketUrl(url) {
|
|
2292
|
+
return url.replace(/(http)(s)?:\/\//, "ws$2://");
|
|
2293
|
+
}
|
|
2294
|
+
const ws = new WebSocket(`${httpUrlToWebSocketUrl(PUBLIC_API_URL)}/api/ws`);
|
|
2295
|
+
ref.current.ws = ws;
|
|
2296
|
+
ws.onopen = () => {
|
|
2297
|
+
ws.send("ping");
|
|
2298
|
+
};
|
|
2299
|
+
ws.onmessage = (event) => {
|
|
2300
|
+
if (event.data === "pong") {
|
|
2301
|
+
if (ref.current.status === "disconnected") {
|
|
2302
|
+
invalidateCaches();
|
|
2303
|
+
}
|
|
2304
|
+
setStatus("connected");
|
|
2305
|
+
return;
|
|
2306
|
+
}
|
|
2307
|
+
try {
|
|
2308
|
+
const data = JSON.parse(event.data);
|
|
2309
|
+
if (data.command === "refresh") {
|
|
2310
|
+
const { eventType, srcPath } = data.event;
|
|
2311
|
+
const [targetName, fileName] = srcPath.split("/").slice(-2);
|
|
2312
|
+
const name = path.parse(fileName).name;
|
|
2313
|
+
const eventId = `${targetName}-${name}-${eventType}`;
|
|
2314
|
+
if (ref.current.artifactsUpdatedToastId == null) {
|
|
2315
|
+
setArtifactsUpdatedToastId(
|
|
2316
|
+
toaster.create({
|
|
2317
|
+
id: eventId,
|
|
2318
|
+
description: `Detected ${targetName} ${name} ${eventType}`,
|
|
2319
|
+
type: "info",
|
|
2320
|
+
duration: 5e3,
|
|
2321
|
+
closable: true
|
|
2322
|
+
})
|
|
2323
|
+
);
|
|
2324
|
+
}
|
|
2325
|
+
invalidateCaches();
|
|
2326
|
+
} else if (data.command === "relaunch") {
|
|
2327
|
+
setEnvStatus("relaunch");
|
|
2328
|
+
} else {
|
|
2329
|
+
const { id, title, description, status: status2, duration } = data.event;
|
|
2330
|
+
setArtifactsUpdatedToastId(
|
|
2331
|
+
toaster.create({
|
|
2332
|
+
id: id || "broadcast",
|
|
2333
|
+
title,
|
|
2334
|
+
description,
|
|
2335
|
+
type: status2 ?? "info",
|
|
2336
|
+
duration: duration ?? 5e3,
|
|
2337
|
+
closable: true
|
|
2338
|
+
})
|
|
2339
|
+
);
|
|
2340
|
+
}
|
|
2341
|
+
} catch (err) {
|
|
2342
|
+
console.error(err);
|
|
2343
|
+
}
|
|
2344
|
+
};
|
|
2345
|
+
ws.onerror = (err) => {
|
|
2346
|
+
console.error("An error occurred during Handling WebSockets", err);
|
|
2347
|
+
};
|
|
2348
|
+
ws.onclose = () => {
|
|
2349
|
+
setStatus((status2) => {
|
|
2350
|
+
if (status2 === "connected") {
|
|
2351
|
+
return "disconnected";
|
|
2352
|
+
}
|
|
2353
|
+
return status2;
|
|
2354
|
+
});
|
|
2355
|
+
ref.current.ws = void 0;
|
|
2356
|
+
};
|
|
2357
|
+
}, [invalidateCaches]);
|
|
2358
|
+
useEffect(() => {
|
|
2359
|
+
const refObj = ref.current;
|
|
2360
|
+
connect();
|
|
2361
|
+
return () => {
|
|
2362
|
+
if (refObj.ws) {
|
|
2363
|
+
refObj.ws.close();
|
|
2364
|
+
}
|
|
2365
|
+
};
|
|
2366
|
+
}, [connect]);
|
|
2367
|
+
return {
|
|
2368
|
+
connectionStatus: status,
|
|
2369
|
+
connect,
|
|
2370
|
+
envStatus
|
|
2371
|
+
};
|
|
2372
|
+
}
|
|
2373
|
+
function LineageGraphContextProvider({ children }) {
|
|
2374
|
+
const {
|
|
2375
|
+
idleTimeout,
|
|
2376
|
+
remainingSeconds,
|
|
2377
|
+
isEnabled,
|
|
2378
|
+
setDisconnected,
|
|
2379
|
+
resetConnection
|
|
2380
|
+
} = useIdleTimeout();
|
|
2381
|
+
const queryServerInfo = useQuery({
|
|
2382
|
+
queryKey: cacheKeys.lineage(),
|
|
2383
|
+
queryFn: getServerInfo
|
|
2384
|
+
});
|
|
2385
|
+
const queryRunAggregated = useQuery({
|
|
2386
|
+
queryKey: cacheKeys.runsAggregated(),
|
|
2387
|
+
queryFn: aggregateRuns
|
|
2388
|
+
});
|
|
2389
|
+
const lineageGraph = useMemo(() => {
|
|
2390
|
+
const lineage2 = queryServerInfo.data?.lineage;
|
|
2391
|
+
if (!lineage2?.base) {
|
|
2392
|
+
return void 0;
|
|
2393
|
+
}
|
|
2394
|
+
return buildLineageGraph(lineage2.base, lineage2.current, lineage2.diff);
|
|
2395
|
+
}, [queryServerInfo.data]);
|
|
2396
|
+
const errorMessage = queryServerInfo.error?.message;
|
|
2397
|
+
const {
|
|
2398
|
+
state_metadata: stateMetadata2,
|
|
2399
|
+
lineage,
|
|
2400
|
+
sqlmesh,
|
|
2401
|
+
demo: isDemoSite,
|
|
2402
|
+
codespace: isCodespace,
|
|
2403
|
+
review_mode: reviewMode,
|
|
2404
|
+
cloud_mode: cloudMode,
|
|
2405
|
+
file_mode: fileMode,
|
|
2406
|
+
filename: fileName,
|
|
2407
|
+
adapter_type: adapterType,
|
|
2408
|
+
git,
|
|
2409
|
+
pull_request: pullRequest,
|
|
2410
|
+
support_tasks: supportTasks
|
|
2411
|
+
} = queryServerInfo.data ?? {
|
|
2412
|
+
demo: false
|
|
2413
|
+
};
|
|
2414
|
+
const dbtBase = lineage?.base.manifest_metadata;
|
|
2415
|
+
const dbtCurrent = lineage?.current.manifest_metadata;
|
|
2416
|
+
const envInfo = {
|
|
2417
|
+
stateMetadata: stateMetadata2,
|
|
2418
|
+
adapterType,
|
|
2419
|
+
git,
|
|
2420
|
+
pullRequest,
|
|
2421
|
+
dbt: {
|
|
2422
|
+
base: dbtBase,
|
|
2423
|
+
current: dbtCurrent
|
|
2424
|
+
},
|
|
2425
|
+
sqlmesh
|
|
2426
|
+
};
|
|
2427
|
+
const { connectionStatus, connect, envStatus } = useLineageWatcher();
|
|
2428
|
+
useEffect(() => {
|
|
2429
|
+
if (connectionStatus === "disconnected") {
|
|
2430
|
+
setDisconnected();
|
|
2431
|
+
} else if (connectionStatus === "connected") {
|
|
2432
|
+
resetConnection();
|
|
2433
|
+
}
|
|
2434
|
+
}, [connectionStatus, setDisconnected, resetConnection]);
|
|
2435
|
+
const { data: flags, isLoading } = useRecceServerFlag();
|
|
2436
|
+
const { featureToggles, shareUrl } = useRecceInstanceContext();
|
|
2437
|
+
const [relaunchHintOpen, setRelaunchHintOpen] = useState(false);
|
|
2438
|
+
const [prevRelaunchCondition, setPrevRelaunchCondition] = useState(false);
|
|
2439
|
+
const queryClient = useQueryClient();
|
|
2440
|
+
const isActionAvailable = useCallback(
|
|
2441
|
+
(name) => {
|
|
2442
|
+
if (supportTasks) {
|
|
2443
|
+
return supportTasks[name] ?? true;
|
|
2444
|
+
}
|
|
2445
|
+
return true;
|
|
2446
|
+
},
|
|
2447
|
+
[supportTasks]
|
|
2448
|
+
);
|
|
2449
|
+
const shouldShowRelaunch = !isLoading && envStatus === "relaunch" && flags?.single_env_onboarding === true && flags.show_relaunch_hint;
|
|
2450
|
+
if (shouldShowRelaunch !== prevRelaunchCondition) {
|
|
2451
|
+
setPrevRelaunchCondition(shouldShowRelaunch);
|
|
2452
|
+
setRelaunchHintOpen(shouldShowRelaunch);
|
|
2453
|
+
}
|
|
2454
|
+
useEffect(() => {
|
|
2455
|
+
if (shouldShowRelaunch && relaunchHintOpen) {
|
|
2456
|
+
trackSingleEnvironment({ action: "target_base_added" });
|
|
2457
|
+
}
|
|
2458
|
+
}, [shouldShowRelaunch, relaunchHintOpen]);
|
|
2459
|
+
const handleRelaunchClose = () => {
|
|
2460
|
+
setRelaunchHintOpen(false);
|
|
2461
|
+
void markRelaunchHintCompleted();
|
|
2462
|
+
void queryClient.invalidateQueries({ queryKey: cacheKeys.flag() });
|
|
2463
|
+
};
|
|
2464
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2465
|
+
/* @__PURE__ */ jsx(
|
|
2466
|
+
LineageGraphContext.Provider,
|
|
2467
|
+
{
|
|
2468
|
+
value: {
|
|
2469
|
+
lineageGraph,
|
|
2470
|
+
retchLineageGraph: () => {
|
|
2471
|
+
void queryRunAggregated.refetch();
|
|
2472
|
+
},
|
|
2473
|
+
envInfo,
|
|
2474
|
+
reviewMode,
|
|
2475
|
+
cloudMode,
|
|
2476
|
+
fileMode,
|
|
2477
|
+
fileName,
|
|
2478
|
+
isDemoSite,
|
|
2479
|
+
isCodespace,
|
|
2480
|
+
error: errorMessage,
|
|
2481
|
+
supportTasks,
|
|
2482
|
+
isActionAvailable,
|
|
2483
|
+
isLoading: queryServerInfo.isLoading,
|
|
2484
|
+
runsAggregated: queryRunAggregated.data,
|
|
2485
|
+
refetchRunsAggregated: () => {
|
|
2486
|
+
void queryRunAggregated.refetch();
|
|
2487
|
+
}
|
|
2488
|
+
},
|
|
2489
|
+
children
|
|
2490
|
+
}
|
|
2491
|
+
),
|
|
2492
|
+
/* @__PURE__ */ jsx(
|
|
2493
|
+
MuiDialog,
|
|
2494
|
+
{
|
|
2495
|
+
open: connectionStatus === "disconnected",
|
|
2496
|
+
onClose: () => void 0,
|
|
2497
|
+
children: shareUrl && featureToggles.mode !== null ? /* @__PURE__ */ jsx(
|
|
2498
|
+
RecceInstanceDisconnectedModalContent,
|
|
2499
|
+
{
|
|
2500
|
+
shareUrl,
|
|
2501
|
+
mode: featureToggles.mode
|
|
2502
|
+
}
|
|
2503
|
+
) : /* @__PURE__ */ jsx(
|
|
2504
|
+
ServerDisconnectedModalContent,
|
|
2505
|
+
{
|
|
2506
|
+
connect,
|
|
2507
|
+
idleSeconds: (
|
|
2508
|
+
// Only show idle time if disconnected due to idle timeout
|
|
2509
|
+
// (idle timeout enabled AND remaining time was near zero)
|
|
2510
|
+
isEnabled && idleTimeout !== null && remainingSeconds !== null && remainingSeconds <= 5 ? idleTimeout - Math.max(0, remainingSeconds) : void 0
|
|
2511
|
+
)
|
|
2512
|
+
}
|
|
2513
|
+
)
|
|
2514
|
+
}
|
|
2515
|
+
),
|
|
2516
|
+
flags?.single_env_onboarding && /* @__PURE__ */ jsxs(MuiDialog, { open: relaunchHintOpen, onClose: handleRelaunchClose, children: [
|
|
2517
|
+
/* @__PURE__ */ jsx(DialogTitle, { children: "Target-base Added" }),
|
|
2518
|
+
/* @__PURE__ */ jsx(
|
|
2519
|
+
IconButton2,
|
|
2520
|
+
{
|
|
2521
|
+
"aria-label": "close",
|
|
2522
|
+
onClick: handleRelaunchClose,
|
|
2523
|
+
sx: {
|
|
2524
|
+
position: "absolute",
|
|
2525
|
+
right: 8,
|
|
2526
|
+
top: 8,
|
|
2527
|
+
color: "grey.500"
|
|
2528
|
+
},
|
|
2529
|
+
children: /* @__PURE__ */ jsx(IoClose, {})
|
|
2530
|
+
}
|
|
2531
|
+
),
|
|
2532
|
+
/* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(Typography28, { children: "Please restart the Recce server." }) }),
|
|
2533
|
+
/* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsx(
|
|
2534
|
+
Button10,
|
|
2535
|
+
{
|
|
2536
|
+
color: "iochmara",
|
|
2537
|
+
variant: "contained",
|
|
2538
|
+
onClick: handleRelaunchClose,
|
|
2539
|
+
children: "Got it!"
|
|
2540
|
+
}
|
|
2541
|
+
) })
|
|
2542
|
+
] })
|
|
2543
|
+
] });
|
|
2544
|
+
}
|
|
1728
2545
|
var useLineageGraphContext = () => useContext(LineageGraphContext);
|
|
1729
2546
|
var useRunsAggregated = () => {
|
|
1730
2547
|
const { runsAggregated, refetchRunsAggregated } = useLineageGraphContext();
|
|
@@ -1913,7 +2730,7 @@ var RunModal = ({
|
|
|
1913
2730
|
onClose();
|
|
1914
2731
|
};
|
|
1915
2732
|
return /* @__PURE__ */ jsxs(
|
|
1916
|
-
|
|
2733
|
+
MuiDialog,
|
|
1917
2734
|
{
|
|
1918
2735
|
open: isOpen,
|
|
1919
2736
|
onClose: handleClose,
|
|
@@ -1924,7 +2741,7 @@ var RunModal = ({
|
|
|
1924
2741
|
paper: { sx: { height: "75%", minHeight: "400px" } }
|
|
1925
2742
|
},
|
|
1926
2743
|
children: [
|
|
1927
|
-
/* @__PURE__ */ jsxs(
|
|
2744
|
+
/* @__PURE__ */ jsxs(DialogTitle, { sx: { display: "flex", alignItems: "center" }, children: [
|
|
1928
2745
|
title,
|
|
1929
2746
|
" ",
|
|
1930
2747
|
documentationUrl && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -1998,7 +2815,7 @@ var RunModal = ({
|
|
|
1998
2815
|
}
|
|
1999
2816
|
),
|
|
2000
2817
|
/* @__PURE__ */ jsx(
|
|
2001
|
-
|
|
2818
|
+
DialogContent,
|
|
2002
2819
|
{
|
|
2003
2820
|
sx: {
|
|
2004
2821
|
p: 0,
|
|
@@ -2016,7 +2833,7 @@ var RunModal = ({
|
|
|
2016
2833
|
) })
|
|
2017
2834
|
}
|
|
2018
2835
|
),
|
|
2019
|
-
/* @__PURE__ */ jsx(
|
|
2836
|
+
/* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsx(Stack24, { direction: "row", spacing: "10px", children: /* @__PURE__ */ jsx(
|
|
2020
2837
|
Button10,
|
|
2021
2838
|
{
|
|
2022
2839
|
disabled: !isReadyToExecute,
|
|
@@ -4580,7 +5397,7 @@ function renderIndexCell(params) {
|
|
|
4580
5397
|
const value = isRemoved ? baseIndex !== void 0 ? baseIndex : "-" : currentIndex !== void 0 ? currentIndex : "-";
|
|
4581
5398
|
return /* @__PURE__ */ jsx("span", { children: value });
|
|
4582
5399
|
}
|
|
4583
|
-
var MemoizedRenderIndexCell =
|
|
5400
|
+
var MemoizedRenderIndexCell = React12.memo(renderIndexCell);
|
|
4584
5401
|
MemoizedRenderIndexCell.displayName = "MemoizedRenderIndexCell";
|
|
4585
5402
|
function renderTypeCell(params) {
|
|
4586
5403
|
if (!params.data) {
|
|
@@ -4613,7 +5430,7 @@ function renderTypeCell(params) {
|
|
|
4613
5430
|
}
|
|
4614
5431
|
return /* @__PURE__ */ jsx("span", { children: isRemoved ? baseType : currentType });
|
|
4615
5432
|
}
|
|
4616
|
-
var MemoizedRenderTypeCell =
|
|
5433
|
+
var MemoizedRenderTypeCell = React12.memo(renderTypeCell);
|
|
4617
5434
|
MemoizedRenderTypeCell.displayName = "MemoizedRenderTypeCell";
|
|
4618
5435
|
|
|
4619
5436
|
// recce-source/js/src/lib/dataGrid/generators/toSchemaDataGrid.ts
|
|
@@ -7270,6 +8087,147 @@ var RecceActionContext = createContext({
|
|
|
7270
8087
|
return void 0;
|
|
7271
8088
|
}
|
|
7272
8089
|
});
|
|
8090
|
+
var useCloseModalEffect = (onClose) => {
|
|
8091
|
+
const pathname = usePathname();
|
|
8092
|
+
useEffect(() => {
|
|
8093
|
+
onClose();
|
|
8094
|
+
}, [onClose, pathname]);
|
|
8095
|
+
};
|
|
8096
|
+
function RecceActionContextProvider({
|
|
8097
|
+
children
|
|
8098
|
+
}) {
|
|
8099
|
+
const [action, setAction] = useState();
|
|
8100
|
+
const [isModalOpen, setModalOpen] = useState(false);
|
|
8101
|
+
const onModalOpen = useCallback(() => setModalOpen(true), []);
|
|
8102
|
+
const onModalClose = useCallback(() => setModalOpen(false), []);
|
|
8103
|
+
const [isRunResultOpen, setRunResultOpen] = useState(false);
|
|
8104
|
+
const onResultPaneOpen = useCallback(() => setRunResultOpen(true), []);
|
|
8105
|
+
const closeRunResult = useCallback(() => setRunResultOpen(false), []);
|
|
8106
|
+
const [isHistoryOpen, setHistoryOpen] = useState(false);
|
|
8107
|
+
const showHistory = useCallback(() => setHistoryOpen(true), []);
|
|
8108
|
+
const closeHistory = useCallback(() => setHistoryOpen(false), []);
|
|
8109
|
+
const [runId, setRunId] = useState();
|
|
8110
|
+
const [location, setLocation] = useAppLocation();
|
|
8111
|
+
const queryClient = useQueryClient();
|
|
8112
|
+
const showRunId = useCallback(
|
|
8113
|
+
async (runId2, refreshHistory) => {
|
|
8114
|
+
setRunId(runId2);
|
|
8115
|
+
onResultPaneOpen();
|
|
8116
|
+
if (refreshHistory !== false) {
|
|
8117
|
+
await queryClient.invalidateQueries({ queryKey: cacheKeys.runs() });
|
|
8118
|
+
}
|
|
8119
|
+
},
|
|
8120
|
+
[onResultPaneOpen, queryClient]
|
|
8121
|
+
);
|
|
8122
|
+
const clearRunResult = useCallback(() => {
|
|
8123
|
+
setRunId(void 0);
|
|
8124
|
+
closeRunResult();
|
|
8125
|
+
}, [closeRunResult]);
|
|
8126
|
+
const runAction = useCallback(
|
|
8127
|
+
async (type, params, options) => {
|
|
8128
|
+
try {
|
|
8129
|
+
const session = (/* @__PURE__ */ new Date()).getTime().toString();
|
|
8130
|
+
let lastRun = void 0;
|
|
8131
|
+
if (options?.showLast) {
|
|
8132
|
+
const runs = await searchRuns(type, params, 1);
|
|
8133
|
+
if (runs.length === 1) {
|
|
8134
|
+
lastRun = runs[0];
|
|
8135
|
+
}
|
|
8136
|
+
}
|
|
8137
|
+
const run = findByRunType(type);
|
|
8138
|
+
const RunResultView = run.RunResultView;
|
|
8139
|
+
const { title, RunForm } = run;
|
|
8140
|
+
if (RunResultView === void 0) {
|
|
8141
|
+
throw new Error(`Run type ${type} does not have a result view`);
|
|
8142
|
+
}
|
|
8143
|
+
if (RunForm == void 0 || !options?.showForm) {
|
|
8144
|
+
const { run_id } = await submitRun(type, params, {
|
|
8145
|
+
nowait: true,
|
|
8146
|
+
trackProps: options?.trackProps
|
|
8147
|
+
});
|
|
8148
|
+
await showRunId(run_id);
|
|
8149
|
+
await queryClient.invalidateQueries({ queryKey: cacheKeys.runs() });
|
|
8150
|
+
if (location.startsWith("/lineage")) {
|
|
8151
|
+
setLocation("/lineage");
|
|
8152
|
+
}
|
|
8153
|
+
} else {
|
|
8154
|
+
setAction({
|
|
8155
|
+
session,
|
|
8156
|
+
title,
|
|
8157
|
+
type,
|
|
8158
|
+
params,
|
|
8159
|
+
lastRun,
|
|
8160
|
+
options,
|
|
8161
|
+
RunForm
|
|
8162
|
+
});
|
|
8163
|
+
onModalOpen();
|
|
8164
|
+
}
|
|
8165
|
+
} catch (e) {
|
|
8166
|
+
toaster.create({
|
|
8167
|
+
title: "Failed to submit a run",
|
|
8168
|
+
description: e instanceof Error ? e.message : void 0,
|
|
8169
|
+
type: "error",
|
|
8170
|
+
duration: 5e3,
|
|
8171
|
+
closable: true
|
|
8172
|
+
});
|
|
8173
|
+
}
|
|
8174
|
+
},
|
|
8175
|
+
[onModalOpen, showRunId, location, setLocation, queryClient]
|
|
8176
|
+
);
|
|
8177
|
+
useCloseModalEffect(onModalClose);
|
|
8178
|
+
const handleExecute = async (type, params) => {
|
|
8179
|
+
try {
|
|
8180
|
+
onModalClose();
|
|
8181
|
+
const { run_id } = await submitRun(type, params, {
|
|
8182
|
+
nowait: true,
|
|
8183
|
+
trackProps: action?.options?.trackProps
|
|
8184
|
+
});
|
|
8185
|
+
await showRunId(run_id);
|
|
8186
|
+
} catch (e) {
|
|
8187
|
+
toaster.create({
|
|
8188
|
+
title: "Failed to submit a run",
|
|
8189
|
+
description: e instanceof Error ? e.message : void 0,
|
|
8190
|
+
type: "error",
|
|
8191
|
+
duration: 5e3,
|
|
8192
|
+
closable: true
|
|
8193
|
+
});
|
|
8194
|
+
}
|
|
8195
|
+
};
|
|
8196
|
+
return /* @__PURE__ */ jsxs(
|
|
8197
|
+
RecceActionContext.Provider,
|
|
8198
|
+
{
|
|
8199
|
+
value: {
|
|
8200
|
+
runAction,
|
|
8201
|
+
runId,
|
|
8202
|
+
showRunId,
|
|
8203
|
+
isRunResultOpen,
|
|
8204
|
+
closeRunResult,
|
|
8205
|
+
isHistoryOpen,
|
|
8206
|
+
closeHistory,
|
|
8207
|
+
showHistory,
|
|
8208
|
+
setHistoryOpen,
|
|
8209
|
+
clearRunResult
|
|
8210
|
+
},
|
|
8211
|
+
children: [
|
|
8212
|
+
action && /* @__PURE__ */ jsx(
|
|
8213
|
+
RunModal,
|
|
8214
|
+
{
|
|
8215
|
+
isOpen: isModalOpen,
|
|
8216
|
+
onClose: onModalClose,
|
|
8217
|
+
onExecute: handleExecute,
|
|
8218
|
+
title: action.title,
|
|
8219
|
+
type: action.type,
|
|
8220
|
+
params: action.params,
|
|
8221
|
+
initialRun: action.lastRun,
|
|
8222
|
+
RunForm: action.options?.showForm && action.RunForm ? action.RunForm : void 0
|
|
8223
|
+
},
|
|
8224
|
+
action.session
|
|
8225
|
+
),
|
|
8226
|
+
children
|
|
8227
|
+
]
|
|
8228
|
+
}
|
|
8229
|
+
);
|
|
8230
|
+
}
|
|
7273
8231
|
var useRecceActionContext = () => useContext(RecceActionContext);
|
|
7274
8232
|
|
|
7275
8233
|
// recce-source/js/src/lib/hooks/useClipBoardToast.tsx
|
|
@@ -7533,8 +8491,8 @@ function useImageDownloadModal() {
|
|
|
7533
8491
|
saveAs(imgBlob, fileName);
|
|
7534
8492
|
onClose();
|
|
7535
8493
|
};
|
|
7536
|
-
return /* @__PURE__ */ jsxs(
|
|
7537
|
-
/* @__PURE__ */ jsx(
|
|
8494
|
+
return /* @__PURE__ */ jsxs(MuiDialog, { open, onClose, maxWidth: "sm", fullWidth: true, children: [
|
|
8495
|
+
/* @__PURE__ */ jsx(DialogTitle, { children: "Screenshot Preview" }),
|
|
7538
8496
|
/* @__PURE__ */ jsx(
|
|
7539
8497
|
IconButton2,
|
|
7540
8498
|
{
|
|
@@ -7549,7 +8507,7 @@ function useImageDownloadModal() {
|
|
|
7549
8507
|
children: /* @__PURE__ */ jsx(IoClose, {})
|
|
7550
8508
|
}
|
|
7551
8509
|
),
|
|
7552
|
-
/* @__PURE__ */ jsxs(
|
|
8510
|
+
/* @__PURE__ */ jsxs(DialogContent, { children: [
|
|
7553
8511
|
/* @__PURE__ */ jsxs(Stack24, { sx: { px: "10px", gap: "10px" }, children: [
|
|
7554
8512
|
/* @__PURE__ */ jsxs(Stack24, { direction: "row", alignItems: "center", spacing: "5px", children: [
|
|
7555
8513
|
/* @__PURE__ */ jsx(Box34, { component: PiInfo, sx: { color: "error.main" } }),
|
|
@@ -7569,7 +8527,7 @@ function useImageDownloadModal() {
|
|
|
7569
8527
|
}
|
|
7570
8528
|
)
|
|
7571
8529
|
] }),
|
|
7572
|
-
/* @__PURE__ */ jsxs(
|
|
8530
|
+
/* @__PURE__ */ jsxs(DialogActions, { children: [
|
|
7573
8531
|
/* @__PURE__ */ jsx(Button10, { sx: { mr: 1.5 }, onClick: onClose, children: "Close" }),
|
|
7574
8532
|
/* @__PURE__ */ jsx(Button10, { color: "iochmara", variant: "contained", onClick: onDownload, children: "Download" })
|
|
7575
8533
|
] })
|
|
@@ -8106,7 +9064,7 @@ function GraphColumnNode(nodeProps) {
|
|
|
8106
9064
|
const selectedNode = viewOptions.column_level_lineage?.node_id;
|
|
8107
9065
|
const selectedColumn = viewOptions.column_level_lineage?.column;
|
|
8108
9066
|
const isFocus = column === selectedColumn && nodeId === selectedNode;
|
|
8109
|
-
const [isHovered, setIsHovered] =
|
|
9067
|
+
const [isHovered, setIsHovered] = React12.useState(false);
|
|
8110
9068
|
const isHighlighted = isNodeHighlighted(columnNodeId);
|
|
8111
9069
|
const isShowingChangeAnalysis = isNodeShowingChangeAnalysis(nodeId);
|
|
8112
9070
|
if (!showContent) {
|
|
@@ -9202,6 +10160,28 @@ var defaultQueryContext = {
|
|
|
9202
10160
|
}
|
|
9203
10161
|
};
|
|
9204
10162
|
var RecceQueryContext = createContext(defaultQueryContext);
|
|
10163
|
+
function RecceQueryContextProvider({ children }) {
|
|
10164
|
+
const [sqlQuery, setSqlQuery] = React12.useState(defaultSqlQuery);
|
|
10165
|
+
const [baseSqlQuery, setBaseSqlQuery] = React12.useState(defaultSqlQuery);
|
|
10166
|
+
const [isCustomQueries, setCustomQueries] = React12.useState(false);
|
|
10167
|
+
const [primaryKeys, setPrimaryKeys] = React12.useState();
|
|
10168
|
+
return /* @__PURE__ */ jsx(
|
|
10169
|
+
RecceQueryContext.Provider,
|
|
10170
|
+
{
|
|
10171
|
+
value: {
|
|
10172
|
+
setSqlQuery,
|
|
10173
|
+
sqlQuery,
|
|
10174
|
+
setPrimaryKeys,
|
|
10175
|
+
primaryKeys,
|
|
10176
|
+
isCustomQueries,
|
|
10177
|
+
setCustomQueries,
|
|
10178
|
+
baseSqlQuery,
|
|
10179
|
+
setBaseSqlQuery
|
|
10180
|
+
},
|
|
10181
|
+
children
|
|
10182
|
+
}
|
|
10183
|
+
);
|
|
10184
|
+
}
|
|
9205
10185
|
var useRecceQueryContext = () => useContext(RecceQueryContext);
|
|
9206
10186
|
var defaultRowCountStateContext = {
|
|
9207
10187
|
isNodesFetching: [],
|
|
@@ -9209,7 +10189,20 @@ var defaultRowCountStateContext = {
|
|
|
9209
10189
|
return void 0;
|
|
9210
10190
|
}
|
|
9211
10191
|
};
|
|
9212
|
-
createContext(defaultRowCountStateContext);
|
|
10192
|
+
var RowCountStateContext = createContext(defaultRowCountStateContext);
|
|
10193
|
+
function RowCountStateContextProvider({
|
|
10194
|
+
children
|
|
10195
|
+
}) {
|
|
10196
|
+
const [isNodesFetching, setIsNodesFetching] = React12.useState([]);
|
|
10197
|
+
return /* @__PURE__ */ jsx(
|
|
10198
|
+
RowCountStateContext.Provider,
|
|
10199
|
+
{
|
|
10200
|
+
value: { isNodesFetching, setIsNodesFetching },
|
|
10201
|
+
children
|
|
10202
|
+
}
|
|
10203
|
+
);
|
|
10204
|
+
}
|
|
10205
|
+
var useRowCountStateContext = () => useContext(RowCountStateContext);
|
|
9213
10206
|
var ContextMenu = ({ menuItems, open, onClose, x, y }) => {
|
|
9214
10207
|
const { featureToggles } = useRecceInstanceContext();
|
|
9215
10208
|
return /* @__PURE__ */ jsx(
|
|
@@ -10879,7 +11872,7 @@ var NodeSqlView = ({ node }) => {
|
|
|
10879
11872
|
}
|
|
10880
11873
|
),
|
|
10881
11874
|
/* @__PURE__ */ jsxs(
|
|
10882
|
-
|
|
11875
|
+
MuiDialog,
|
|
10883
11876
|
{
|
|
10884
11877
|
open: isOpen,
|
|
10885
11878
|
onClose: () => setIsOpen(false),
|
|
@@ -10889,7 +11882,7 @@ var NodeSqlView = ({ node }) => {
|
|
|
10889
11882
|
paper: { sx: { height: "75%", overflowY: "auto" } }
|
|
10890
11883
|
},
|
|
10891
11884
|
children: [
|
|
10892
|
-
/* @__PURE__ */ jsxs(
|
|
11885
|
+
/* @__PURE__ */ jsxs(DialogTitle, { sx: { display: "flex", alignItems: "center" }, children: [
|
|
10893
11886
|
isSingleEnvOnboarding ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
10894
11887
|
/* @__PURE__ */ jsx("code", { children: modelName }),
|
|
10895
11888
|
"\xA0Model Code"
|
|
@@ -10900,7 +11893,7 @@ var NodeSqlView = ({ node }) => {
|
|
|
10900
11893
|
/* @__PURE__ */ jsx(Box34, { sx: { flex: 1 } }),
|
|
10901
11894
|
/* @__PURE__ */ jsx(IconButton2, { size: "small", onClick: () => setIsOpen(false), children: /* @__PURE__ */ jsx(IoClose, {}) })
|
|
10902
11895
|
] }),
|
|
10903
|
-
/* @__PURE__ */ jsx(
|
|
11896
|
+
/* @__PURE__ */ jsx(DialogContent, { children: isSingleEnvOnboarding ? /* @__PURE__ */ jsx(
|
|
10904
11897
|
CodeEditor,
|
|
10905
11898
|
{
|
|
10906
11899
|
language: "sql",
|
|
@@ -11493,7 +12486,7 @@ function AuthModal({
|
|
|
11493
12486
|
}
|
|
11494
12487
|
};
|
|
11495
12488
|
return /* @__PURE__ */ jsxs(
|
|
11496
|
-
|
|
12489
|
+
MuiDialog,
|
|
11497
12490
|
{
|
|
11498
12491
|
open,
|
|
11499
12492
|
onClose: handleClose,
|
|
@@ -11503,9 +12496,9 @@ function AuthModal({
|
|
|
11503
12496
|
paper: { sx: { borderRadius: "1rem" } }
|
|
11504
12497
|
},
|
|
11505
12498
|
children: [
|
|
11506
|
-
authState !== "authenticating" && /* @__PURE__ */ jsx(
|
|
12499
|
+
authState !== "authenticating" && /* @__PURE__ */ jsx(DialogTitle, { sx: { textAlign: "center", fontSize: "1.5rem" }, children: content.title }),
|
|
11507
12500
|
authState !== "authenticating" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
11508
|
-
/* @__PURE__ */ jsxs(
|
|
12501
|
+
/* @__PURE__ */ jsxs(DialogContent, { className: "space-y-2 font-light", children: [
|
|
11509
12502
|
/* @__PURE__ */ jsx(Typography28, { children: "To enable sharing, get your token from Recce Cloud and launch your local instance with it." }),
|
|
11510
12503
|
/* @__PURE__ */ jsxs("ul", { className: "list-inside list-disc", children: [
|
|
11511
12504
|
/* @__PURE__ */ jsx("li", { children: "Share your instance with teammates via Recce Cloud." }),
|
|
@@ -11532,7 +12525,7 @@ function AuthModal({
|
|
|
11532
12525
|
)
|
|
11533
12526
|
] })
|
|
11534
12527
|
] }),
|
|
11535
|
-
/* @__PURE__ */ jsxs(
|
|
12528
|
+
/* @__PURE__ */ jsxs(DialogActions, { sx: { flexDirection: "column", gap: 1, px: 3, pb: 3 }, children: [
|
|
11536
12529
|
/* @__PURE__ */ jsxs(
|
|
11537
12530
|
Button10,
|
|
11538
12531
|
{
|
|
@@ -11583,7 +12576,7 @@ function AuthModal({
|
|
|
11583
12576
|
)
|
|
11584
12577
|
] })
|
|
11585
12578
|
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
11586
|
-
/* @__PURE__ */ jsx(
|
|
12579
|
+
/* @__PURE__ */ jsx(DialogContent, { className: "space-y-2 self-center font-light", children: /* @__PURE__ */ jsxs(Stack24, { spacing: 2, alignItems: "center", sx: { pt: "1rem" }, children: [
|
|
11587
12580
|
/* @__PURE__ */ jsx(
|
|
11588
12581
|
Box34,
|
|
11589
12582
|
{
|
|
@@ -11596,7 +12589,7 @@ function AuthModal({
|
|
|
11596
12589
|
/* @__PURE__ */ jsx(Typography28, { sx: { fontSize: "1.5rem", fontWeight: 500 }, children: "Reload to Finish" }),
|
|
11597
12590
|
/* @__PURE__ */ jsx(Typography28, { children: "Reload to complete connection to Recce Cloud" })
|
|
11598
12591
|
] }) }),
|
|
11599
|
-
/* @__PURE__ */ jsx(
|
|
12592
|
+
/* @__PURE__ */ jsx(DialogActions, { sx: { px: 3, pb: 3 }, children: /* @__PURE__ */ jsx(
|
|
11600
12593
|
Button10,
|
|
11601
12594
|
{
|
|
11602
12595
|
fullWidth: true,
|
|
@@ -11714,6 +12707,37 @@ async function shareState() {
|
|
|
11714
12707
|
)).data;
|
|
11715
12708
|
}
|
|
11716
12709
|
var ShareState = createContext(void 0);
|
|
12710
|
+
function RecceShareStateContextProvider({
|
|
12711
|
+
children
|
|
12712
|
+
}) {
|
|
12713
|
+
const [shareUrl, setShareUrl] = useState();
|
|
12714
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
12715
|
+
const [error, setError] = useState();
|
|
12716
|
+
const handleShareClick = async () => {
|
|
12717
|
+
setIsLoading(true);
|
|
12718
|
+
setError(void 0);
|
|
12719
|
+
setShareUrl(void 0);
|
|
12720
|
+
try {
|
|
12721
|
+
const response = await shareState();
|
|
12722
|
+
if (response.status !== "success") {
|
|
12723
|
+
setError(response.message);
|
|
12724
|
+
return;
|
|
12725
|
+
}
|
|
12726
|
+
setShareUrl(response.share_url);
|
|
12727
|
+
} catch (err) {
|
|
12728
|
+
setError(err.message);
|
|
12729
|
+
} finally {
|
|
12730
|
+
setIsLoading(false);
|
|
12731
|
+
}
|
|
12732
|
+
};
|
|
12733
|
+
return /* @__PURE__ */ jsx(
|
|
12734
|
+
ShareState.Provider,
|
|
12735
|
+
{
|
|
12736
|
+
value: { shareUrl, isLoading, error, handleShareClick },
|
|
12737
|
+
children
|
|
12738
|
+
}
|
|
12739
|
+
);
|
|
12740
|
+
}
|
|
11717
12741
|
var useRecceShareStateContext = () => {
|
|
11718
12742
|
const context = useContext(ShareState);
|
|
11719
12743
|
if (!context) {
|
|
@@ -12776,7 +13800,7 @@ function SandboxView({ isOpen, onClose, current }) {
|
|
|
12776
13800
|
trackPreviewChange({ action: "close", node: current?.name });
|
|
12777
13801
|
};
|
|
12778
13802
|
return /* @__PURE__ */ jsxs(
|
|
12779
|
-
|
|
13803
|
+
MuiDialog,
|
|
12780
13804
|
{
|
|
12781
13805
|
open: isOpen,
|
|
12782
13806
|
onClose: handleClose,
|
|
@@ -12868,7 +13892,7 @@ function SandboxView({ isOpen, onClose, current }) {
|
|
|
12868
13892
|
]
|
|
12869
13893
|
}
|
|
12870
13894
|
),
|
|
12871
|
-
/* @__PURE__ */ jsx(
|
|
13895
|
+
/* @__PURE__ */ jsx(DialogContent, { sx: { p: 0 }, children: /* @__PURE__ */ jsxs(
|
|
12872
13896
|
VSplit,
|
|
12873
13897
|
{
|
|
12874
13898
|
sizes: isRunResultOpen ? [50, 50] : [100, 0],
|
|
@@ -13898,7 +14922,7 @@ function useValueDiffAlertDialog() {
|
|
|
13898
14922
|
setOpen(false);
|
|
13899
14923
|
};
|
|
13900
14924
|
const ValueDiffAlertDialog = /* @__PURE__ */ jsxs(
|
|
13901
|
-
|
|
14925
|
+
MuiDialog,
|
|
13902
14926
|
{
|
|
13903
14927
|
open,
|
|
13904
14928
|
onClose: handleCancel,
|
|
@@ -13907,7 +14931,7 @@ function useValueDiffAlertDialog() {
|
|
|
13907
14931
|
"aria-labelledby": "value-diff-alert-dialog-title",
|
|
13908
14932
|
children: [
|
|
13909
14933
|
/* @__PURE__ */ jsxs(
|
|
13910
|
-
|
|
14934
|
+
DialogTitle,
|
|
13911
14935
|
{
|
|
13912
14936
|
id: "value-diff-alert-dialog-title",
|
|
13913
14937
|
sx: { fontSize: "1.125rem", fontWeight: "bold" },
|
|
@@ -13932,12 +14956,12 @@ function useValueDiffAlertDialog() {
|
|
|
13932
14956
|
children: /* @__PURE__ */ jsx(IoClose, {})
|
|
13933
14957
|
}
|
|
13934
14958
|
),
|
|
13935
|
-
/* @__PURE__ */ jsx(
|
|
14959
|
+
/* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(Stack24, { spacing: "20px", children: /* @__PURE__ */ jsxs(Box34, { children: [
|
|
13936
14960
|
"Value diff will be executed on ",
|
|
13937
14961
|
nodeCount,
|
|
13938
14962
|
" nodes in the Lineage, which can add extra costs to your bill."
|
|
13939
14963
|
] }) }) }),
|
|
13940
|
-
/* @__PURE__ */ jsxs(
|
|
14964
|
+
/* @__PURE__ */ jsxs(DialogActions, { sx: { gap: 0.5 }, children: [
|
|
13941
14965
|
/* @__PURE__ */ jsx(
|
|
13942
14966
|
Button10,
|
|
13943
14967
|
{
|
|
@@ -15485,14 +16509,14 @@ var CheckList = ({
|
|
|
15485
16509
|
]
|
|
15486
16510
|
}
|
|
15487
16511
|
) }) }),
|
|
15488
|
-
/* @__PURE__ */ jsxs(
|
|
15489
|
-
/* @__PURE__ */ jsxs(
|
|
16512
|
+
/* @__PURE__ */ jsxs(MuiDialog, { open, onClose: handleClose, maxWidth: "xs", fullWidth: true, children: [
|
|
16513
|
+
/* @__PURE__ */ jsxs(DialogTitle, { sx: { display: "flex", alignItems: "center" }, children: [
|
|
15490
16514
|
"Mark as Approved?",
|
|
15491
16515
|
/* @__PURE__ */ jsx(Box34, { sx: { flexGrow: 1 } }),
|
|
15492
16516
|
/* @__PURE__ */ jsx(IconButton2, { size: "small", onClick: handleClose, children: /* @__PURE__ */ jsx(IoClose, {}) })
|
|
15493
16517
|
] }),
|
|
15494
16518
|
/* @__PURE__ */ jsx(Divider, {}),
|
|
15495
|
-
/* @__PURE__ */ jsxs(
|
|
16519
|
+
/* @__PURE__ */ jsxs(DialogContent, { sx: { fontSize: "0.875rem" }, children: [
|
|
15496
16520
|
/* @__PURE__ */ jsx(Typography28, { children: "Please ensure you have reviewed the contents of this check before marking it as approved." }),
|
|
15497
16521
|
/* @__PURE__ */ jsx(
|
|
15498
16522
|
FormControlLabel4,
|
|
@@ -15512,7 +16536,7 @@ var CheckList = ({
|
|
|
15512
16536
|
)
|
|
15513
16537
|
] }),
|
|
15514
16538
|
/* @__PURE__ */ jsx(Divider, {}),
|
|
15515
|
-
/* @__PURE__ */ jsxs(
|
|
16539
|
+
/* @__PURE__ */ jsxs(DialogActions, { sx: { gap: 0 }, children: [
|
|
15516
16540
|
/* @__PURE__ */ jsx(Button10, { variant: "outlined", size: "small", onClick: handleClose, children: "Cancel" }),
|
|
15517
16541
|
/* @__PURE__ */ jsx(
|
|
15518
16542
|
Button10,
|
|
@@ -15711,13 +16735,13 @@ function truncateUrl(url, maxLength = 60) {
|
|
|
15711
16735
|
try {
|
|
15712
16736
|
const urlObj = new URL(url);
|
|
15713
16737
|
const domain = urlObj.hostname;
|
|
15714
|
-
const
|
|
16738
|
+
const path2 = urlObj.pathname + urlObj.search + urlObj.hash;
|
|
15715
16739
|
if (domain.length >= maxLength - 3) {
|
|
15716
16740
|
return domain.substring(0, maxLength - 3) + "...";
|
|
15717
16741
|
}
|
|
15718
16742
|
const remainingLength = maxLength - domain.length - 3;
|
|
15719
|
-
if (
|
|
15720
|
-
return `${domain}${
|
|
16743
|
+
if (path2.length > remainingLength) {
|
|
16744
|
+
return `${domain}${path2.substring(0, remainingLength)}...`;
|
|
15721
16745
|
}
|
|
15722
16746
|
return url;
|
|
15723
16747
|
} catch {
|
|
@@ -15732,7 +16756,7 @@ function ExternalLinkConfirmDialog({
|
|
|
15732
16756
|
}) {
|
|
15733
16757
|
const cancelRef = useRef(null);
|
|
15734
16758
|
return /* @__PURE__ */ jsxs(
|
|
15735
|
-
|
|
16759
|
+
MuiDialog,
|
|
15736
16760
|
{
|
|
15737
16761
|
open: isOpen,
|
|
15738
16762
|
onClose: onCancel,
|
|
@@ -15741,7 +16765,7 @@ function ExternalLinkConfirmDialog({
|
|
|
15741
16765
|
"aria-labelledby": "external-link-dialog-title",
|
|
15742
16766
|
children: [
|
|
15743
16767
|
/* @__PURE__ */ jsxs(
|
|
15744
|
-
|
|
16768
|
+
DialogTitle,
|
|
15745
16769
|
{
|
|
15746
16770
|
id: "external-link-dialog-title",
|
|
15747
16771
|
sx: { display: "flex", alignItems: "center", gap: 1 },
|
|
@@ -15765,7 +16789,7 @@ function ExternalLinkConfirmDialog({
|
|
|
15765
16789
|
children: /* @__PURE__ */ jsx(IoClose, {})
|
|
15766
16790
|
}
|
|
15767
16791
|
),
|
|
15768
|
-
/* @__PURE__ */ jsxs(
|
|
16792
|
+
/* @__PURE__ */ jsxs(DialogContent, { children: [
|
|
15769
16793
|
/* @__PURE__ */ jsx(Typography28, { sx: { mb: 1.5 }, children: "This link will take you to an external website outside of Recce. Are you sure you want to continue?" }),
|
|
15770
16794
|
/* @__PURE__ */ jsx(
|
|
15771
16795
|
Box34,
|
|
@@ -15794,7 +16818,7 @@ function ExternalLinkConfirmDialog({
|
|
|
15794
16818
|
}
|
|
15795
16819
|
)
|
|
15796
16820
|
] }),
|
|
15797
|
-
/* @__PURE__ */ jsxs(
|
|
16821
|
+
/* @__PURE__ */ jsxs(DialogActions, { sx: { gap: 1 }, children: [
|
|
15798
16822
|
/* @__PURE__ */ jsx(Button10, { ref: cancelRef, variant: "outlined", onClick: onCancel, children: "Cancel" }),
|
|
15799
16823
|
/* @__PURE__ */ jsx(Button10, { color: "iochmara", variant: "contained", onClick: onConfirm, children: "Open Link" })
|
|
15800
16824
|
] })
|
|
@@ -16537,6 +17561,19 @@ var RecceCheckContext = createContext({
|
|
|
16537
17561
|
return void 0;
|
|
16538
17562
|
}
|
|
16539
17563
|
});
|
|
17564
|
+
function RecceCheckContextProvider({ children }) {
|
|
17565
|
+
const [selectCheckId, setSelectCheckId] = React12.useState("");
|
|
17566
|
+
return /* @__PURE__ */ jsx(
|
|
17567
|
+
RecceCheckContext.Provider,
|
|
17568
|
+
{
|
|
17569
|
+
value: {
|
|
17570
|
+
setLatestSelectedCheckId: setSelectCheckId,
|
|
17571
|
+
latestSelectedCheckId: selectCheckId
|
|
17572
|
+
},
|
|
17573
|
+
children
|
|
17574
|
+
}
|
|
17575
|
+
);
|
|
17576
|
+
}
|
|
16540
17577
|
var useRecceCheckContext = () => useContext(RecceCheckContext);
|
|
16541
17578
|
function CheckBreadcrumb({ name, setName }) {
|
|
16542
17579
|
const [isEditing, setIsEditing] = useState(false);
|
|
@@ -17577,15 +18614,15 @@ function CheckDetail({
|
|
|
17577
18614
|
}
|
|
17578
18615
|
) }),
|
|
17579
18616
|
/* @__PURE__ */ jsxs(
|
|
17580
|
-
|
|
18617
|
+
MuiDialog,
|
|
17581
18618
|
{
|
|
17582
18619
|
open: isPresetCheckTemplateOpen,
|
|
17583
18620
|
onClose: () => setIsPresetCheckTemplateOpen(false),
|
|
17584
18621
|
maxWidth: "md",
|
|
17585
18622
|
fullWidth: true,
|
|
17586
18623
|
children: [
|
|
17587
|
-
/* @__PURE__ */ jsx(
|
|
17588
|
-
/* @__PURE__ */ jsxs(
|
|
18624
|
+
/* @__PURE__ */ jsx(DialogTitle, { children: "Preset Check Template" }),
|
|
18625
|
+
/* @__PURE__ */ jsxs(DialogContent, { children: [
|
|
17589
18626
|
/* @__PURE__ */ jsxs(Typography28, { variant: "subtitle2", fontWeight: "bold", sx: { mb: 2 }, children: [
|
|
17590
18627
|
"Please",
|
|
17591
18628
|
" ",
|
|
@@ -17621,7 +18658,7 @@ function CheckDetail({
|
|
|
17621
18658
|
] }),
|
|
17622
18659
|
/* @__PURE__ */ jsx(PresetCheckTemplateView, { yamlTemplate: presetCheckTemplate })
|
|
17623
18660
|
] }),
|
|
17624
|
-
/* @__PURE__ */ jsx(
|
|
18661
|
+
/* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsx(
|
|
17625
18662
|
IconButton2,
|
|
17626
18663
|
{
|
|
17627
18664
|
size: "small",
|
|
@@ -17901,7 +18938,7 @@ function DateDividedRunHistoryItem({
|
|
|
17901
18938
|
},
|
|
17902
18939
|
[setLocation]
|
|
17903
18940
|
);
|
|
17904
|
-
return /* @__PURE__ */ jsxs(
|
|
18941
|
+
return /* @__PURE__ */ jsxs(React12.Fragment, { children: [
|
|
17905
18942
|
shouldRenderDateSegment && /* @__PURE__ */ jsx(DateSegmentItem, { runAt: run.run_at }, currentDate),
|
|
17906
18943
|
/* @__PURE__ */ jsx(
|
|
17907
18944
|
RunListItem,
|
|
@@ -18254,10 +19291,13 @@ function useVersionNumber() {
|
|
|
18254
19291
|
}, []);
|
|
18255
19292
|
return { version, latestVersion };
|
|
18256
19293
|
}
|
|
19294
|
+
function RecceContextProvider({ children }) {
|
|
19295
|
+
return /* @__PURE__ */ jsx(RecceInstanceInfoProvider, { children: /* @__PURE__ */ jsx(RecceShareStateContextProvider, { children: /* @__PURE__ */ jsx(RecceQueryContextProvider, { children: /* @__PURE__ */ jsx(LineageGraphContextProvider, { children: /* @__PURE__ */ jsx(RowCountStateContextProvider, { children: /* @__PURE__ */ jsx(RecceActionContextProvider, { children: /* @__PURE__ */ jsx(RecceCheckContextProvider, { children }) }) }) }) }) }) });
|
|
19296
|
+
}
|
|
18257
19297
|
|
|
18258
19298
|
// src/index.ts
|
|
18259
19299
|
var VERSION = "0.1.0";
|
|
18260
19300
|
|
|
18261
|
-
export { ChangeSummary, CheckBreadcrumb, CheckDescription, CheckDetail, CheckList, ColumnNameCell, DiffText, DisableTooltipMessages, GraphColumnNode, GraphEdge, GraphNode, HSplit, HistogramChart, HistogramDiffForm, HistogramDiffResultView, HistoryToggle, IconEdit, IconExport, IconImport, IconInfo, IconSave, IconSync, LineageDiffView, LineagePage, LineageView, LineageViewContext, LineageViewTopBar, ModelRowCount, MuiProvider, mui_provider_default as MuiProviderDefault, NodeSqlView, NodeView, PUBLIC_API_URL, PUBLIC_CLOUD_WEB_URL, ProfileDiffForm, ProfileDiffResultView, QueryDiffResultView, QueryForm, QueryPage, QueryResultView, RECCE_SUPPORT_CALENDAR_URL, ResourceTypeTag, RowCountDiffResultView, RowCountDiffTag, RunList, RunModal, RunPage, RunStatusAndDate, RunToolbar, RunView, SchemaDiffView, SchemaSummary, SchemaView, ScreenshotBox, ScreenshotDataGrid, SqlEditor_default as SqlEditor, SquareIcon, SummaryView, Toaster, ToasterProvider, TopKDiffForm, TopKDiffResultView, TopKSummaryList, VERSION, VSplit, ValueDiffForm, aggregateRuns, axiosClient, cancelRun, connectToCloud, createCheckByRun, createLineageDiffCheck, createSchemaDiffCheck, createSimpleCheck, deleteCheck, exportState, fetchGitHubAvatar, fetchModelRowCount, fetchUser, getCheck, getCll, getLineage, getLineageDiff, getLineageWithError, getModelInfo, getRun, getServerFlag, getServerInfo, importState, isStateSyncing, listChecks, listRuns, localStorageKeys, markAsPresetCheck, markOnboardingCompleted, markRelaunchHintCompleted, queryModelRowCount, queryRowCount, reactQueryClient, rename, reorderChecks, saveAs2 as saveAs, searchRuns, select, sessionStorageKeys, shareState, submitProfileDiff, submitQuery, submitQueryBase, submitQueryDiff, submitRowCountDiff, submitRun, submitRunFromCheck, submitValueDiff, submitValueDiffDetail, syncState, updateCheck, useCheckToast, useChecks, useClipBoardToast, useLineageViewContext, useRecceInstanceInfo, useToaster, useValueDiffAlertDialog_default as useValueDiffAlertDialog, useVersionNumber, waitRun };
|
|
19301
|
+
export { ChangeSummary, CheckBreadcrumb, CheckDescription, CheckDetail, CheckList, ColumnNameCell, DiffText, DisableTooltipMessages, GraphColumnNode, GraphEdge, GraphNode, HSplit, HistogramChart, HistogramDiffForm, HistogramDiffResultView, HistoryToggle, IconEdit, IconExport, IconImport, IconInfo, IconSave, IconSync, IdleTimeoutProvider, LineageDiffView, LineageGraphContextProvider, LineagePage, LineageView, LineageViewContext, LineageViewTopBar, ModelRowCount, MuiProvider, mui_provider_default as MuiProviderDefault, NodeSqlView, NodeView, PUBLIC_API_URL, PUBLIC_CLOUD_WEB_URL, ProfileDiffForm, ProfileDiffResultView, QueryDiffResultView, QueryForm, QueryPage, QueryResultView, RECCE_SUPPORT_CALENDAR_URL, RecceActionContextProvider, RecceCheckContextProvider, RecceContextProvider, RecceInstanceInfoProvider, RecceQueryContextProvider, RecceShareStateContextProvider, ResourceTypeTag, RowCountDiffResultView, RowCountDiffTag, RowCountStateContextProvider, RunList, RunModal, RunPage, RunStatusAndDate, RunToolbar, RunView, SchemaDiffView, SchemaSummary, SchemaView, ScreenshotBox, ScreenshotDataGrid, SqlEditor_default as SqlEditor, SquareIcon, SummaryView, Toaster, ToasterProvider, TopKDiffForm, TopKDiffResultView, TopKSummaryList, VERSION, VSplit, ValueDiffForm, aggregateRuns, axiosClient, cancelRun, connectToCloud, createCheckByRun, createLineageDiffCheck, createSchemaDiffCheck, createSimpleCheck, deleteCheck, exportState, fetchGitHubAvatar, fetchModelRowCount, fetchUser, getCheck, getCll, getLineage, getLineageDiff, getLineageWithError, getModelInfo, getRun, getServerFlag, getServerInfo, importState, isStateSyncing, listChecks, listRuns, localStorageKeys, markAsPresetCheck, markOnboardingCompleted, markRelaunchHintCompleted, queryModelRowCount, queryRowCount, reactQueryClient, rename, reorderChecks, saveAs2 as saveAs, searchRuns, select, sessionStorageKeys, shareState, submitProfileDiff, submitQuery, submitQueryBase, submitQueryDiff, submitRowCountDiff, submitRun, submitRunFromCheck, submitValueDiff, submitValueDiffDetail, syncState, updateCheck, useCheckToast, useChecks, useClipBoardToast, useIdleTimeout, useLineageGraphContext, useLineageViewContext, useRecceActionContext, useRecceCheckContext, useRecceInstanceContext, useRecceInstanceInfo, useRecceQueryContext, useRecceShareStateContext, useRowCountStateContext, useRunsAggregated, useToaster, useValueDiffAlertDialog_default as useValueDiffAlertDialog, useVersionNumber, waitRun };
|
|
18262
19302
|
//# sourceMappingURL=index.mjs.map
|
|
18263
19303
|
//# sourceMappingURL=index.mjs.map
|