@malloy-publisher/sdk 0.3.1 → 0.4.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 +33 -9
- package/dist/{DocumentStorageProvider-tGvodI8f.es.js → DocumentStorage-BiFqO15i.es.js} +7126 -6943
- package/dist/DocumentStorage-CMyLifsz.cjs.js +134 -0
- package/dist/RenderedResult-CZzE8wv-.cjs.js +115 -0
- package/dist/{RenderedResult-mDE-4u8S.es.js → RenderedResult-CvrmYyr5.es.js} +64 -57
- package/dist/{ServerProvider-X2Ma0HRs.es.js → ServerProvider-BWOEKg0O.es.js} +1217 -1244
- package/dist/ServerProvider-Cc489A3f.cjs.js +1 -0
- package/dist/builder/index.cjs.js +52 -52
- package/dist/builder/index.es.js +3961 -3960
- package/dist/client/api.d.ts +100 -42
- package/dist/client/index.cjs.js +1 -1
- package/dist/client/index.es.js +1 -1
- package/dist/components/AppDialog.d.ts +30 -0
- package/dist/components/BackLink.d.ts +32 -0
- package/dist/components/Dashboard/DashboardBar.d.ts +21 -0
- package/dist/components/Dashboard/telemetry.d.ts +24 -7
- package/dist/components/DashboardBuilder/BuilderToolbar.d.ts +12 -10
- package/dist/components/DashboardBuilder/DashboardBuilder.d.ts +20 -2
- package/dist/components/DashboardBuilder/DashboardEditor.d.ts +21 -11
- package/dist/components/DashboardBuilder/newDashboard.d.ts +17 -0
- package/dist/components/DashboardBuilder/spliceDocument.d.ts +10 -1
- package/dist/components/DocumentStorage/DocumentStorage.d.ts +69 -5
- package/dist/components/DocumentStorage/index.d.ts +1 -0
- package/dist/components/ItemRow.d.ts +38 -0
- package/dist/components/Materializations/MaterializationDetailDialog.d.ts +1 -2
- package/dist/components/Materializations/MaterializationRunsList.d.ts +1 -5
- package/dist/components/Materializations/Materializations.d.ts +7 -3
- package/dist/components/Materializations/ScopeButton.d.ts +18 -0
- package/dist/components/Materializations/SectionLabel.d.ts +7 -4
- package/dist/components/Materializations/TriggerLabel.d.ts +14 -0
- package/dist/components/Materializations/index.d.ts +0 -1
- package/dist/components/Package/ContentTypeIcon.d.ts +3 -5
- package/dist/components/Package/NewDashboardDialog.d.ts +18 -0
- package/dist/components/Package/index.d.ts +0 -1
- package/dist/components/PackageSection.d.ts +23 -0
- package/dist/components/buttons.d.ts +53 -0
- package/dist/components/index.d.ts +5 -0
- package/dist/components/styles.d.ts +49 -40
- package/dist/hooks/useCrudMutation.d.ts +42 -0
- package/dist/index.cjs.js +22 -26
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +17431 -20676
- package/dist/telemetry/consoleEvents.d.ts +60 -0
- package/dist/utils/sha256.d.ts +2 -0
- package/package.json +1 -1
- package/src/components/AppDialog.tsx +115 -0
- package/src/components/BackLink.tsx +83 -0
- package/src/components/Connections/AddConnectionDialog.tsx +50 -70
- package/src/components/Connections/DeleteConnectionDialog.tsx +23 -50
- package/src/components/Connections/EditConnectionDialog.tsx +54 -73
- package/src/components/Dashboard/DashboardBar.tsx +88 -0
- package/src/components/Dashboard/telemetry.ts +24 -5
- package/src/components/DashboardBuilder/AddTileDialog.tsx +141 -143
- package/src/components/DashboardBuilder/BuilderToolbar.tsx +110 -218
- package/src/components/DashboardBuilder/DashboardBuilder.spec.tsx +5 -11
- package/src/components/DashboardBuilder/DashboardBuilder.tsx +202 -171
- package/src/components/DashboardBuilder/DashboardEditor.authoritative.spec.tsx +706 -0
- package/src/components/DashboardBuilder/DashboardEditor.package.spec.tsx +163 -0
- package/src/components/DashboardBuilder/DashboardEditor.spec.tsx +2 -25
- package/src/components/DashboardBuilder/DashboardEditor.tsx +442 -94
- package/src/components/DashboardBuilder/DiffDialog.tsx +75 -82
- package/src/components/DashboardBuilder/DrillDialog.tsx +144 -156
- package/src/components/DashboardBuilder/FilterDialog.tsx +276 -295
- package/src/components/DashboardBuilder/FilterStrip.tsx +11 -10
- package/src/components/DashboardBuilder/newDashboard.spec.ts +40 -0
- package/src/components/DashboardBuilder/newDashboard.ts +48 -0
- package/src/components/DashboardBuilder/spliceDocument.spec.ts +53 -0
- package/src/components/DashboardBuilder/spliceDocument.ts +45 -8
- package/src/components/DashboardBuilder/useDashboardEditor.spec.ts +56 -0
- package/src/components/DashboardBuilder/useDashboardEditor.ts +12 -4
- package/src/components/DocumentStorage/BrowserDocumentStorage.ts +7 -6
- package/src/components/DocumentStorage/DocumentStorage.ts +78 -5
- package/src/components/DocumentStorage/index.ts +1 -0
- package/src/components/Environment/About.tsx +14 -28
- package/src/components/Environment/AddPackageDialog.tsx +85 -154
- package/src/components/Environment/Connections.tsx +125 -205
- package/src/components/Environment/DeletePackageDialog.tsx +32 -77
- package/src/components/Environment/EditPackageDialog.tsx +46 -58
- package/src/components/Environment/Environment.tsx +34 -36
- package/src/components/Environment/Packages.tsx +63 -128
- package/src/components/Home/AddEnvironmentDialog.tsx +47 -70
- package/src/components/Home/DeleteEnvironmentDialog.tsx +32 -77
- package/src/components/Home/EditEnvironmentDialog.tsx +47 -61
- package/src/components/Home/Home.tsx +101 -214
- package/src/components/ItemRow.tsx +165 -0
- package/src/components/Materializations/CreateMaterializationDialog.tsx +34 -51
- package/src/components/Materializations/DeleteMaterializationDialog.tsx +31 -53
- package/src/components/Materializations/MaterializationDetailDialog.tsx +60 -69
- package/src/components/Materializations/MaterializationRunsList.tsx +29 -42
- package/src/components/Materializations/Materializations.tsx +137 -140
- package/src/components/Materializations/ScopeButton.tsx +85 -0
- package/src/components/Materializations/SectionLabel.tsx +7 -4
- package/src/components/Materializations/SetScheduleDialog.tsx +48 -89
- package/src/components/Materializations/TriggerLabel.tsx +36 -0
- package/src/components/Materializations/cron.spec.ts +113 -0
- package/src/components/Materializations/index.ts +0 -1
- package/src/components/Materializations/utils.spec.ts +182 -0
- package/src/components/Package/ContentTypeIcon.spec.ts +22 -37
- package/src/components/Package/ContentTypeIcon.tsx +10 -12
- package/src/components/Package/NewDashboardDialog.spec.tsx +129 -0
- package/src/components/Package/NewDashboardDialog.tsx +265 -0
- package/src/components/Package/Package.tsx +184 -238
- package/src/components/Package/index.ts +0 -1
- package/src/components/PackageSection.tsx +85 -0
- package/src/components/RenderedResult/RenderedResult.lifecycle.spec.tsx +198 -0
- package/src/components/RenderedResult/RenderedResult.tsx +22 -8
- package/src/components/ResultsDialog.tsx +8 -32
- package/src/components/buttons.tsx +114 -0
- package/src/components/designSystem.spec.tsx +316 -0
- package/src/components/given/paramCodec.spec.ts +1 -1
- package/src/components/index.ts +10 -0
- package/src/components/styles.ts +49 -85
- package/src/hooks/useCrudMutation.spec.tsx +119 -0
- package/src/hooks/useCrudMutation.tsx +85 -0
- package/src/index.ts +9 -0
- package/src/telemetry/consoleEvents.spec.ts +130 -0
- package/src/telemetry/consoleEvents.ts +124 -0
- package/src/theme/defaults.ts +34 -23
- package/src/theme/resolveTheme.spec.ts +9 -4
- package/src/theme/resolveTheme.ts +12 -8
- package/src/utils/sha256.ts +13 -0
- package/test/README.md +1 -1
- package/test/serverProvider.tsx +5 -2
- package/dist/DocumentStorageProvider-BeBD0uWc.cjs.js +0 -134
- package/dist/RenderedResult-CPi6uQWq.cjs.js +0 -115
- package/dist/ServerProvider-CH71GsoL.cjs.js +0 -1
- package/dist/components/Materializations/CreateEnvMaterializationDialog.d.ts +0 -14
- package/dist/components/Materializations/EnvironmentMaterializations.d.ts +0 -7
- package/dist/components/Materializations/ScheduleCard.d.ts +0 -20
- package/dist/components/Materializations/TriggerChip.d.ts +0 -10
- package/dist/components/Package/Models.d.ts +0 -6
- package/src/components/Materializations/CreateEnvMaterializationDialog.tsx +0 -179
- package/src/components/Materializations/EnvironmentMaterializations.tsx +0 -267
- package/src/components/Materializations/ScheduleCard.tsx +0 -231
- package/src/components/Materializations/TriggerChip.tsx +0 -44
- package/src/components/Package/Models.tsx +0 -71
|
@@ -6,10 +6,6 @@ import {
|
|
|
6
6
|
Box,
|
|
7
7
|
Button,
|
|
8
8
|
Checkbox,
|
|
9
|
-
Dialog,
|
|
10
|
-
DialogActions,
|
|
11
|
-
DialogContent,
|
|
12
|
-
DialogTitle,
|
|
13
9
|
MenuItem,
|
|
14
10
|
Stack,
|
|
15
11
|
TextField,
|
|
@@ -32,6 +28,7 @@ import {
|
|
|
32
28
|
type MappingRow,
|
|
33
29
|
} from "./controls";
|
|
34
30
|
import type { DashboardDocument, DashboardTile, LocalGiven } from "./document";
|
|
31
|
+
import { AppDialog } from "../AppDialog";
|
|
35
32
|
|
|
36
33
|
/**
|
|
37
34
|
* A filter control: what it is, and which tiles it drives.
|
|
@@ -245,15 +242,13 @@ export function FilterDialog({
|
|
|
245
242
|
);
|
|
246
243
|
|
|
247
244
|
return (
|
|
248
|
-
<
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
sx={{ color: theme.tileTitle, mt: 0.25 }}
|
|
256
|
-
>
|
|
245
|
+
<AppDialog
|
|
246
|
+
open={open}
|
|
247
|
+
onClose={onClose}
|
|
248
|
+
title={editing ? (shown.label ?? shown.name) : "Add a filter"}
|
|
249
|
+
description={
|
|
250
|
+
editing ? (
|
|
251
|
+
<>
|
|
257
252
|
<Box
|
|
258
253
|
component="span"
|
|
259
254
|
sx={{ fontFamily: "ui-monospace, monospace" }}
|
|
@@ -263,319 +258,305 @@ export function FilterDialog({
|
|
|
263
258
|
{fromModel
|
|
264
259
|
? " · declared in the model, so its label and options are set there"
|
|
265
260
|
: " · declared in this dashboard"}
|
|
266
|
-
|
|
267
|
-
)
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
size="small"
|
|
280
|
-
value={source.kind}
|
|
281
|
-
onChange={(_, value: "new" | "existing" | null) => {
|
|
282
|
-
if (value === "new") setSource({ kind: "new" });
|
|
283
|
-
else if (value === "existing" && available[0])
|
|
284
|
-
pickExisting(available[0]);
|
|
285
|
-
}}
|
|
286
|
-
aria-label="Where the filter comes from"
|
|
261
|
+
</>
|
|
262
|
+
) : (
|
|
263
|
+
"A control on the page, and the tiles it filters."
|
|
264
|
+
)
|
|
265
|
+
}
|
|
266
|
+
actions={
|
|
267
|
+
<>
|
|
268
|
+
{editing && (
|
|
269
|
+
<Button
|
|
270
|
+
color="error"
|
|
271
|
+
onClick={() => onRemove(shown.name)}
|
|
272
|
+
aria-label={`Remove control ${shown.name}`}
|
|
273
|
+
sx={{ mr: "auto" }}
|
|
287
274
|
>
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
</ToggleButton>
|
|
291
|
-
<ToggleButton value="existing">
|
|
292
|
-
From the model
|
|
293
|
-
</ToggleButton>
|
|
294
|
-
</ToggleButtonGroup>
|
|
275
|
+
Remove from dashboard
|
|
276
|
+
</Button>
|
|
295
277
|
)}
|
|
278
|
+
<Button onClick={onClose}>Cancel</Button>
|
|
279
|
+
<Tooltip
|
|
280
|
+
title={
|
|
281
|
+
canApply || target === undefined
|
|
282
|
+
? ""
|
|
283
|
+
: "A ticked tile has no field, or names one its source does not have."
|
|
284
|
+
}
|
|
285
|
+
>
|
|
286
|
+
<span>
|
|
287
|
+
<Button
|
|
288
|
+
variant="contained"
|
|
289
|
+
onClick={apply}
|
|
290
|
+
disabled={!canApply}
|
|
291
|
+
>
|
|
292
|
+
{editing ? "Apply" : "Add filter"}
|
|
293
|
+
</Button>
|
|
294
|
+
</span>
|
|
295
|
+
</Tooltip>
|
|
296
|
+
</>
|
|
297
|
+
}
|
|
298
|
+
>
|
|
299
|
+
<Stack sx={{ gap: 2.5, pt: 1 }}>
|
|
300
|
+
{/* WHAT the filter is. */}
|
|
301
|
+
{!editing && available.length > 0 && (
|
|
302
|
+
<ToggleButtonGroup
|
|
303
|
+
exclusive
|
|
304
|
+
size="small"
|
|
305
|
+
value={source.kind}
|
|
306
|
+
onChange={(_, value: "new" | "existing" | null) => {
|
|
307
|
+
if (value === "new") setSource({ kind: "new" });
|
|
308
|
+
else if (value === "existing" && available[0])
|
|
309
|
+
pickExisting(available[0]);
|
|
310
|
+
}}
|
|
311
|
+
aria-label="Where the filter comes from"
|
|
312
|
+
>
|
|
313
|
+
<ToggleButton value="new">New in this dashboard</ToggleButton>
|
|
314
|
+
<ToggleButton value="existing">From the model</ToggleButton>
|
|
315
|
+
</ToggleButtonGroup>
|
|
316
|
+
)}
|
|
317
|
+
|
|
318
|
+
{!editing && source.kind === "existing" ? (
|
|
319
|
+
<TextField
|
|
320
|
+
select
|
|
321
|
+
size="small"
|
|
322
|
+
label="Control"
|
|
323
|
+
value={source.name}
|
|
324
|
+
onChange={(event) => {
|
|
325
|
+
const picked = available.find(
|
|
326
|
+
(g) => g.name === event.target.value,
|
|
327
|
+
);
|
|
328
|
+
if (picked) pickExisting(picked);
|
|
329
|
+
}}
|
|
330
|
+
>
|
|
331
|
+
{available.map((given) => (
|
|
332
|
+
<MenuItem key={given.name} value={given.name}>
|
|
333
|
+
{given.label ?? given.name}
|
|
334
|
+
<Typography
|
|
335
|
+
component="span"
|
|
336
|
+
variant="caption"
|
|
337
|
+
sx={{ ml: 1, opacity: 0.6 }}
|
|
338
|
+
>
|
|
339
|
+
${given.name}
|
|
340
|
+
</Typography>
|
|
341
|
+
</MenuItem>
|
|
342
|
+
))}
|
|
343
|
+
</TextField>
|
|
344
|
+
) : null}
|
|
296
345
|
|
|
297
|
-
|
|
346
|
+
<Stack direction="row" sx={{ gap: 1.5, flexWrap: "wrap" }}>
|
|
347
|
+
{/* Hidden while per-tile fields are open: they speak for
|
|
348
|
+
themselves then, and a box above them that applied to
|
|
349
|
+
nothing would read as one more thing to fill. */}
|
|
350
|
+
{!perTile && (
|
|
351
|
+
<FieldPicker
|
|
352
|
+
value={field}
|
|
353
|
+
onChange={pickField}
|
|
354
|
+
fields={commonFields}
|
|
355
|
+
accepts={accepts}
|
|
356
|
+
label="Field to filter"
|
|
357
|
+
ariaLabel="Field to filter"
|
|
358
|
+
placeholder="category"
|
|
359
|
+
autoFocus={!editing}
|
|
360
|
+
error={commonProblem !== undefined}
|
|
361
|
+
helperText={
|
|
362
|
+
commonProblem ??
|
|
363
|
+
(!editing && newName
|
|
364
|
+
? `Declared as $${newName}`
|
|
365
|
+
: undefined)
|
|
366
|
+
}
|
|
367
|
+
sx={{ flex: 1, minWidth: 200 }}
|
|
368
|
+
/>
|
|
369
|
+
)}
|
|
370
|
+
{!fromModel && (
|
|
371
|
+
<TextField
|
|
372
|
+
size="small"
|
|
373
|
+
label="Label"
|
|
374
|
+
placeholder={newName ? titleCase(newName) : ""}
|
|
375
|
+
value={label}
|
|
376
|
+
onChange={(event) => setLabel(event.target.value)}
|
|
377
|
+
inputProps={{ "aria-label": "Control label" }}
|
|
378
|
+
sx={{ flex: 1, minWidth: 160 }}
|
|
379
|
+
/>
|
|
380
|
+
)}
|
|
381
|
+
{valueTyped &&
|
|
382
|
+
!perTile &&
|
|
383
|
+
operatorField(commonOp, setCommonOp, "Comparison")}
|
|
384
|
+
</Stack>
|
|
385
|
+
{!editing && source.kind === "new" && (
|
|
386
|
+
<Stack direction="row" sx={{ gap: 1.5 }}>
|
|
298
387
|
<TextField
|
|
299
388
|
select
|
|
300
389
|
size="small"
|
|
301
390
|
label="Control"
|
|
302
|
-
value={
|
|
303
|
-
onChange={(event) =>
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
391
|
+
value={kind}
|
|
392
|
+
onChange={(event) =>
|
|
393
|
+
pickKind(event.target.value as ControlKind)
|
|
394
|
+
}
|
|
395
|
+
inputProps={{ "aria-label": "Kind of control" }}
|
|
396
|
+
slotProps={{
|
|
397
|
+
select: {
|
|
398
|
+
renderValue: (value) =>
|
|
399
|
+
CONTROL_KINDS.find((k) => k.kind === value)
|
|
400
|
+
?.label ?? String(value),
|
|
401
|
+
},
|
|
308
402
|
}}
|
|
403
|
+
sx={{ flex: 1 }}
|
|
309
404
|
>
|
|
310
|
-
{
|
|
311
|
-
<MenuItem key={
|
|
312
|
-
{
|
|
405
|
+
{CONTROL_KINDS.map((option) => (
|
|
406
|
+
<MenuItem key={option.kind} value={option.kind}>
|
|
407
|
+
{option.label}
|
|
313
408
|
<Typography
|
|
314
409
|
component="span"
|
|
315
410
|
variant="caption"
|
|
316
411
|
sx={{ ml: 1, opacity: 0.6 }}
|
|
317
412
|
>
|
|
318
|
-
|
|
413
|
+
{option.hint}
|
|
319
414
|
</Typography>
|
|
320
415
|
</MenuItem>
|
|
321
416
|
))}
|
|
322
417
|
</TextField>
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
<Stack direction="row" sx={{ gap: 1.5, flexWrap: "wrap" }}>
|
|
326
|
-
{/* Hidden while per-tile fields are open: they speak for
|
|
327
|
-
themselves then, and a box above them that applied to
|
|
328
|
-
nothing would read as one more thing to fill. */}
|
|
329
|
-
{!perTile && (
|
|
330
|
-
<FieldPicker
|
|
331
|
-
value={field}
|
|
332
|
-
onChange={pickField}
|
|
333
|
-
fields={commonFields}
|
|
334
|
-
accepts={accepts}
|
|
335
|
-
label="Field to filter"
|
|
336
|
-
ariaLabel="Field to filter"
|
|
337
|
-
placeholder="category"
|
|
338
|
-
autoFocus={!editing}
|
|
339
|
-
error={commonProblem !== undefined}
|
|
340
|
-
helperText={
|
|
341
|
-
commonProblem ??
|
|
342
|
-
(!editing && newName
|
|
343
|
-
? `Declared as $${newName}`
|
|
344
|
-
: undefined)
|
|
345
|
-
}
|
|
346
|
-
sx={{ flex: 1, minWidth: 200 }}
|
|
347
|
-
/>
|
|
348
|
-
)}
|
|
349
|
-
{!fromModel && (
|
|
418
|
+
{kind === "date" && (
|
|
350
419
|
<TextField
|
|
351
420
|
size="small"
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
value={
|
|
355
|
-
onChange={(event) =>
|
|
356
|
-
|
|
357
|
-
sx={{ flex: 1
|
|
421
|
+
type="date"
|
|
422
|
+
label="Starts at"
|
|
423
|
+
value={dateDefault}
|
|
424
|
+
onChange={(event) => setDateDefault(event.target.value)}
|
|
425
|
+
InputLabelProps={{ shrink: true }}
|
|
426
|
+
sx={{ flex: 1 }}
|
|
358
427
|
/>
|
|
359
428
|
)}
|
|
360
|
-
{valueTyped &&
|
|
361
|
-
!perTile &&
|
|
362
|
-
operatorField(commonOp, setCommonOp, "Comparison")}
|
|
363
429
|
</Stack>
|
|
364
|
-
|
|
365
|
-
<Stack direction="row" sx={{ gap: 1.5 }}>
|
|
366
|
-
<TextField
|
|
367
|
-
select
|
|
368
|
-
size="small"
|
|
369
|
-
label="Control"
|
|
370
|
-
value={kind}
|
|
371
|
-
onChange={(event) =>
|
|
372
|
-
pickKind(event.target.value as ControlKind)
|
|
373
|
-
}
|
|
374
|
-
inputProps={{ "aria-label": "Kind of control" }}
|
|
375
|
-
slotProps={{
|
|
376
|
-
select: {
|
|
377
|
-
renderValue: (value) =>
|
|
378
|
-
CONTROL_KINDS.find((k) => k.kind === value)
|
|
379
|
-
?.label ?? String(value),
|
|
380
|
-
},
|
|
381
|
-
}}
|
|
382
|
-
sx={{ flex: 1 }}
|
|
383
|
-
>
|
|
384
|
-
{CONTROL_KINDS.map((option) => (
|
|
385
|
-
<MenuItem key={option.kind} value={option.kind}>
|
|
386
|
-
{option.label}
|
|
387
|
-
<Typography
|
|
388
|
-
component="span"
|
|
389
|
-
variant="caption"
|
|
390
|
-
sx={{ ml: 1, opacity: 0.6 }}
|
|
391
|
-
>
|
|
392
|
-
{option.hint}
|
|
393
|
-
</Typography>
|
|
394
|
-
</MenuItem>
|
|
395
|
-
))}
|
|
396
|
-
</TextField>
|
|
397
|
-
{kind === "date" && (
|
|
398
|
-
<TextField
|
|
399
|
-
size="small"
|
|
400
|
-
type="date"
|
|
401
|
-
label="Starts at"
|
|
402
|
-
value={dateDefault}
|
|
403
|
-
onChange={(event) =>
|
|
404
|
-
setDateDefault(event.target.value)
|
|
405
|
-
}
|
|
406
|
-
InputLabelProps={{ shrink: true }}
|
|
407
|
-
sx={{ flex: 1 }}
|
|
408
|
-
/>
|
|
409
|
-
)}
|
|
410
|
-
</Stack>
|
|
411
|
-
)}
|
|
430
|
+
)}
|
|
412
431
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
432
|
+
{/* WHICH tiles. */}
|
|
433
|
+
<Box>
|
|
434
|
+
<Stack direction="row" sx={{ alignItems: "center", gap: 0.5 }}>
|
|
435
|
+
<Checkbox
|
|
436
|
+
size="small"
|
|
437
|
+
checked={bindableCount > 0 && included === bindableCount}
|
|
438
|
+
indeterminate={included > 0 && included < bindableCount}
|
|
439
|
+
disabled={bindableCount === 0}
|
|
440
|
+
onChange={(event) => setAll(event.target.checked)}
|
|
441
|
+
inputProps={{ "aria-label": "All tiles" }}
|
|
442
|
+
/>
|
|
443
|
+
<Typography variant="subtitle2" sx={{ flex: 1 }}>
|
|
444
|
+
Applies to {included} of {document.tiles.length} tiles
|
|
445
|
+
</Typography>
|
|
446
|
+
<Button
|
|
447
|
+
size="small"
|
|
448
|
+
onClick={() => {
|
|
449
|
+
// Opening per-tile starts every row from the common
|
|
450
|
+
// field; closing it goes back to one box for all.
|
|
451
|
+
if (!perTile)
|
|
452
|
+
setRows((previous) =>
|
|
453
|
+
previous.map((row) => ({ ...row, field })),
|
|
454
|
+
);
|
|
455
|
+
setPerTile((was) => !was);
|
|
456
|
+
}}
|
|
418
457
|
>
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
return (
|
|
455
|
-
<Stack
|
|
456
|
-
key={`${tile.source}.${tile.name}`}
|
|
457
|
-
direction="row"
|
|
458
|
+
{perTile ? "Same field for all" : "Adjust per tile"}
|
|
459
|
+
</Button>
|
|
460
|
+
</Stack>
|
|
461
|
+
<Stack sx={{ gap: perTile ? 1 : 0 }}>
|
|
462
|
+
{document.tiles.map((tile, index) => {
|
|
463
|
+
const row = rows[index];
|
|
464
|
+
const title = tile.label ?? tile.name;
|
|
465
|
+
const problem = perTile ? rowProblems[index] : undefined;
|
|
466
|
+
return (
|
|
467
|
+
<Stack
|
|
468
|
+
key={`${tile.source}.${tile.name}`}
|
|
469
|
+
direction="row"
|
|
470
|
+
sx={{
|
|
471
|
+
gap: 1,
|
|
472
|
+
alignItems: perTile ? "flex-start" : "center",
|
|
473
|
+
opacity: bindable[index] ? 1 : 0.6,
|
|
474
|
+
}}
|
|
475
|
+
>
|
|
476
|
+
<Checkbox
|
|
477
|
+
size="small"
|
|
478
|
+
disabled={!bindable[index]}
|
|
479
|
+
checked={
|
|
480
|
+
(row?.include ?? false) && bindable[index]
|
|
481
|
+
}
|
|
482
|
+
inputProps={{
|
|
483
|
+
"aria-label": `Filter ${title}`,
|
|
484
|
+
}}
|
|
485
|
+
onChange={(event) =>
|
|
486
|
+
setRow(index, {
|
|
487
|
+
include: event.target.checked,
|
|
488
|
+
})
|
|
489
|
+
}
|
|
490
|
+
/>
|
|
491
|
+
<Typography
|
|
492
|
+
variant="body2"
|
|
458
493
|
sx={{
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
494
|
+
flex: 1,
|
|
495
|
+
minWidth: 0,
|
|
496
|
+
pt: perTile ? 1 : 0,
|
|
462
497
|
}}
|
|
498
|
+
noWrap
|
|
463
499
|
>
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
}}
|
|
473
|
-
onChange={(event) =>
|
|
474
|
-
setRow(index, {
|
|
475
|
-
include: event.target.checked,
|
|
476
|
-
})
|
|
500
|
+
{title}
|
|
501
|
+
</Typography>
|
|
502
|
+
{!bindable[index] ? (
|
|
503
|
+
<Tooltip
|
|
504
|
+
title={
|
|
505
|
+
tile.declaration.kind === "inherited"
|
|
506
|
+
? "Declared on its source, which this dashboard does not write."
|
|
507
|
+
: "Its query is written out here rather than named, so a filter cannot be added to it."
|
|
477
508
|
}
|
|
478
|
-
/>
|
|
479
|
-
<Typography
|
|
480
|
-
variant="body2"
|
|
481
|
-
sx={{
|
|
482
|
-
flex: 1,
|
|
483
|
-
minWidth: 0,
|
|
484
|
-
pt: perTile ? 1 : 0,
|
|
485
|
-
}}
|
|
486
|
-
noWrap
|
|
487
509
|
>
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
<Tooltip
|
|
492
|
-
title={
|
|
493
|
-
tile.declaration.kind === "inherited"
|
|
494
|
-
? "Declared on its source, which this dashboard does not write."
|
|
495
|
-
: "Its query is written out here rather than named, so a filter cannot be added to it."
|
|
496
|
-
}
|
|
510
|
+
<Typography
|
|
511
|
+
variant="caption"
|
|
512
|
+
sx={{ color: theme.tileTitle }}
|
|
497
513
|
>
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
)
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
{included === 0 && (
|
|
538
|
-
<Typography
|
|
539
|
-
variant="caption"
|
|
540
|
-
sx={{ color: "warning.main", display: "block", mt: 1 }}
|
|
541
|
-
>
|
|
542
|
-
No tile is ticked, so this control will not appear on
|
|
543
|
-
the dashboard.
|
|
544
|
-
</Typography>
|
|
545
|
-
)}
|
|
546
|
-
</Box>
|
|
547
|
-
</Stack>
|
|
548
|
-
</DialogContent>
|
|
549
|
-
<DialogActions sx={{ px: 3, py: 1.5 }}>
|
|
550
|
-
{editing && (
|
|
551
|
-
<Button
|
|
552
|
-
color="error"
|
|
553
|
-
onClick={() => onRemove(shown.name)}
|
|
554
|
-
aria-label={`Remove control ${shown.name}`}
|
|
555
|
-
sx={{ mr: "auto" }}
|
|
556
|
-
>
|
|
557
|
-
Remove from dashboard
|
|
558
|
-
</Button>
|
|
559
|
-
)}
|
|
560
|
-
<Button onClick={onClose}>Cancel</Button>
|
|
561
|
-
<Tooltip
|
|
562
|
-
title={
|
|
563
|
-
canApply || target === undefined
|
|
564
|
-
? ""
|
|
565
|
-
: "A ticked tile has no field, or names one its source does not have."
|
|
566
|
-
}
|
|
567
|
-
>
|
|
568
|
-
<span>
|
|
569
|
-
<Button
|
|
570
|
-
variant="contained"
|
|
571
|
-
onClick={apply}
|
|
572
|
-
disabled={!canApply}
|
|
514
|
+
{tile.declaration.kind === "inherited"
|
|
515
|
+
? "From the model"
|
|
516
|
+
: "Inline query"}
|
|
517
|
+
</Typography>
|
|
518
|
+
</Tooltip>
|
|
519
|
+
) : (
|
|
520
|
+
perTile && (
|
|
521
|
+
<>
|
|
522
|
+
{valueTyped &&
|
|
523
|
+
operatorField(
|
|
524
|
+
row?.op,
|
|
525
|
+
(op) => setRow(index, { op }),
|
|
526
|
+
`Comparison for ${title}`,
|
|
527
|
+
)}
|
|
528
|
+
<FieldPicker
|
|
529
|
+
value={row?.field ?? ""}
|
|
530
|
+
onChange={(next) =>
|
|
531
|
+
setRow(index, { field: next })
|
|
532
|
+
}
|
|
533
|
+
fields={fieldsFor?.(tile)}
|
|
534
|
+
accepts={accepts}
|
|
535
|
+
label="Field"
|
|
536
|
+
ariaLabel={`Field for ${title}`}
|
|
537
|
+
disabled={!row?.include}
|
|
538
|
+
error={problem !== undefined}
|
|
539
|
+
helperText={problem}
|
|
540
|
+
sx={{ width: 220 }}
|
|
541
|
+
/>
|
|
542
|
+
</>
|
|
543
|
+
)
|
|
544
|
+
)}
|
|
545
|
+
</Stack>
|
|
546
|
+
);
|
|
547
|
+
})}
|
|
548
|
+
</Stack>
|
|
549
|
+
{included === 0 && (
|
|
550
|
+
<Typography
|
|
551
|
+
variant="caption"
|
|
552
|
+
sx={{ color: "warning.main", display: "block", mt: 1 }}
|
|
573
553
|
>
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
554
|
+
No tile is ticked, so this control will not appear on the
|
|
555
|
+
dashboard.
|
|
556
|
+
</Typography>
|
|
557
|
+
)}
|
|
558
|
+
</Box>
|
|
559
|
+
</Stack>
|
|
560
|
+
</AppDialog>
|
|
580
561
|
);
|
|
581
562
|
}
|