@malloy-publisher/sdk 0.0.382-dev → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +115 -95
- package/TREE_SHAKING.md +16 -11
- package/bunfig.toml +7 -0
- package/dist/ServerProvider-CTopDUWW.cjs.js +1 -0
- package/dist/ServerProvider-DUFPY6Rv.es.js +4072 -0
- package/dist/client/api.d.ts +3718 -1507
- package/dist/client/configuration.d.ts +1 -1
- package/dist/client/index.cjs.js +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.es.js +85 -59
- package/dist/components/Connections/EditConnectionDialog.d.ts +2 -1
- package/dist/components/Connections/common.d.ts +8 -2
- package/dist/components/Dashboard/Dashboard.d.ts +49 -0
- package/dist/components/Dashboard/DashboardTile.d.ts +48 -0
- package/dist/components/Dashboard/index.d.ts +2 -0
- package/dist/components/DataAppViewer/DataAppViewer.d.ts +23 -0
- package/dist/components/DataAppViewer/index.d.ts +1 -0
- package/dist/components/Environment/Environment.d.ts +6 -0
- package/dist/components/Environment/index.d.ts +2 -0
- package/dist/components/Home/AddEnvironmentDialog.d.ts +1 -0
- package/dist/components/Home/DeleteEnvironmentDialog.d.ts +5 -0
- package/dist/components/Home/EditEnvironmentDialog.d.ts +7 -0
- package/dist/components/Home/Home.d.ts +2 -2
- package/dist/components/Materializations/CreateEnvMaterializationDialog.d.ts +14 -0
- package/dist/components/Materializations/CreateMaterializationDialog.d.ts +10 -0
- package/dist/components/Materializations/DeleteMaterializationDialog.d.ts +7 -0
- package/dist/components/Materializations/EnvironmentMaterializations.d.ts +7 -0
- package/dist/components/Materializations/ManifestView.d.ts +13 -0
- package/dist/components/Materializations/MaterializationDetailDialog.d.ts +9 -0
- package/dist/components/Materializations/MaterializationRunsList.d.ts +15 -0
- package/dist/components/Materializations/Materializations.d.ts +7 -0
- package/dist/components/Materializations/ScheduleCard.d.ts +20 -0
- package/dist/components/Materializations/SectionLabel.d.ts +10 -0
- package/dist/components/Materializations/SetScheduleDialog.d.ts +11 -0
- package/dist/components/Materializations/TriggerChip.d.ts +10 -0
- package/dist/components/Materializations/cron.d.ts +23 -0
- package/dist/components/Materializations/index.d.ts +2 -0
- package/dist/components/Materializations/utils.d.ts +46 -0
- package/dist/components/Notebook/Notebook.d.ts +47 -4
- package/dist/components/Notebook/NotebookCell.d.ts +37 -1
- package/dist/components/Notebook/runPlan.d.ts +29 -0
- package/dist/components/Notebook/types.d.ts +10 -0
- package/dist/components/Package/ContentTypeIcon.d.ts +31 -0
- package/dist/components/Package/Package.d.ts +1 -4
- package/dist/components/RenderedResult/RenderedResult.d.ts +7 -1
- package/dist/components/RenderedResult/ResultContainer.d.ts +5 -1
- package/dist/components/RenderedResult/renderLogs.d.ts +6 -0
- package/dist/components/ResultsDialog.d.ts +6 -1
- package/dist/components/ServerProvider.d.ts +28 -4
- package/dist/components/click_helper.d.ts +10 -1
- package/dist/components/drill/index.d.ts +3 -0
- package/dist/components/drill/markDrillableCells.d.ts +55 -0
- package/dist/components/drill/resolveDrill.d.ts +139 -0
- package/dist/components/drill/useDrill.d.ts +63 -0
- package/dist/components/given/GivenInput.d.ts +52 -0
- package/dist/components/given/GivensPanel.d.ts +47 -0
- package/dist/components/given/filterValue.d.ts +97 -0
- package/dist/components/given/index.d.ts +2 -0
- package/dist/components/given/paramCodec.d.ts +60 -0
- package/dist/components/given/utils.d.ts +17 -0
- package/dist/components/highlighter.d.ts +6 -1
- package/dist/components/index.d.ts +7 -2
- package/dist/components/styles.d.ts +47 -0
- package/dist/constants/docLinks.d.ts +12 -0
- package/dist/{core-YNpOLuB1.cjs.js → core-hLahnv0W.cjs.js} +1 -1
- package/dist/{core-CjeTkq8O.es.js → core-lb28vQkR.es.js} +1 -1
- package/dist/github-dark-BKL9xNgN.cjs.js +1 -0
- package/dist/github-dark-DenFmJkN.es.js +4 -0
- package/dist/hooks/givenValue.d.ts +10 -0
- package/dist/hooks/index.d.ts +4 -0
- package/dist/hooks/useDimensionFiltersFromSpec.d.ts +3 -3
- package/dist/hooks/useDimensionFiltersQuery.d.ts +3 -3
- package/dist/hooks/useDimensionalFilterRangeData.d.ts +4 -4
- package/dist/hooks/useGivensState.d.ts +64 -0
- package/dist/hooks/useModelGivens.d.ts +10 -0
- package/dist/hooks/useSuggestOptions.d.ts +78 -0
- package/dist/index-DvEanVgc.cjs.js +339 -0
- package/dist/{index-DRDu9kIV.es.js → index-txw04ZbN.es.js} +40531 -27964
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.es.js +79 -48
- package/dist/malloy-explorer.css +12 -1
- package/dist/sdk.css +1 -1
- package/dist/theme/ThemeContext.d.ts +45 -0
- package/dist/theme/buildMalloyExplicitTheme.d.ts +34 -0
- package/dist/theme/buildTableCssVars.d.ts +25 -0
- package/dist/theme/buildVegaThemeOverride.d.ts +16 -0
- package/dist/theme/defaults.d.ts +7 -0
- package/dist/theme/index.d.ts +8 -0
- package/dist/theme/keys.d.ts +20 -0
- package/dist/theme/readChartAnnotations.d.ts +23 -0
- package/dist/theme/resolveTheme.d.ts +22 -0
- package/dist/theme/types.d.ts +70 -0
- package/dist/utils/dataAppEmbed.d.ts +44 -0
- package/dist/utils/formatting.d.ts +1 -1
- package/dist/utils/malloyString.d.ts +7 -0
- package/dist/utils/parsing.d.ts +2 -2
- package/dist/utils/queryClient.d.ts +5 -0
- package/package.json +19 -8
- package/src/client-entry.ts +3 -0
- package/src/components/AnalyzePackageButton.tsx +9 -3
- package/src/components/ApiErrorDisplay.tsx +3 -0
- package/src/components/Connections/AddConnectionDialog.tsx +30 -2
- package/src/components/Connections/DeleteConnectionDialog.tsx +14 -3
- package/src/components/Connections/EditConnectionDialog.tsx +33 -4
- package/src/components/Connections/common.ts +64 -1
- package/src/components/DOMElement/DOMElement.tsx +3 -0
- package/src/components/DOMElement/index.ts +3 -0
- package/src/components/Dashboard/Dashboard.tsx +398 -0
- package/src/components/Dashboard/DashboardTile.tsx +153 -0
- package/src/components/Dashboard/index.ts +5 -0
- package/src/components/DataAppViewer/DataAppViewer.tsx +214 -0
- package/src/components/DataAppViewer/index.ts +4 -0
- package/src/components/{Project → Environment}/About.tsx +11 -4
- package/src/components/Environment/AddPackageDialog.tsx +202 -0
- package/src/components/{Project → Environment}/ConnectionExplorer.tsx +17 -14
- package/src/components/Environment/Connections.tsx +391 -0
- package/src/components/{Project → Environment}/DeletePackageDialog.tsx +8 -4
- package/src/components/{Project → Environment}/EditPackageDialog.tsx +21 -13
- package/src/components/Environment/Environment.tsx +89 -0
- package/src/components/Environment/Packages.tsx +206 -0
- package/src/components/Environment/index.ts +5 -0
- package/src/components/Home/{AddProjectDialog.tsx → AddEnvironmentDialog.tsx} +25 -19
- package/src/components/Home/{DeleteProjectDialog.tsx → DeleteEnvironmentDialog.tsx} +20 -15
- package/src/components/Home/{EditProjectDialog.tsx → EditEnvironmentDialog.tsx} +35 -28
- package/src/components/Home/Home.tsx +386 -408
- package/src/components/Home/index.ts +3 -0
- package/src/components/Loading.tsx +3 -0
- package/src/components/Materializations/CreateEnvMaterializationDialog.tsx +179 -0
- package/src/components/Materializations/CreateMaterializationDialog.tsx +112 -0
- package/src/components/Materializations/DeleteMaterializationDialog.tsx +109 -0
- package/src/components/Materializations/EnvironmentMaterializations.tsx +267 -0
- package/src/components/Materializations/ManifestView.tsx +87 -0
- package/src/components/Materializations/MaterializationDetailDialog.tsx +259 -0
- package/src/components/Materializations/MaterializationRunsList.tsx +256 -0
- package/src/components/Materializations/Materializations.tsx +355 -0
- package/src/components/Materializations/ScheduleCard.tsx +231 -0
- package/src/components/Materializations/SectionLabel.tsx +30 -0
- package/src/components/Materializations/SetScheduleDialog.tsx +162 -0
- package/src/components/Materializations/TriggerChip.tsx +44 -0
- package/src/components/Materializations/cron.ts +124 -0
- package/src/components/Materializations/index.ts +5 -0
- package/src/components/Materializations/utils.ts +145 -0
- package/src/components/Model/Model.tsx +44 -2
- package/src/components/Model/ModelCell.tsx +14 -5
- package/src/components/Model/ModelExplorer.tsx +3 -0
- package/src/components/Model/ModelExplorerDialog.tsx +4 -1
- package/src/components/Model/SourcesExplorer.tsx +9 -6
- package/src/components/Model/index.ts +3 -0
- package/src/components/Model/useModelData.ts +6 -3
- package/src/components/Notebook/Notebook.tsx +475 -339
- package/src/components/Notebook/NotebookCell.tsx +264 -25
- package/src/components/Notebook/index.ts +3 -0
- package/src/components/Notebook/runPlan.spec.ts +155 -0
- package/src/components/Notebook/runPlan.ts +67 -0
- package/src/components/Notebook/types.ts +14 -0
- package/src/components/Package/ContentTypeIcon.spec.ts +91 -0
- package/src/components/Package/ContentTypeIcon.tsx +177 -0
- package/src/components/Package/FileTreeView.tsx +3 -0
- package/src/components/Package/Models.tsx +7 -4
- package/src/components/Package/Package.tsx +666 -59
- package/src/components/Package/index.ts +3 -0
- package/src/components/QueryResult/QueryResult.tsx +17 -8
- package/src/components/QueryResult/index.ts +3 -0
- package/src/components/RenderedResult/RenderedResult.tsx +685 -67
- package/src/components/RenderedResult/ResultContainer.tsx +71 -2
- package/src/components/RenderedResult/index.ts +3 -0
- package/src/components/RenderedResult/renderLogs.spec.ts +58 -0
- package/src/components/RenderedResult/renderLogs.ts +43 -0
- package/src/components/ResultsDialog.tsx +13 -1
- package/src/components/ServerProvider.tsx +175 -51
- package/src/components/Workbook/BrowserWorkbookStorage.ts +3 -0
- package/src/components/Workbook/EditableMalloyCell.tsx +3 -0
- package/src/components/Workbook/ModelPicker.tsx +7 -4
- package/src/components/Workbook/MutableCell.tsx +10 -5
- package/src/components/Workbook/Workbook.tsx +8 -5
- package/src/components/Workbook/WorkbookList.tsx +3 -0
- package/src/components/Workbook/WorkbookManager.ts +3 -0
- package/src/components/Workbook/WorkbookStorage.ts +3 -0
- package/src/components/Workbook/WorkbookStorageProvider.tsx +3 -0
- package/src/components/Workbook/index.ts +3 -0
- package/src/components/click_helper.ts +17 -1
- package/src/components/drill/index.ts +28 -0
- package/src/components/drill/markDrillableCells.dom.spec.ts +313 -0
- package/src/components/drill/markDrillableCells.spec.ts +109 -0
- package/src/components/drill/markDrillableCells.ts +314 -0
- package/src/components/drill/resolveDrill.spec.ts +449 -0
- package/src/components/drill/resolveDrill.ts +375 -0
- package/src/components/drill/useDrill.tsx +203 -0
- package/src/components/filter/DimensionFilter.tsx +3 -0
- package/src/components/filter/index.ts +3 -0
- package/src/components/filter/utils.ts +16 -5
- package/src/components/given/GivenInput.spec.tsx +689 -0
- package/src/components/given/GivenInput.tsx +801 -0
- package/src/components/given/GivensPanel.spec.tsx +175 -0
- package/src/components/given/GivensPanel.tsx +195 -0
- package/src/components/given/filterValue.spec.ts +364 -0
- package/src/components/given/filterValue.ts +207 -0
- package/src/components/given/index.ts +9 -0
- package/src/components/given/paramCodec.spec.ts +857 -0
- package/src/components/given/paramCodec.ts +483 -0
- package/src/components/given/utils.spec.ts +60 -0
- package/src/components/given/utils.ts +79 -0
- package/src/components/highlighter.ts +22 -5
- package/src/components/index.ts +10 -2
- package/src/components/styles.ts +82 -33
- package/src/constants/docLinks.spec.ts +54 -0
- package/src/constants/docLinks.ts +46 -0
- package/src/hooks/givenValue.ts +13 -0
- package/src/hooks/index.ts +13 -0
- package/src/hooks/useDimensionFilters.ts +4 -7
- package/src/hooks/useDimensionFiltersFromSpec.ts +8 -5
- package/src/hooks/useDimensionFiltersQuery.ts +10 -13
- package/src/hooks/useDimensionalFilterRangeData.ts +11 -14
- package/src/hooks/useGivensState.spec.ts +449 -0
- package/src/hooks/useGivensState.ts +340 -0
- package/src/hooks/useModelGivens.ts +29 -0
- package/src/hooks/useQueryWithApiError.ts +3 -0
- package/src/hooks/useRawQueryData.ts +6 -3
- package/src/hooks/useSuggestOptions.spec.ts +112 -0
- package/src/hooks/useSuggestOptions.ts +263 -0
- package/src/index.ts +10 -1
- package/src/react-app-env.d.ts +3 -0
- package/src/theme/ThemeContext.tsx +86 -0
- package/src/theme/buildMalloyExplicitTheme.ts +61 -0
- package/src/theme/buildTableCssVars.spec.ts +67 -0
- package/src/theme/buildTableCssVars.ts +67 -0
- package/src/theme/buildVegaThemeOverride.spec.ts +56 -0
- package/src/theme/buildVegaThemeOverride.ts +47 -0
- package/src/theme/defaults.ts +78 -0
- package/src/theme/index.ts +11 -0
- package/src/theme/keys.ts +32 -0
- package/src/theme/readChartAnnotations.spec.ts +58 -0
- package/src/theme/readChartAnnotations.ts +69 -0
- package/src/theme/resolveTheme.spec.ts +160 -0
- package/src/theme/resolveTheme.ts +121 -0
- package/src/theme/types.ts +79 -0
- package/src/utils/dataAppEmbed.spec.ts +63 -0
- package/src/utils/dataAppEmbed.ts +84 -0
- package/src/utils/formatting.spec.ts +25 -21
- package/src/utils/formatting.ts +11 -7
- package/src/utils/malloyString.spec.ts +24 -0
- package/src/utils/malloyString.ts +12 -0
- package/src/utils/parsing.spec.ts +26 -19
- package/src/utils/parsing.ts +11 -6
- package/src/utils/queryClient.ts +17 -0
- package/test/README.md +141 -0
- package/test/setup.ts +29 -0
- package/tsconfig.json +12 -1
- package/tsconfig.spec.json +22 -0
- package/vite.config.ts +3 -0
- package/dist/ServerProvider-lOQXDlqB.cjs.js +0 -1
- package/dist/ServerProvider-on-8FH5Z.es.js +0 -3060
- package/dist/components/Home/AddProjectDialog.d.ts +0 -1
- package/dist/components/Home/DeleteProjectDialog.d.ts +0 -5
- package/dist/components/Home/EditProjectDialog.d.ts +0 -7
- package/dist/components/Package/Config.d.ts +0 -5
- package/dist/components/Package/Databases.d.ts +0 -5
- package/dist/components/Package/Notebooks.d.ts +0 -6
- package/dist/components/Project/Project.d.ts +0 -6
- package/dist/components/Project/index.d.ts +0 -2
- package/dist/index-BOLBP6_i.cjs.js +0 -233
- package/src/components/Package/Config.tsx +0 -97
- package/src/components/Package/Connections.tsx +0 -373
- package/src/components/Package/Databases.tsx +0 -228
- package/src/components/Package/Notebooks.tsx +0 -77
- package/src/components/Project/AddPackageDialog.tsx +0 -159
- package/src/components/Project/Packages.tsx +0 -191
- package/src/components/Project/Project.tsx +0 -52
- package/src/components/Project/index.ts +0 -2
- /package/dist/components/{Project → Environment}/About.d.ts +0 -0
- /package/dist/components/{Project → Environment}/AddPackageDialog.d.ts +0 -0
- /package/dist/components/{Project → Environment}/ConnectionExplorer.d.ts +0 -0
- /package/dist/components/{Package → Environment}/Connections.d.ts +0 -0
- /package/dist/components/{Project → Environment}/DeletePackageDialog.d.ts +0 -0
- /package/dist/components/{Project → Environment}/EditPackageDialog.d.ts +0 -0
- /package/dist/components/{Project → Environment}/Packages.d.ts +0 -0
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
// Copyright (c) Credible Data Inc.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
import ScheduleIcon from "@mui/icons-material/Schedule";
|
|
5
|
+
import {
|
|
6
|
+
Alert,
|
|
7
|
+
Box,
|
|
8
|
+
Button,
|
|
9
|
+
Dialog,
|
|
10
|
+
DialogActions,
|
|
11
|
+
DialogContent,
|
|
12
|
+
DialogContentText,
|
|
13
|
+
DialogTitle,
|
|
14
|
+
TextField,
|
|
15
|
+
Tooltip,
|
|
16
|
+
Typography,
|
|
17
|
+
} from "@mui/material";
|
|
18
|
+
import { useState } from "react";
|
|
19
|
+
import { MONO_FONT_FAMILY } from "../styles";
|
|
20
|
+
import { describeCron, formatNextRun } from "./cron";
|
|
21
|
+
|
|
22
|
+
type SetScheduleDialogProps = {
|
|
23
|
+
/** The current cron, or null when no schedule is set. */
|
|
24
|
+
currentSchedule: string | null;
|
|
25
|
+
isSubmitting: boolean;
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
disabledReason?: string;
|
|
28
|
+
/** Persist a new cron, or null to clear the schedule. */
|
|
29
|
+
onSubmit: (schedule: string | null) => Promise<unknown>;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const DEFAULT_CRON = "0 6 * * *";
|
|
33
|
+
|
|
34
|
+
export default function SetScheduleDialog({
|
|
35
|
+
currentSchedule,
|
|
36
|
+
isSubmitting,
|
|
37
|
+
disabled,
|
|
38
|
+
disabledReason,
|
|
39
|
+
onSubmit,
|
|
40
|
+
}: SetScheduleDialogProps) {
|
|
41
|
+
const [open, setOpen] = useState(false);
|
|
42
|
+
const [expr, setExpr] = useState(currentSchedule ?? DEFAULT_CRON);
|
|
43
|
+
|
|
44
|
+
const handleOpen = () => {
|
|
45
|
+
setExpr(currentSchedule ?? DEFAULT_CRON);
|
|
46
|
+
setOpen(true);
|
|
47
|
+
};
|
|
48
|
+
const handleClose = () => setOpen(false);
|
|
49
|
+
|
|
50
|
+
const info = describeCron(expr);
|
|
51
|
+
|
|
52
|
+
const submit = async (schedule: string | null) => {
|
|
53
|
+
try {
|
|
54
|
+
await onSubmit(schedule);
|
|
55
|
+
setOpen(false);
|
|
56
|
+
} catch {
|
|
57
|
+
// The caller surfaces the error via its Snackbar; keep the dialog
|
|
58
|
+
// open so the user can correct the cron and retry.
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const button = (
|
|
63
|
+
<span>
|
|
64
|
+
<Button
|
|
65
|
+
variant="outlined"
|
|
66
|
+
size="small"
|
|
67
|
+
startIcon={<ScheduleIcon />}
|
|
68
|
+
onClick={handleOpen}
|
|
69
|
+
disabled={disabled}
|
|
70
|
+
aria-label={currentSchedule ? "Edit schedule" : "Set schedule"}
|
|
71
|
+
>
|
|
72
|
+
{currentSchedule ? "Edit schedule" : "Set schedule"}
|
|
73
|
+
</Button>
|
|
74
|
+
</span>
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<>
|
|
79
|
+
{disabled && disabledReason ? (
|
|
80
|
+
<Tooltip title={disabledReason}>{button}</Tooltip>
|
|
81
|
+
) : (
|
|
82
|
+
button
|
|
83
|
+
)}
|
|
84
|
+
|
|
85
|
+
<Dialog
|
|
86
|
+
open={open}
|
|
87
|
+
onClose={handleClose}
|
|
88
|
+
maxWidth="xs"
|
|
89
|
+
fullWidth
|
|
90
|
+
aria-labelledby="set-schedule-title"
|
|
91
|
+
>
|
|
92
|
+
<DialogTitle id="set-schedule-title">
|
|
93
|
+
{currentSchedule ? "Edit schedule" : "Set schedule"}
|
|
94
|
+
</DialogTitle>
|
|
95
|
+
<DialogContent>
|
|
96
|
+
<DialogContentText sx={{ mb: 2 }}>
|
|
97
|
+
The publisher rebuilds the materializations in this package on
|
|
98
|
+
this cadence. Enter a 5-field UNIX cron, evaluated in UTC. In
|
|
99
|
+
a hosted deployment, the change takes effect on your next
|
|
100
|
+
publish.
|
|
101
|
+
</DialogContentText>
|
|
102
|
+
<TextField
|
|
103
|
+
autoFocus
|
|
104
|
+
fullWidth
|
|
105
|
+
label="Cron expression"
|
|
106
|
+
value={expr}
|
|
107
|
+
onChange={(event) => setExpr(event.target.value)}
|
|
108
|
+
error={expr.trim() !== "" && !info.valid}
|
|
109
|
+
slotProps={{
|
|
110
|
+
htmlInput: { style: { fontFamily: MONO_FONT_FAMILY } },
|
|
111
|
+
}}
|
|
112
|
+
/>
|
|
113
|
+
<Box sx={{ mt: 1.5, minHeight: 48 }}>
|
|
114
|
+
{info.valid ? (
|
|
115
|
+
<>
|
|
116
|
+
<Typography variant="body2">
|
|
117
|
+
{info.description}
|
|
118
|
+
</Typography>
|
|
119
|
+
<Typography variant="body2" color="text.secondary">
|
|
120
|
+
Next run: {formatNextRun(info.nextRun)}
|
|
121
|
+
</Typography>
|
|
122
|
+
</>
|
|
123
|
+
) : (
|
|
124
|
+
<Typography variant="body2" color="error">
|
|
125
|
+
{info.error}
|
|
126
|
+
</Typography>
|
|
127
|
+
)}
|
|
128
|
+
</Box>
|
|
129
|
+
<Alert severity="info" sx={{ mt: 2 }}>
|
|
130
|
+
A schedule runs only on version-scoped packages, so saving one
|
|
131
|
+
sets <code>scope: version</code> for this package.
|
|
132
|
+
</Alert>
|
|
133
|
+
</DialogContent>
|
|
134
|
+
<DialogActions sx={{ justifyContent: "space-between", px: 3 }}>
|
|
135
|
+
<Box>
|
|
136
|
+
{currentSchedule && (
|
|
137
|
+
<Button
|
|
138
|
+
color="error"
|
|
139
|
+
loading={isSubmitting}
|
|
140
|
+
onClick={() => submit(null)}
|
|
141
|
+
>
|
|
142
|
+
Clear schedule
|
|
143
|
+
</Button>
|
|
144
|
+
)}
|
|
145
|
+
</Box>
|
|
146
|
+
<Box>
|
|
147
|
+
<Button onClick={handleClose}>Cancel</Button>
|
|
148
|
+
<Button
|
|
149
|
+
variant="contained"
|
|
150
|
+
loading={isSubmitting}
|
|
151
|
+
disabled={!info.valid}
|
|
152
|
+
onClick={() => submit(expr.trim())}
|
|
153
|
+
sx={{ ml: 1 }}
|
|
154
|
+
>
|
|
155
|
+
Save
|
|
156
|
+
</Button>
|
|
157
|
+
</Box>
|
|
158
|
+
</DialogActions>
|
|
159
|
+
</Dialog>
|
|
160
|
+
</>
|
|
161
|
+
);
|
|
162
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Copyright (c) Credible Data Inc.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
import ScheduleIcon from "@mui/icons-material/Schedule";
|
|
5
|
+
import TouchAppIcon from "@mui/icons-material/TouchApp";
|
|
6
|
+
import { Chip, Tooltip } from "@mui/material";
|
|
7
|
+
import { MaterializationMetadata, triggerLabel } from "./utils";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Chip showing how a run was initiated — Scheduled (the standalone scheduler
|
|
11
|
+
* fired the package's cron) vs Manual (an API/UI create) — with a tooltip. One
|
|
12
|
+
* source of truth for the color/icon/label so the runs list and the detail
|
|
13
|
+
* dialog can never drift.
|
|
14
|
+
*/
|
|
15
|
+
export default function TriggerChip({
|
|
16
|
+
meta,
|
|
17
|
+
}: {
|
|
18
|
+
meta: MaterializationMetadata;
|
|
19
|
+
}) {
|
|
20
|
+
const scheduled = meta.trigger === "SCHEDULER";
|
|
21
|
+
return (
|
|
22
|
+
<Tooltip
|
|
23
|
+
title={
|
|
24
|
+
scheduled
|
|
25
|
+
? "Fired by the materialization schedule"
|
|
26
|
+
: "Triggered manually"
|
|
27
|
+
}
|
|
28
|
+
>
|
|
29
|
+
<Chip
|
|
30
|
+
size="small"
|
|
31
|
+
variant="outlined"
|
|
32
|
+
color={scheduled ? "info" : "default"}
|
|
33
|
+
icon={
|
|
34
|
+
scheduled ? (
|
|
35
|
+
<ScheduleIcon fontSize="small" />
|
|
36
|
+
) : (
|
|
37
|
+
<TouchAppIcon fontSize="small" />
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
label={triggerLabel(meta)}
|
|
41
|
+
/>
|
|
42
|
+
</Tooltip>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
// Copyright (c) Credible Data Inc.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
import { CronExpressionParser } from "cron-parser";
|
|
5
|
+
import cronstrue from "cronstrue";
|
|
6
|
+
|
|
7
|
+
export interface CronInfo {
|
|
8
|
+
valid: boolean;
|
|
9
|
+
/** Human-readable summary, e.g. "Every minute" (empty when invalid). */
|
|
10
|
+
description: string;
|
|
11
|
+
/** Next fire instant in UTC (null when invalid). */
|
|
12
|
+
nextRun: Date | null;
|
|
13
|
+
/** Reason the expression was rejected (set only when `valid` is false). */
|
|
14
|
+
error?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** Valid 3-letter month and day-of-week names in UNIX cron. */
|
|
18
|
+
const UNIX_CRON_NAMES = new Set([
|
|
19
|
+
"JAN",
|
|
20
|
+
"FEB",
|
|
21
|
+
"MAR",
|
|
22
|
+
"APR",
|
|
23
|
+
"MAY",
|
|
24
|
+
"JUN",
|
|
25
|
+
"JUL",
|
|
26
|
+
"AUG",
|
|
27
|
+
"SEP",
|
|
28
|
+
"OCT",
|
|
29
|
+
"NOV",
|
|
30
|
+
"DEC",
|
|
31
|
+
"SUN",
|
|
32
|
+
"MON",
|
|
33
|
+
"TUE",
|
|
34
|
+
"WED",
|
|
35
|
+
"THU",
|
|
36
|
+
"FRI",
|
|
37
|
+
"SAT",
|
|
38
|
+
]);
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Reject cron-parser / Quartz extensions absent from plain UNIX cron (`L`, `W`,
|
|
42
|
+
* `#`, `?`). Mirrors the server's `CronEvaluator.isPlainUnixGrammar` so the UI
|
|
43
|
+
* preview flags the same expressions the server (and the control plane) reject,
|
|
44
|
+
* rather than describing a cron that would silently never arm after publish.
|
|
45
|
+
*/
|
|
46
|
+
function isPlainUnixGrammar(expr: string): boolean {
|
|
47
|
+
for (const field of expr.trim().split(/\s+/)) {
|
|
48
|
+
if (/[#?]/.test(field)) return false;
|
|
49
|
+
for (const token of field.split(/[,\-/]/)) {
|
|
50
|
+
if (token === "" || token === "*") continue;
|
|
51
|
+
if (
|
|
52
|
+
/[A-Za-z]/.test(token) &&
|
|
53
|
+
!UNIX_CRON_NAMES.has(token.toUpperCase())
|
|
54
|
+
) {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Describe a 5-field UNIX cron for display: a human-readable summary (cronstrue)
|
|
64
|
+
* and the next fire instant (cron-parser, in UTC — matching the publisher's
|
|
65
|
+
* server-side scheduler so the UI shows the same instants it will fire at).
|
|
66
|
+
*
|
|
67
|
+
* The expression is required to be exactly 5 fields and plain UNIX grammar,
|
|
68
|
+
* mirroring the server's `CronEvaluator`: cron-parser also accepts an optional
|
|
69
|
+
* leading seconds field (6 fields) and extensions (L/W/#/?), but the manifest
|
|
70
|
+
* contract is plain 5-field UNIX cron, so those are reported invalid rather
|
|
71
|
+
* than silently reinterpreted (or accepted here yet rejected after publish).
|
|
72
|
+
*/
|
|
73
|
+
export function describeCron(expr: string): CronInfo {
|
|
74
|
+
const trimmed = (expr ?? "").trim();
|
|
75
|
+
if (trimmed.split(/\s+/).filter(Boolean).length !== 5) {
|
|
76
|
+
return {
|
|
77
|
+
valid: false,
|
|
78
|
+
description: "",
|
|
79
|
+
nextRun: null,
|
|
80
|
+
error: "Expected a 5-field UNIX cron: minute hour day-of-month month day-of-week.",
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
if (!isPlainUnixGrammar(trimmed)) {
|
|
84
|
+
return {
|
|
85
|
+
valid: false,
|
|
86
|
+
description: "",
|
|
87
|
+
nextRun: null,
|
|
88
|
+
error: "Unsupported cron syntax: L, W, #, and ? extensions are not allowed (plain 5-field UNIX cron only).",
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
try {
|
|
92
|
+
const description = cronstrue.toString(trimmed, {
|
|
93
|
+
use24HourTimeFormat: true,
|
|
94
|
+
verbose: false,
|
|
95
|
+
});
|
|
96
|
+
const nextRun = CronExpressionParser.parse(trimmed, { tz: "UTC" })
|
|
97
|
+
.next()
|
|
98
|
+
.toDate();
|
|
99
|
+
return { valid: true, description, nextRun };
|
|
100
|
+
} catch (e) {
|
|
101
|
+
return {
|
|
102
|
+
valid: false,
|
|
103
|
+
description: "",
|
|
104
|
+
nextRun: null,
|
|
105
|
+
error: e instanceof Error ? e.message : "Invalid cron expression.",
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** Absolute UTC label for a next-run instant, e.g. "Jul 14, 2026, 06:00 UTC". */
|
|
111
|
+
export function formatNextRun(d: Date | null): string {
|
|
112
|
+
if (!d) return "—";
|
|
113
|
+
return (
|
|
114
|
+
d.toLocaleString(undefined, {
|
|
115
|
+
year: "numeric",
|
|
116
|
+
month: "short",
|
|
117
|
+
day: "numeric",
|
|
118
|
+
hour: "2-digit",
|
|
119
|
+
minute: "2-digit",
|
|
120
|
+
timeZone: "UTC",
|
|
121
|
+
hour12: false,
|
|
122
|
+
}) + " UTC"
|
|
123
|
+
);
|
|
124
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
// Copyright (c) Credible Data Inc.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
import { Materialization, MaterializationStatus } from "../../client";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Non-terminal phases of a build: PENDING (building) -> MANIFEST_ROWS_READY
|
|
8
|
+
* (tables built) -> MANIFEST_FILE_READY (terminal). Any non-terminal phase may
|
|
9
|
+
* be polled and stopped.
|
|
10
|
+
*/
|
|
11
|
+
export function isActiveStatus(status?: MaterializationStatus): boolean {
|
|
12
|
+
return (
|
|
13
|
+
status === MaterializationStatus.Pending ||
|
|
14
|
+
status === MaterializationStatus.ManifestRowsReady
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function isTerminalStatus(status?: MaterializationStatus): boolean {
|
|
19
|
+
return (
|
|
20
|
+
status === MaterializationStatus.ManifestFileReady ||
|
|
21
|
+
status === MaterializationStatus.Failed ||
|
|
22
|
+
status === MaterializationStatus.Cancelled
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Human-friendly status label. The publisher drives every phase automatically,
|
|
28
|
+
* so the intermediate states (PENDING / MANIFEST_ROWS_READY) both read as
|
|
29
|
+
* "Pending" and the terminal success state reads as "Done". Failures and
|
|
30
|
+
* cancellations keep their own labels.
|
|
31
|
+
*/
|
|
32
|
+
export function statusLabel(status?: MaterializationStatus): string {
|
|
33
|
+
switch (status) {
|
|
34
|
+
case MaterializationStatus.ManifestFileReady:
|
|
35
|
+
return "Done";
|
|
36
|
+
case MaterializationStatus.Failed:
|
|
37
|
+
return "Failed";
|
|
38
|
+
case MaterializationStatus.Cancelled:
|
|
39
|
+
return "Cancelled";
|
|
40
|
+
case MaterializationStatus.Pending:
|
|
41
|
+
case MaterializationStatus.ManifestRowsReady:
|
|
42
|
+
return "Pending";
|
|
43
|
+
default:
|
|
44
|
+
return "Unknown";
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
type ChipColor = "default" | "info" | "success" | "error" | "warning";
|
|
49
|
+
|
|
50
|
+
export function statusColor(status?: MaterializationStatus): ChipColor {
|
|
51
|
+
switch (status) {
|
|
52
|
+
case MaterializationStatus.ManifestRowsReady:
|
|
53
|
+
return "info";
|
|
54
|
+
case MaterializationStatus.ManifestFileReady:
|
|
55
|
+
return "success";
|
|
56
|
+
case MaterializationStatus.Failed:
|
|
57
|
+
return "error";
|
|
58
|
+
case MaterializationStatus.Cancelled:
|
|
59
|
+
return "warning";
|
|
60
|
+
case MaterializationStatus.Pending:
|
|
61
|
+
default:
|
|
62
|
+
return "default";
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Shape of Materialization.metadata. The generated client types it as
|
|
68
|
+
* `object | null`, so callers must read it through parseMetadata(), which
|
|
69
|
+
* narrows defensively and tolerates a missing or differently-shaped object.
|
|
70
|
+
*/
|
|
71
|
+
export interface MaterializationMetadata {
|
|
72
|
+
forceRefresh?: boolean;
|
|
73
|
+
sourceNames?: string[];
|
|
74
|
+
mode?: "auto" | "orchestrated";
|
|
75
|
+
/**
|
|
76
|
+
* What initiated the run. `SCHEDULER` = the standalone scheduler fired the
|
|
77
|
+
* package's `materialization.schedule` cron; `ON_DEMAND` (default) = an
|
|
78
|
+
* explicit API/UI create. Recorded on the run so a scheduled rebuild is
|
|
79
|
+
* distinguishable from a manual one.
|
|
80
|
+
*/
|
|
81
|
+
trigger?: "ON_DEMAND" | "SCHEDULER";
|
|
82
|
+
sourcesBuilt?: number;
|
|
83
|
+
sourcesReused?: number;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function parseMetadata(
|
|
87
|
+
materialization: Materialization,
|
|
88
|
+
): MaterializationMetadata {
|
|
89
|
+
return (materialization.metadata ?? {}) as MaterializationMetadata;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** Human label for how a run was initiated. */
|
|
93
|
+
export function triggerLabel(
|
|
94
|
+
meta: MaterializationMetadata,
|
|
95
|
+
): "Scheduled" | "Manual" {
|
|
96
|
+
return meta.trigger === "SCHEDULER" ? "Scheduled" : "Manual";
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** Human-readable elapsed time between two ISO timestamps (to now if open). */
|
|
100
|
+
export function formatDuration(
|
|
101
|
+
startedAt?: string | null,
|
|
102
|
+
completedAt?: string | null,
|
|
103
|
+
): string {
|
|
104
|
+
if (!startedAt) return "-";
|
|
105
|
+
const start = new Date(startedAt).getTime();
|
|
106
|
+
const end = completedAt ? new Date(completedAt).getTime() : Date.now();
|
|
107
|
+
const totalMs = Math.max(0, end - start);
|
|
108
|
+
if (totalMs < 1000) return `${totalMs}ms`;
|
|
109
|
+
const seconds = Math.round(totalMs / 1000);
|
|
110
|
+
if (seconds < 60) return `${seconds}s`;
|
|
111
|
+
const minutes = Math.floor(seconds / 60);
|
|
112
|
+
const remSeconds = seconds % 60;
|
|
113
|
+
if (minutes < 60) return `${minutes}m ${remSeconds}s`;
|
|
114
|
+
const hours = Math.floor(minutes / 60);
|
|
115
|
+
const remMinutes = minutes % 60;
|
|
116
|
+
return `${hours}h ${remMinutes}m`;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** Absolute, locale-formatted timestamp (e.g. "Jun 19, 2026, 3:33 PM"). */
|
|
120
|
+
export function formatTimestamp(iso?: string | null): string {
|
|
121
|
+
if (!iso) return "—";
|
|
122
|
+
const date = new Date(iso);
|
|
123
|
+
if (Number.isNaN(date.getTime())) return "—";
|
|
124
|
+
return date.toLocaleString(undefined, {
|
|
125
|
+
year: "numeric",
|
|
126
|
+
month: "short",
|
|
127
|
+
day: "numeric",
|
|
128
|
+
hour: "numeric",
|
|
129
|
+
minute: "2-digit",
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/** Compact relative timestamp, e.g. "just now", "5m ago", "2h ago", "3d ago". */
|
|
134
|
+
export function formatRelativeTime(iso?: string | null): string {
|
|
135
|
+
if (!iso) return "-";
|
|
136
|
+
const then = new Date(iso).getTime();
|
|
137
|
+
const seconds = Math.round((Date.now() - then) / 1000);
|
|
138
|
+
if (seconds < 60) return "just now";
|
|
139
|
+
const minutes = Math.floor(seconds / 60);
|
|
140
|
+
if (minutes < 60) return `${minutes}m ago`;
|
|
141
|
+
const hours = Math.floor(minutes / 60);
|
|
142
|
+
if (hours < 24) return `${hours}h ago`;
|
|
143
|
+
const days = Math.floor(hours / 24);
|
|
144
|
+
return `${days}d ago`;
|
|
145
|
+
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// Copyright (c) Credible Data Inc.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
1
4
|
import "@malloydata/malloy-explorer/styles.css";
|
|
2
5
|
import LinkOutlinedIcon from "@mui/icons-material/LinkOutlined";
|
|
3
6
|
import SearchIcon from "@mui/icons-material/Search";
|
|
@@ -45,6 +48,22 @@ export default function Model({
|
|
|
45
48
|
const [sharedSourceIndex, setSharedSourceIndex] = React.useState(0);
|
|
46
49
|
const [copyMessage, setCopyMessage] = useState("");
|
|
47
50
|
|
|
51
|
+
// Whether the model imports other files — drives the empty-state hint for
|
|
52
|
+
// import-only models, whose discovery surface is legitimately empty (no
|
|
53
|
+
// local sources, no export{}) but whose page would otherwise render blank.
|
|
54
|
+
// `modelDef` is returned by the server but intentionally absent from the
|
|
55
|
+
// typed CompiledModel schema (internal compiler blob), hence the cast.
|
|
56
|
+
const modelDefJson = (data as { modelDef?: string } | undefined)?.modelDef;
|
|
57
|
+
const hasImports = React.useMemo(() => {
|
|
58
|
+
if (!modelDefJson) return false;
|
|
59
|
+
try {
|
|
60
|
+
const def = JSON.parse(modelDefJson) as { imports?: unknown[] };
|
|
61
|
+
return Array.isArray(def.imports) && def.imports.length > 0;
|
|
62
|
+
} catch {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
}, [modelDefJson]);
|
|
66
|
+
|
|
48
67
|
if (isLoading) {
|
|
49
68
|
return <Loading text="Fetching Model..." />;
|
|
50
69
|
}
|
|
@@ -114,7 +133,7 @@ export default function Model({
|
|
|
114
133
|
<LinkOutlinedIcon
|
|
115
134
|
sx={{
|
|
116
135
|
fontSize: "24px",
|
|
117
|
-
color: "
|
|
136
|
+
color: "text.secondary",
|
|
118
137
|
cursor: "pointer",
|
|
119
138
|
}}
|
|
120
139
|
onClick={copyToClipboard}
|
|
@@ -150,7 +169,7 @@ export default function Model({
|
|
|
150
169
|
<SearchIcon
|
|
151
170
|
sx={{
|
|
152
171
|
fontSize: "18px",
|
|
153
|
-
color: "
|
|
172
|
+
color: "text.secondary",
|
|
154
173
|
marginBottom: "5px",
|
|
155
174
|
}}
|
|
156
175
|
/>
|
|
@@ -196,6 +215,29 @@ export default function Model({
|
|
|
196
215
|
</Stack>
|
|
197
216
|
)}
|
|
198
217
|
|
|
218
|
+
{/* Empty discovery surface: nothing exported, nothing to render.
|
|
219
|
+
For import-only models, say why and how to fix it — otherwise
|
|
220
|
+
the page reads as broken. */}
|
|
221
|
+
{(!Array.isArray(data?.sourceInfos) ||
|
|
222
|
+
data.sourceInfos.length === 0) &&
|
|
223
|
+
!(data?.queries && data.queries.length > 0) && (
|
|
224
|
+
<Box sx={{ textAlign: "center", py: 6 }}>
|
|
225
|
+
<Typography
|
|
226
|
+
variant="body1"
|
|
227
|
+
sx={{ color: "text.secondary", marginBottom: "8px" }}
|
|
228
|
+
>
|
|
229
|
+
This model exposes no sources or queries.
|
|
230
|
+
</Typography>
|
|
231
|
+
{hasImports && (
|
|
232
|
+
<Typography variant="body2" color="text.secondary">
|
|
233
|
+
It imports other files but re-exports nothing. Add{" "}
|
|
234
|
+
<code>export {"{ source_name }"}</code> to surface
|
|
235
|
+
imported sources here.
|
|
236
|
+
</Typography>
|
|
237
|
+
)}
|
|
238
|
+
</Box>
|
|
239
|
+
)}
|
|
240
|
+
|
|
199
241
|
{/* Model Explorer Dialog */}
|
|
200
242
|
<ModelExplorerDialog
|
|
201
243
|
open={dialogOpen}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
+
// Copyright (c) Credible Data Inc.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
1
4
|
import PlayArrowIcon from "@mui/icons-material/PlayArrow";
|
|
2
5
|
import SearchIcon from "@mui/icons-material/Search";
|
|
3
6
|
import { Box, Button, IconButton, Typography } from "@mui/material";
|
|
4
7
|
import React, { useEffect } from "react";
|
|
5
8
|
import { useQueryWithApiError } from "../../hooks/useQueryWithApiError";
|
|
9
|
+
import { usePublisherTheme } from "../../theme/ThemeContext";
|
|
6
10
|
import { parseResourceUri } from "../../utils/formatting";
|
|
11
|
+
import { CHART_RESULT_QUERY_OPTIONS } from "../../utils/queryClient";
|
|
7
12
|
import { highlight } from "../highlighter";
|
|
8
13
|
import ResultContainer from "../RenderedResult/ResultContainer";
|
|
9
14
|
import ResultsDialog from "../ResultsDialog";
|
|
@@ -32,7 +37,7 @@ export function ModelCell({
|
|
|
32
37
|
const [resultsDialogOpen, setResultsDialogOpen] = React.useState(false);
|
|
33
38
|
const [hasRun, setHasRun] = React.useState(false);
|
|
34
39
|
|
|
35
|
-
const { packageName,
|
|
40
|
+
const { packageName, environmentName, versionId, modelPath } =
|
|
36
41
|
parseResourceUri(resourceUri);
|
|
37
42
|
const { apiClients } = useServer();
|
|
38
43
|
|
|
@@ -44,7 +49,7 @@ export function ModelCell({
|
|
|
44
49
|
queryKey: ["namedQueryResult", resourceUri, queryName],
|
|
45
50
|
queryFn: () =>
|
|
46
51
|
apiClients.models.executeQueryModel(
|
|
47
|
-
|
|
52
|
+
environmentName,
|
|
48
53
|
packageName,
|
|
49
54
|
modelPath,
|
|
50
55
|
{
|
|
@@ -55,18 +60,20 @@ export function ModelCell({
|
|
|
55
60
|
},
|
|
56
61
|
),
|
|
57
62
|
enabled: runOnDemand ? hasRun : true, // Execute on demand or always
|
|
63
|
+
...CHART_RESULT_QUERY_OPTIONS,
|
|
58
64
|
});
|
|
59
65
|
|
|
66
|
+
const { mode } = usePublisherTheme();
|
|
60
67
|
useEffect(() => {
|
|
61
68
|
if (annotations && annotations.length > 0) {
|
|
62
69
|
const code = annotations
|
|
63
70
|
.map((annotation) => `// ${annotation}`)
|
|
64
71
|
.join("\n");
|
|
65
|
-
highlight(code, "typescript").then((highlightedCode) => {
|
|
72
|
+
highlight(code, "typescript", mode).then((highlightedCode) => {
|
|
66
73
|
setHighlightedAnnotations(highlightedCode);
|
|
67
74
|
});
|
|
68
75
|
}
|
|
69
|
-
}, [annotations]);
|
|
76
|
+
}, [annotations, mode]);
|
|
70
77
|
|
|
71
78
|
return (
|
|
72
79
|
<CleanNotebookCell>
|
|
@@ -123,7 +130,7 @@ export function ModelCell({
|
|
|
123
130
|
}}
|
|
124
131
|
onClick={() => setResultsDialogOpen(true)}
|
|
125
132
|
>
|
|
126
|
-
<SearchIcon sx={{ fontSize: "18px", color: "
|
|
133
|
+
<SearchIcon sx={{ fontSize: "18px", color: "text.secondary" }} />
|
|
127
134
|
</IconButton>
|
|
128
135
|
</Box>
|
|
129
136
|
|
|
@@ -177,6 +184,7 @@ export function ModelCell({
|
|
|
177
184
|
result={queryData.data.result}
|
|
178
185
|
maxHeight={600}
|
|
179
186
|
maxResultSize={maxResultSize}
|
|
187
|
+
renderLogs={queryData.data.renderLogs}
|
|
180
188
|
/>
|
|
181
189
|
)}
|
|
182
190
|
</CleanMetricCard>
|
|
@@ -186,6 +194,7 @@ export function ModelCell({
|
|
|
186
194
|
open={resultsDialogOpen}
|
|
187
195
|
onClose={() => setResultsDialogOpen(false)}
|
|
188
196
|
result={queryData?.data?.result || ""}
|
|
197
|
+
renderLogs={queryData?.data?.renderLogs}
|
|
189
198
|
title={`Query: ${queryName}`}
|
|
190
199
|
/>
|
|
191
200
|
</CleanNotebookCell>
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// Copyright (c) Credible Data Inc.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
1
4
|
import React from "react";
|
|
2
5
|
import { Dialog, DialogTitle, DialogContent, IconButton } from "@mui/material";
|
|
3
6
|
import CloseIcon from "@mui/icons-material/Close";
|
|
@@ -40,7 +43,7 @@ export function ModelExplorerDialog({
|
|
|
40
43
|
}}
|
|
41
44
|
>
|
|
42
45
|
{title}
|
|
43
|
-
<IconButton onClick={onClose} sx={{ color: "
|
|
46
|
+
<IconButton onClick={onClose} sx={{ color: "text.secondary" }}>
|
|
44
47
|
<CloseIcon />
|
|
45
48
|
</IconButton>
|
|
46
49
|
</DialogTitle>
|