@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
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
type Workspace,
|
|
27
27
|
} from "../DocumentStorage";
|
|
28
28
|
import { DocumentStorageProvider } from "../DocumentStorage/DocumentStorageProvider";
|
|
29
|
-
import type {
|
|
29
|
+
import type { ReportEvent } from "../Report/telemetry";
|
|
30
30
|
import { editInline } from "./testing/inline";
|
|
31
31
|
|
|
32
32
|
/**
|
|
@@ -36,19 +36,19 @@ import { editInline } from "./testing/inline";
|
|
|
36
36
|
const REPO = path.resolve(import.meta.dir, "../../../../..");
|
|
37
37
|
const LEGACY = fs
|
|
38
38
|
.readFileSync(
|
|
39
|
-
path.join(REPO, "examples/storefront/
|
|
39
|
+
path.join(REPO, "examples/storefront/category-review.malloy"),
|
|
40
40
|
"utf8",
|
|
41
41
|
)
|
|
42
42
|
.replace(/\r\n/g, "\n");
|
|
43
43
|
|
|
44
|
-
const LAYOUT = `## artifact {
|
|
44
|
+
const LAYOUT = `## artifact { layout=linear title="Tour" tiles=[intro { kind=text }] }
|
|
45
45
|
|
|
46
46
|
##|(markdown) intro
|
|
47
47
|
Hello.
|
|
48
48
|
|##
|
|
49
49
|
`;
|
|
50
50
|
|
|
51
|
-
const REFUSED = `## artifact {
|
|
51
|
+
const REFUSED = `## artifact { layout=linear }
|
|
52
52
|
import { orders } from "../m.malloy"
|
|
53
53
|
|
|
54
54
|
run: orders extend { dimension: z is 1 } -> { select: z }
|
|
@@ -73,18 +73,22 @@ const getModel = mock(
|
|
|
73
73
|
},
|
|
74
74
|
}),
|
|
75
75
|
);
|
|
76
|
-
|
|
76
|
+
// One read for either layout, by path: a report in tiles carries its manifest,
|
|
77
|
+
// one in cells carries its cells instead.
|
|
78
|
+
const getReport = mock(
|
|
77
79
|
async (_env: string, _pkg: string, modelPath: string) => ({
|
|
78
80
|
data: served.includes("tiles=")
|
|
79
81
|
? {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
tiles: [],
|
|
85
|
-
},
|
|
82
|
+
path: modelPath,
|
|
83
|
+
layout: "linear",
|
|
84
|
+
givens: [{ name: "FROM_MANIFEST", type: "string" }],
|
|
85
|
+
tiles: [],
|
|
86
86
|
}
|
|
87
|
-
: {
|
|
87
|
+
: {
|
|
88
|
+
path: modelPath,
|
|
89
|
+
layout: "linear",
|
|
90
|
+
notebook: { notebookCells: [] },
|
|
91
|
+
},
|
|
88
92
|
}),
|
|
89
93
|
);
|
|
90
94
|
const getDashboard = mock(() => pending());
|
|
@@ -113,29 +117,29 @@ const serverContext: {
|
|
|
113
117
|
mockServerProvider(
|
|
114
118
|
{
|
|
115
119
|
models: { getModel, listModels, executeQueryModel, updateModelSource },
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
listDashboards: mock(async () => ({ data: [] })),
|
|
120
|
+
reports: {
|
|
121
|
+
getReport,
|
|
122
|
+
listReports: mock(async () => ({ data: [] })),
|
|
120
123
|
},
|
|
124
|
+
dashboards: { getDashboard },
|
|
121
125
|
},
|
|
122
126
|
serverContext,
|
|
123
127
|
);
|
|
124
128
|
|
|
125
|
-
const {
|
|
126
|
-
const { NotebookEditor } = await import("
|
|
129
|
+
const { ReportEditor } = await import("./ReportEditor");
|
|
130
|
+
const { NotebookEditor } = await import("../legacy/NotebookEditor");
|
|
127
131
|
|
|
128
132
|
const button = (name: string | RegExp) =>
|
|
129
133
|
screen.getByRole("button", { name, hidden: true });
|
|
130
134
|
|
|
131
135
|
const mount = (
|
|
132
|
-
props: Partial<Parameters<typeof
|
|
136
|
+
props: Partial<Parameters<typeof ReportEditor>[0]> & {
|
|
133
137
|
dashboardName?: string;
|
|
134
138
|
} = {},
|
|
135
|
-
onEvent?: (event:
|
|
139
|
+
onEvent?: (event: ReportEvent) => void,
|
|
136
140
|
) =>
|
|
137
141
|
render(
|
|
138
|
-
<
|
|
142
|
+
<ReportEditor
|
|
139
143
|
kind="notebook"
|
|
140
144
|
environmentName="env"
|
|
141
145
|
packageName="pkg"
|
|
@@ -155,14 +159,14 @@ beforeEach(async () => {
|
|
|
155
159
|
writes = [];
|
|
156
160
|
serverContext.mutable = true;
|
|
157
161
|
getModel.mockClear();
|
|
158
|
-
|
|
162
|
+
getReport.mockClear();
|
|
159
163
|
getDashboard.mockClear();
|
|
160
164
|
updateModelSource.mockClear();
|
|
161
165
|
});
|
|
162
166
|
|
|
163
|
-
describe("
|
|
164
|
-
it("reads the file with the authoring flag, and the manifest from the
|
|
165
|
-
const onEvent = mock((_event:
|
|
167
|
+
describe("ReportEditor as a notebook", () => {
|
|
168
|
+
it("reads the file with the authoring flag, and the manifest from the report read", async () => {
|
|
169
|
+
const onEvent = mock((_event: ReportEvent) => {});
|
|
166
170
|
mount({}, onEvent);
|
|
167
171
|
expect(await screen.findByText("Tour")).toBeDefined();
|
|
168
172
|
expect(getModel.mock.calls[0].slice(0, 3)).toEqual([
|
|
@@ -171,12 +175,15 @@ describe("DashboardEditor as a notebook", () => {
|
|
|
171
175
|
"notebooks/tour.malloy",
|
|
172
176
|
]);
|
|
173
177
|
expect(getModel.mock.calls[0][4]).toBe(true);
|
|
174
|
-
await waitFor(() => expect(
|
|
178
|
+
await waitFor(() => expect(getReport).toHaveBeenCalled());
|
|
179
|
+
expect(getReport.mock.calls[0][2]).toBe("notebooks/tour.malloy");
|
|
175
180
|
expect(getDashboard).not.toHaveBeenCalled();
|
|
176
181
|
expect(onEvent.mock.calls[0][0]).toMatchObject({
|
|
177
|
-
type: "
|
|
182
|
+
type: "report.opened",
|
|
183
|
+
surface: "edit",
|
|
184
|
+
layout: "linear",
|
|
178
185
|
from: "package",
|
|
179
|
-
|
|
186
|
+
tiles: 1,
|
|
180
187
|
});
|
|
181
188
|
});
|
|
182
189
|
|
|
@@ -200,25 +207,33 @@ describe("DashboardEditor as a notebook", () => {
|
|
|
200
207
|
expect(getModel.mock.calls[0][2]).toBe("dashboards/tour.malloy");
|
|
201
208
|
});
|
|
202
209
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
210
|
+
// DEPRECATED FEATURE COVERAGE — delete together with
|
|
211
|
+
// `.malloynb` notebooks (see RELEASE_NOTES deprecations).
|
|
212
|
+
describe("deprecated: .malloynb notebooks", () => {
|
|
213
|
+
it("refuses a .malloynb notebook without fetching it", async () => {
|
|
214
|
+
const onEvent = mock((_event: ReportEvent) => {});
|
|
215
|
+
mount({ dashboardName: "old.malloynb" }, onEvent);
|
|
216
|
+
expect(
|
|
217
|
+
await screen.findByText(
|
|
218
|
+
/a \.malloynb notebook is read, not edited/,
|
|
219
|
+
),
|
|
220
|
+
).toBeDefined();
|
|
221
|
+
expect(getModel).not.toHaveBeenCalled();
|
|
222
|
+
expect(onEvent.mock.calls[0][0]).toMatchObject({
|
|
223
|
+
type: "report.load_failed",
|
|
224
|
+
surface: "edit",
|
|
225
|
+
category: "unsupported",
|
|
226
|
+
});
|
|
212
227
|
});
|
|
213
228
|
});
|
|
214
229
|
|
|
215
230
|
it("offers a notebook in the cell format as a conversion, and Save writes it exactly", async () => {
|
|
216
231
|
served = LEGACY;
|
|
217
232
|
servedHash = await sha256Hex(LEGACY);
|
|
218
|
-
const onEvent = mock((_event:
|
|
233
|
+
const onEvent = mock((_event: ReportEvent) => {});
|
|
219
234
|
mount({}, onEvent);
|
|
220
235
|
expect(
|
|
221
|
-
await screen.findByText(/This
|
|
236
|
+
await screen.findByText(/This report is in the cell format/),
|
|
222
237
|
).toBeDefined();
|
|
223
238
|
expect(screen.getByLabelText("Tile revenue_by_month")).toBeDefined();
|
|
224
239
|
|
|
@@ -231,8 +246,8 @@ describe("DashboardEditor as a notebook", () => {
|
|
|
231
246
|
expect(writes[0]).toContain("view: revenue_by_month is sales_by_month");
|
|
232
247
|
await waitFor(() =>
|
|
233
248
|
expect(onEvent.mock.calls.map(([event]) => event.type)).toEqual([
|
|
234
|
-
"
|
|
235
|
-
"
|
|
249
|
+
"report.opened",
|
|
250
|
+
"report.saved",
|
|
236
251
|
]),
|
|
237
252
|
);
|
|
238
253
|
expect(onEvent.mock.calls[1][0]).toMatchObject({ converted: true });
|
|
@@ -240,20 +255,24 @@ describe("DashboardEditor as a notebook", () => {
|
|
|
240
255
|
|
|
241
256
|
it("says why a notebook cannot be converted, naming the line", async () => {
|
|
242
257
|
served = REFUSED;
|
|
243
|
-
const onEvent = mock((_event:
|
|
258
|
+
const onEvent = mock((_event: ReportEvent) => {});
|
|
244
259
|
mount({}, onEvent);
|
|
245
260
|
const alert = await screen.findByText(/cannot be opened in the builder/);
|
|
246
261
|
expect(alert.textContent).toMatch(/line 4/i);
|
|
247
262
|
expect(
|
|
248
|
-
screen.queryByText(/This
|
|
263
|
+
screen.queryByText(/This report is in the cell format/),
|
|
249
264
|
).toBeNull();
|
|
250
265
|
expect(onEvent.mock.calls[0][0]).toMatchObject({
|
|
251
|
-
type: "
|
|
266
|
+
type: "report.load_failed",
|
|
267
|
+
surface: "edit",
|
|
268
|
+
category: "invalid",
|
|
252
269
|
});
|
|
270
|
+
// A category, never the message: the reason can carry the file's text.
|
|
271
|
+
expect(onEvent.mock.calls[0][0]).not.toHaveProperty("reason");
|
|
253
272
|
});
|
|
254
273
|
});
|
|
255
274
|
|
|
256
|
-
describe("
|
|
275
|
+
describe("ReportEditor as a notebook: the host's record", () => {
|
|
257
276
|
const RECORD: Workspace = {
|
|
258
277
|
name: "Branch",
|
|
259
278
|
writeable: true,
|
|
@@ -277,17 +296,18 @@ describe("DashboardEditor as a notebook: the host's record", () => {
|
|
|
277
296
|
return this.record;
|
|
278
297
|
}
|
|
279
298
|
async saveDocument(locator: DocumentLocator, content: string) {
|
|
299
|
+
this.types.push(locator.type);
|
|
280
300
|
this.saved.set(locator.path, content);
|
|
281
301
|
}
|
|
282
302
|
async deleteDocument(): Promise<void> {}
|
|
283
303
|
async moveDocument(): Promise<void> {}
|
|
284
304
|
}
|
|
285
305
|
|
|
286
|
-
it("reads
|
|
306
|
+
it("reads it with the linear layout the deprecated kind names, and records that layout on a save", async () => {
|
|
287
307
|
const store = new Store(LAYOUT.replace("Hello.", "From the record."));
|
|
288
308
|
render(
|
|
289
309
|
<DocumentStorageProvider documentStorage={store}>
|
|
290
|
-
<
|
|
310
|
+
<ReportEditor
|
|
291
311
|
kind="notebook"
|
|
292
312
|
environmentName="env"
|
|
293
313
|
packageName="pkg"
|
|
@@ -297,10 +317,11 @@ describe("DashboardEditor as a notebook: the host's record", () => {
|
|
|
297
317
|
{ wrapper: serverWrapper },
|
|
298
318
|
);
|
|
299
319
|
expect(await screen.findByText("From the record.")).toBeDefined();
|
|
300
|
-
expect(store.types).toEqual(["
|
|
301
|
-
editInline("Tour", "
|
|
320
|
+
expect(store.types).toEqual(["linear"]);
|
|
321
|
+
editInline("Tour", "Report title", "Tour, again");
|
|
302
322
|
fireEvent.click(button("Save"));
|
|
303
323
|
await waitFor(() => expect(store.saved.size).toBe(1));
|
|
324
|
+
expect(store.types).toEqual(["linear", "linear"]);
|
|
304
325
|
expect(store.saved.get("env/pkg/notebooks/tour.malloy")).toContain(
|
|
305
326
|
'title="Tour, again"',
|
|
306
327
|
);
|
|
@@ -55,8 +55,8 @@ mockServerProvider(
|
|
|
55
55
|
executeQueryModel: mock(() => pending()),
|
|
56
56
|
updateModelSource,
|
|
57
57
|
},
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
reports: {
|
|
59
|
+
getReport: mock(() =>
|
|
60
60
|
Promise.resolve({
|
|
61
61
|
data: {
|
|
62
62
|
path: "dashboards/overview.malloy",
|
|
@@ -65,19 +65,27 @@ mockServerProvider(
|
|
|
65
65
|
},
|
|
66
66
|
}),
|
|
67
67
|
),
|
|
68
|
-
|
|
69
|
-
Promise.resolve({
|
|
68
|
+
listReports: mock(() =>
|
|
69
|
+
Promise.resolve({
|
|
70
|
+
data: [
|
|
71
|
+
{
|
|
72
|
+
path: "dashboards/overview.malloy",
|
|
73
|
+
name: "overview",
|
|
74
|
+
layout: "grid",
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
}),
|
|
70
78
|
),
|
|
71
79
|
},
|
|
72
80
|
},
|
|
73
81
|
{ mutable: true },
|
|
74
82
|
);
|
|
75
83
|
|
|
76
|
-
const {
|
|
84
|
+
const { ReportEditor } = await import("./ReportEditor");
|
|
77
85
|
|
|
78
86
|
const DRAFT = {
|
|
79
87
|
workspace: "Local",
|
|
80
|
-
type: "
|
|
88
|
+
type: "grid" as const,
|
|
81
89
|
path: "env/pkg/dashboards/overview.malloy",
|
|
82
90
|
};
|
|
83
91
|
|
|
@@ -85,7 +93,7 @@ const mount = () => {
|
|
|
85
93
|
const storage = new BrowserDocumentStorage();
|
|
86
94
|
render(
|
|
87
95
|
<DocumentStorageProvider documentStorage={storage}>
|
|
88
|
-
<
|
|
96
|
+
<ReportEditor
|
|
89
97
|
environmentName="env"
|
|
90
98
|
packageName="pkg"
|
|
91
99
|
dashboardName="overview"
|
|
@@ -104,7 +112,7 @@ beforeEach(() => {
|
|
|
104
112
|
updateModelSource.mockClear();
|
|
105
113
|
});
|
|
106
114
|
|
|
107
|
-
describe("
|
|
115
|
+
describe("ReportEditor, when the server takes writes", () => {
|
|
108
116
|
it("saves into the package with the hash of the text it opened, and supersedes the browser draft", async () => {
|
|
109
117
|
const storage = mount();
|
|
110
118
|
await new BrowserDocumentStorage().saveDocument(DRAFT, "stale draft");
|
|
@@ -187,3 +195,39 @@ describe("DashboardEditor, when the server takes writes", () => {
|
|
|
187
195
|
).toBe(false);
|
|
188
196
|
});
|
|
189
197
|
});
|
|
198
|
+
|
|
199
|
+
describe("ReportEditor's layout switch", () => {
|
|
200
|
+
const mountWith = (allowLayoutChange?: boolean) =>
|
|
201
|
+
render(
|
|
202
|
+
<DocumentStorageProvider
|
|
203
|
+
documentStorage={new BrowserDocumentStorage()}
|
|
204
|
+
>
|
|
205
|
+
<ReportEditor
|
|
206
|
+
environmentName="env"
|
|
207
|
+
packageName="pkg"
|
|
208
|
+
dashboardName="overview"
|
|
209
|
+
{...(allowLayoutChange !== undefined
|
|
210
|
+
? { allowLayoutChange }
|
|
211
|
+
: {})}
|
|
212
|
+
/>
|
|
213
|
+
</DocumentStorageProvider>,
|
|
214
|
+
{ wrapper: serverWrapper },
|
|
215
|
+
);
|
|
216
|
+
|
|
217
|
+
it("is offered for a file by default", async () => {
|
|
218
|
+
mountWith();
|
|
219
|
+
await screen.findByText("Storefront");
|
|
220
|
+
expect(button("Grid layout")).toBeDefined();
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
it("is hidden when the host passes allowLayoutChange={false}", async () => {
|
|
224
|
+
mountWith(false);
|
|
225
|
+
await screen.findByText("Storefront");
|
|
226
|
+
expect(
|
|
227
|
+
screen.queryByRole("button", { name: "Grid layout", hidden: true }),
|
|
228
|
+
).toBeNull();
|
|
229
|
+
expect(
|
|
230
|
+
screen.queryByRole("button", { name: "Linear layout", hidden: true }),
|
|
231
|
+
).toBeNull();
|
|
232
|
+
});
|
|
233
|
+
});
|
|
@@ -61,8 +61,8 @@ const getModel = mock(
|
|
|
61
61
|
},
|
|
62
62
|
}),
|
|
63
63
|
);
|
|
64
|
-
const
|
|
65
|
-
(_env: string, _pkg: string,
|
|
64
|
+
const getReport = mock(
|
|
65
|
+
(_env: string, _pkg: string, _path: string, _versionId?: string) =>
|
|
66
66
|
Promise.resolve({
|
|
67
67
|
data: { path: "dashboards/overview.malloy", givens: [], tiles: [] },
|
|
68
68
|
}),
|
|
@@ -70,8 +70,16 @@ const getDashboard = mock(
|
|
|
70
70
|
const listModels = mock((_env: string, _pkg: string, _versionId?: string) =>
|
|
71
71
|
Promise.resolve({ data: [{ path: "data_app.malloy" }] }),
|
|
72
72
|
);
|
|
73
|
-
const
|
|
74
|
-
Promise.resolve({
|
|
73
|
+
const listReports = mock((_env: string, _pkg: string, _versionId?: string) =>
|
|
74
|
+
Promise.resolve({
|
|
75
|
+
data: [
|
|
76
|
+
{
|
|
77
|
+
path: "dashboards/overview.malloy",
|
|
78
|
+
name: "overview",
|
|
79
|
+
layout: "grid",
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
}),
|
|
75
83
|
);
|
|
76
84
|
const updateModelSource = mock(
|
|
77
85
|
(_env: string, _pkg: string, path: string, body: { source: string }) =>
|
|
@@ -102,12 +110,12 @@ const serverContext = { mutable: false };
|
|
|
102
110
|
mockServerProvider(
|
|
103
111
|
{
|
|
104
112
|
models: { getModel, executeQueryModel, updateModelSource, listModels },
|
|
105
|
-
|
|
113
|
+
reports: { getReport, listReports },
|
|
106
114
|
},
|
|
107
115
|
serverContext,
|
|
108
116
|
);
|
|
109
117
|
|
|
110
|
-
const {
|
|
118
|
+
const { ReportEditor } = await import("./ReportEditor");
|
|
111
119
|
|
|
112
120
|
const URI = "publisher://environments/env/packages/pkg";
|
|
113
121
|
const button = (name: string | RegExp) =>
|
|
@@ -116,7 +124,7 @@ const button = (name: string | RegExp) =>
|
|
|
116
124
|
const mountByUri = (versionId?: string) =>
|
|
117
125
|
render(
|
|
118
126
|
<DocumentStorageProvider documentStorage={new BrowserDocumentStorage()}>
|
|
119
|
-
<
|
|
127
|
+
<ReportEditor
|
|
120
128
|
resourceUri={
|
|
121
129
|
versionId === undefined ? URI : `${URI}?versionId=${versionId}`
|
|
122
130
|
}
|
|
@@ -126,10 +134,18 @@ const mountByUri = (versionId?: string) =>
|
|
|
126
134
|
{ wrapper: serverWrapper },
|
|
127
135
|
);
|
|
128
136
|
|
|
137
|
+
const mountByPath = () =>
|
|
138
|
+
render(
|
|
139
|
+
<DocumentStorageProvider documentStorage={new BrowserDocumentStorage()}>
|
|
140
|
+
<ReportEditor resourceUri={URI} path="dashboards/overview.malloy" />
|
|
141
|
+
</DocumentStorageProvider>,
|
|
142
|
+
{ wrapper: serverWrapper },
|
|
143
|
+
);
|
|
144
|
+
|
|
129
145
|
const mountLegacy = () =>
|
|
130
146
|
render(
|
|
131
147
|
<DocumentStorageProvider documentStorage={new BrowserDocumentStorage()}>
|
|
132
|
-
<
|
|
148
|
+
<ReportEditor
|
|
133
149
|
environmentName="env"
|
|
134
150
|
packageName="pkg"
|
|
135
151
|
dashboardName="overview"
|
|
@@ -142,8 +158,8 @@ beforeEach(() => {
|
|
|
142
158
|
clearCache();
|
|
143
159
|
localStorage.clear();
|
|
144
160
|
getModel.mockClear();
|
|
145
|
-
|
|
146
|
-
|
|
161
|
+
getReport.mockClear();
|
|
162
|
+
listReports.mockClear();
|
|
147
163
|
listModels.mockClear();
|
|
148
164
|
updateModelSource.mockClear();
|
|
149
165
|
// Uncleared, a tile query from an earlier test carries into the next one's
|
|
@@ -152,7 +168,23 @@ beforeEach(() => {
|
|
|
152
168
|
serverContext.mutable = false;
|
|
153
169
|
});
|
|
154
170
|
|
|
155
|
-
describe("the
|
|
171
|
+
describe("the prop forms", () => {
|
|
172
|
+
it("open the same report by path as by the deprecated name", async () => {
|
|
173
|
+
mountByPath();
|
|
174
|
+
expect(await screen.findByText("Storefront")).toBeDefined();
|
|
175
|
+
expect(
|
|
176
|
+
getModel.mock.calls.find(
|
|
177
|
+
(call) => call[2] === "dashboards/overview.malloy",
|
|
178
|
+
),
|
|
179
|
+
).toEqual(["env", "pkg", "dashboards/overview.malloy", undefined]);
|
|
180
|
+
// The manifest is read by path, not by the basename.
|
|
181
|
+
await waitFor(() =>
|
|
182
|
+
expect(getReport.mock.calls[0]?.[2]).toBe(
|
|
183
|
+
"dashboards/overview.malloy",
|
|
184
|
+
),
|
|
185
|
+
);
|
|
186
|
+
});
|
|
187
|
+
|
|
156
188
|
it("open the same dashboard", async () => {
|
|
157
189
|
mountLegacy();
|
|
158
190
|
expect(await screen.findByText("Storefront")).toBeDefined();
|
|
@@ -201,13 +233,13 @@ describe("versionId", () => {
|
|
|
201
233
|
expect(
|
|
202
234
|
getModel.mock.calls.find((call) => call[2] === "data_app.malloy"),
|
|
203
235
|
).toEqual(["env", "pkg", "data_app.malloy", "v7"]);
|
|
204
|
-
expect(
|
|
236
|
+
expect(getReport.mock.calls[0]).toEqual([
|
|
205
237
|
"env",
|
|
206
238
|
"pkg",
|
|
207
|
-
"overview",
|
|
239
|
+
"dashboards/overview.malloy",
|
|
208
240
|
"v7",
|
|
209
241
|
]);
|
|
210
|
-
expect(
|
|
242
|
+
expect(listReports.mock.calls[0]).toEqual(["env", "pkg", "v7"]);
|
|
211
243
|
expect(listModels.mock.calls[0]).toEqual(["env", "pkg", "v7"]);
|
|
212
244
|
|
|
213
245
|
// The key too, appended last, never spliced in the middle of it: a
|
|
@@ -216,9 +248,9 @@ describe("versionId", () => {
|
|
|
216
248
|
// screen.
|
|
217
249
|
expect(cacheKeys("dashboard-editor-model")[0]).toContain('"v7"');
|
|
218
250
|
expect(cacheKeys("dashboard-editor-manifest")[0]).toContain('"v7"');
|
|
219
|
-
expect(cacheKeys("
|
|
251
|
+
expect(cacheKeys("reports")[0]).toContain('"v7"');
|
|
220
252
|
await waitFor(() =>
|
|
221
|
-
expect(cacheKeys("
|
|
253
|
+
expect(cacheKeys("report-editor-models")[0]).toContain('"v7"'),
|
|
222
254
|
);
|
|
223
255
|
});
|
|
224
256
|
|
|
@@ -333,13 +365,13 @@ describe("a malformed resourceUri", () => {
|
|
|
333
365
|
for (const [what, resourceUri] of badUris) {
|
|
334
366
|
it(`degrades to an error display when it ${what}`, async () => {
|
|
335
367
|
render(
|
|
336
|
-
<
|
|
368
|
+
<ReportEditor resourceUri={resourceUri} dashboard="overview" />,
|
|
337
369
|
{ wrapper: serverWrapper },
|
|
338
370
|
);
|
|
339
371
|
|
|
340
372
|
expect(
|
|
341
373
|
await screen.findByText(
|
|
342
|
-
/A
|
|
374
|
+
/A report resource URI must name an environment and a package/,
|
|
343
375
|
),
|
|
344
376
|
).toBeDefined();
|
|
345
377
|
});
|