@malloy-publisher/sdk 0.9.7 → 0.9.8
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 +117 -17
- package/dist/{RenderedResult-qnpbr4tc.cjs.js → RenderedResult-BrvrMDAP.cjs.js} +1 -1
- package/dist/{RenderedResult-CkUS04tl.es.js → RenderedResult-DZj-FnOJ.es.js} +2 -2
- package/dist/{ServerProvider-DnLLeXEX.es.js → ServerProvider-B_bPAsu2.es.js} +583 -398
- package/dist/ServerProvider-DuEOzwPc.cjs.js +1 -0
- package/dist/builder/index.cjs.js +93 -93
- package/dist/builder/index.es.js +4630 -4562
- package/dist/builder-entry.d.ts +13 -12
- package/dist/client/api.d.ts +472 -94
- package/dist/client/index.cjs.js +1 -1
- package/dist/client/index.es.js +105 -95
- package/dist/components/Dashboard/DashboardTile.d.ts +3 -1
- package/dist/components/Dashboard/DashboardView.d.ts +1 -3
- package/dist/components/Dashboard/index.d.ts +0 -2
- package/dist/components/DocumentCreate/createDocument.d.ts +29 -9
- package/dist/components/DocumentCreate/documentPath.d.ts +21 -6
- package/dist/components/DocumentCreate/guards.d.ts +2 -3
- package/dist/components/DocumentCreate/index.d.ts +2 -3
- package/dist/components/DocumentCreate/newNotebook.d.ts +14 -5
- package/dist/components/DocumentStorage/BrowserDocumentStorage.d.ts +6 -0
- package/dist/components/DocumentStorage/DocumentStorage.d.ts +52 -24
- package/dist/components/Loading.d.ts +1 -1
- package/dist/components/Package/DataSchemaDialog.d.ts +26 -0
- package/dist/components/Package/NewDocumentDialog.d.ts +19 -10
- package/dist/components/Package/Package.d.ts +14 -9
- package/dist/components/Package/documentLocation.d.ts +66 -23
- package/dist/components/Package/index.d.ts +3 -2
- package/dist/components/Package/reportQueries.d.ts +8 -0
- package/dist/components/Package/useDocumentLocation.d.ts +36 -6
- package/dist/components/Package/useDraftLayout.d.ts +20 -0
- package/dist/components/Report/CellReport.d.ts +89 -0
- package/dist/components/Report/LinearReport.d.ts +18 -0
- package/dist/components/Report/Report.d.ts +62 -0
- package/dist/components/Report/index.d.ts +2 -0
- package/dist/components/Report/telemetry.d.ts +163 -0
- package/dist/components/{DashboardBuilder → ReportBuilder}/BuilderDialogs.d.ts +2 -2
- package/dist/components/{DashboardBuilder → ReportBuilder}/BuilderGrid.d.ts +2 -2
- package/dist/components/{DashboardBuilder → ReportBuilder}/BuilderHeader.d.ts +5 -4
- package/dist/components/{DashboardBuilder → ReportBuilder}/BuilderToolbar.d.ts +5 -1
- package/dist/components/{DashboardBuilder → ReportBuilder}/EditorSurface.d.ts +10 -7
- package/dist/components/{DashboardBuilder/DashboardBuilder.d.ts → ReportBuilder/ReportBuilder.d.ts} +17 -8
- package/dist/components/{DashboardBuilder/DashboardEditor.d.ts → ReportBuilder/ReportEditor.d.ts} +41 -14
- package/dist/components/ReportBuilder/builderReport.d.ts +14 -0
- package/dist/components/{DashboardBuilder → ReportBuilder}/catalog.d.ts +8 -5
- package/dist/components/{DashboardBuilder → ReportBuilder}/document.d.ts +3 -4
- package/dist/components/{DashboardBuilder → ReportBuilder}/documentSession.d.ts +1 -1
- package/dist/components/{DashboardBuilder → ReportBuilder}/imports.d.ts +5 -1
- package/dist/components/{DashboardBuilder → ReportBuilder}/malloyTree.d.ts +9 -0
- package/dist/components/{DashboardBuilder → ReportBuilder}/newDashboard.d.ts +7 -1
- package/dist/components/{DashboardBuilder → ReportBuilder}/readDocument.d.ts +7 -5
- package/dist/components/{DashboardBuilder → ReportBuilder}/readForEditor.d.ts +1 -1
- package/dist/components/ReportBuilder/reportTag.d.ts +52 -0
- package/dist/components/{DashboardBuilder → ReportBuilder}/spliceDocument.d.ts +1 -7
- package/dist/components/{DashboardBuilder → ReportBuilder}/useBuilderSelection.d.ts +2 -2
- package/dist/components/{DashboardBuilder → ReportBuilder}/useControlBindings.d.ts +2 -2
- package/dist/components/ReportBuilder/useEditorCatalog.d.ts +25 -0
- package/dist/components/{DashboardBuilder → ReportBuilder}/useHostCopy.d.ts +5 -3
- package/dist/components/{DashboardBuilder → ReportBuilder}/useOpenedDocument.d.ts +7 -5
- package/dist/components/{DashboardBuilder/useDashboardEditor.d.ts → ReportBuilder/useReportEditor.d.ts} +3 -7
- package/dist/components/{DashboardBuilder → ReportBuilder}/useSaveChannel.d.ts +6 -4
- package/dist/components/{DashboardBuilder → ReportBuilder}/useTileEditing.d.ts +2 -2
- package/dist/components/ServerProvider.d.ts +2 -1
- package/dist/components/drill/resolveDrill.d.ts +8 -1
- package/dist/components/drill/useDrillSelf.d.ts +4 -2
- package/dist/components/index.d.ts +2 -1
- package/dist/components/{Dashboard → legacy}/Dashboard.d.ts +15 -9
- package/dist/components/legacy/MalloynbCells.d.ts +13 -0
- package/dist/components/legacy/Notebook.d.ts +15 -0
- package/dist/components/{DashboardBuilder → legacy}/NotebookEditor.d.ts +3 -3
- package/dist/components/legacy/builderNames.d.ts +10 -0
- package/dist/components/legacy/index.d.ts +11 -0
- package/dist/components/legacy/kindAdapter.d.ts +11 -0
- package/dist/components/legacy/kindTypedDrafts.d.ts +10 -0
- package/dist/components/legacy/nameAlias.d.ts +44 -0
- package/dist/components/legacy/queryKeys.d.ts +8 -0
- package/dist/index.cjs.js +19 -19
- package/dist/index.es.js +7984 -7452
- package/dist/text/index.es.js +2 -2
- package/dist/{text-entry-CA0LZ1xL.es.js → text-entry-72YFLeNk.es.js} +10 -10
- package/dist/useCompiledDocument-oocN5cGE.cjs.js +141 -0
- package/dist/{useCompiledDocument-Bf72Ob5v.es.js → useCompiledDocument-x0B2RAH3.es.js} +4593 -4395
- package/package.json +2 -2
- package/src/builder-entry.ts +32 -24
- package/src/components/Dashboard/DashboardTile.tsx +17 -0
- package/src/components/Dashboard/DashboardView.spec.tsx +0 -21
- package/src/components/Dashboard/DashboardView.tsx +8 -24
- package/src/components/Dashboard/dropValueUrlTags.spec.ts +1 -4
- package/src/components/Dashboard/index.ts +0 -2
- package/src/components/DocumentCreate/createDocument.spec.ts +346 -53
- package/src/components/DocumentCreate/createDocument.ts +143 -63
- package/src/components/DocumentCreate/documentPath.ts +41 -12
- package/src/components/DocumentCreate/guards.ts +7 -15
- package/src/components/DocumentCreate/index.ts +3 -7
- package/src/components/DocumentCreate/newNotebook.spec.ts +113 -43
- package/src/components/DocumentCreate/newNotebook.ts +32 -10
- package/src/components/DocumentStorage/BrowserDocumentStorage.spec.ts +130 -28
- package/src/components/DocumentStorage/BrowserDocumentStorage.ts +78 -40
- package/src/components/DocumentStorage/DocumentStorage.contract.spec.tsx +426 -0
- package/src/components/DocumentStorage/DocumentStorage.ts +57 -24
- package/src/components/Home/AddEnvironmentDialog.tsx +1 -1
- package/src/components/Home/Home.tsx +1 -1
- package/src/components/Loading.tsx +1 -1
- package/src/components/Model/SourcesExplorer.tsx +1 -1
- package/src/components/Notebook/NotebookCell.tsx +6 -5
- package/src/components/Notebook/cellKind.spec.ts +15 -7
- package/src/components/Package/DataSchemaDialog.spec.tsx +85 -0
- package/src/components/Package/DataSchemaDialog.tsx +367 -0
- package/src/components/Package/NewDocumentDialog.spec.tsx +145 -88
- package/src/components/Package/NewDocumentDialog.tsx +93 -48
- package/src/components/Package/Package.artifacts.spec.tsx +79 -60
- package/src/components/Package/Package.create.spec.tsx +126 -112
- package/src/components/Package/Package.notebooks.spec.tsx +46 -27
- package/src/components/Package/Package.spec.tsx +43 -30
- package/src/components/Package/Package.tsx +173 -292
- package/src/components/Package/documentLocation.spec.ts +145 -50
- package/src/components/Package/documentLocation.ts +118 -39
- package/src/components/Package/index.ts +12 -3
- package/src/components/Package/reportQueries.ts +25 -0
- package/src/components/Package/useDocumentLocation.spec.ts +58 -0
- package/src/components/Package/useDocumentLocation.ts +90 -32
- package/src/components/Package/useDraftLayout.spec.tsx +143 -0
- package/src/components/Package/useDraftLayout.ts +81 -0
- package/src/components/Prose.spec.tsx +3 -3
- package/src/components/RenderedResult/RenderedResult.tsx +1 -1
- package/src/components/Report/CellReport.spec.tsx +155 -0
- package/src/components/{Notebook/Notebook.tsx → Report/CellReport.tsx} +178 -220
- package/src/components/Report/LinearReport.tsx +71 -0
- package/src/components/Report/Report.spec.tsx +238 -0
- package/src/components/Report/Report.telemetry.spec.tsx +292 -0
- package/src/components/Report/Report.tsx +277 -0
- package/src/components/Report/index.ts +12 -0
- package/src/components/Report/telemetry.spec.ts +90 -0
- package/src/components/Report/telemetry.ts +250 -0
- package/src/components/{DashboardBuilder → ReportBuilder}/BuilderDialogs.tsx +5 -5
- package/src/components/{DashboardBuilder → ReportBuilder}/BuilderGrid.tsx +2 -2
- package/src/components/{DashboardBuilder → ReportBuilder}/BuilderHeader.tsx +6 -7
- package/src/components/{DashboardBuilder → ReportBuilder}/BuilderToolbar.tsx +33 -0
- package/src/components/{DashboardBuilder → ReportBuilder}/DrillDialog.tsx +2 -2
- package/src/components/{DashboardBuilder → ReportBuilder}/EditorSurface.tsx +67 -107
- package/src/components/{DashboardBuilder → ReportBuilder}/FilterDialog.tsx +3 -4
- package/src/components/{DashboardBuilder/DashboardBuilder.charts.spec.tsx → ReportBuilder/ReportBuilder.charts.spec.tsx} +4 -4
- package/src/components/{DashboardBuilder/DashboardBuilder.exit.spec.tsx → ReportBuilder/ReportBuilder.exit.spec.tsx} +5 -5
- package/src/components/{DashboardBuilder/DashboardBuilder.inline.spec.tsx → ReportBuilder/ReportBuilder.inline.spec.tsx} +4 -4
- package/src/components/ReportBuilder/ReportBuilder.layoutSwitch.spec.tsx +145 -0
- package/src/components/{DashboardBuilder/DashboardBuilder.notebook.spec.tsx → ReportBuilder/ReportBuilder.notebook.spec.tsx} +22 -21
- package/src/components/{DashboardBuilder/DashboardBuilder.openDraft.spec.tsx → ReportBuilder/ReportBuilder.openDraft.spec.tsx} +3 -3
- package/src/components/{DashboardBuilder/DashboardBuilder.sources.spec.tsx → ReportBuilder/ReportBuilder.sources.spec.tsx} +19 -8
- package/src/components/{DashboardBuilder/DashboardBuilder.spec.tsx → ReportBuilder/ReportBuilder.spec.tsx} +34 -34
- package/src/components/{DashboardBuilder/DashboardBuilder.textTiles.spec.tsx → ReportBuilder/ReportBuilder.textTiles.spec.tsx} +5 -5
- package/src/components/{DashboardBuilder/DashboardBuilder.tsx → ReportBuilder/ReportBuilder.tsx} +46 -21
- package/src/components/{DashboardBuilder/DashboardEditor.authoritative.spec.tsx → ReportBuilder/ReportEditor.authoritative.spec.tsx} +28 -20
- package/src/components/{DashboardBuilder/DashboardEditor.emptyStart.spec.tsx → ReportBuilder/ReportEditor.emptyStart.spec.tsx} +19 -11
- package/src/components/{DashboardBuilder/DashboardEditor.filterTag.spec.tsx → ReportBuilder/ReportEditor.filterTag.spec.tsx} +7 -7
- package/src/components/{DashboardBuilder/DashboardEditor.notebook.spec.tsx → ReportBuilder/ReportEditor.notebook.spec.tsx} +70 -49
- package/src/components/{DashboardBuilder/DashboardEditor.package.spec.tsx → ReportBuilder/ReportEditor.package.spec.tsx} +52 -8
- package/src/components/{DashboardBuilder/DashboardEditor.resourceUri.spec.tsx → ReportBuilder/ReportEditor.resourceUri.spec.tsx} +50 -18
- package/src/components/{DashboardBuilder/DashboardEditor.spec.tsx → ReportBuilder/ReportEditor.spec.tsx} +65 -20
- package/src/components/{DashboardBuilder/DashboardEditor.textSource.spec.tsx → ReportBuilder/ReportEditor.textSource.spec.tsx} +6 -6
- package/src/components/{DashboardBuilder/DashboardEditor.tsx → ReportBuilder/ReportEditor.tsx} +92 -35
- package/src/components/{DashboardBuilder → ReportBuilder}/addTile.compile.spec.ts +1 -3
- package/src/components/{DashboardBuilder → ReportBuilder}/addTileToDocument.spec.ts +1 -0
- package/src/components/{DashboardBuilder → ReportBuilder}/artifactBlock.spec.ts +21 -29
- package/src/components/ReportBuilder/builderReport.ts +53 -0
- package/src/components/{DashboardBuilder → ReportBuilder}/catalog.spec.ts +28 -10
- package/src/components/{DashboardBuilder → ReportBuilder}/catalog.ts +17 -10
- package/src/components/{DashboardBuilder → ReportBuilder}/controls.spec.ts +1 -0
- package/src/components/{DashboardBuilder → ReportBuilder}/document.ts +4 -7
- package/src/components/{DashboardBuilder → ReportBuilder}/documentSession.spec.ts +5 -5
- package/src/components/{DashboardBuilder → ReportBuilder}/documentSession.ts +1 -1
- package/src/components/{DashboardBuilder → ReportBuilder}/imports.spec.ts +6 -2
- package/src/components/{DashboardBuilder → ReportBuilder}/imports.ts +8 -4
- package/src/components/{DashboardBuilder → ReportBuilder}/legacyNotebook.chart.spec.ts +1 -1
- package/src/components/{DashboardBuilder → ReportBuilder}/legacyNotebook.convert.spec.ts +9 -13
- package/src/components/{DashboardBuilder → ReportBuilder}/legacyNotebook.read.spec.ts +15 -15
- package/src/components/{DashboardBuilder → ReportBuilder}/legacyNotebook.ts +7 -2
- package/src/components/{DashboardBuilder → ReportBuilder}/malloyTree.ts +25 -0
- package/src/components/{DashboardBuilder → ReportBuilder}/newDashboard.spec.ts +12 -4
- package/src/components/{DashboardBuilder → ReportBuilder}/newDashboard.ts +11 -24
- package/src/components/{DashboardBuilder → ReportBuilder}/preview.spec.ts +1 -0
- package/src/components/{DashboardBuilder → ReportBuilder}/readDocument.spec.ts +64 -36
- package/src/components/{DashboardBuilder → ReportBuilder}/readDocument.ts +33 -32
- package/src/components/ReportBuilder/readForEditor.spec.ts +96 -0
- package/src/components/{DashboardBuilder → ReportBuilder}/readForEditor.ts +3 -11
- package/src/components/ReportBuilder/reportTag.ts +108 -0
- package/src/components/{DashboardBuilder → ReportBuilder}/spliceDocument.imports.spec.ts +28 -1
- package/src/components/{DashboardBuilder → ReportBuilder}/spliceDocument.spec.ts +32 -3
- package/src/components/{DashboardBuilder → ReportBuilder}/spliceDocument.ts +37 -60
- package/src/components/{DashboardBuilder → ReportBuilder}/tagParse.spec.ts +3 -3
- package/src/components/{DashboardBuilder → ReportBuilder}/testing/artifactTagParity.json +2 -2
- package/src/components/ReportBuilder/testing/drillResolution.json +279 -0
- package/src/components/ReportBuilder/testing/reportLayoutParity.json +125 -0
- package/src/components/{DashboardBuilder → ReportBuilder}/textTiles.spec.ts +66 -143
- package/src/components/{DashboardBuilder → ReportBuilder}/useBuilderSelection.ts +2 -2
- package/src/components/{DashboardBuilder → ReportBuilder}/useControlBindings.ts +2 -2
- package/src/components/ReportBuilder/useEditorCatalog.spec.tsx +156 -0
- package/src/components/ReportBuilder/useEditorCatalog.ts +119 -0
- package/src/components/{DashboardBuilder → ReportBuilder}/useHostCopy.ts +7 -5
- package/src/components/{DashboardBuilder → ReportBuilder}/useOpenedDocument.ts +56 -35
- package/src/components/{DashboardBuilder/useDashboardEditor.spec.ts → ReportBuilder/useReportEditor.spec.ts} +6 -6
- package/src/components/{DashboardBuilder/useDashboardEditor.ts → ReportBuilder/useReportEditor.ts} +6 -17
- package/src/components/{DashboardBuilder → ReportBuilder}/useSaveChannel.ts +36 -35
- package/src/components/{DashboardBuilder → ReportBuilder}/useTileEditing.ts +2 -2
- package/src/components/ServerProvider.tsx +2 -0
- package/src/components/drill/resolveDrill.ts +9 -2
- package/src/components/drill/useDrill.tsx +1 -0
- package/src/components/drill/useDrillSelf.spec.tsx +60 -7
- package/src/components/drill/useDrillSelf.ts +29 -12
- package/src/components/index.ts +2 -1
- package/src/components/{Dashboard → legacy}/Dashboard.spec.tsx +1 -1
- package/src/components/{Dashboard → legacy}/Dashboard.tsx +40 -28
- package/src/components/legacy/MalloynbCells.tsx +88 -0
- package/src/components/{Notebook → legacy}/Notebook.served.spec.tsx +17 -13
- package/src/components/{Notebook → legacy}/Notebook.spec.tsx +24 -20
- package/src/components/legacy/Notebook.tsx +44 -0
- package/src/components/{DashboardBuilder → legacy}/NotebookEditor.tsx +7 -4
- package/src/components/legacy/builderNames.ts +25 -0
- package/src/components/legacy/index.ts +20 -0
- package/src/components/legacy/kindAdapter.ts +19 -0
- package/src/components/legacy/kindTypedDrafts.ts +34 -0
- package/src/components/legacy/nameAlias.spec.ts +124 -0
- package/src/components/legacy/nameAlias.ts +95 -0
- package/src/components/legacy/queryKeys.ts +26 -0
- package/src/hooks/useGivensState.spec.ts +9 -9
- package/src/mainEntry.spec.ts +1 -1
- package/src/textEntry.spec.ts +9 -9
- package/src/utils/formatting.spec.ts +5 -5
- package/src/utils/parsing.spec.ts +1 -1
- package/src/utils/parsing.ts +1 -1
- package/dist/ServerProvider-Gj-im5VD.cjs.js +0 -1
- package/dist/components/Dashboard/telemetry.d.ts +0 -73
- package/dist/components/DashboardBuilder/builderReport.d.ts +0 -13
- package/dist/components/DashboardBuilder/telemetry.d.ts +0 -43
- package/dist/components/DocumentCreate/events.d.ts +0 -10
- package/dist/components/Notebook/Notebook.d.ts +0 -52
- package/dist/components/Notebook/index.d.ts +0 -1
- package/dist/useCompiledDocument-tBejqZ7s.cjs.js +0 -142
- package/src/components/Dashboard/telemetry.ts +0 -75
- package/src/components/DashboardBuilder/builderReport.ts +0 -74
- package/src/components/DashboardBuilder/readForEditor.spec.ts +0 -80
- package/src/components/DashboardBuilder/telemetry.ts +0 -47
- package/src/components/DashboardBuilder/testing/documentKindRule.json +0 -40
- package/src/components/DocumentCreate/events.ts +0 -15
- package/src/components/Notebook/index.ts +0 -4
- /package/dist/components/{DashboardBuilder → ReportBuilder}/AddTileDialog.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/ChartPicker.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/DrillDialog.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/FilterDialog.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/FilterStrip.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/InlineMarkdown.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/InlineText.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/SourceViewPicker.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/TextTileBody.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/TileFrame.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/TileMenu.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/addTileToDocument.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/annotationText.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/changedTile.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/chartLine.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/controls.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/inlineEdit.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/layout.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/legacyNotebook.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/loadMalloy.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/openDraft.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/preview.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/sortable.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/spliceResult.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/tagParse.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/testing/fixtures.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/testing/inline.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/testing/resize.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/tileDisplayTitle.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/useBuilderSession.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/useBuilderShortcuts.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/useConversionConfirm.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/useDocumentEditor.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/useDraft.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/useExitGuard.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/useFilterForm.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/useOpenDraftCommit.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/useTileReorder.d.ts +0 -0
- /package/dist/components/{DashboardBuilder → ReportBuilder}/useTileResize.d.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/AddTileDialog.spec.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/AddTileDialog.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/ChartPicker.render.spec.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/ChartPicker.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/ChartPicker.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/FilterStrip.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/InlineMarkdown.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/InlineText.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/SourceViewPicker.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/TextTileBody.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/TileFrame.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/TileMenu.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/__test__/inventory.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/addTileToDocument.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/annotationText.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/annotationText.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/artifactTagParity.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/catalog.aggregate.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/changedTile.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/changedTile.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/chartLine.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/chartLine.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/controls.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/emptyStart.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/inlineEdit.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/invariants.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/keepRowStructure.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/layout.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/loadMalloy.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/loadMalloy.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/malloyTree.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/moveIntoGap.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/openDraft.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/preview.shapes.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/preview.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/scannerShapes.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/sortable.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/sortable.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/spliceDocument.chart.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/spliceResult.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/statementExtent.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/tagParse.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/testing/fixtures.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/testing/inline.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/testing/resize.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/testing/urlRenderTags.json +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/tileDisplayTitle.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useBuilderSession.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useBuilderSession.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useBuilderShortcuts.overlay.spec.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useBuilderShortcuts.spec.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useBuilderShortcuts.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useConversionConfirm.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useDocumentEditor.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useDocumentEditor.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useDraft.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useExitGuard.spec.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useExitGuard.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useFilterForm.existing.spec.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useFilterForm.spec.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useFilterForm.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useOpenDraftCommit.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useTileReorder.spec.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useTileReorder.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useTileResize.spec.tsx +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/useTileResize.ts +0 -0
- /package/src/components/{DashboardBuilder → ReportBuilder}/withGaps.spec.ts +0 -0
- /package/src/components/{Notebook → legacy}/Notebook.layout.spec.tsx +0 -0
|
@@ -11,11 +11,11 @@ import {
|
|
|
11
11
|
within,
|
|
12
12
|
} from "@testing-library/react";
|
|
13
13
|
import { describe, expect, it } from "bun:test";
|
|
14
|
-
import {
|
|
14
|
+
import { ReportBuilder } from "./ReportBuilder";
|
|
15
15
|
import { isTextTile } from "./document";
|
|
16
16
|
import { openDocument } from "./testing/fixtures";
|
|
17
17
|
import { TEXT_TILE_PLACEHOLDER } from "./TextTileBody";
|
|
18
|
-
import {
|
|
18
|
+
import { useReportEditor } from "./useReportEditor";
|
|
19
19
|
import { dragEdge } from "./testing/resize";
|
|
20
20
|
|
|
21
21
|
const SOURCE = `## artifact { title="Storefront" tiles=[intro { kind=text colspan=12 }, "a -> by_cat", empty { kind=text }] } dashboard { columns=12 }
|
|
@@ -51,7 +51,7 @@ const catalog = {
|
|
|
51
51
|
const mount = async (onSave?: (source: string) => void) => {
|
|
52
52
|
const document = await openDocument(SOURCE);
|
|
53
53
|
return render(
|
|
54
|
-
<
|
|
54
|
+
<ReportBuilder
|
|
55
55
|
source={SOURCE}
|
|
56
56
|
document={document}
|
|
57
57
|
catalog={catalog}
|
|
@@ -64,7 +64,7 @@ const tile = (name: string) => screen.getByLabelText(`Tile ${name}`);
|
|
|
64
64
|
const button = (name: string) =>
|
|
65
65
|
screen.getByRole("button", { name, hidden: true });
|
|
66
66
|
|
|
67
|
-
describe("
|
|
67
|
+
describe("ReportBuilder: text tiles", () => {
|
|
68
68
|
it("draws a text tile's markdown, and a hint while it is empty", async () => {
|
|
69
69
|
await mount();
|
|
70
70
|
expect(
|
|
@@ -158,7 +158,7 @@ describe("DashboardBuilder: text tiles", () => {
|
|
|
158
158
|
it("edits a text tile's markdown through the document, and writes the block", async () => {
|
|
159
159
|
const document = await openDocument(SOURCE);
|
|
160
160
|
const view = renderHook(() =>
|
|
161
|
-
|
|
161
|
+
useReportEditor({ source: SOURCE, document, onSave: () => {} }),
|
|
162
162
|
);
|
|
163
163
|
act(() =>
|
|
164
164
|
view.result.current.update((draft) => {
|
package/src/components/{DashboardBuilder/DashboardBuilder.tsx → ReportBuilder/ReportBuilder.tsx}
RENAMED
|
@@ -6,8 +6,9 @@ import { Alert, Button, Stack, Typography } from "@mui/material";
|
|
|
6
6
|
import { useMemo, useRef, useState, type ReactNode } from "react";
|
|
7
7
|
import { DEFAULT_COLUMNS, nudgedSpan } from "../Dashboard/DashboardGrid";
|
|
8
8
|
import type { TileChrome, TileHeadingSlots } from "../Dashboard/TileCard";
|
|
9
|
+
import type { ReportLayout } from "../Package/documentLocation";
|
|
9
10
|
import type { SavesTo } from "./documentSession";
|
|
10
|
-
import type
|
|
11
|
+
import { reportEmitter, type ReportEventHandler } from "../Report/telemetry";
|
|
11
12
|
import type { BuilderGiven } from "./controls";
|
|
12
13
|
import { BuilderDialogs } from "./BuilderDialogs";
|
|
13
14
|
import { BuilderGrid } from "./BuilderGrid";
|
|
@@ -27,7 +28,7 @@ import { useBuilderSelection } from "./useBuilderSelection";
|
|
|
27
28
|
import { useBuilderSession } from "./useBuilderSession";
|
|
28
29
|
import { useControlBindings } from "./useControlBindings";
|
|
29
30
|
import { useConversionConfirm } from "./useConversionConfirm";
|
|
30
|
-
import {
|
|
31
|
+
import { useReportEditor } from "./useReportEditor";
|
|
31
32
|
import type { SaveHandler } from "./useDocumentEditor";
|
|
32
33
|
import { useOpenDraftCommit } from "./useOpenDraftCommit";
|
|
33
34
|
import { useTileEditing } from "./useTileEditing";
|
|
@@ -66,7 +67,7 @@ export type { BuilderGiven } from "./controls";
|
|
|
66
67
|
*
|
|
67
68
|
* Tiles are added from the package's catalog and removed from their menu.
|
|
68
69
|
*/
|
|
69
|
-
export interface
|
|
70
|
+
export interface ReportBuilderProps {
|
|
70
71
|
/** The file being edited. */
|
|
71
72
|
source: string;
|
|
72
73
|
/** The document that file produced. */
|
|
@@ -143,8 +144,12 @@ export interface DashboardBuilderProps {
|
|
|
143
144
|
* go. Absent, a drill can only filter this dashboard.
|
|
144
145
|
*/
|
|
145
146
|
dashboards?: string[];
|
|
146
|
-
/**
|
|
147
|
-
|
|
147
|
+
/**
|
|
148
|
+
* Saves, refusals and layout switches, for the host to log; see
|
|
149
|
+
* `ReportEvent`. Each is stamped with `modelPath` (empty when the builder
|
|
150
|
+
* was given none) and the document's layout as it stands.
|
|
151
|
+
*/
|
|
152
|
+
onEvent?: ReportEventHandler;
|
|
148
153
|
/**
|
|
149
154
|
* The document is a conversion of a cell-format notebook: `from` is the text
|
|
150
155
|
* on disk, `to` the layout text it converts to. Save writes `to` with the
|
|
@@ -173,10 +178,8 @@ export interface DashboardBuilderProps {
|
|
|
173
178
|
saveLabel?: string;
|
|
174
179
|
/** The file a save overwrites when `source` is a draft of it, so Undo save restores that file rather than the draft. */
|
|
175
180
|
replaces?: string;
|
|
176
|
-
/** The document's file within the package
|
|
181
|
+
/** The document's file within the package: the name an untitled document is shown under, and what a new tile is written beside. */
|
|
177
182
|
modelPath?: string;
|
|
178
|
-
/** The document is held as text, which the server reads by its tags rather than its folder: the tag always carries `kind=`. */
|
|
179
|
-
explicitKind?: boolean;
|
|
180
183
|
/** Set for a document held as text: the sources it sees without an `import`. A tile on one of them adds no import. */
|
|
181
184
|
visibleSources?: readonly string[];
|
|
182
185
|
/**
|
|
@@ -192,15 +195,23 @@ export interface DashboardBuilderProps {
|
|
|
192
195
|
toolbar?: ReactNode;
|
|
193
196
|
/** Leave the builder, opted into: draws Close, which asks first when edits are unsaved. */
|
|
194
197
|
onExit?: () => void;
|
|
198
|
+
/**
|
|
199
|
+
* Whether the toolbar offers the Linear / Grid layout switch. Default
|
|
200
|
+
* true. A host that files a report by its layout passes false, so an
|
|
201
|
+
* author cannot change a layout the host files by. A document held as text
|
|
202
|
+
* never gets the switch.
|
|
203
|
+
*/
|
|
204
|
+
allowLayoutChange?: boolean;
|
|
195
205
|
}
|
|
196
206
|
|
|
197
|
-
export function
|
|
207
|
+
export function ReportBuilder({
|
|
198
208
|
source,
|
|
199
209
|
document,
|
|
200
210
|
onSave,
|
|
201
211
|
onChange,
|
|
202
212
|
onDirtyChange,
|
|
203
213
|
onExit,
|
|
214
|
+
allowLayoutChange = true,
|
|
204
215
|
renderTile,
|
|
205
216
|
controls,
|
|
206
217
|
givens,
|
|
@@ -213,18 +224,15 @@ export function DashboardBuilder({
|
|
|
213
224
|
saveLabel,
|
|
214
225
|
replaces,
|
|
215
226
|
modelPath,
|
|
216
|
-
explicitKind,
|
|
217
227
|
visibleSources,
|
|
218
228
|
addFilterDisabledReason,
|
|
219
|
-
}:
|
|
220
|
-
const editor =
|
|
229
|
+
}: ReportBuilderProps) {
|
|
230
|
+
const editor = useReportEditor({
|
|
221
231
|
source,
|
|
222
232
|
document,
|
|
223
233
|
...(onSave ? { onSave } : {}),
|
|
224
234
|
...(conversion ? { conversion } : {}),
|
|
225
235
|
...(replaces !== undefined ? { replaces } : {}),
|
|
226
|
-
...(modelPath !== undefined ? { modelPath } : {}),
|
|
227
|
-
...(explicitKind ? { explicitKind } : {}),
|
|
228
236
|
...(visibleSources ? { visibleSources } : {}),
|
|
229
237
|
});
|
|
230
238
|
const gridBox = useRef<HTMLDivElement>(null);
|
|
@@ -238,8 +246,8 @@ export function DashboardBuilder({
|
|
|
238
246
|
flash,
|
|
239
247
|
stepEditor,
|
|
240
248
|
} = useBuilderSelection({ editor, gridBox });
|
|
241
|
-
// A
|
|
242
|
-
const notebook = editor.document.
|
|
249
|
+
// A linear report is one column whatever the file says, and the builder never writes its width.
|
|
250
|
+
const notebook = editor.document.layout === "linear";
|
|
243
251
|
const columns = notebook ? 1 : (editor.document.columns ?? DEFAULT_COLUMNS);
|
|
244
252
|
// The reader's tile chrome for this document: cards on a dashboard, bare
|
|
245
253
|
// flow on a notebook. Every tile, text block and the description take it,
|
|
@@ -357,7 +365,8 @@ export function DashboardBuilder({
|
|
|
357
365
|
shortcuts,
|
|
358
366
|
report: builderReport({
|
|
359
367
|
size: editor.document.tiles.length,
|
|
360
|
-
|
|
368
|
+
path: modelPath ?? "",
|
|
369
|
+
layout: editor.document.layout,
|
|
361
370
|
savesTo,
|
|
362
371
|
onEvent,
|
|
363
372
|
}),
|
|
@@ -373,6 +382,23 @@ export function DashboardBuilder({
|
|
|
373
382
|
{...(catalog ? { onAddTile: () => openAdd() } : {})}
|
|
374
383
|
savesTo={savesTo}
|
|
375
384
|
{...(saveLabel ? { saveLabel } : {})}
|
|
385
|
+
{...(visibleSources === undefined && allowLayoutChange
|
|
386
|
+
? {
|
|
387
|
+
// A text-held document's layout is the host's record, so only a file gets the switch, and only when the host allows it.
|
|
388
|
+
layout: editor.document.layout,
|
|
389
|
+
onLayoutChange: (next: ReportLayout) => {
|
|
390
|
+
const from = editor.document.layout;
|
|
391
|
+
if (next === from) return;
|
|
392
|
+
editor.update((draft) => {
|
|
393
|
+
draft.layout = next;
|
|
394
|
+
});
|
|
395
|
+
reportEmitter(
|
|
396
|
+
{ path: modelPath ?? "", layout: next },
|
|
397
|
+
onEvent,
|
|
398
|
+
).emit({ type: "report.layout_changed", from, to: next });
|
|
399
|
+
},
|
|
400
|
+
}
|
|
401
|
+
: {})}
|
|
376
402
|
/>
|
|
377
403
|
);
|
|
378
404
|
return (
|
|
@@ -401,8 +427,8 @@ export function DashboardBuilder({
|
|
|
401
427
|
>
|
|
402
428
|
{editor.pendingOpen && (
|
|
403
429
|
<Alert severity="info">
|
|
404
|
-
This
|
|
405
|
-
|
|
430
|
+
This report is in the cell format. Saving rewrites it as a
|
|
431
|
+
layout notebook, and a named query run once becomes that
|
|
406
432
|
tile's view.
|
|
407
433
|
</Alert>
|
|
408
434
|
)}
|
|
@@ -431,8 +457,7 @@ export function DashboardBuilder({
|
|
|
431
457
|
}}
|
|
432
458
|
>
|
|
433
459
|
<Typography variant="body2">
|
|
434
|
-
This
|
|
435
|
-
served until it has a tile.
|
|
460
|
+
This report is not served until it has a tile.
|
|
436
461
|
</Typography>
|
|
437
462
|
{catalog && (
|
|
438
463
|
<Button
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
} from "../DocumentStorage";
|
|
28
28
|
import { BrowserDocumentStorage } from "../DocumentStorage/BrowserDocumentStorage";
|
|
29
29
|
import { DocumentStorageProvider } from "../DocumentStorage/DocumentStorageProvider";
|
|
30
|
-
import type {
|
|
30
|
+
import type { ReportEvent } from "../Report/telemetry";
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
33
|
* The editor against a host whose store is the record, and against the same
|
|
@@ -103,8 +103,8 @@ mockServerProvider(
|
|
|
103
103
|
executeQueryModel: mock(() => pending()),
|
|
104
104
|
updateModelSource,
|
|
105
105
|
},
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
reports: {
|
|
107
|
+
getReport: mock(() =>
|
|
108
108
|
Promise.resolve({
|
|
109
109
|
data: {
|
|
110
110
|
path: "dashboards/overview.malloy",
|
|
@@ -113,15 +113,23 @@ mockServerProvider(
|
|
|
113
113
|
},
|
|
114
114
|
}),
|
|
115
115
|
),
|
|
116
|
-
|
|
117
|
-
Promise.resolve({
|
|
116
|
+
listReports: mock(() =>
|
|
117
|
+
Promise.resolve({
|
|
118
|
+
data: [
|
|
119
|
+
{
|
|
120
|
+
path: "dashboards/overview.malloy",
|
|
121
|
+
name: "overview",
|
|
122
|
+
layout: "grid",
|
|
123
|
+
},
|
|
124
|
+
],
|
|
125
|
+
}),
|
|
118
126
|
),
|
|
119
127
|
},
|
|
120
128
|
},
|
|
121
129
|
serverContext,
|
|
122
130
|
);
|
|
123
131
|
|
|
124
|
-
const {
|
|
132
|
+
const { ReportEditor } = await import("./ReportEditor");
|
|
125
133
|
|
|
126
134
|
const PATH = "env/pkg/dashboards/overview.malloy";
|
|
127
135
|
const RECORD: Workspace = {
|
|
@@ -167,7 +175,7 @@ class FakeStorage implements DocumentStorage {
|
|
|
167
175
|
): Promise<DocumentLocator[]> {
|
|
168
176
|
return [...this.documents.keys()].map((path) => ({
|
|
169
177
|
workspace: this.workspace.name,
|
|
170
|
-
type: "
|
|
178
|
+
type: "grid" as const,
|
|
171
179
|
path,
|
|
172
180
|
}));
|
|
173
181
|
}
|
|
@@ -198,11 +206,11 @@ class FakeStorage implements DocumentStorage {
|
|
|
198
206
|
const mount = (
|
|
199
207
|
storage: DocumentStorage,
|
|
200
208
|
onDirtyChange?: (dirty: boolean) => void,
|
|
201
|
-
onEvent?: (event:
|
|
209
|
+
onEvent?: (event: ReportEvent) => void,
|
|
202
210
|
) =>
|
|
203
211
|
render(
|
|
204
212
|
<DocumentStorageProvider documentStorage={storage}>
|
|
205
|
-
<
|
|
213
|
+
<ReportEditor
|
|
206
214
|
environmentName="env"
|
|
207
215
|
packageName="pkg"
|
|
208
216
|
dashboardName="overview"
|
|
@@ -262,19 +270,19 @@ beforeEach(() => {
|
|
|
262
270
|
updateModelSource.mockClear();
|
|
263
271
|
});
|
|
264
272
|
|
|
265
|
-
describe("
|
|
273
|
+
describe("ReportEditor, when the host's store is the record", () => {
|
|
266
274
|
it("opens the store's copy rather than the package file, and never offers to resume it", async () => {
|
|
267
275
|
const storage = new FakeStorage(RECORD);
|
|
268
276
|
storage.documents.set(PATH, withTitle("Recorded"));
|
|
269
|
-
const onEvent = mock((_event:
|
|
277
|
+
const onEvent = mock((_event: ReportEvent) => {});
|
|
270
278
|
mount(storage, undefined, onEvent);
|
|
271
279
|
|
|
272
280
|
expect(await screen.findByText("Recorded")).toBeDefined();
|
|
273
281
|
expect(screen.queryByText("Storefront")).toBeNull();
|
|
274
282
|
// Nothing is pending, so there is nothing to resume.
|
|
275
|
-
expect(screen.queryByText(/edits to this
|
|
283
|
+
expect(screen.queryByText(/edits to this report/)).toBeNull();
|
|
276
284
|
expect(onEvent.mock.calls[0][0]).toMatchObject({
|
|
277
|
-
type: "
|
|
285
|
+
type: "report.opened",
|
|
278
286
|
from: "record",
|
|
279
287
|
});
|
|
280
288
|
});
|
|
@@ -285,7 +293,7 @@ describe("DashboardEditor, when the host's store is the record", () => {
|
|
|
285
293
|
mount(storage);
|
|
286
294
|
|
|
287
295
|
expect(await screen.findByText("Storefront")).toBeDefined();
|
|
288
|
-
expect(await screen.findByText(/edits to this
|
|
296
|
+
expect(await screen.findByText(/edits to this report/)).toBeDefined();
|
|
289
297
|
});
|
|
290
298
|
|
|
291
299
|
it("opens the package file when the record has no copy yet, and the first save keeps the history", async () => {
|
|
@@ -348,14 +356,14 @@ describe("DashboardEditor, when the host's store is the record", () => {
|
|
|
348
356
|
const storage = new FakeStorage(RECORD);
|
|
349
357
|
storage.slow = true;
|
|
350
358
|
storage.documents.set(PATH, withTitle("Recorded"));
|
|
351
|
-
const onEvent = mock((_event:
|
|
359
|
+
const onEvent = mock((_event: ReportEvent) => {});
|
|
352
360
|
mount(storage, undefined, onEvent);
|
|
353
361
|
|
|
354
362
|
expect(await screen.findByText("Recorded")).toBeDefined();
|
|
355
363
|
await settle();
|
|
356
364
|
const opens = onEvent.mock.calls
|
|
357
365
|
.map((call) => call[0])
|
|
358
|
-
.filter((event) => event.type === "
|
|
366
|
+
.filter((event) => event.type === "report.opened");
|
|
359
367
|
expect(opens).toHaveLength(1);
|
|
360
368
|
expect(opens[0]).toMatchObject({ from: "record" });
|
|
361
369
|
});
|
|
@@ -397,7 +405,7 @@ describe("DashboardEditor, when the host's store is the record", () => {
|
|
|
397
405
|
});
|
|
398
406
|
});
|
|
399
407
|
|
|
400
|
-
describe("
|
|
408
|
+
describe("ReportEditor, when the copy is kept beside the package", () => {
|
|
401
409
|
it("opens the package but withholds Save when the saved copy could not be read", async () => {
|
|
402
410
|
const storage = new FakeStorage(BESIDE);
|
|
403
411
|
storage.readFailure = new Error("the branch could not be reached");
|
|
@@ -447,7 +455,7 @@ describe("DashboardEditor, when the copy is kept beside the package", () => {
|
|
|
447
455
|
clearCache();
|
|
448
456
|
serverContext.mutable = true;
|
|
449
457
|
mount(storage);
|
|
450
|
-
expect(await screen.findByText(/edits to this
|
|
458
|
+
expect(await screen.findByText(/edits to this report/)).toBeDefined();
|
|
451
459
|
});
|
|
452
460
|
|
|
453
461
|
it("keeps a resumed copy on screen after saving it into the package, and splices the next save onto it", async () => {
|
|
@@ -490,7 +498,7 @@ describe("DashboardEditor, when the copy is kept beside the package", () => {
|
|
|
490
498
|
* up with. Everything here is about that window: what the editor believes is
|
|
491
499
|
* open in it, and what it does with a version that lands during or after it.
|
|
492
500
|
*/
|
|
493
|
-
describe("
|
|
501
|
+
describe("ReportEditor, after a save", () => {
|
|
494
502
|
it("keeps the next edit, on the package path", async () => {
|
|
495
503
|
serverContext.mutable = true;
|
|
496
504
|
mount(new FakeStorage(BESIDE));
|
|
@@ -632,7 +640,7 @@ describe("DashboardEditor, after a save", () => {
|
|
|
632
640
|
});
|
|
633
641
|
});
|
|
634
642
|
|
|
635
|
-
describe("
|
|
643
|
+
describe("ReportEditor, when a new version of the file arrives", () => {
|
|
636
644
|
it("holds it back rather than replacing unsaved edits, and loads it when the reader says so", async () => {
|
|
637
645
|
serverContext.mutable = true;
|
|
638
646
|
mount(new FakeStorage(BESIDE));
|
|
@@ -64,7 +64,7 @@ const getModel = mock((_env: string, _pkg: string, path: string) =>
|
|
|
64
64
|
},
|
|
65
65
|
}),
|
|
66
66
|
);
|
|
67
|
-
const
|
|
67
|
+
const getReport = mock(() =>
|
|
68
68
|
Promise.resolve({
|
|
69
69
|
data: {
|
|
70
70
|
path: "dashboards/overview.malloy",
|
|
@@ -83,8 +83,16 @@ const updateModelSource = mock(
|
|
|
83
83
|
},
|
|
84
84
|
}),
|
|
85
85
|
);
|
|
86
|
-
const
|
|
87
|
-
Promise.resolve({
|
|
86
|
+
const listReports = mock(() =>
|
|
87
|
+
Promise.resolve({
|
|
88
|
+
data: [
|
|
89
|
+
{
|
|
90
|
+
path: "dashboards/overview.malloy",
|
|
91
|
+
name: "overview",
|
|
92
|
+
layout: "grid",
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
}),
|
|
88
96
|
);
|
|
89
97
|
const executeQueryModel = mock(() => pending());
|
|
90
98
|
// What the package publishes: the catalog is built from these, not from
|
|
@@ -95,24 +103,24 @@ const listModels = mock(() =>
|
|
|
95
103
|
mockServerProvider(
|
|
96
104
|
{
|
|
97
105
|
models: { getModel, executeQueryModel, listModels, updateModelSource },
|
|
98
|
-
|
|
106
|
+
reports: { getReport, listReports },
|
|
99
107
|
},
|
|
100
108
|
{ mutable: true },
|
|
101
109
|
);
|
|
102
110
|
|
|
103
111
|
// Imported after the stub is registered: a static import would hoist above it.
|
|
104
|
-
const {
|
|
112
|
+
const { ReportEditor } = await import("./ReportEditor");
|
|
105
113
|
|
|
106
114
|
beforeEach(() => {
|
|
107
115
|
clearCache();
|
|
108
|
-
|
|
116
|
+
getReport.mockClear();
|
|
109
117
|
updateModelSource.mockClear();
|
|
110
118
|
});
|
|
111
119
|
|
|
112
|
-
describe("
|
|
120
|
+
describe("ReportEditor, starting empty", () => {
|
|
113
121
|
it("fetches the manifest once, after the save that gives it its first tile", async () => {
|
|
114
122
|
render(
|
|
115
|
-
<
|
|
123
|
+
<ReportEditor
|
|
116
124
|
environmentName="env"
|
|
117
125
|
packageName="pkg"
|
|
118
126
|
dashboardName="overview"
|
|
@@ -120,7 +128,7 @@ describe("DashboardEditor, starting empty", () => {
|
|
|
120
128
|
{ wrapper: serverWrapper },
|
|
121
129
|
);
|
|
122
130
|
await screen.findByText(/not served until it has a tile/);
|
|
123
|
-
expect(
|
|
131
|
+
expect(getReport).not.toHaveBeenCalled();
|
|
124
132
|
|
|
125
133
|
fireEvent.click(
|
|
126
134
|
(
|
|
@@ -137,9 +145,9 @@ describe("DashboardEditor, starting empty", () => {
|
|
|
137
145
|
);
|
|
138
146
|
|
|
139
147
|
await waitFor(() => expect(updateModelSource).toHaveBeenCalledTimes(1));
|
|
140
|
-
await waitFor(() => expect(
|
|
148
|
+
await waitFor(() => expect(getReport).toHaveBeenCalledTimes(1));
|
|
141
149
|
// Settled, and not asked again by a later render.
|
|
142
150
|
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
143
|
-
expect(
|
|
151
|
+
expect(getReport).toHaveBeenCalledTimes(1);
|
|
144
152
|
});
|
|
145
153
|
});
|
|
@@ -29,7 +29,7 @@ const getModel = mock((_env: string, _pkg: string, path: string) =>
|
|
|
29
29
|
: { modelPath: path, sources: [], sourceInfos: [] },
|
|
30
30
|
}),
|
|
31
31
|
);
|
|
32
|
-
const
|
|
32
|
+
const getReport = mock(() =>
|
|
33
33
|
Promise.resolve({
|
|
34
34
|
data: { path: "dashboards/overview.malloy", tiles: [], ...served },
|
|
35
35
|
}),
|
|
@@ -41,21 +41,21 @@ mockServerProvider(
|
|
|
41
41
|
executeQueryModel: mock(() => pending()),
|
|
42
42
|
listModels: mock(() => Promise.resolve({ data: [] })),
|
|
43
43
|
},
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
reports: {
|
|
45
|
+
getReport,
|
|
46
|
+
listReports: mock(() => Promise.resolve({ data: [] })),
|
|
47
47
|
},
|
|
48
48
|
},
|
|
49
49
|
{ mutable: true },
|
|
50
50
|
);
|
|
51
51
|
|
|
52
|
-
const {
|
|
52
|
+
const { ReportEditor } = await import("./ReportEditor");
|
|
53
53
|
|
|
54
54
|
beforeEach(() => clearCache());
|
|
55
55
|
|
|
56
56
|
async function warnings(): Promise<Record<string, string>> {
|
|
57
57
|
render(
|
|
58
|
-
<
|
|
58
|
+
<ReportEditor
|
|
59
59
|
environmentName="env"
|
|
60
60
|
packageName="pkg"
|
|
61
61
|
dashboardName="overview"
|
|
@@ -74,7 +74,7 @@ async function warnings(): Promise<Record<string, string>> {
|
|
|
74
74
|
);
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
describe("
|
|
77
|
+
describe("ReportEditor filter warnings", () => {
|
|
78
78
|
it("warns only on the tile the control does not reach", async () => {
|
|
79
79
|
packageFile = `## artifact { title="Storefront" tiles=["a -> by_cat", "a -> by_brand"] } dashboard { columns=12 }
|
|
80
80
|
import { scoped_orders } from "../data_app.malloy"
|