@malloy-publisher/sdk 0.0.198-dev → 0.0.198-dev1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ServerProvider-DDScRRDc.es.js → ServerProvider-BuM1usxf.es.js} +181 -177
- package/dist/{ServerProvider-IhQ4aYBm.cjs.js → ServerProvider-C_Mnvmgc.cjs.js} +1 -1
- package/dist/client/api.d.ts +61 -4
- package/dist/client/index.cjs.js +1 -1
- package/dist/client/index.es.js +1 -1
- package/dist/components/Package/ContentTypeIcon.d.ts +16 -0
- package/dist/components/Package/index.d.ts +0 -1
- package/dist/components/styles.d.ts +16 -0
- package/dist/{core-w79IMXAG.es.js → core-DfcpQGVP.es.js} +1 -1
- package/dist/{core-7-3Jcsb0.cjs.js → core-yDgxkpo0.cjs.js} +1 -1
- package/dist/index-CMA8U4-B.cjs.js +228 -0
- package/dist/{index-CN0_kZSF.es.js → index-Y4ooZDYA.es.js} +17654 -20603
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +33 -34
- package/package.json +5 -5
- package/src/components/Environment/AddPackageDialog.tsx +116 -79
- package/src/components/Environment/DeletePackageDialog.tsx +3 -2
- package/src/components/Environment/Environment.tsx +44 -23
- package/src/components/Environment/Packages.tsx +164 -156
- package/src/components/Home/DeleteEnvironmentDialog.tsx +3 -2
- package/src/components/Home/Home.tsx +272 -389
- package/src/components/Model/Model.tsx +2 -2
- package/src/components/Model/ModelCell.tsx +1 -1
- package/src/components/Model/ModelExplorerDialog.tsx +1 -1
- package/src/components/Model/SourcesExplorer.tsx +4 -4
- package/src/components/Notebook/Notebook.tsx +4 -9
- package/src/components/Notebook/NotebookCell.tsx +10 -7
- package/src/components/Package/ContentTypeIcon.tsx +79 -0
- package/src/components/Package/Package.tsx +387 -55
- package/src/components/Package/index.ts +0 -1
- package/src/components/QueryResult/QueryResult.tsx +1 -1
- package/src/components/RenderedResult/RenderedResult.tsx +9 -8
- package/src/components/ResultsDialog.tsx +1 -1
- package/src/components/styles.ts +28 -15
- package/dist/components/Package/Config.d.ts +0 -5
- package/dist/components/Package/Databases.d.ts +0 -5
- package/dist/components/Package/FileTreeView.d.ts +0 -9
- package/dist/components/Package/Models.d.ts +0 -6
- package/dist/components/Package/Notebooks.d.ts +0 -6
- package/dist/index-Xo_ADux9.cjs.js +0 -233
- package/src/components/Package/Config.tsx +0 -97
- package/src/components/Package/Databases.tsx +0 -228
- package/src/components/Package/FileTreeView.tsx +0 -241
- package/src/components/Package/Models.tsx +0 -68
- package/src/components/Package/Notebooks.tsx +0 -77
|
@@ -1,18 +1,35 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import ArrowBackIcon from "@mui/icons-material/ArrowBack";
|
|
2
|
+
import CloseIcon from "@mui/icons-material/Close";
|
|
3
|
+
import {
|
|
4
|
+
Box,
|
|
5
|
+
Container,
|
|
6
|
+
Dialog,
|
|
7
|
+
DialogContent,
|
|
8
|
+
DialogTitle,
|
|
9
|
+
IconButton,
|
|
10
|
+
Link,
|
|
11
|
+
Stack,
|
|
12
|
+
Table,
|
|
13
|
+
TableBody,
|
|
14
|
+
TableCell,
|
|
15
|
+
TableHead,
|
|
16
|
+
TableRow,
|
|
17
|
+
Typography,
|
|
18
|
+
} from "@mui/material";
|
|
19
|
+
import React, { useState } from "react";
|
|
20
|
+
import { Database } from "../../client";
|
|
21
|
+
import { useQueryWithApiError } from "../../hooks/useQueryWithApiError";
|
|
22
|
+
import { ApiErrorDisplay } from "../ApiErrorDisplay";
|
|
4
23
|
import { RetrievalFunction } from "../filter/DimensionFilter";
|
|
24
|
+
import { Loading } from "../Loading";
|
|
5
25
|
import { Notebook } from "../Notebook";
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
26
|
+
import { useServer } from "../ServerProvider";
|
|
27
|
+
import { encodeResourceUri, parseResourceUri } from "../../utils/formatting";
|
|
28
|
+
import { MALLOY_BRAND, MONO_FONT_FAMILY } from "../styles";
|
|
29
|
+
import ContentTypeIcon from "./ContentTypeIcon";
|
|
30
|
+
// TODO(redesign-followup): port the Connections section into the redesigned
|
|
31
|
+
// flat-row aesthetic (currently rendered with its original card/table styling).
|
|
12
32
|
import Connections from "./Connections";
|
|
13
|
-
import Databases from "./Databases";
|
|
14
|
-
import Models from "./Models";
|
|
15
|
-
import Notebooks from "./Notebooks";
|
|
16
33
|
|
|
17
34
|
const README_NOTEBOOK = "README.malloynb";
|
|
18
35
|
|
|
@@ -28,55 +45,370 @@ export default function Package({
|
|
|
28
45
|
resourceUri,
|
|
29
46
|
retrievalFn,
|
|
30
47
|
}: PackageProps) {
|
|
31
|
-
|
|
32
|
-
|
|
48
|
+
const { apiClients } = useServer();
|
|
49
|
+
const onClick =
|
|
50
|
+
onClickPackageFile ??
|
|
51
|
+
((to: string) => {
|
|
33
52
|
window.location.href = to;
|
|
34
|
-
};
|
|
35
|
-
}
|
|
53
|
+
});
|
|
54
|
+
const { environmentName, packageName, versionId } =
|
|
55
|
+
parseResourceUri(resourceUri);
|
|
56
|
+
|
|
57
|
+
const [schemaDatabase, setSchemaDatabase] = useState<Database | null>(null);
|
|
58
|
+
|
|
59
|
+
const pkgQuery = useQueryWithApiError({
|
|
60
|
+
queryKey: ["package", environmentName, packageName, versionId],
|
|
61
|
+
queryFn: () =>
|
|
62
|
+
apiClients.packages.getPackage(
|
|
63
|
+
environmentName,
|
|
64
|
+
packageName,
|
|
65
|
+
versionId,
|
|
66
|
+
false,
|
|
67
|
+
),
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const notebooksQuery = useQueryWithApiError({
|
|
71
|
+
queryKey: ["notebooks", environmentName, packageName, versionId],
|
|
72
|
+
queryFn: () =>
|
|
73
|
+
apiClients.notebooks.listNotebooks(
|
|
74
|
+
environmentName,
|
|
75
|
+
packageName,
|
|
76
|
+
versionId,
|
|
77
|
+
),
|
|
78
|
+
});
|
|
36
79
|
|
|
80
|
+
const modelsQuery = useQueryWithApiError({
|
|
81
|
+
queryKey: ["models", environmentName, packageName, versionId],
|
|
82
|
+
queryFn: () =>
|
|
83
|
+
apiClients.models.listModels(environmentName, packageName, versionId),
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
const databasesQuery = useQueryWithApiError({
|
|
87
|
+
queryKey: ["databases", environmentName, packageName, versionId],
|
|
88
|
+
queryFn: () =>
|
|
89
|
+
apiClients.databases.listDatabases(
|
|
90
|
+
environmentName,
|
|
91
|
+
packageName,
|
|
92
|
+
versionId,
|
|
93
|
+
),
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
const notebooks = (notebooksQuery.data?.data ?? [])
|
|
97
|
+
.slice()
|
|
98
|
+
.sort((a, b) => a.path.localeCompare(b.path));
|
|
99
|
+
const models = (modelsQuery.data?.data ?? [])
|
|
100
|
+
.slice()
|
|
101
|
+
.sort((a, b) => a.path.localeCompare(b.path));
|
|
102
|
+
const databases = (databasesQuery.data?.data ?? [])
|
|
103
|
+
.slice()
|
|
104
|
+
.sort((a, b) => a.path.localeCompare(b.path));
|
|
105
|
+
|
|
106
|
+
const description = pkgQuery.data?.data?.description ?? "";
|
|
107
|
+
const hasReadme = notebooks.some((n) => n.path === README_NOTEBOOK);
|
|
37
108
|
const readmeResourceUri = encodeResourceUri({
|
|
38
|
-
|
|
109
|
+
environmentName,
|
|
110
|
+
packageName,
|
|
111
|
+
versionId,
|
|
39
112
|
modelPath: README_NOTEBOOK,
|
|
40
113
|
});
|
|
41
114
|
|
|
115
|
+
const isLoading = !notebooksQuery.isSuccess && !notebooksQuery.isError;
|
|
116
|
+
|
|
117
|
+
if (pkgQuery.isError) {
|
|
118
|
+
return (
|
|
119
|
+
<ApiErrorDisplay
|
|
120
|
+
error={pkgQuery.error}
|
|
121
|
+
context={`${environmentName} > ${packageName}`}
|
|
122
|
+
/>
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
|
|
42
126
|
return (
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
<
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
<
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
127
|
+
<Container
|
|
128
|
+
maxWidth={false}
|
|
129
|
+
sx={{ maxWidth: 1024, mx: "auto", px: 3, py: 6 }}
|
|
130
|
+
>
|
|
131
|
+
<Box sx={{ mb: 4 }}>
|
|
132
|
+
<Link
|
|
133
|
+
onClick={(event: React.MouseEvent) =>
|
|
134
|
+
onClick(`/${environmentName}/`, event)
|
|
135
|
+
}
|
|
136
|
+
underline="none"
|
|
137
|
+
sx={{
|
|
138
|
+
display: "inline-flex",
|
|
139
|
+
alignItems: "center",
|
|
140
|
+
gap: 0.5,
|
|
141
|
+
cursor: "pointer",
|
|
142
|
+
color: "text.secondary",
|
|
143
|
+
fontSize: "0.875rem",
|
|
144
|
+
mb: 2,
|
|
145
|
+
"&:hover": { color: "primary.main" },
|
|
146
|
+
}}
|
|
147
|
+
>
|
|
148
|
+
<ArrowBackIcon sx={{ fontSize: 18 }} />
|
|
149
|
+
Back to {environmentName}
|
|
150
|
+
</Link>
|
|
151
|
+
<Typography
|
|
152
|
+
variant="h4"
|
|
153
|
+
component="h1"
|
|
154
|
+
sx={{
|
|
155
|
+
fontWeight: 600,
|
|
156
|
+
letterSpacing: "-0.025em",
|
|
157
|
+
mb: 0.5,
|
|
158
|
+
}}
|
|
159
|
+
>
|
|
160
|
+
{packageName}
|
|
161
|
+
</Typography>
|
|
162
|
+
{description && (
|
|
163
|
+
<Typography variant="body2" color="text.secondary">
|
|
164
|
+
{description}
|
|
165
|
+
</Typography>
|
|
166
|
+
)}
|
|
167
|
+
</Box>
|
|
168
|
+
|
|
169
|
+
{isLoading && <Loading text="Loading package..." />}
|
|
170
|
+
|
|
171
|
+
{!isLoading && (
|
|
172
|
+
<>
|
|
173
|
+
<PackageSection
|
|
174
|
+
title="Governed Reports"
|
|
175
|
+
count={notebooks.length}
|
|
176
|
+
>
|
|
177
|
+
{notebooks.map((notebook) => (
|
|
178
|
+
<PackageItemRow
|
|
179
|
+
key={notebook.path}
|
|
180
|
+
icon={<ContentTypeIcon type="report" />}
|
|
181
|
+
tint={MALLOY_BRAND.teal}
|
|
182
|
+
label={notebook.path}
|
|
183
|
+
onClick={(event) => onClick(notebook.path, event)}
|
|
184
|
+
/>
|
|
185
|
+
))}
|
|
186
|
+
{notebooks.length === 0 && <EmptyRow label="No notebooks" />}
|
|
187
|
+
</PackageSection>
|
|
188
|
+
|
|
189
|
+
<PackageSection title="Semantic Models" count={models.length}>
|
|
190
|
+
{models.map((model) => (
|
|
191
|
+
<PackageItemRow
|
|
192
|
+
key={model.path}
|
|
193
|
+
icon={<ContentTypeIcon type="model" />}
|
|
194
|
+
tint={MALLOY_BRAND.orange}
|
|
195
|
+
label={model.path}
|
|
196
|
+
onClick={(event) => onClick(model.path, event)}
|
|
197
|
+
/>
|
|
198
|
+
))}
|
|
199
|
+
{models.length === 0 && <EmptyRow label="No models" />}
|
|
200
|
+
</PackageSection>
|
|
201
|
+
|
|
202
|
+
<PackageSection title="Package Data" count={databases.length}>
|
|
203
|
+
{databases.map((database) => (
|
|
204
|
+
<PackageItemRow
|
|
205
|
+
key={database.path}
|
|
206
|
+
icon={<ContentTypeIcon type="data" />}
|
|
207
|
+
tint={MALLOY_BRAND.darkBlue}
|
|
208
|
+
label={database.path}
|
|
209
|
+
rightLabel={formatRowCount(database.info.rowCount)}
|
|
210
|
+
onClick={() => setSchemaDatabase(database)}
|
|
211
|
+
/>
|
|
212
|
+
))}
|
|
213
|
+
{databases.length === 0 && <EmptyRow label="No data files" />}
|
|
214
|
+
</PackageSection>
|
|
215
|
+
|
|
216
|
+
<Box sx={{ mb: 4 }}>
|
|
217
|
+
<Connections resourceUri={resourceUri} />
|
|
218
|
+
</Box>
|
|
219
|
+
|
|
220
|
+
{hasReadme && (
|
|
221
|
+
<Box sx={{ mt: 6 }}>
|
|
222
|
+
<Notebook
|
|
223
|
+
resourceUri={readmeResourceUri}
|
|
224
|
+
retrievalFn={retrievalFn}
|
|
225
|
+
/>
|
|
226
|
+
</Box>
|
|
227
|
+
)}
|
|
228
|
+
</>
|
|
229
|
+
)}
|
|
230
|
+
|
|
231
|
+
<Dialog
|
|
232
|
+
open={schemaDatabase !== null}
|
|
233
|
+
onClose={() => setSchemaDatabase(null)}
|
|
234
|
+
maxWidth="sm"
|
|
235
|
+
fullWidth
|
|
236
|
+
>
|
|
237
|
+
<DialogTitle sx={{ pr: 6 }}>
|
|
238
|
+
{schemaDatabase?.path}
|
|
239
|
+
<IconButton
|
|
240
|
+
aria-label="close"
|
|
241
|
+
onClick={() => setSchemaDatabase(null)}
|
|
242
|
+
sx={{ position: "absolute", right: 8, top: 8 }}
|
|
243
|
+
>
|
|
244
|
+
<CloseIcon fontSize="small" />
|
|
245
|
+
</IconButton>
|
|
246
|
+
</DialogTitle>
|
|
247
|
+
<DialogContent>
|
|
248
|
+
{schemaDatabase?.info?.columns && (
|
|
249
|
+
<Table size="small">
|
|
250
|
+
<TableHead>
|
|
251
|
+
<TableRow>
|
|
252
|
+
<TableCell>Column</TableCell>
|
|
253
|
+
<TableCell>Type</TableCell>
|
|
254
|
+
</TableRow>
|
|
255
|
+
</TableHead>
|
|
256
|
+
<TableBody>
|
|
257
|
+
{schemaDatabase.info.columns.map((column) => (
|
|
258
|
+
<TableRow key={column.name}>
|
|
259
|
+
<TableCell component="th" scope="row">
|
|
260
|
+
{column.name}
|
|
261
|
+
</TableCell>
|
|
262
|
+
<TableCell>{column.type}</TableCell>
|
|
263
|
+
</TableRow>
|
|
264
|
+
))}
|
|
265
|
+
</TableBody>
|
|
266
|
+
</Table>
|
|
267
|
+
)}
|
|
268
|
+
</DialogContent>
|
|
269
|
+
</Dialog>
|
|
270
|
+
</Container>
|
|
81
271
|
);
|
|
82
272
|
}
|
|
273
|
+
|
|
274
|
+
function PackageSection({
|
|
275
|
+
title,
|
|
276
|
+
count,
|
|
277
|
+
children,
|
|
278
|
+
}: {
|
|
279
|
+
title: string;
|
|
280
|
+
count: number;
|
|
281
|
+
children: React.ReactNode;
|
|
282
|
+
}) {
|
|
283
|
+
return (
|
|
284
|
+
<Box sx={{ mb: 4 }}>
|
|
285
|
+
<Stack
|
|
286
|
+
direction="row"
|
|
287
|
+
alignItems="baseline"
|
|
288
|
+
spacing={1}
|
|
289
|
+
sx={{ mb: 1 }}
|
|
290
|
+
>
|
|
291
|
+
<Typography
|
|
292
|
+
variant="h6"
|
|
293
|
+
sx={{ fontWeight: 600, letterSpacing: "-0.025em" }}
|
|
294
|
+
>
|
|
295
|
+
{title}
|
|
296
|
+
</Typography>
|
|
297
|
+
<Typography variant="caption" color="text.secondary">
|
|
298
|
+
({count})
|
|
299
|
+
</Typography>
|
|
300
|
+
</Stack>
|
|
301
|
+
<Box>{children}</Box>
|
|
302
|
+
</Box>
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
function PackageItemRow({
|
|
307
|
+
icon,
|
|
308
|
+
tint,
|
|
309
|
+
label,
|
|
310
|
+
rightLabel,
|
|
311
|
+
onClick,
|
|
312
|
+
}: {
|
|
313
|
+
icon: React.ReactNode;
|
|
314
|
+
tint: string;
|
|
315
|
+
label: string;
|
|
316
|
+
rightLabel?: string;
|
|
317
|
+
onClick?: (event: React.MouseEvent) => void;
|
|
318
|
+
}) {
|
|
319
|
+
const interactive = !!onClick;
|
|
320
|
+
const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {
|
|
321
|
+
if (!onClick) return;
|
|
322
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
323
|
+
event.preventDefault();
|
|
324
|
+
onClick(event as unknown as React.MouseEvent);
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
return (
|
|
328
|
+
<Box
|
|
329
|
+
onClick={onClick}
|
|
330
|
+
onKeyDown={interactive ? handleKeyDown : undefined}
|
|
331
|
+
role={interactive ? "button" : undefined}
|
|
332
|
+
tabIndex={interactive ? 0 : undefined}
|
|
333
|
+
sx={{
|
|
334
|
+
display: "flex",
|
|
335
|
+
alignItems: "center",
|
|
336
|
+
gap: 1.5,
|
|
337
|
+
py: 1,
|
|
338
|
+
px: 1,
|
|
339
|
+
mx: -1,
|
|
340
|
+
cursor: interactive ? "pointer" : "default",
|
|
341
|
+
borderRadius: 1.5,
|
|
342
|
+
transition: "background-color 0.1s",
|
|
343
|
+
"&:hover": interactive
|
|
344
|
+
? { backgroundColor: "grey.100" }
|
|
345
|
+
: undefined,
|
|
346
|
+
"&:focus-visible": interactive
|
|
347
|
+
? {
|
|
348
|
+
outline: "2px solid",
|
|
349
|
+
outlineColor: "primary.main",
|
|
350
|
+
outlineOffset: 2,
|
|
351
|
+
}
|
|
352
|
+
: undefined,
|
|
353
|
+
}}
|
|
354
|
+
>
|
|
355
|
+
<Box
|
|
356
|
+
sx={{
|
|
357
|
+
width: 32,
|
|
358
|
+
height: 32,
|
|
359
|
+
borderRadius: 1,
|
|
360
|
+
bgcolor: tint,
|
|
361
|
+
color: "#FFFFFF",
|
|
362
|
+
display: "flex",
|
|
363
|
+
alignItems: "center",
|
|
364
|
+
justifyContent: "center",
|
|
365
|
+
flexShrink: 0,
|
|
366
|
+
}}
|
|
367
|
+
>
|
|
368
|
+
{icon}
|
|
369
|
+
</Box>
|
|
370
|
+
<Typography
|
|
371
|
+
variant="body2"
|
|
372
|
+
sx={{
|
|
373
|
+
fontFamily: MONO_FONT_FAMILY,
|
|
374
|
+
flex: 1,
|
|
375
|
+
minWidth: 0,
|
|
376
|
+
overflow: "hidden",
|
|
377
|
+
textOverflow: "ellipsis",
|
|
378
|
+
whiteSpace: "nowrap",
|
|
379
|
+
}}
|
|
380
|
+
>
|
|
381
|
+
{label}
|
|
382
|
+
</Typography>
|
|
383
|
+
{rightLabel && (
|
|
384
|
+
<Typography
|
|
385
|
+
variant="caption"
|
|
386
|
+
color="text.secondary"
|
|
387
|
+
sx={{ flexShrink: 0 }}
|
|
388
|
+
>
|
|
389
|
+
{rightLabel}
|
|
390
|
+
</Typography>
|
|
391
|
+
)}
|
|
392
|
+
</Box>
|
|
393
|
+
);
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
function EmptyRow({ label }: { label: string }) {
|
|
397
|
+
return (
|
|
398
|
+
<Typography
|
|
399
|
+
variant="body2"
|
|
400
|
+
color="text.secondary"
|
|
401
|
+
sx={{ py: 1, fontStyle: "italic" }}
|
|
402
|
+
>
|
|
403
|
+
{label}
|
|
404
|
+
</Typography>
|
|
405
|
+
);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
function formatRowCount(rows: number): string {
|
|
409
|
+
if (rows >= 1_000_000_000)
|
|
410
|
+
return `${(rows / 1_000_000_000).toFixed(1)} B rows`;
|
|
411
|
+
if (rows >= 1_000_000) return `${(rows / 1_000_000).toFixed(1)} M rows`;
|
|
412
|
+
if (rows >= 1_000) return `${(rows / 1_000).toFixed(1)} K rows`;
|
|
413
|
+
return `${rows} rows`;
|
|
414
|
+
}
|
|
@@ -72,7 +72,7 @@ export default function QueryResult({
|
|
|
72
72
|
|
|
73
73
|
if (!environmentName || !packageName) {
|
|
74
74
|
throw new Error(
|
|
75
|
-
"No
|
|
75
|
+
"No environment or package name provided. A resource URI must be provided.",
|
|
76
76
|
);
|
|
77
77
|
}
|
|
78
78
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Box } from "@mui/material";
|
|
1
2
|
import React, { Suspense, useLayoutEffect, useRef } from "react";
|
|
2
3
|
|
|
3
4
|
type MalloyRenderElement = HTMLElement & Record<string, unknown>;
|
|
@@ -156,36 +157,36 @@ export default function RenderedResult(props: RenderedResultProps) {
|
|
|
156
157
|
// Show loading state if we're in server-side rendering
|
|
157
158
|
if (typeof window === "undefined") {
|
|
158
159
|
return (
|
|
159
|
-
<
|
|
160
|
-
|
|
160
|
+
<Box
|
|
161
|
+
sx={{
|
|
161
162
|
width: "100%",
|
|
162
163
|
height: props.height ? `${props.height}px` : "100%",
|
|
163
164
|
display: "flex",
|
|
164
165
|
alignItems: "center",
|
|
165
166
|
justifyContent: "center",
|
|
166
|
-
color: "
|
|
167
|
+
color: "text.secondary",
|
|
167
168
|
}}
|
|
168
169
|
>
|
|
169
170
|
Loading...
|
|
170
|
-
</
|
|
171
|
+
</Box>
|
|
171
172
|
);
|
|
172
173
|
}
|
|
173
174
|
|
|
174
175
|
return (
|
|
175
176
|
<Suspense
|
|
176
177
|
fallback={
|
|
177
|
-
<
|
|
178
|
-
|
|
178
|
+
<Box
|
|
179
|
+
sx={{
|
|
179
180
|
width: "100%",
|
|
180
181
|
height: props.height ? `${props.height}px` : "100%",
|
|
181
182
|
display: "flex",
|
|
182
183
|
alignItems: "center",
|
|
183
184
|
justifyContent: "center",
|
|
184
|
-
color: "
|
|
185
|
+
color: "text.secondary",
|
|
185
186
|
}}
|
|
186
187
|
>
|
|
187
188
|
Loading visualization...
|
|
188
|
-
</
|
|
189
|
+
</Box>
|
|
189
190
|
}
|
|
190
191
|
>
|
|
191
192
|
<RenderedResultInner {...props} />
|
package/src/components/styles.ts
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
import { Card, CardContent, CardMedia, styled } from "@mui/material";
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Malloy brand colors — exact hex values from
|
|
5
|
+
* `publisher/packages/app/public/logo.svg`. Use these instead of hardcoding
|
|
6
|
+
* the hex values inline so the brand can be retuned in one place.
|
|
7
|
+
*/
|
|
8
|
+
export const MALLOY_BRAND = {
|
|
9
|
+
teal: "#14b3cb", // light wing of the M (governed reports)
|
|
10
|
+
orange: "#e47404", // right wing of the M (semantic models)
|
|
11
|
+
darkBlue: "#1474a4", // deep shadow of the M (package data)
|
|
12
|
+
} as const;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Monospace font stack used by code-like surfaces inside the SDK
|
|
16
|
+
* (file-path labels in PackageItemRow, code blocks, etc.). Matches the
|
|
17
|
+
* `MONO_FONT_FAMILY` defined in the publisher app's theme.
|
|
18
|
+
*/
|
|
19
|
+
export const MONO_FONT_FAMILY =
|
|
20
|
+
'"JetBrains Mono", "ui-monospace", "SFMono-Regular", "Menlo", monospace';
|
|
21
|
+
|
|
3
22
|
export const StyledCard = styled(Card)({
|
|
4
23
|
display: "flex",
|
|
5
24
|
flexDirection: "column",
|
|
@@ -54,17 +73,13 @@ export const CleanNotebookCell = styled("div")({
|
|
|
54
73
|
});
|
|
55
74
|
|
|
56
75
|
export const CleanMetricCard = styled("div")({
|
|
57
|
-
backgroundColor: "
|
|
76
|
+
backgroundColor: "transparent",
|
|
58
77
|
paddingTop: "12px",
|
|
59
78
|
paddingBottom: "2px",
|
|
60
79
|
borderRadius: "8px",
|
|
61
|
-
border: "
|
|
62
|
-
boxShadow: "
|
|
80
|
+
border: "none",
|
|
81
|
+
boxShadow: "none",
|
|
63
82
|
marginBottom: "0",
|
|
64
|
-
transition: "box-shadow 0.2s ease-in-out",
|
|
65
|
-
"&:hover": {
|
|
66
|
-
boxShadow: "0 2px 6px rgba(0, 0, 0, 0.08)",
|
|
67
|
-
},
|
|
68
83
|
});
|
|
69
84
|
|
|
70
85
|
export const CleanCodeBlock = styled("div")({
|
|
@@ -134,16 +149,14 @@ export const PackageCardContent = styled(CardContent)({
|
|
|
134
149
|
},
|
|
135
150
|
});
|
|
136
151
|
|
|
137
|
-
export const PackageSectionTitle = styled("div")({
|
|
138
|
-
fontSize: "
|
|
139
|
-
fontWeight:
|
|
140
|
-
color:
|
|
141
|
-
textTransform: "uppercase",
|
|
142
|
-
letterSpacing: "0.5px",
|
|
152
|
+
export const PackageSectionTitle = styled("div")(({ theme }) => ({
|
|
153
|
+
fontSize: "0.875rem",
|
|
154
|
+
fontWeight: 500,
|
|
155
|
+
color: theme.palette.text.secondary,
|
|
143
156
|
marginBottom: "16px",
|
|
144
157
|
paddingBottom: "8px",
|
|
145
|
-
borderBottom:
|
|
146
|
-
});
|
|
158
|
+
borderBottom: `1px solid ${theme.palette.divider}`,
|
|
159
|
+
}));
|
|
147
160
|
|
|
148
161
|
export const PackageContainer = styled("div")({
|
|
149
162
|
padding: "32px",
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Database, Model } from '../../client';
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
interface FiieTreeViewProps {
|
|
4
|
-
items: Model[] | Database[];
|
|
5
|
-
defaultExpandedItems: string[];
|
|
6
|
-
onClickTreeNode?: (to: string, event?: React.MouseEvent) => void;
|
|
7
|
-
}
|
|
8
|
-
export declare function FileTreeView({ items, defaultExpandedItems, onClickTreeNode, }: FiieTreeViewProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
export {};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
interface NotebooksProps {
|
|
2
|
-
onClickNotebookFile: (to: string, event?: React.MouseEvent) => void;
|
|
3
|
-
resourceUri: string;
|
|
4
|
-
}
|
|
5
|
-
export default function Notebooks({ onClickNotebookFile, resourceUri, }: NotebooksProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
export {};
|