@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
|
@@ -147,7 +147,25 @@ export interface DashboardBuilderProps {
|
|
|
147
147
|
/** Saves and refusals, for the host to log; see `DashboardEvent`. */
|
|
148
148
|
onEvent?: DashboardEventHandler;
|
|
149
149
|
/**
|
|
150
|
-
*
|
|
150
|
+
* Whether the document differs from what was last saved, on every change
|
|
151
|
+
* and on mount.
|
|
152
|
+
*
|
|
153
|
+
* For a host that has to decide whether it may replace what is open — a
|
|
154
|
+
* newer version arriving from its store, a navigation away. `onChange`
|
|
155
|
+
* cannot answer that: the saved baseline lives in this hook, so a parent
|
|
156
|
+
* comparing the document it is handed against the one it passed in reads
|
|
157
|
+
* dirty immediately after a successful save.
|
|
158
|
+
*/
|
|
159
|
+
onDirtyChange?: (dirty: boolean) => void;
|
|
160
|
+
/**
|
|
161
|
+
* Where `onSave` puts the file, for the event it reports. The builder
|
|
162
|
+
* cannot tell — it is handed a function — and a save into the package, into
|
|
163
|
+
* this browser, and into a host store that holds the record are not the
|
|
164
|
+
* same event.
|
|
165
|
+
*/
|
|
166
|
+
savesTo?: "package" | "browser" | "host";
|
|
167
|
+
/**
|
|
168
|
+
* The host's own actions for the edit bar — Done — rendered beside
|
|
151
169
|
* undo, redo and save. The builder owns the edits; where the file goes
|
|
152
170
|
* afterwards is the host's, so its buttons sit in the host's slot.
|
|
153
171
|
*/
|
|
@@ -159,6 +177,7 @@ export function DashboardBuilder({
|
|
|
159
177
|
document,
|
|
160
178
|
onSave,
|
|
161
179
|
onChange,
|
|
180
|
+
onDirtyChange,
|
|
162
181
|
renderTile,
|
|
163
182
|
controls,
|
|
164
183
|
givens,
|
|
@@ -166,6 +185,7 @@ export function DashboardBuilder({
|
|
|
166
185
|
toolbar,
|
|
167
186
|
dashboards,
|
|
168
187
|
onEvent,
|
|
188
|
+
savesTo = "package",
|
|
169
189
|
}: DashboardBuilderProps) {
|
|
170
190
|
const editor = useDashboardEditor({
|
|
171
191
|
source,
|
|
@@ -218,6 +238,11 @@ export function DashboardBuilder({
|
|
|
218
238
|
useEffect(() => {
|
|
219
239
|
onChange?.(editor.document);
|
|
220
240
|
}, [editor.document, onChange]);
|
|
241
|
+
// Also on mount, so a host that remounted the builder on new text is told
|
|
242
|
+
// the slate is clean rather than carrying the previous mount's answer.
|
|
243
|
+
useEffect(() => {
|
|
244
|
+
onDirtyChange?.(editor.dirty);
|
|
245
|
+
}, [editor.dirty, onDirtyChange]);
|
|
221
246
|
// One object per document, or the popover's draft would reset on every
|
|
222
247
|
// render of the builder while it is open.
|
|
223
248
|
const settings = useMemo(
|
|
@@ -315,6 +340,7 @@ export function DashboardBuilder({
|
|
|
315
340
|
type: "dashboard.saved",
|
|
316
341
|
tiles,
|
|
317
342
|
structural,
|
|
343
|
+
where: savesTo,
|
|
318
344
|
durationMs: now() - started,
|
|
319
345
|
});
|
|
320
346
|
else
|
|
@@ -324,7 +350,7 @@ export function DashboardBuilder({
|
|
|
324
350
|
});
|
|
325
351
|
})
|
|
326
352
|
.finally(() => setSaving(false));
|
|
327
|
-
}, [editor, onEvent]);
|
|
353
|
+
}, [editor, onEvent, savesTo]);
|
|
328
354
|
const save = useCallback(() => {
|
|
329
355
|
if (!onSave || !editor.dirty || saving) return;
|
|
330
356
|
if (!editor.structural) {
|
|
@@ -376,15 +402,6 @@ export function DashboardBuilder({
|
|
|
376
402
|
setSelected(editor.document.tiles.length);
|
|
377
403
|
};
|
|
378
404
|
|
|
379
|
-
/** Every tile this file owns, to one fraction of the grid. */
|
|
380
|
-
const quickLayout = (share: 1 | 2 | 3 | 4) => {
|
|
381
|
-
const span = Math.max(1, Math.round(columns / share));
|
|
382
|
-
editor.update((draft) => {
|
|
383
|
-
for (const tile of draft.tiles)
|
|
384
|
-
if (tile.declaration.kind !== "inherited") tile.colspan = span;
|
|
385
|
-
});
|
|
386
|
-
};
|
|
387
|
-
|
|
388
405
|
const removeTile = (index: number) => {
|
|
389
406
|
setMenu(undefined);
|
|
390
407
|
setSelected(undefined);
|
|
@@ -470,9 +487,11 @@ export function DashboardBuilder({
|
|
|
470
487
|
// grid alone, so the header, the control row and the tiles all inset
|
|
471
488
|
// together and stay aligned with each other. 4px = the ring's 2px offset
|
|
472
489
|
// plus its 2px width.
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
490
|
+
// The bar carries its own gap to what it sits over, so the surface adds
|
|
491
|
+
// none between the two.
|
|
492
|
+
<Stack sx={{ gap: 0 }}>
|
|
493
|
+
{/* Outside the ring's inset, so the bar lines up to the pixel with the
|
|
494
|
+
reader's — the whole point of it being the same bar. */}
|
|
476
495
|
<BuilderToolbar
|
|
477
496
|
canUndo={editor.canUndo}
|
|
478
497
|
canRedo={editor.canRedo}
|
|
@@ -484,170 +503,182 @@ export function DashboardBuilder({
|
|
|
484
503
|
{...(toolbar ? { actions: toolbar } : {})}
|
|
485
504
|
{...(catalog ? { onAddTile: () => setAddingTile(true) } : {})}
|
|
486
505
|
onSettings={setSettingsAnchor}
|
|
487
|
-
onQuickLayout={quickLayout}
|
|
488
506
|
/>
|
|
489
507
|
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
508
|
+
{/* The ring's inset, minus the top: nothing at the top of this stack
|
|
509
|
+
can be selected (the prose and the control row are not tiles), and
|
|
510
|
+
4px there would put the title 4px further from the bar than the
|
|
511
|
+
reader's is. */}
|
|
512
|
+
<Stack sx={{ gap: 2, px: "4px", pb: "4px" }}>
|
|
513
|
+
<DashboardProse
|
|
514
|
+
title={editor.document.title || "Untitled dashboard"}
|
|
515
|
+
{...(editor.document.description
|
|
516
|
+
? { description: editor.document.description }
|
|
517
|
+
: {})}
|
|
518
|
+
/>
|
|
496
519
|
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
520
|
+
<FilterStrip
|
|
521
|
+
controls={controlList}
|
|
522
|
+
tileCount={editor.document.tiles.length}
|
|
523
|
+
unknownFieldsOf={unknownFieldsOf}
|
|
524
|
+
onEdit={(control) => setFilterDialog({ control })}
|
|
525
|
+
onAdd={() => setFilterDialog({})}
|
|
526
|
+
>
|
|
527
|
+
{controls}
|
|
528
|
+
</FilterStrip>
|
|
506
529
|
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
530
|
+
{editor.error && (
|
|
531
|
+
// The edit is still here; the message says what stopped it reaching
|
|
532
|
+
// the file, which is a different thing from losing the work.
|
|
533
|
+
<Alert severity="warning">{editor.error}</Alert>
|
|
534
|
+
)}
|
|
512
535
|
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
536
|
+
<DragDropProvider
|
|
537
|
+
sensors={builderSensors}
|
|
538
|
+
onDragStart={onDragStart}
|
|
539
|
+
onDragOver={onDragOver}
|
|
540
|
+
onDragEnd={onDragEnd}
|
|
541
|
+
>
|
|
542
|
+
<Box ref={gridBox} sx={{ position: "relative" }}>
|
|
543
|
+
{(resize !== undefined || dragging) && (
|
|
544
|
+
<GridGuides columns={columns} />
|
|
545
|
+
)}
|
|
523
546
|
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
setSelected(index)
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
547
|
+
<DashboardGrid
|
|
548
|
+
tiles={entries}
|
|
549
|
+
columns={columns}
|
|
550
|
+
keyOf={(entry) =>
|
|
551
|
+
entry.kind === "gap"
|
|
552
|
+
? gapId(entry.after)
|
|
553
|
+
: tileKey(entry.tile)
|
|
554
|
+
}
|
|
555
|
+
renderTile={(entry) => {
|
|
556
|
+
if (entry.kind === "gap")
|
|
557
|
+
return <GapTarget after={entry.after} />;
|
|
558
|
+
const { tile: each, index } = entry;
|
|
559
|
+
return (
|
|
560
|
+
<TileFrame
|
|
561
|
+
tile={each}
|
|
562
|
+
index={index}
|
|
563
|
+
selected={index === selected}
|
|
564
|
+
menuOpen={menu?.index === index}
|
|
565
|
+
resizeSpan={
|
|
566
|
+
resize?.index === index
|
|
567
|
+
? resize.span
|
|
568
|
+
: undefined
|
|
569
|
+
}
|
|
570
|
+
columns={columns}
|
|
571
|
+
onSelect={() => setSelected(index)}
|
|
572
|
+
onOpenMenu={(anchor) => {
|
|
573
|
+
setSelected(index);
|
|
574
|
+
setMenu({ anchor, index });
|
|
575
|
+
}}
|
|
576
|
+
onResizeStart={(event) =>
|
|
577
|
+
startResize(event, index)
|
|
578
|
+
}
|
|
579
|
+
onResizeMove={onResize}
|
|
580
|
+
onResizeEnd={endResize}
|
|
581
|
+
>
|
|
582
|
+
{renderTile ? (
|
|
583
|
+
renderTile(each)
|
|
584
|
+
) : (
|
|
585
|
+
<TilePlaceholder tile={each} />
|
|
586
|
+
)}
|
|
587
|
+
</TileFrame>
|
|
588
|
+
);
|
|
589
|
+
}}
|
|
590
|
+
/>
|
|
591
|
+
</Box>
|
|
592
|
+
</DragDropProvider>
|
|
593
|
+
<FilterDialog
|
|
594
|
+
open={filterDialog !== undefined}
|
|
595
|
+
document={editor.document}
|
|
596
|
+
{...(filterDialog?.control
|
|
597
|
+
? { control: filterDialog.control }
|
|
598
|
+
: {})}
|
|
599
|
+
available={available}
|
|
600
|
+
{...(catalog ? { fieldsFor } : {})}
|
|
601
|
+
onClose={() => setFilterDialog(undefined)}
|
|
602
|
+
onApply={applyFilter}
|
|
603
|
+
onRemove={dropControl}
|
|
604
|
+
/>
|
|
605
|
+
<TileMenu
|
|
606
|
+
anchor={menu?.anchor ?? null}
|
|
607
|
+
tile={
|
|
608
|
+
menu === undefined
|
|
609
|
+
? undefined
|
|
610
|
+
: editor.document.tiles[menu.index]
|
|
611
|
+
}
|
|
612
|
+
onClose={() => setMenu(undefined)}
|
|
613
|
+
onCommit={(next) => {
|
|
614
|
+
const at = menu?.index;
|
|
615
|
+
if (at === undefined) return;
|
|
616
|
+
editor.update((draft) => {
|
|
617
|
+
draft.tiles[at] = next;
|
|
618
|
+
});
|
|
619
|
+
}}
|
|
620
|
+
onRemove={() => {
|
|
621
|
+
if (menu !== undefined) removeTile(menu.index);
|
|
622
|
+
}}
|
|
623
|
+
columns={columns}
|
|
624
|
+
onDrills={() => {
|
|
625
|
+
if (menu !== undefined)
|
|
626
|
+
setDrillSource(editor.document.tiles[menu.index]?.source);
|
|
627
|
+
}}
|
|
628
|
+
/>
|
|
629
|
+
<DrillDialog
|
|
630
|
+
open={drillSource !== undefined}
|
|
631
|
+
document={editor.document}
|
|
632
|
+
source={editor.document.sources.find(
|
|
633
|
+
(s) => s.name === drillSource,
|
|
634
|
+
)}
|
|
635
|
+
givenNames={controlList.map((c) => c.name)}
|
|
636
|
+
dashboards={dashboards ?? []}
|
|
637
|
+
onClose={() => setDrillSource(undefined)}
|
|
638
|
+
onApply={(drills) =>
|
|
639
|
+
editor.update((draft) => {
|
|
640
|
+
const kept = (draft.drills ?? []).filter(
|
|
641
|
+
(d) => d.source !== drillSource,
|
|
561
642
|
);
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
/>
|
|
602
|
-
<DrillDialog
|
|
603
|
-
open={drillSource !== undefined}
|
|
604
|
-
document={editor.document}
|
|
605
|
-
source={editor.document.sources.find((s) => s.name === drillSource)}
|
|
606
|
-
givenNames={controlList.map((c) => c.name)}
|
|
607
|
-
dashboards={dashboards ?? []}
|
|
608
|
-
onClose={() => setDrillSource(undefined)}
|
|
609
|
-
onApply={(drills) =>
|
|
610
|
-
editor.update((draft) => {
|
|
611
|
-
const kept = (draft.drills ?? []).filter(
|
|
612
|
-
(d) => d.source !== drillSource,
|
|
613
|
-
);
|
|
614
|
-
const next = [...kept, ...drills];
|
|
615
|
-
if (next.length === 0) delete draft.drills;
|
|
616
|
-
else draft.drills = next;
|
|
617
|
-
})
|
|
618
|
-
}
|
|
619
|
-
/>
|
|
620
|
-
<SettingsPopover
|
|
621
|
-
anchor={settingsAnchor}
|
|
622
|
-
settings={settings}
|
|
623
|
-
onClose={() => setSettingsAnchor(null)}
|
|
624
|
-
onCommit={(next) =>
|
|
625
|
-
editor.update((draft) => {
|
|
626
|
-
draft.title = next.title;
|
|
627
|
-
if (next.description === undefined) delete draft.description;
|
|
628
|
-
else draft.description = next.description;
|
|
629
|
-
if (next.columns === undefined) delete draft.columns;
|
|
630
|
-
else draft.columns = next.columns;
|
|
631
|
-
if (next.autorun === undefined) delete draft.autorun;
|
|
632
|
-
else draft.autorun = next.autorun;
|
|
633
|
-
})
|
|
634
|
-
}
|
|
635
|
-
/>
|
|
636
|
-
<AddTileDialog
|
|
637
|
-
open={addingTile}
|
|
638
|
-
document={editor.document}
|
|
639
|
-
catalog={catalog}
|
|
640
|
-
columns={columns}
|
|
641
|
-
onClose={() => setAddingTile(false)}
|
|
642
|
-
onAdd={addTile}
|
|
643
|
-
/>
|
|
644
|
-
<DiffDialog
|
|
645
|
-
open={pendingSave !== undefined}
|
|
646
|
-
before={pendingSave?.before ?? ""}
|
|
647
|
-
after={pendingSave?.after ?? ""}
|
|
648
|
-
onConfirm={commitSave}
|
|
649
|
-
onClose={() => setPendingSave(undefined)}
|
|
650
|
-
/>
|
|
643
|
+
const next = [...kept, ...drills];
|
|
644
|
+
if (next.length === 0) delete draft.drills;
|
|
645
|
+
else draft.drills = next;
|
|
646
|
+
})
|
|
647
|
+
}
|
|
648
|
+
/>
|
|
649
|
+
<SettingsPopover
|
|
650
|
+
anchor={settingsAnchor}
|
|
651
|
+
settings={settings}
|
|
652
|
+
onClose={() => setSettingsAnchor(null)}
|
|
653
|
+
onCommit={(next) =>
|
|
654
|
+
editor.update((draft) => {
|
|
655
|
+
draft.title = next.title;
|
|
656
|
+
if (next.description === undefined)
|
|
657
|
+
delete draft.description;
|
|
658
|
+
else draft.description = next.description;
|
|
659
|
+
if (next.columns === undefined) delete draft.columns;
|
|
660
|
+
else draft.columns = next.columns;
|
|
661
|
+
if (next.autorun === undefined) delete draft.autorun;
|
|
662
|
+
else draft.autorun = next.autorun;
|
|
663
|
+
})
|
|
664
|
+
}
|
|
665
|
+
/>
|
|
666
|
+
<AddTileDialog
|
|
667
|
+
open={addingTile}
|
|
668
|
+
document={editor.document}
|
|
669
|
+
catalog={catalog}
|
|
670
|
+
columns={columns}
|
|
671
|
+
onClose={() => setAddingTile(false)}
|
|
672
|
+
onAdd={addTile}
|
|
673
|
+
/>
|
|
674
|
+
<DiffDialog
|
|
675
|
+
open={pendingSave !== undefined}
|
|
676
|
+
before={pendingSave?.before ?? ""}
|
|
677
|
+
after={pendingSave?.after ?? ""}
|
|
678
|
+
onConfirm={commitSave}
|
|
679
|
+
onClose={() => setPendingSave(undefined)}
|
|
680
|
+
/>
|
|
681
|
+
</Stack>
|
|
651
682
|
</Stack>
|
|
652
683
|
);
|
|
653
684
|
}
|