@malloy-publisher/sdk 0.0.248 → 0.0.250
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 +37 -17
- package/TREE_SHAKING.md +5 -0
- package/bunfig.toml +3 -0
- package/dist/ServerProvider-CcfeBpt3.cjs.js +1 -0
- package/dist/{ServerProvider-BxEh3nFI.es.js → ServerProvider-EqBlMMqx.es.js} +1056 -905
- package/dist/client/api.d.ts +306 -9
- package/dist/client/index.cjs.js +1 -1
- package/dist/client/index.es.js +74 -70
- 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/Notebook/Notebook.d.ts +46 -8
- package/dist/components/Notebook/NotebookCell.d.ts +37 -3
- 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 +17 -1
- 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 +3 -1
- package/dist/components/ResultsDialog.d.ts +4 -1
- package/dist/components/ServerProvider.d.ts +2 -1
- 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 +27 -3
- package/dist/components/given/GivensPanel.d.ts +36 -7
- package/dist/components/given/filterValue.d.ts +97 -0
- package/dist/components/given/index.d.ts +1 -1
- package/dist/components/given/paramCodec.d.ts +60 -0
- package/dist/components/index.d.ts +4 -1
- package/dist/components/styles.d.ts +31 -0
- package/dist/constants/docLinks.d.ts +6 -0
- package/dist/{core-C86Rb7tJ.cjs.js → core-CVXEUnnm.cjs.js} +1 -1
- package/dist/{core-BuvlzSIX.es.js → core-Cr-9Wkp3.es.js} +1 -1
- package/dist/hooks/givenValue.d.ts +10 -0
- package/dist/hooks/index.d.ts +3 -1
- package/dist/hooks/useGivensState.d.ts +64 -0
- package/dist/hooks/useSuggestOptions.d.ts +78 -0
- package/dist/index-C-KeIwsG.cjs.js +339 -0
- package/dist/{index-BdtAZ5k6.es.js → index-DVkelll3.es.js} +40981 -39669
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +77 -62
- package/dist/theme/types.d.ts +9 -0
- package/dist/utils/malloyString.d.ts +7 -0
- package/package.json +3 -1
- package/src/client-entry.ts +3 -0
- package/src/components/AnalyzePackageButton.tsx +3 -0
- package/src/components/ApiErrorDisplay.tsx +3 -0
- package/src/components/Connections/AddConnectionDialog.tsx +13 -1
- package/src/components/Connections/DeleteConnectionDialog.tsx +3 -0
- package/src/components/Connections/EditConnectionDialog.tsx +3 -0
- package/src/components/Connections/common.ts +3 -0
- 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 +3 -0
- package/src/components/DataAppViewer/index.ts +3 -0
- package/src/components/Environment/About.tsx +3 -0
- package/src/components/Environment/AddPackageDialog.tsx +3 -0
- package/src/components/Environment/ConnectionExplorer.tsx +3 -0
- package/src/components/Environment/Connections.tsx +3 -0
- package/src/components/Environment/DeletePackageDialog.tsx +3 -0
- package/src/components/Environment/EditPackageDialog.tsx +3 -0
- package/src/components/Environment/Environment.tsx +3 -0
- package/src/components/Environment/Packages.tsx +3 -0
- package/src/components/Environment/index.ts +3 -0
- package/src/components/Home/AddEnvironmentDialog.tsx +3 -0
- package/src/components/Home/DeleteEnvironmentDialog.tsx +3 -0
- package/src/components/Home/EditEnvironmentDialog.tsx +3 -0
- package/src/components/Home/Home.tsx +113 -23
- package/src/components/Home/index.ts +3 -0
- package/src/components/Loading.tsx +3 -0
- package/src/components/Materializations/CreateEnvMaterializationDialog.tsx +3 -0
- package/src/components/Materializations/CreateMaterializationDialog.tsx +3 -0
- package/src/components/Materializations/DeleteMaterializationDialog.tsx +3 -0
- package/src/components/Materializations/EnvironmentMaterializations.tsx +3 -0
- package/src/components/Materializations/ManifestView.tsx +3 -0
- package/src/components/Materializations/MaterializationDetailDialog.tsx +3 -0
- package/src/components/Materializations/MaterializationRunsList.tsx +3 -0
- package/src/components/Materializations/Materializations.tsx +3 -0
- package/src/components/Materializations/ScheduleCard.tsx +3 -0
- package/src/components/Materializations/SectionLabel.tsx +3 -0
- package/src/components/Materializations/SetScheduleDialog.tsx +3 -0
- package/src/components/Materializations/TriggerChip.tsx +3 -0
- package/src/components/Materializations/cron.ts +3 -0
- package/src/components/Materializations/index.ts +3 -0
- package/src/components/Materializations/utils.ts +3 -0
- package/src/components/Model/Model.tsx +3 -0
- package/src/components/Model/ModelCell.tsx +3 -0
- package/src/components/Model/ModelExplorer.tsx +3 -0
- package/src/components/Model/ModelExplorerDialog.tsx +3 -0
- package/src/components/Model/SourcesExplorer.tsx +3 -0
- package/src/components/Model/index.ts +3 -0
- package/src/components/Model/useModelData.ts +3 -0
- package/src/components/Notebook/Notebook.tsx +447 -390
- package/src/components/Notebook/NotebookCell.tsx +120 -3
- 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 +80 -6
- package/src/components/Package/FileTreeView.tsx +3 -0
- package/src/components/Package/Models.tsx +3 -0
- package/src/components/Package/Package.tsx +151 -38
- package/src/components/Package/index.ts +3 -0
- package/src/components/QueryResult/QueryResult.tsx +3 -0
- package/src/components/QueryResult/index.ts +3 -0
- package/src/components/RenderedResult/RenderedResult.tsx +312 -19
- package/src/components/RenderedResult/ResultContainer.tsx +31 -1
- package/src/components/RenderedResult/index.ts +3 -0
- package/src/components/RenderedResult/renderLogs.spec.ts +3 -0
- package/src/components/RenderedResult/renderLogs.ts +3 -0
- package/src/components/ResultsDialog.tsx +8 -0
- package/src/components/ServerProvider.tsx +5 -0
- package/src/components/Workbook/BrowserWorkbookStorage.ts +3 -0
- package/src/components/Workbook/EditableMalloyCell.tsx +3 -0
- package/src/components/Workbook/ModelPicker.tsx +3 -0
- package/src/components/Workbook/MutableCell.tsx +3 -0
- package/src/components/Workbook/Workbook.tsx +3 -0
- 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 +498 -15
- package/src/components/given/GivenInput.tsx +565 -30
- package/src/components/given/GivensPanel.spec.tsx +175 -0
- package/src/components/given/GivensPanel.tsx +142 -32
- package/src/components/given/filterValue.spec.ts +364 -0
- package/src/components/given/filterValue.ts +207 -0
- package/src/components/given/index.ts +8 -1
- package/src/components/given/paramCodec.spec.ts +857 -0
- package/src/components/given/paramCodec.ts +483 -0
- package/src/components/given/utils.spec.ts +3 -0
- package/src/components/given/utils.ts +3 -0
- package/src/components/highlighter.ts +3 -0
- package/src/components/index.ts +7 -1
- package/src/components/styles.ts +38 -3
- package/src/constants/docLinks.spec.ts +54 -0
- package/src/constants/docLinks.ts +29 -0
- package/src/hooks/givenValue.ts +13 -0
- package/src/hooks/index.ts +9 -4
- package/src/hooks/useDimensionFilters.ts +4 -7
- package/src/hooks/useDimensionFiltersFromSpec.ts +3 -0
- package/src/hooks/useDimensionFiltersQuery.ts +4 -7
- package/src/hooks/useDimensionalFilterRangeData.ts +4 -7
- package/src/hooks/useGivensState.spec.ts +449 -0
- package/src/hooks/useGivensState.ts +340 -0
- package/src/hooks/useModelGivens.ts +3 -0
- package/src/hooks/useQueryWithApiError.ts +3 -0
- package/src/hooks/useRawQueryData.ts +3 -0
- package/src/hooks/useSuggestOptions.spec.ts +112 -0
- package/src/hooks/useSuggestOptions.ts +263 -0
- package/src/index.ts +3 -0
- package/src/react-app-env.d.ts +3 -0
- package/src/theme/ThemeContext.tsx +3 -0
- package/src/theme/buildMalloyExplicitTheme.ts +3 -0
- package/src/theme/buildTableCssVars.spec.ts +3 -0
- package/src/theme/buildTableCssVars.ts +7 -0
- package/src/theme/buildVegaThemeOverride.spec.ts +3 -0
- package/src/theme/buildVegaThemeOverride.ts +3 -0
- package/src/theme/defaults.ts +3 -0
- package/src/theme/index.ts +3 -0
- package/src/theme/keys.ts +3 -0
- package/src/theme/readChartAnnotations.spec.ts +3 -0
- package/src/theme/readChartAnnotations.ts +3 -0
- package/src/theme/resolveTheme.spec.ts +16 -0
- package/src/theme/resolveTheme.ts +6 -0
- package/src/theme/types.ts +12 -0
- package/src/utils/dataAppEmbed.spec.ts +3 -0
- package/src/utils/dataAppEmbed.ts +3 -0
- package/src/utils/formatting.spec.ts +3 -0
- package/src/utils/formatting.ts +3 -0
- package/src/utils/malloyString.spec.ts +24 -0
- package/src/utils/malloyString.ts +12 -0
- package/src/utils/parsing.spec.ts +3 -0
- package/src/utils/parsing.ts +3 -0
- package/src/utils/queryClient.ts +3 -0
- package/test/README.md +21 -10
- package/test/setup.ts +3 -0
- package/vite.config.ts +3 -0
- package/dist/ServerProvider-Dg5S1qBU.cjs.js +0 -1
- package/dist/hooks/useGivensForm.d.ts +0 -35
- package/dist/index-MES4MGpQ.cjs.js +0 -309
- package/src/hooks/useGivensForm.spec.ts +0 -99
- package/src/hooks/useGivensForm.ts +0 -107
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// Copyright (c) Credible Data Inc.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
1
4
|
import ArrowBackIcon from "@mui/icons-material/ArrowBack";
|
|
2
5
|
import CloseIcon from "@mui/icons-material/Close";
|
|
3
6
|
import OpenInNewIcon from "@mui/icons-material/OpenInNew";
|
|
@@ -22,28 +25,27 @@ import React, { useState } from "react";
|
|
|
22
25
|
import { Database } from "../../client";
|
|
23
26
|
import { useQueryWithApiError } from "../../hooks/useQueryWithApiError";
|
|
24
27
|
import { ApiErrorDisplay } from "../ApiErrorDisplay";
|
|
25
|
-
import { RetrievalFunction } from "../filter/DimensionFilter";
|
|
26
28
|
import { Loading } from "../Loading";
|
|
27
29
|
import { Notebook } from "../Notebook";
|
|
28
30
|
import { useServer } from "../ServerProvider";
|
|
29
31
|
import { encodeResourceUri, parseResourceUri } from "../../utils/formatting";
|
|
30
32
|
import { serverBaseUrl } from "../../utils/dataAppEmbed";
|
|
31
|
-
import {
|
|
32
|
-
import ContentTypeIcon
|
|
33
|
+
import { MONO_FONT_FAMILY } from "../styles";
|
|
34
|
+
import ContentTypeIcon, {
|
|
35
|
+
CONTENT_TINT,
|
|
36
|
+
type ContentType,
|
|
37
|
+
} from "./ContentTypeIcon";
|
|
33
38
|
|
|
34
39
|
const README_NOTEBOOK = "README.malloynb";
|
|
35
40
|
|
|
36
41
|
interface PackageProps {
|
|
37
42
|
onClickPackageFile?: (to: string, event?: React.MouseEvent) => void;
|
|
38
43
|
resourceUri: string;
|
|
39
|
-
/** Optional retrieval function for semantic search filters */
|
|
40
|
-
retrievalFn?: RetrievalFunction;
|
|
41
44
|
}
|
|
42
45
|
|
|
43
46
|
export default function Package({
|
|
44
47
|
onClickPackageFile,
|
|
45
48
|
resourceUri,
|
|
46
|
-
retrievalFn,
|
|
47
49
|
}: PackageProps) {
|
|
48
50
|
const { apiClients, server } = useServer();
|
|
49
51
|
const onClick =
|
|
@@ -128,11 +130,65 @@ export default function Package({
|
|
|
128
130
|
});
|
|
129
131
|
const dataApps = dataAppsQuery.data?.data ?? [];
|
|
130
132
|
|
|
133
|
+
// No versionId, for the same reason as data apps: the dashboards endpoint
|
|
134
|
+
// takes only env + package.
|
|
135
|
+
const dashboardsQuery = useQueryWithApiError({
|
|
136
|
+
queryKey: ["dashboards", environmentName, packageName],
|
|
137
|
+
queryFn: async () => {
|
|
138
|
+
try {
|
|
139
|
+
return await apiClients.dashboards.listDashboards(
|
|
140
|
+
environmentName,
|
|
141
|
+
packageName,
|
|
142
|
+
);
|
|
143
|
+
} catch (e) {
|
|
144
|
+
// Non-fatal for the same reasons as the data-apps list above: an
|
|
145
|
+
// older Publisher without the route should render a package page
|
|
146
|
+
// without a Dashboards section, not an error.
|
|
147
|
+
const status = (e as { response?: { status?: number } })?.response
|
|
148
|
+
?.status;
|
|
149
|
+
if (status === 404 || status === undefined) {
|
|
150
|
+
return { data: [] } as Awaited<
|
|
151
|
+
ReturnType<typeof apiClients.dashboards.listDashboards>
|
|
152
|
+
>;
|
|
153
|
+
}
|
|
154
|
+
throw e;
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
});
|
|
158
|
+
// Sorted by the string the row actually SHOWS, not by the slug or the path
|
|
159
|
+
// underneath it. A list labelled by title and ordered by filename reads as
|
|
160
|
+
// unsorted: `overview` titled "Business Overview" sorts ahead of `regions`
|
|
161
|
+
// titled "Regional Sales". Notebooks acquired that mismatch here too, when
|
|
162
|
+
// they started being listed by title while still being ordered by path.
|
|
163
|
+
const dashboardLabel = (dashboard: { name?: string; title?: string }) =>
|
|
164
|
+
dashboard.title && dashboard.title !== dashboard.name
|
|
165
|
+
? dashboard.title
|
|
166
|
+
: (dashboard.name ?? "");
|
|
167
|
+
const notebookLabel = (notebook: { path?: string; title?: string }) =>
|
|
168
|
+
notebook.title && notebook.title !== notebook.path
|
|
169
|
+
? notebook.title
|
|
170
|
+
: (notebook.path ?? "");
|
|
171
|
+
|
|
172
|
+
const dashboards = (dashboardsQuery.data?.data ?? [])
|
|
173
|
+
.slice()
|
|
174
|
+
.sort((a, b) => dashboardLabel(a).localeCompare(dashboardLabel(b)));
|
|
175
|
+
|
|
131
176
|
const notebooks = (notebooksQuery.data?.data ?? [])
|
|
132
177
|
.slice()
|
|
133
|
-
.sort((a, b) => a.
|
|
178
|
+
.sort((a, b) => notebookLabel(a).localeCompare(notebookLabel(b)));
|
|
179
|
+
// A dashboard is listed once, under Dashboards. Its file is a model like any
|
|
180
|
+
// other, so it would otherwise appear a second time under Semantic Models
|
|
181
|
+
// where clicking it opens the Explorer rather than the dashboard. Untagged
|
|
182
|
+
// shared includes in `dashboards/` are not dashboards and stay in the model
|
|
183
|
+
// list, which is where they belong.
|
|
184
|
+
const dashboardPaths = new Set(
|
|
185
|
+
dashboards
|
|
186
|
+
.map((dashboard) => dashboard.path)
|
|
187
|
+
.filter((path): path is string => path !== undefined),
|
|
188
|
+
);
|
|
134
189
|
const models = (modelsQuery.data?.data ?? [])
|
|
135
190
|
.slice()
|
|
191
|
+
.filter((model) => !dashboardPaths.has(model.path))
|
|
136
192
|
.sort((a, b) => a.path.localeCompare(b.path));
|
|
137
193
|
const databases = (databasesQuery.data?.data ?? [])
|
|
138
194
|
.slice()
|
|
@@ -147,7 +203,16 @@ export default function Package({
|
|
|
147
203
|
modelPath: README_NOTEBOOK,
|
|
148
204
|
});
|
|
149
205
|
|
|
150
|
-
|
|
206
|
+
// The dashboards list is part of the gate, not just the notebooks one,
|
|
207
|
+
// because the models list is FILTERED by it. Gated on notebooks alone, a
|
|
208
|
+
// dashboards call that resolves after the models call rendered the sections
|
|
209
|
+
// with an empty `dashboardPaths`, so `dashboards/overview.malloy` appeared
|
|
210
|
+
// under Semantic Models and then vanished: the double listing the filter
|
|
211
|
+
// exists to prevent, briefly on screen. It cannot hang the page: the query
|
|
212
|
+
// above turns a 404 or a transport failure into an empty list.
|
|
213
|
+
const isLoading =
|
|
214
|
+
(!notebooksQuery.isSuccess && !notebooksQuery.isError) ||
|
|
215
|
+
(!dashboardsQuery.isSuccess && !dashboardsQuery.isError);
|
|
151
216
|
|
|
152
217
|
if (pkgQuery.isError) {
|
|
153
218
|
return (
|
|
@@ -205,21 +270,66 @@ export default function Package({
|
|
|
205
270
|
|
|
206
271
|
{!isLoading && (
|
|
207
272
|
<>
|
|
273
|
+
{/* First: the at-a-glance artifact a visitor most likely wants,
|
|
274
|
+
ahead of the notebooks and models it is built on. Hidden when
|
|
275
|
+
empty, like Data Apps. */}
|
|
276
|
+
{dashboards.length > 0 && (
|
|
277
|
+
<PackageSection title="Dashboards" count={dashboards.length}>
|
|
278
|
+
{dashboards.map((dashboard) => {
|
|
279
|
+
// A title equal to the slug is what the server falls
|
|
280
|
+
// back to when the file names itself neither way, so
|
|
281
|
+
// showing both would print the same word twice.
|
|
282
|
+
const hasTitle =
|
|
283
|
+
!!dashboard.title &&
|
|
284
|
+
dashboard.title !== dashboard.name;
|
|
285
|
+
return (
|
|
286
|
+
<PackageItemRow
|
|
287
|
+
key={dashboard.name}
|
|
288
|
+
type="dashboard"
|
|
289
|
+
label={
|
|
290
|
+
hasTitle ? dashboard.title! : dashboard.name!
|
|
291
|
+
}
|
|
292
|
+
rightLabel={hasTitle ? dashboard.name : undefined}
|
|
293
|
+
onClick={(event) =>
|
|
294
|
+
onClick(
|
|
295
|
+
`/${environmentName}/${packageName}/dashboards/` +
|
|
296
|
+
// The slug comes from a filename, which
|
|
297
|
+
// can hold characters that would read as
|
|
298
|
+
// structure in a path. The server encodes
|
|
299
|
+
// it in `resource` for the same reason.
|
|
300
|
+
encodeURIComponent(dashboard.name ?? ""),
|
|
301
|
+
event,
|
|
302
|
+
)
|
|
303
|
+
}
|
|
304
|
+
/>
|
|
305
|
+
);
|
|
306
|
+
})}
|
|
307
|
+
</PackageSection>
|
|
308
|
+
)}
|
|
309
|
+
|
|
208
310
|
<PackageSection title="Notebooks" count={notebooks.length}>
|
|
209
|
-
{notebooks.map((notebook) =>
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
311
|
+
{notebooks.map((notebook) => {
|
|
312
|
+
// Named the way dashboards and data apps are: a notebook
|
|
313
|
+
// that titles itself is listed by that title, with the
|
|
314
|
+
// filename kept as the secondary label so the path a
|
|
315
|
+
// reader needs to find the file is never lost.
|
|
316
|
+
const hasTitle =
|
|
317
|
+
!!notebook.title && notebook.title !== notebook.path;
|
|
318
|
+
return (
|
|
319
|
+
<PackageItemRow
|
|
320
|
+
key={notebook.path}
|
|
321
|
+
type="report"
|
|
322
|
+
label={hasTitle ? notebook.title! : notebook.path}
|
|
323
|
+
rightLabel={hasTitle ? notebook.path : undefined}
|
|
324
|
+
onClick={(event) =>
|
|
325
|
+
onClick(
|
|
326
|
+
`/${environmentName}/${packageName}/${notebook.path}`,
|
|
327
|
+
event,
|
|
328
|
+
)
|
|
329
|
+
}
|
|
330
|
+
/>
|
|
331
|
+
);
|
|
332
|
+
})}
|
|
223
333
|
{notebooks.length === 0 && <EmptyRow label="No notebooks" />}
|
|
224
334
|
</PackageSection>
|
|
225
335
|
|
|
@@ -239,8 +349,7 @@ export default function Package({
|
|
|
239
349
|
return (
|
|
240
350
|
<PackageItemRow
|
|
241
351
|
key={dataApp.path}
|
|
242
|
-
|
|
243
|
-
tint={MALLOY_BRAND.teal}
|
|
352
|
+
type="dataApp"
|
|
244
353
|
label={hasTitle ? dataApp.title : dataApp.path}
|
|
245
354
|
rightLabel={hasTitle ? dataApp.path : undefined}
|
|
246
355
|
onClick={(event) => {
|
|
@@ -255,7 +364,7 @@ export default function Package({
|
|
|
255
364
|
event,
|
|
256
365
|
);
|
|
257
366
|
} else {
|
|
258
|
-
// No host app
|
|
367
|
+
// No host app: navigate to standalone HTML.
|
|
259
368
|
if (
|
|
260
369
|
event &&
|
|
261
370
|
(event.metaKey || event.ctrlKey)
|
|
@@ -293,8 +402,7 @@ export default function Package({
|
|
|
293
402
|
{models.map((model) => (
|
|
294
403
|
<PackageItemRow
|
|
295
404
|
key={model.path}
|
|
296
|
-
|
|
297
|
-
tint={MALLOY_BRAND.orange}
|
|
405
|
+
type="model"
|
|
298
406
|
label={model.path}
|
|
299
407
|
onClick={(event) =>
|
|
300
408
|
onClick(
|
|
@@ -311,8 +419,7 @@ export default function Package({
|
|
|
311
419
|
{databases.map((database) => (
|
|
312
420
|
<PackageItemRow
|
|
313
421
|
key={database.path}
|
|
314
|
-
|
|
315
|
-
tint={MALLOY_BRAND.darkBlue}
|
|
422
|
+
type="data"
|
|
316
423
|
label={database.path}
|
|
317
424
|
rightLabel={
|
|
318
425
|
// A file the server could not probe is listed with
|
|
@@ -330,8 +437,7 @@ export default function Package({
|
|
|
330
437
|
|
|
331
438
|
<PackageSection title="Materializations">
|
|
332
439
|
<PackageItemRow
|
|
333
|
-
|
|
334
|
-
tint={MALLOY_BRAND.teal}
|
|
440
|
+
type="materialization"
|
|
335
441
|
label="Materializations"
|
|
336
442
|
onClick={(event) =>
|
|
337
443
|
onClick(
|
|
@@ -346,7 +452,6 @@ export default function Package({
|
|
|
346
452
|
<Box sx={{ mt: 6 }}>
|
|
347
453
|
<Notebook
|
|
348
454
|
resourceUri={readmeResourceUri}
|
|
349
|
-
retrievalFn={retrievalFn}
|
|
350
455
|
onNavigate={onClick}
|
|
351
456
|
/>
|
|
352
457
|
</Box>
|
|
@@ -436,16 +541,24 @@ function PackageSection({
|
|
|
436
541
|
);
|
|
437
542
|
}
|
|
438
543
|
|
|
544
|
+
/**
|
|
545
|
+
* A row names its content type once. The glyph and the color behind it are two
|
|
546
|
+
* halves of one signal, so the row derives both rather than letting a caller
|
|
547
|
+
* pair a dashboard's icon with a model's color.
|
|
548
|
+
*
|
|
549
|
+
* That is not hypothetical tidying: with the two passed separately, four of the
|
|
550
|
+
* six rows on this page had been handed the same teal, so color told a reader
|
|
551
|
+
* nothing about four of the kinds it was there to distinguish. A rule each call
|
|
552
|
+
* site has to remember is a rule some call sites will forget.
|
|
553
|
+
*/
|
|
439
554
|
function PackageItemRow({
|
|
440
|
-
|
|
441
|
-
tint,
|
|
555
|
+
type,
|
|
442
556
|
label,
|
|
443
557
|
rightLabel,
|
|
444
558
|
onClick,
|
|
445
559
|
trailingAction,
|
|
446
560
|
}: {
|
|
447
|
-
|
|
448
|
-
tint: string;
|
|
561
|
+
type: ContentType;
|
|
449
562
|
label: string;
|
|
450
563
|
rightLabel?: string;
|
|
451
564
|
onClick?: (event: React.MouseEvent) => void;
|
|
@@ -500,7 +613,7 @@ function PackageItemRow({
|
|
|
500
613
|
width: 32,
|
|
501
614
|
height: 32,
|
|
502
615
|
borderRadius: 1,
|
|
503
|
-
bgcolor:
|
|
616
|
+
bgcolor: CONTENT_TINT[type],
|
|
504
617
|
color: "#FFFFFF",
|
|
505
618
|
display: "flex",
|
|
506
619
|
alignItems: "center",
|
|
@@ -508,7 +621,7 @@ function PackageItemRow({
|
|
|
508
621
|
flexShrink: 0,
|
|
509
622
|
}}
|
|
510
623
|
>
|
|
511
|
-
{
|
|
624
|
+
<ContentTypeIcon type={type} />
|
|
512
625
|
</Box>
|
|
513
626
|
<Typography
|
|
514
627
|
variant="body2"
|