@malloy-publisher/sdk 0.0.382-dev → 0.2.1
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-Cn_LhKda.cjs.js +1 -0
- package/dist/ServerProvider-sfabtriY.es.js +4076 -0
- package/dist/client/api.d.ts +3773 -1515
- 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 +86 -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 +62 -0
- package/dist/components/Dashboard/DashboardTile.d.ts +57 -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-CqRKhtoy.cjs.js} +1 -1
- package/dist/{core-CjeTkq8O.es.js → core-DyU47reh.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-DRDu9kIV.es.js → index-CAkFE4Ol.es.js} +41278 -28504
- package/dist/index-DD4b_bt0.cjs.js +356 -0
- 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 +41 -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 +132 -25
- package/src/components/Connections/DeleteConnectionDialog.tsx +14 -3
- package/src/components/Connections/EditConnectionDialog.tsx +167 -37
- package/src/components/Connections/common.ts +94 -3
- package/src/components/DOMElement/DOMElement.tsx +3 -0
- package/src/components/DOMElement/index.ts +3 -0
- package/src/components/Dashboard/Dashboard.spec.tsx +216 -0
- package/src/components/Dashboard/Dashboard.tsx +458 -0
- package/src/components/Dashboard/DashboardTile.spec.tsx +81 -0
- package/src/components/Dashboard/DashboardTile.tsx +199 -0
- package/src/components/Dashboard/index.ts +5 -0
- package/src/components/Dashboard/tileGridColumn.spec.ts +35 -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.spec.tsx +88 -0
- package/src/components/Notebook/Notebook.tsx +476 -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.spec.tsx +113 -0
- package/src/components/Package/Package.tsx +692 -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 +725 -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.dom.spec.ts +91 -0
- package/src/hooks/useSuggestOptions.spec.ts +112 -0
- package/src/hooks/useSuggestOptions.ts +268 -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 +86 -0
- package/src/theme/buildTableCssVars.ts +98 -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 +185 -0
- package/test/serverProvider.tsx +72 -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
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
// Copyright (c) Credible Data Inc.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
1
4
|
import { Warning } from "@mui/icons-material";
|
|
2
|
-
import
|
|
5
|
+
import InfoOutlinedIcon from "@mui/icons-material/InfoOutlined";
|
|
6
|
+
import { Box, Button, IconButton, Tooltip, Typography } from "@mui/material";
|
|
3
7
|
import { lazy, Suspense, useRef, useState } from "react";
|
|
8
|
+
import { LogMessage } from "../../client";
|
|
9
|
+
import type { DrillBinding } from "../drill/useDrill";
|
|
4
10
|
import { Loading } from "../Loading";
|
|
11
|
+
import { summarizeRenderLogs } from "./renderLogs";
|
|
5
12
|
|
|
6
13
|
const RenderedResult = lazy(() => import("../RenderedResult/RenderedResult"));
|
|
7
14
|
|
|
@@ -12,8 +19,33 @@ interface ResultContainerProps {
|
|
|
12
19
|
// this is to prevent performance issues with large results.
|
|
13
20
|
// the default is 0, which means no warning will be shown.
|
|
14
21
|
maxResultSize?: number;
|
|
22
|
+
// Render tag findings from the query response. Callers whose result did not
|
|
23
|
+
// come from a query response have none to pass.
|
|
24
|
+
renderLogs?: LogMessage[];
|
|
25
|
+
// `# drill` click handling and its affordance. Passed straight through: this
|
|
26
|
+
// is the one render path dashboards and notebooks share, which is what lets
|
|
27
|
+
// drill be implemented once for both.
|
|
28
|
+
drill?: DrillBinding;
|
|
15
29
|
}
|
|
16
30
|
|
|
31
|
+
/**
|
|
32
|
+
* Height to paint at before the result has been measured.
|
|
33
|
+
*
|
|
34
|
+
* `maxHeight` is a CAP, but it was also the first paint's height, because the
|
|
35
|
+
* measured height starts out equal to it. That was harmless while every caller
|
|
36
|
+
* passed something viewport-sized (400 to 800). A caller that means "no cap"
|
|
37
|
+
* passes a number that is not a height anyone wants to see: the dashboard
|
|
38
|
+
* viewer's whole-page form passes 20000, so the panel painted twenty thousand
|
|
39
|
+
* pixels tall until the measurement landed, and a result the renderer sizes to
|
|
40
|
+
* its CONTAINER (a top-level chart, as opposed to a `# dashboard` grid, which
|
|
41
|
+
* reports its own height) measured that back and kept it.
|
|
42
|
+
*
|
|
43
|
+
* Bounded here rather than by lowering the cap, so "no cap" stays expressible.
|
|
44
|
+
* Above the cap it does nothing, which is every caller that passes a real
|
|
45
|
+
* height, so this changes nothing for them.
|
|
46
|
+
*/
|
|
47
|
+
const INITIAL_RENDER_HEIGHT = 2000;
|
|
48
|
+
|
|
17
49
|
// ResultContainer is a component that renders a result, with a toggle button to expand/collapse the result.
|
|
18
50
|
// For fill-elements, the result is rendered at minHeight, and the toggle button is shown to scale up to maxHeight.
|
|
19
51
|
// For non-fill-elements, the result is rendered at explicitHeight, with a small window (minHeight) that can be expanded to maxHeight.
|
|
@@ -22,10 +54,15 @@ export default function ResultContainer({
|
|
|
22
54
|
result,
|
|
23
55
|
maxHeight,
|
|
24
56
|
maxResultSize = 0,
|
|
57
|
+
renderLogs,
|
|
58
|
+
drill,
|
|
25
59
|
}: ResultContainerProps) {
|
|
26
60
|
const containerRef = useRef<HTMLDivElement>(null);
|
|
27
|
-
const [measuredHeight, setMeasuredHeight] = useState(
|
|
61
|
+
const [measuredHeight, setMeasuredHeight] = useState(
|
|
62
|
+
Math.min(maxHeight, INITIAL_RENDER_HEIGHT),
|
|
63
|
+
);
|
|
28
64
|
const [userAcknowledged, setUserAcknowledged] = useState(false);
|
|
65
|
+
const renderLogSummary = summarizeRenderLogs(renderLogs);
|
|
29
66
|
|
|
30
67
|
if (!result) {
|
|
31
68
|
return null;
|
|
@@ -87,9 +124,41 @@ export default function ResultContainer({
|
|
|
87
124
|
result={result}
|
|
88
125
|
height={renderedHeight}
|
|
89
126
|
onSizeChange={setMeasuredHeight}
|
|
127
|
+
drill={drill}
|
|
90
128
|
/>
|
|
91
129
|
</Suspense>
|
|
92
130
|
)}
|
|
131
|
+
{renderLogSummary && (
|
|
132
|
+
// Overlaid rather than stacked, so the note cannot change the height
|
|
133
|
+
// the container just measured. The button is what makes the message
|
|
134
|
+
// reachable: an icon alone is aria-hidden and cannot take focus.
|
|
135
|
+
<Box sx={{ position: "absolute", top: 4, right: 4, zIndex: 1 }}>
|
|
136
|
+
<Tooltip
|
|
137
|
+
title={renderLogSummary.title}
|
|
138
|
+
slotProps={{ tooltip: { sx: { whiteSpace: "pre-line" } } }}
|
|
139
|
+
>
|
|
140
|
+
<IconButton
|
|
141
|
+
size="small"
|
|
142
|
+
aria-label="Render tag warnings"
|
|
143
|
+
sx={{
|
|
144
|
+
backgroundColor: "rgba(255, 255, 255, 0.9)",
|
|
145
|
+
"&:hover": {
|
|
146
|
+
backgroundColor: "rgba(255, 255, 255, 1)",
|
|
147
|
+
},
|
|
148
|
+
}}
|
|
149
|
+
>
|
|
150
|
+
<InfoOutlinedIcon
|
|
151
|
+
fontSize="small"
|
|
152
|
+
color={
|
|
153
|
+
renderLogSummary.severity === "error"
|
|
154
|
+
? "error"
|
|
155
|
+
: "warning"
|
|
156
|
+
}
|
|
157
|
+
/>
|
|
158
|
+
</IconButton>
|
|
159
|
+
</Tooltip>
|
|
160
|
+
</Box>
|
|
161
|
+
)}
|
|
93
162
|
</Box>
|
|
94
163
|
);
|
|
95
164
|
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// Copyright (c) Credible Data Inc.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
import { describe, expect, it } from "bun:test";
|
|
5
|
+
import { summarizeRenderLogs } from "./renderLogs";
|
|
6
|
+
|
|
7
|
+
describe("summarizeRenderLogs", () => {
|
|
8
|
+
it("returns nothing when there are no logs", () => {
|
|
9
|
+
expect(summarizeRenderLogs(undefined)).toBeUndefined();
|
|
10
|
+
expect(summarizeRenderLogs([])).toBeUndefined();
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it("surfaces a warning, which is the severity a bad render tag reports", () => {
|
|
14
|
+
expect(
|
|
15
|
+
summarizeRenderLogs([
|
|
16
|
+
{
|
|
17
|
+
severity: "warn",
|
|
18
|
+
message: "Unknown render tag 'viz.stack.y' on field 'root'",
|
|
19
|
+
},
|
|
20
|
+
]),
|
|
21
|
+
).toEqual({
|
|
22
|
+
severity: "warn",
|
|
23
|
+
title: "Unknown render tag 'viz.stack.y' on field 'root'",
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it("reports the worst severity when both are present", () => {
|
|
28
|
+
const summary = summarizeRenderLogs([
|
|
29
|
+
{ severity: "warn", message: "first" },
|
|
30
|
+
{ severity: "error", message: "second" },
|
|
31
|
+
]);
|
|
32
|
+
expect(summary?.severity).toBe("error");
|
|
33
|
+
expect(summary?.title).toBe("first\nsecond");
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it("drops debug and info, which are not worth interrupting for", () => {
|
|
37
|
+
expect(
|
|
38
|
+
summarizeRenderLogs([
|
|
39
|
+
{ severity: "debug", message: "noise" },
|
|
40
|
+
{ severity: "info", message: "more noise" },
|
|
41
|
+
]),
|
|
42
|
+
).toBeUndefined();
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it("drops entries with no message or no severity rather than showing an empty tooltip", () => {
|
|
46
|
+
// Every LogMessage field is optional in the generated client.
|
|
47
|
+
expect(summarizeRenderLogs([{ severity: "warn" }])).toBeUndefined();
|
|
48
|
+
expect(summarizeRenderLogs([{ message: "orphan" }])).toBeUndefined();
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it("dedupes repeated messages", () => {
|
|
52
|
+
const summary = summarizeRenderLogs([
|
|
53
|
+
{ severity: "warn", message: "same" },
|
|
54
|
+
{ severity: "warn", message: "same" },
|
|
55
|
+
]);
|
|
56
|
+
expect(summary?.title).toBe("same");
|
|
57
|
+
});
|
|
58
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// Copyright (c) Credible Data Inc.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
import { LogMessage } from "../../client";
|
|
5
|
+
|
|
6
|
+
export interface RenderLogSummary {
|
|
7
|
+
severity: "warn" | "error";
|
|
8
|
+
title: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// Severity describes the tag defect, not whether the chart drew, so findings are
|
|
12
|
+
// only ever annotated, never used to withhold a result.
|
|
13
|
+
const SHOWN_SEVERITIES = new Set(["warn", "error"]);
|
|
14
|
+
|
|
15
|
+
// Every LogMessage field is optional, so entries without a severity we show or
|
|
16
|
+
// without a message are dropped rather than rendered as an empty tooltip.
|
|
17
|
+
export function summarizeRenderLogs(
|
|
18
|
+
logs: LogMessage[] | undefined,
|
|
19
|
+
): RenderLogSummary | undefined {
|
|
20
|
+
if (!logs?.length) {
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
const messages: string[] = [];
|
|
24
|
+
let hasError = false;
|
|
25
|
+
for (const log of logs) {
|
|
26
|
+
if (!log.message || !SHOWN_SEVERITIES.has(log.severity ?? "")) {
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
if (log.severity === "error") {
|
|
30
|
+
hasError = true;
|
|
31
|
+
}
|
|
32
|
+
if (!messages.includes(log.message)) {
|
|
33
|
+
messages.push(log.message);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
if (!messages.length) {
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
severity: hasError ? "error" : "warn",
|
|
41
|
+
title: messages.join("\n"),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
// Copyright (c) Credible Data Inc.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
1
4
|
import CloseIcon from "@mui/icons-material/Close";
|
|
2
5
|
import { Dialog, DialogContent, DialogTitle, IconButton } from "@mui/material";
|
|
6
|
+
import { LogMessage } from "../client";
|
|
7
|
+
import type { DrillBinding } from "./drill";
|
|
3
8
|
import ResultContainer from "./RenderedResult/ResultContainer";
|
|
4
9
|
|
|
5
10
|
interface ResultsDialogProps {
|
|
@@ -7,6 +12,9 @@ interface ResultsDialogProps {
|
|
|
7
12
|
onClose: () => void;
|
|
8
13
|
result: string;
|
|
9
14
|
title?: string;
|
|
15
|
+
renderLogs?: LogMessage[];
|
|
16
|
+
/** `# drill` wiring, so a result stays clickable when it is expanded. */
|
|
17
|
+
drill?: DrillBinding;
|
|
10
18
|
}
|
|
11
19
|
|
|
12
20
|
export default function ResultsDialog({
|
|
@@ -14,6 +22,8 @@ export default function ResultsDialog({
|
|
|
14
22
|
onClose,
|
|
15
23
|
result,
|
|
16
24
|
title = "Results",
|
|
25
|
+
renderLogs,
|
|
26
|
+
drill,
|
|
17
27
|
}: ResultsDialogProps) {
|
|
18
28
|
return (
|
|
19
29
|
<Dialog
|
|
@@ -37,7 +47,7 @@ export default function ResultsDialog({
|
|
|
37
47
|
}}
|
|
38
48
|
>
|
|
39
49
|
{title}
|
|
40
|
-
<IconButton onClick={onClose} sx={{ color: "
|
|
50
|
+
<IconButton onClick={onClose} sx={{ color: "text.secondary" }}>
|
|
41
51
|
<CloseIcon />
|
|
42
52
|
</IconButton>
|
|
43
53
|
</DialogTitle>
|
|
@@ -52,6 +62,8 @@ export default function ResultsDialog({
|
|
|
52
62
|
result={result}
|
|
53
63
|
maxHeight={800}
|
|
54
64
|
maxResultSize={1000000}
|
|
65
|
+
renderLogs={renderLogs}
|
|
66
|
+
drill={drill}
|
|
55
67
|
/>
|
|
56
68
|
</DialogContent>
|
|
57
69
|
</Dialog>
|
|
@@ -1,26 +1,68 @@
|
|
|
1
|
-
|
|
1
|
+
// Copyright (c) Credible Data Inc.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
import { QueryClientProvider, useQuery } from "@tanstack/react-query";
|
|
2
5
|
import axios from "axios";
|
|
3
6
|
import React, {
|
|
4
7
|
createContext,
|
|
5
8
|
ReactNode,
|
|
9
|
+
useCallback,
|
|
6
10
|
useContext,
|
|
7
|
-
useMemo,
|
|
8
11
|
useEffect,
|
|
12
|
+
useMemo,
|
|
9
13
|
useState,
|
|
10
14
|
} from "react";
|
|
11
15
|
import {
|
|
12
16
|
ConnectionsApi,
|
|
17
|
+
DashboardsApi,
|
|
18
|
+
DataAppsApi,
|
|
13
19
|
DatabasesApi,
|
|
20
|
+
EnvironmentsApi,
|
|
21
|
+
MaterializationsApi,
|
|
14
22
|
ModelsApi,
|
|
15
23
|
NotebooksApi,
|
|
16
24
|
PackagesApi,
|
|
17
|
-
ProjectsApi,
|
|
18
25
|
PublisherApi,
|
|
19
26
|
WatchModeApi,
|
|
20
27
|
} from "../client";
|
|
21
28
|
import { Configuration } from "../client/configuration";
|
|
29
|
+
import { resolveMode } from "../theme/resolveTheme";
|
|
30
|
+
import { ThemeProvider } from "../theme/ThemeContext";
|
|
31
|
+
import type { Theme, ThemeMode } from "../theme/types";
|
|
22
32
|
import { globalQueryClient } from "../utils/queryClient";
|
|
23
33
|
|
|
34
|
+
const THEME_MODE_STORAGE_KEY = "publisher:themeMode";
|
|
35
|
+
|
|
36
|
+
/** SSR-safe read of the viewer's persisted mode choice. */
|
|
37
|
+
function readStoredMode(): ThemeMode | "auto" | undefined {
|
|
38
|
+
if (typeof window === "undefined") return undefined;
|
|
39
|
+
try {
|
|
40
|
+
const raw = window.localStorage.getItem(THEME_MODE_STORAGE_KEY);
|
|
41
|
+
if (raw === "light" || raw === "dark" || raw === "auto") return raw;
|
|
42
|
+
} catch {
|
|
43
|
+
// localStorage can throw (Safari private mode, sandboxed iframes).
|
|
44
|
+
}
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function writeStoredMode(mode: ThemeMode | "auto" | undefined) {
|
|
49
|
+
if (typeof window === "undefined") return;
|
|
50
|
+
try {
|
|
51
|
+
if (mode === undefined) {
|
|
52
|
+
window.localStorage.removeItem(THEME_MODE_STORAGE_KEY);
|
|
53
|
+
} else {
|
|
54
|
+
window.localStorage.setItem(THEME_MODE_STORAGE_KEY, mode);
|
|
55
|
+
}
|
|
56
|
+
} catch {
|
|
57
|
+
// Persistence is best-effort; swallow.
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function getPrefersDark(): boolean {
|
|
62
|
+
if (typeof window === "undefined" || !window.matchMedia) return false;
|
|
63
|
+
return window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
64
|
+
}
|
|
65
|
+
|
|
24
66
|
// There's a bug in the OpenAPI generator that causes it to ignore baseURL in
|
|
25
67
|
// the axios request if axios.defaults.baseURL is not set. The per-instance
|
|
26
68
|
// baseURL on the custom axios instance below is the real value we use; this
|
|
@@ -35,6 +77,12 @@ export interface ServerContextValue {
|
|
|
35
77
|
apiClients: ApiClients;
|
|
36
78
|
mutable: boolean;
|
|
37
79
|
isLoadingStatus: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Instance-wide default theme, pulled from the `/api/v0/status` response.
|
|
82
|
+
* `undefined` while loading, or when the operator has not configured a
|
|
83
|
+
* theme in `publisher.config.json`.
|
|
84
|
+
*/
|
|
85
|
+
instanceTheme?: Theme;
|
|
38
86
|
}
|
|
39
87
|
|
|
40
88
|
const ServerContext = createContext<ServerContextValue | undefined>(undefined);
|
|
@@ -52,11 +100,20 @@ export interface ServerProviderProps {
|
|
|
52
100
|
* Will send "Bearer 123" in the Authorization header.
|
|
53
101
|
*/
|
|
54
102
|
getAccessToken?: () => Promise<string>;
|
|
55
|
-
/** Whether the publisher should allow
|
|
56
|
-
* When false, users can only view and explore existing
|
|
103
|
+
/** Whether the publisher should allow environment and package management operations.
|
|
104
|
+
* When false, users can only view and explore existing environments and packages.
|
|
57
105
|
* @default true
|
|
58
106
|
*/
|
|
59
107
|
mutable?: boolean;
|
|
108
|
+
/** An optional theme supplied by the embedding app, for a host that wants its
|
|
109
|
+
* own brand palette and fonts on the rendered charts and tables. It is added
|
|
110
|
+
* as the highest-precedence base layer, so it wins over the operator's
|
|
111
|
+
* instance theme from `/status`, while per-chart `# theme` annotations still
|
|
112
|
+
* layer on top. Omit to use only the instance theme. Mode (light/dark) is
|
|
113
|
+
* unaffected, so set both variants of any per-mode key if the host is
|
|
114
|
+
* single-mode.
|
|
115
|
+
*/
|
|
116
|
+
theme?: Theme;
|
|
60
117
|
}
|
|
61
118
|
|
|
62
119
|
const getApiClients = (
|
|
@@ -83,22 +140,43 @@ const getApiClients = (
|
|
|
83
140
|
return {
|
|
84
141
|
models: new ModelsApi(config, basePath, axiosInstance),
|
|
85
142
|
publisher: new PublisherApi(config, basePath, axiosInstance),
|
|
86
|
-
|
|
143
|
+
environments: new EnvironmentsApi(config, basePath, axiosInstance),
|
|
87
144
|
packages: new PackagesApi(config, basePath, axiosInstance),
|
|
145
|
+
dashboards: new DashboardsApi(config, basePath, axiosInstance),
|
|
146
|
+
dataApps: new DataAppsApi(config, basePath, axiosInstance),
|
|
88
147
|
notebooks: new NotebooksApi(config, basePath, axiosInstance),
|
|
89
148
|
connections: new ConnectionsApi(config, basePath, axiosInstance),
|
|
90
149
|
databases: new DatabasesApi(config, basePath, axiosInstance),
|
|
150
|
+
materializations: new MaterializationsApi(
|
|
151
|
+
config,
|
|
152
|
+
basePath,
|
|
153
|
+
axiosInstance,
|
|
154
|
+
),
|
|
91
155
|
watchMode: new WatchModeApi(config, basePath, axiosInstance),
|
|
92
156
|
};
|
|
93
157
|
};
|
|
94
158
|
|
|
95
159
|
export type ApiClients = ReturnType<typeof getApiClients>;
|
|
96
160
|
|
|
97
|
-
|
|
161
|
+
/**
|
|
162
|
+
* Outer wrapper that owns the QueryClient. The inner component runs
|
|
163
|
+
* react-query hooks for /status, so it has to live below the
|
|
164
|
+
* QueryClientProvider.
|
|
165
|
+
*/
|
|
166
|
+
export const ServerProvider: React.FC<ServerProviderProps> = (props) => {
|
|
167
|
+
return (
|
|
168
|
+
<QueryClientProvider client={globalQueryClient}>
|
|
169
|
+
<ServerProviderInner {...props} />
|
|
170
|
+
</QueryClientProvider>
|
|
171
|
+
);
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
const ServerProviderInner: React.FC<ServerProviderProps> = ({
|
|
98
175
|
children,
|
|
99
176
|
getAccessToken,
|
|
100
177
|
baseURL,
|
|
101
178
|
mutable: mutableProp,
|
|
179
|
+
theme: themeProp,
|
|
102
180
|
}) => {
|
|
103
181
|
const apiClients = useMemo(
|
|
104
182
|
() => getApiClients(baseURL, getAccessToken),
|
|
@@ -108,48 +186,87 @@ export const ServerProvider: React.FC<ServerProviderProps> = ({
|
|
|
108
186
|
const server =
|
|
109
187
|
baseURL || `${window.location.protocol}//${window.location.host}/api/v0`;
|
|
110
188
|
|
|
111
|
-
|
|
112
|
-
|
|
189
|
+
// Fetch /status via react-query so callers like the Theme Editor can
|
|
190
|
+
// invalidate the "status" key after a write and pick up the new
|
|
191
|
+
// instanceTheme without a full page reload.
|
|
192
|
+
const statusQuery = useQuery({
|
|
193
|
+
queryKey: ["status"],
|
|
194
|
+
queryFn: async () => {
|
|
195
|
+
const response = await apiClients.publisher.getStatus();
|
|
196
|
+
return response.data as {
|
|
197
|
+
frozenConfig?: boolean;
|
|
198
|
+
theme?: Theme;
|
|
199
|
+
};
|
|
200
|
+
},
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
if (statusQuery.error) {
|
|
204
|
+
console.error("Failed to fetch publisher status:", statusQuery.error);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
const frozenConfig = statusQuery.data?.frozenConfig;
|
|
208
|
+
const instanceTheme = statusQuery.data?.theme;
|
|
209
|
+
const isLoadingStatus = statusQuery.isLoading;
|
|
210
|
+
|
|
211
|
+
// Preserve original semantics: while loading or on error, mirror the
|
|
212
|
+
// mutableProp the caller passed in (which itself may be undefined).
|
|
213
|
+
// Once /status arrives, frozenConfig forces read-only; otherwise the
|
|
214
|
+
// explicit prop wins, with a default of true.
|
|
215
|
+
let mutable: boolean | undefined;
|
|
216
|
+
if (statusQuery.isLoading || statusQuery.error) {
|
|
217
|
+
mutable = mutableProp;
|
|
218
|
+
} else if (frozenConfig) {
|
|
219
|
+
mutable = false;
|
|
220
|
+
} else {
|
|
221
|
+
mutable = mutableProp ?? true;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// Stable layers reference so ThemeProvider's useMemo doesn't reshuffle on
|
|
225
|
+
// every render when the inputs are unchanged. Layers are low-to-high
|
|
226
|
+
// precedence, so the embedder-supplied theme (if any) comes last and
|
|
227
|
+
// overrides the operator's instance theme from /status.
|
|
228
|
+
const themeLayers = useMemo(
|
|
229
|
+
() => [instanceTheme, themeProp],
|
|
230
|
+
[instanceTheme, themeProp],
|
|
231
|
+
);
|
|
232
|
+
|
|
233
|
+
// Viewer's light/dark/auto preference. localStorage is the source of
|
|
234
|
+
// truth across reloads; matchMedia provides the OS hint that 'auto'
|
|
235
|
+
// resolves against.
|
|
236
|
+
const [userChoice, setUserChoice] = useState<ThemeMode | "auto" | undefined>(
|
|
237
|
+
readStoredMode,
|
|
238
|
+
);
|
|
239
|
+
const [prefersDark, setPrefersDark] = useState<boolean>(getPrefersDark);
|
|
113
240
|
|
|
114
|
-
// Fetch status on mount
|
|
115
241
|
useEffect(() => {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
fetchStatus();
|
|
148
|
-
|
|
149
|
-
return () => {
|
|
150
|
-
isMounted = false;
|
|
151
|
-
};
|
|
152
|
-
}, [apiClients, mutableProp]);
|
|
242
|
+
if (typeof window === "undefined" || !window.matchMedia) return;
|
|
243
|
+
const media = window.matchMedia("(prefers-color-scheme: dark)");
|
|
244
|
+
const listener = (e: MediaQueryListEvent) => setPrefersDark(e.matches);
|
|
245
|
+
media.addEventListener("change", listener);
|
|
246
|
+
return () => media.removeEventListener("change", listener);
|
|
247
|
+
}, []);
|
|
248
|
+
|
|
249
|
+
const setMode = useCallback((next: ThemeMode | "auto") => {
|
|
250
|
+
setUserChoice(next);
|
|
251
|
+
writeStoredMode(next);
|
|
252
|
+
}, []);
|
|
253
|
+
|
|
254
|
+
// When the operator forbids viewer overrides, ignore localStorage and
|
|
255
|
+
// honour only the instance defaultMode (with the OS preference for
|
|
256
|
+
// 'auto'). The toggle UI hides itself in this case, but this guard
|
|
257
|
+
// protects against an old localStorage entry from before the operator
|
|
258
|
+
// locked it.
|
|
259
|
+
const allowUserToggle = instanceTheme?.allowUserToggle ?? true;
|
|
260
|
+
const effectiveUserChoice = allowUserToggle ? userChoice : undefined;
|
|
261
|
+
const mode: ThemeMode = useMemo(
|
|
262
|
+
() =>
|
|
263
|
+
resolveMode(
|
|
264
|
+
instanceTheme?.defaultMode,
|
|
265
|
+
effectiveUserChoice,
|
|
266
|
+
prefersDark,
|
|
267
|
+
),
|
|
268
|
+
[instanceTheme?.defaultMode, effectiveUserChoice, prefersDark],
|
|
269
|
+
);
|
|
153
270
|
|
|
154
271
|
const value: ServerContextValue = {
|
|
155
272
|
server,
|
|
@@ -157,14 +274,21 @@ export const ServerProvider: React.FC<ServerProviderProps> = ({
|
|
|
157
274
|
apiClients,
|
|
158
275
|
mutable,
|
|
159
276
|
isLoadingStatus,
|
|
277
|
+
instanceTheme,
|
|
160
278
|
};
|
|
161
279
|
|
|
162
280
|
return (
|
|
163
|
-
<
|
|
164
|
-
<
|
|
281
|
+
<ServerContext.Provider value={value}>
|
|
282
|
+
<ThemeProvider
|
|
283
|
+
layers={themeLayers}
|
|
284
|
+
mode={mode}
|
|
285
|
+
userChoice={effectiveUserChoice}
|
|
286
|
+
setMode={setMode}
|
|
287
|
+
allowUserToggle={allowUserToggle}
|
|
288
|
+
>
|
|
165
289
|
{children}
|
|
166
|
-
</
|
|
167
|
-
</
|
|
290
|
+
</ThemeProvider>
|
|
291
|
+
</ServerContext.Provider>
|
|
168
292
|
);
|
|
169
293
|
};
|
|
170
294
|
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// Copyright (c) Credible Data Inc.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
1
4
|
import CloseIcon from "@mui/icons-material/Close";
|
|
2
5
|
import FileUploadOutlinedIcon from "@mui/icons-material/FileUploadOutlined";
|
|
3
6
|
import {
|
|
@@ -32,16 +35,16 @@ export function ModelPicker({
|
|
|
32
35
|
resourceUri,
|
|
33
36
|
}: ModelPickerProps) {
|
|
34
37
|
const {
|
|
35
|
-
|
|
38
|
+
environmentName: environmentName,
|
|
36
39
|
packageName: packageName,
|
|
37
40
|
versionId: versionId,
|
|
38
41
|
} = parseResourceUri(resourceUri);
|
|
39
42
|
const { apiClients } = useServer();
|
|
40
43
|
|
|
41
44
|
const { data, isLoading, isSuccess, isError, error } = useQueryWithApiError({
|
|
42
|
-
queryKey: ["models",
|
|
45
|
+
queryKey: ["models", environmentName, packageName, versionId],
|
|
43
46
|
queryFn: () =>
|
|
44
|
-
apiClients.models.listModels(
|
|
47
|
+
apiClients.models.listModels(environmentName, packageName, versionId),
|
|
45
48
|
});
|
|
46
49
|
const [selectedModels, setSelectedModels] = React.useState<string[]>(
|
|
47
50
|
initialSelectedModels || [],
|
|
@@ -76,7 +79,7 @@ export function ModelPicker({
|
|
|
76
79
|
return (
|
|
77
80
|
<ApiErrorDisplay
|
|
78
81
|
error={error}
|
|
79
|
-
context={`${
|
|
82
|
+
context={`${environmentName} > ${packageName} > Model Picker`}
|
|
80
83
|
/>
|
|
81
84
|
);
|
|
82
85
|
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// Copyright (c) Credible Data Inc.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
1
4
|
import CheckIcon from "@mui/icons-material/Check";
|
|
2
5
|
import CodeIcon from "@mui/icons-material/Code";
|
|
3
6
|
import EditOutlinedIcon from "@mui/icons-material/EditOutlined";
|
|
@@ -18,6 +21,7 @@ import {
|
|
|
18
21
|
import MDEditor from "@uiw/react-md-editor/nohighlight";
|
|
19
22
|
import Markdown from "markdown-to-jsx";
|
|
20
23
|
import React, { useEffect, useState } from "react";
|
|
24
|
+
import { usePublisherTheme } from "../../theme/ThemeContext";
|
|
21
25
|
import { highlight } from "../highlighter";
|
|
22
26
|
import {
|
|
23
27
|
emptyQueryExplorerResult,
|
|
@@ -73,12 +77,13 @@ export function MutableCell({
|
|
|
73
77
|
: 0,
|
|
74
78
|
);
|
|
75
79
|
|
|
80
|
+
const { mode } = usePublisherTheme();
|
|
76
81
|
useEffect(() => {
|
|
77
82
|
if (!cell.isMarkdown)
|
|
78
|
-
highlight(cell.value, "malloy").then((code) => {
|
|
83
|
+
highlight(cell.value, "malloy", mode).then((code) => {
|
|
79
84
|
setHighlightedMalloyCode(code);
|
|
80
85
|
});
|
|
81
|
-
}, [cell]);
|
|
86
|
+
}, [cell, mode]);
|
|
82
87
|
React.useEffect(() => {
|
|
83
88
|
document.documentElement.setAttribute("data-color-mode", "light");
|
|
84
89
|
});
|
|
@@ -265,14 +270,14 @@ export function MutableCell({
|
|
|
265
270
|
|
|
266
271
|
return (
|
|
267
272
|
<StyledCard
|
|
268
|
-
sx={{
|
|
273
|
+
sx={(theme) => ({
|
|
269
274
|
position: "relative",
|
|
270
275
|
marginTop: "5px",
|
|
271
276
|
marginBottom: "5px",
|
|
272
277
|
borderWidth: "1.5px",
|
|
273
|
-
backgroundColor:
|
|
278
|
+
backgroundColor: theme.palette.background.paper,
|
|
274
279
|
minHeight: "50px",
|
|
275
|
-
}}
|
|
280
|
+
})}
|
|
276
281
|
onMouseEnter={() => setIsHovered(true)}
|
|
277
282
|
onMouseLeave={() => {
|
|
278
283
|
setIsHovered(false);
|