@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
|
@@ -12,28 +12,34 @@ import {
|
|
|
12
12
|
import { useEffect, useMemo, useState } from "react";
|
|
13
13
|
import {
|
|
14
14
|
createDocument,
|
|
15
|
-
|
|
15
|
+
reportPathForTitle,
|
|
16
16
|
MAX_SLUG_ATTEMPTS,
|
|
17
17
|
newDocumentProblem,
|
|
18
|
+
reportPathProblem,
|
|
18
19
|
useDocumentChoices,
|
|
19
20
|
type CreatedDocument,
|
|
20
21
|
type CreateTarget,
|
|
21
|
-
type DocumentCreatedEvent,
|
|
22
22
|
} from "../DocumentCreate";
|
|
23
|
+
import type { ReportEventHandler } from "../Report/telemetry";
|
|
23
24
|
import { canRetryRequest } from "../DocumentCreate/canRetry";
|
|
24
|
-
import type { DocumentType } from "../DocumentStorage/DocumentStorage";
|
|
25
25
|
import { AppDialog } from "../AppDialog";
|
|
26
|
+
import { layoutOfKind, type DocumentKind } from "../legacy/kindAdapter";
|
|
27
|
+
import type { ReportLayout } from "./documentLocation";
|
|
26
28
|
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
const LAYOUT_LABEL: Record<ReportLayout, string> = {
|
|
30
|
+
linear: "Linear: read top to bottom",
|
|
31
|
+
grid: "Grid: tiles side by side",
|
|
30
32
|
};
|
|
31
33
|
|
|
32
34
|
export interface NewDocumentDialogProps {
|
|
33
35
|
open: boolean;
|
|
34
|
-
/** Which
|
|
35
|
-
|
|
36
|
-
/**
|
|
36
|
+
/** Which layout the dialog opens on. Default linear. */
|
|
37
|
+
layout?: ReportLayout;
|
|
38
|
+
/** @deprecated Pass `layout`: `dashboard` is grid, `notebook` linear. */
|
|
39
|
+
kind?: DocumentKind;
|
|
40
|
+
/** Whether the reader may switch the layout. Default true. */
|
|
41
|
+
allowLayoutChange?: boolean;
|
|
42
|
+
/** @deprecated Pass `allowLayoutChange`. */
|
|
37
43
|
allowKindChange?: boolean;
|
|
38
44
|
environmentName: string;
|
|
39
45
|
packageName: string;
|
|
@@ -52,18 +58,23 @@ export interface NewDocumentDialogProps {
|
|
|
52
58
|
savedAs?: string;
|
|
53
59
|
onClose: () => void;
|
|
54
60
|
onCreated: (created: CreatedDocument) => void;
|
|
55
|
-
|
|
61
|
+
/** `report.created` or `report.create_refused`; see `ReportEvent`. */
|
|
62
|
+
onEvent?: ReportEventHandler;
|
|
56
63
|
}
|
|
57
64
|
|
|
58
65
|
/**
|
|
59
|
-
* A new
|
|
60
|
-
*
|
|
61
|
-
*
|
|
66
|
+
* A new report: pick the model, the view its first query tile shows, a title
|
|
67
|
+
* and a layout. The file is written as `<slug>.malloy` at the package root, or
|
|
68
|
+
* at the location the author types instead. It is the file the builder would
|
|
69
|
+
* write, so everything after this is the builder's; the host opens it from
|
|
70
|
+
* `onCreated`.
|
|
62
71
|
*/
|
|
63
72
|
export function NewDocumentDialog({
|
|
64
73
|
open,
|
|
65
|
-
|
|
66
|
-
|
|
74
|
+
layout: layoutProp,
|
|
75
|
+
kind: kindProp,
|
|
76
|
+
allowLayoutChange,
|
|
77
|
+
allowKindChange,
|
|
67
78
|
environmentName,
|
|
68
79
|
packageName,
|
|
69
80
|
versionId,
|
|
@@ -77,7 +88,12 @@ export function NewDocumentDialog({
|
|
|
77
88
|
onCreated,
|
|
78
89
|
onEvent,
|
|
79
90
|
}: NewDocumentDialogProps) {
|
|
80
|
-
const
|
|
91
|
+
const initialLayout: ReportLayout =
|
|
92
|
+
layoutProp ?? (kindProp ? layoutOfKind(kindProp) : "linear");
|
|
93
|
+
const canChangeLayout = allowLayoutChange ?? allowKindChange ?? true;
|
|
94
|
+
const [layout, setLayout] = useState<ReportLayout>(initialLayout);
|
|
95
|
+
/** The location as typed; undefined until the author edits it, and the title then names the file. */
|
|
96
|
+
const [location, setLocation] = useState<string | undefined>(undefined);
|
|
81
97
|
const [modelPath, setModelPath] = useState("");
|
|
82
98
|
/** The chosen view, as `source::view` — one value, so the pair is always valid. */
|
|
83
99
|
const [tile, setTile] = useState("");
|
|
@@ -107,8 +123,8 @@ export function NewDocumentDialog({
|
|
|
107
123
|
const chosen = tiles.find((t) => `${t.source}::${t.view}` === tile);
|
|
108
124
|
|
|
109
125
|
useEffect(() => {
|
|
110
|
-
if (open)
|
|
111
|
-
}, [open,
|
|
126
|
+
if (open) setLayout(initialLayout);
|
|
127
|
+
}, [open, initialLayout]);
|
|
112
128
|
|
|
113
129
|
// Everything with one answer answers itself: a package with one usable
|
|
114
130
|
// model, a model with one view, and a title taken from that view.
|
|
@@ -136,24 +152,41 @@ export function NewDocumentDialog({
|
|
|
136
152
|
setTile("");
|
|
137
153
|
setTitle("");
|
|
138
154
|
setTouchedTitle(false);
|
|
155
|
+
setLocation(undefined);
|
|
139
156
|
setAttempted(false);
|
|
140
157
|
setFailure(undefined);
|
|
141
158
|
}, [open]);
|
|
142
159
|
|
|
143
|
-
// The first name the package listing leaves free; the storage
|
|
144
|
-
// each name against the store itself when it writes.
|
|
145
|
-
const
|
|
160
|
+
// The first name at the package root the listing leaves free; the storage
|
|
161
|
+
// route checks each name against the store itself when it writes.
|
|
162
|
+
const suggested = useMemo(() => {
|
|
146
163
|
if (title.trim() === "") return undefined;
|
|
147
164
|
for (let n = 1; n <= MAX_SLUG_ATTEMPTS; n++) {
|
|
148
|
-
const candidate =
|
|
165
|
+
const candidate = reportPathForTitle(title, n);
|
|
149
166
|
if (!target.existing?.includes(candidate)) return candidate;
|
|
150
167
|
}
|
|
151
168
|
return undefined;
|
|
152
|
-
}, [
|
|
169
|
+
}, [title, target]);
|
|
170
|
+
const typed = location?.trim();
|
|
171
|
+
// A typed location is taken as written, `.malloy` added when it is left off.
|
|
172
|
+
const typedPath =
|
|
173
|
+
typed === undefined || typed === ""
|
|
174
|
+
? undefined
|
|
175
|
+
: typed.endsWith(".malloy")
|
|
176
|
+
? typed
|
|
177
|
+
: `${typed}.malloy`;
|
|
178
|
+
const path = typedPath ?? suggested;
|
|
179
|
+
const locationProblem =
|
|
180
|
+
typedPath === undefined
|
|
181
|
+
? undefined
|
|
182
|
+
: (reportPathProblem(typedPath) ??
|
|
183
|
+
(target.existing?.includes(typedPath)
|
|
184
|
+
? `${typedPath} already exists; choose another location.`
|
|
185
|
+
: undefined));
|
|
153
186
|
const problem =
|
|
154
187
|
chosen === undefined
|
|
155
188
|
? undefined
|
|
156
|
-
: newDocumentProblem(
|
|
189
|
+
: newDocumentProblem({
|
|
157
190
|
title,
|
|
158
191
|
modelPath,
|
|
159
192
|
source: chosen.source,
|
|
@@ -180,14 +213,14 @@ export function NewDocumentDialog({
|
|
|
180
213
|
: chosen === undefined
|
|
181
214
|
? "Pick a view to start from"
|
|
182
215
|
: undefined;
|
|
183
|
-
const label =
|
|
216
|
+
const label = "report";
|
|
184
217
|
const createLabel = busy ? `Creating ${label}…` : `Create ${label}`;
|
|
185
|
-
const first =
|
|
218
|
+
const first = "First query";
|
|
186
219
|
const picked = tile !== "" && chosen === undefined && tiles.length > 0;
|
|
187
220
|
|
|
188
221
|
const create = async () => {
|
|
189
222
|
if (blocked !== undefined || chosen === undefined || busy) return;
|
|
190
|
-
if (titleProblem !== undefined) {
|
|
223
|
+
if (titleProblem !== undefined || locationProblem !== undefined) {
|
|
191
224
|
setAttempted(true);
|
|
192
225
|
return;
|
|
193
226
|
}
|
|
@@ -195,7 +228,8 @@ export function NewDocumentDialog({
|
|
|
195
228
|
setFailure(undefined);
|
|
196
229
|
try {
|
|
197
230
|
const created = await createDocument({
|
|
198
|
-
|
|
231
|
+
layout,
|
|
232
|
+
...(typedPath !== undefined ? { path: typedPath } : {}),
|
|
199
233
|
document: {
|
|
200
234
|
title,
|
|
201
235
|
modelPath,
|
|
@@ -230,11 +264,7 @@ export function NewDocumentDialog({
|
|
|
230
264
|
// A write in flight is not abandoned by Escape or a backdrop click.
|
|
231
265
|
onClose={busy ? () => {} : onClose}
|
|
232
266
|
title={`New ${label}`}
|
|
233
|
-
description=
|
|
234
|
-
kind === "dashboard"
|
|
235
|
-
? "A dashboard is a Malloy file in the package. Pick what its first tile shows; the rest is the builder."
|
|
236
|
-
: "A notebook is a Malloy file in the package that mixes text and queries. Pick what its first query runs; the rest is the builder."
|
|
237
|
-
}
|
|
267
|
+
description="A report is a Malloy file in the package that lays out text and queries, as a grid or top to bottom. Pick what its first query shows; the rest is the builder."
|
|
238
268
|
actions={
|
|
239
269
|
<>
|
|
240
270
|
<Button onClick={onClose} disabled={busy}>
|
|
@@ -300,21 +330,22 @@ export function NewDocumentDialog({
|
|
|
300
330
|
</Alert>
|
|
301
331
|
)
|
|
302
332
|
)}
|
|
303
|
-
{
|
|
333
|
+
{canChangeLayout && (
|
|
304
334
|
<TextField
|
|
305
335
|
select
|
|
306
336
|
size="small"
|
|
307
|
-
label="
|
|
308
|
-
value={
|
|
337
|
+
label="Layout"
|
|
338
|
+
value={layout}
|
|
309
339
|
disabled={busy}
|
|
310
340
|
onChange={(event) =>
|
|
311
|
-
|
|
341
|
+
setLayout(event.target.value as ReportLayout)
|
|
312
342
|
}
|
|
313
|
-
inputProps={{ "aria-label": "
|
|
343
|
+
inputProps={{ "aria-label": "Layout" }}
|
|
344
|
+
helperText="Switch it any time in the builder."
|
|
314
345
|
>
|
|
315
|
-
{(
|
|
316
|
-
<MenuItem key={
|
|
317
|
-
{
|
|
346
|
+
{(["linear", "grid"] as const).map((l) => (
|
|
347
|
+
<MenuItem key={l} value={l}>
|
|
348
|
+
{LAYOUT_LABEL[l]}
|
|
318
349
|
</MenuItem>
|
|
319
350
|
))}
|
|
320
351
|
</TextField>
|
|
@@ -381,17 +412,31 @@ export function NewDocumentDialog({
|
|
|
381
412
|
setTouchedTitle(true);
|
|
382
413
|
setTitle(event.target.value);
|
|
383
414
|
}}
|
|
384
|
-
inputProps={{ "aria-label":
|
|
415
|
+
inputProps={{ "aria-label": "Report title" }}
|
|
385
416
|
error={showTitleProblem}
|
|
386
417
|
helperText={
|
|
387
418
|
showTitleProblem
|
|
388
419
|
? titleProblem
|
|
389
|
-
:
|
|
390
|
-
?
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
420
|
+
: target.route === "package"
|
|
421
|
+
? "Names the file too, unless you type a location."
|
|
422
|
+
: (savedAs ??
|
|
423
|
+
`Saved as a new ${label} in the host's store, and opened in the builder.`)
|
|
424
|
+
}
|
|
425
|
+
/>
|
|
426
|
+
<TextField
|
|
427
|
+
size="small"
|
|
428
|
+
label="Location"
|
|
429
|
+
value={location ?? suggested ?? ""}
|
|
430
|
+
placeholder="report.malloy"
|
|
431
|
+
disabled={busy}
|
|
432
|
+
onChange={(event) => setLocation(event.target.value)}
|
|
433
|
+
inputProps={{ "aria-label": "Location" }}
|
|
434
|
+
error={locationProblem !== undefined}
|
|
435
|
+
helperText={
|
|
436
|
+
locationProblem ??
|
|
437
|
+
(path
|
|
438
|
+
? `Written as ${path} in the package, and opened in the builder.`
|
|
439
|
+
: "A path in the package; the package root by default.")
|
|
395
440
|
}
|
|
396
441
|
/>
|
|
397
442
|
{failure && <Alert severity="error">{failure}</Alert>}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// Copyright (c) Credible Data Inc.
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
|
|
4
|
-
/** The package page's one
|
|
4
|
+
/** The package page's one Reports list: both layouts, named by one rule, opened by path. */
|
|
5
5
|
import { cleanup, fireEvent, render, screen } from "@testing-library/react";
|
|
6
|
-
import { afterEach, beforeEach, expect, it, mock } from "bun:test";
|
|
6
|
+
import { afterEach, beforeEach, describe, expect, it, mock } from "bun:test";
|
|
7
7
|
import type { ReactNode } from "react";
|
|
8
8
|
import {
|
|
9
9
|
clearCache,
|
|
@@ -17,23 +17,18 @@ import type {
|
|
|
17
17
|
} from "../DocumentStorage/DocumentStorage";
|
|
18
18
|
import { DocumentStorageProvider } from "../DocumentStorage/DocumentStorageProvider";
|
|
19
19
|
|
|
20
|
-
let
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
Promise.resolve({ data: dashboards }),
|
|
24
|
-
);
|
|
25
|
-
const listNotebooks = mock((_e: string, _p: string, _v?: string) =>
|
|
26
|
-
Promise.resolve({ data: notebooks }),
|
|
20
|
+
let reports: { path: string; layout: string; title?: string }[] = [];
|
|
21
|
+
const listReports = mock((_e: string, _p: string, _v?: string) =>
|
|
22
|
+
Promise.resolve({ data: reports }),
|
|
27
23
|
);
|
|
28
24
|
|
|
29
25
|
mockServerProvider(
|
|
30
26
|
{
|
|
31
27
|
packages: { getPackage: pending },
|
|
32
|
-
|
|
28
|
+
reports: { listReports, getReport: pending },
|
|
33
29
|
models: { listModels: () => Promise.resolve({ data: [] }) },
|
|
34
30
|
databases: { listDatabases: () => Promise.resolve({ data: [] }) },
|
|
35
31
|
dataApps: { listDataApps: () => Promise.resolve({ data: [] }) },
|
|
36
|
-
dashboards: { listDashboards },
|
|
37
32
|
materializations: {
|
|
38
33
|
listMaterializations: () => Promise.resolve({ data: [] }),
|
|
39
34
|
},
|
|
@@ -65,52 +60,53 @@ function mount(storage?: DocumentStorage) {
|
|
|
65
60
|
);
|
|
66
61
|
}
|
|
67
62
|
|
|
68
|
-
/** The
|
|
63
|
+
/** The report rows' text, top to bottom. */
|
|
69
64
|
const rows = async () => {
|
|
70
|
-
await screen.findByRole("heading", { name: "
|
|
71
|
-
const section = screen.getByRole("region", { name: "
|
|
65
|
+
await screen.findByRole("heading", { name: "Reports" });
|
|
66
|
+
const section = screen.getByRole("region", { name: "Reports" });
|
|
72
67
|
return Array.from(section.querySelectorAll('[role="button"]'))
|
|
73
68
|
.map((row) => row.textContent ?? "")
|
|
74
|
-
.filter((text) => text !== "New");
|
|
69
|
+
.filter((text) => text !== "New report");
|
|
75
70
|
};
|
|
76
71
|
|
|
77
72
|
beforeEach(() => {
|
|
78
73
|
clearCache();
|
|
79
|
-
|
|
80
|
-
notebooks = [];
|
|
74
|
+
reports = [];
|
|
81
75
|
onClick.mockClear();
|
|
82
|
-
|
|
83
|
-
listNotebooks.mockClear();
|
|
76
|
+
listReports.mockClear();
|
|
84
77
|
});
|
|
85
78
|
afterEach(cleanup);
|
|
86
79
|
|
|
87
|
-
it("lists
|
|
88
|
-
|
|
89
|
-
{
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
{ path: "notebooks/tour.malloy", title: "Aardvark" },
|
|
93
|
-
{ path: "notebooks/plain.malloy", title: "notebooks/plain.malloy" },
|
|
80
|
+
it("lists both layouts in one section, each marked with its layout, ordered by what is shown", async () => {
|
|
81
|
+
reports = [
|
|
82
|
+
{ path: "overview.malloy", layout: "grid", title: "Zebra" },
|
|
83
|
+
{ path: "tour.malloy", layout: "linear", title: "Aardvark" },
|
|
84
|
+
{ path: "plain.malloy", layout: "linear", title: "plain.malloy" },
|
|
94
85
|
];
|
|
95
86
|
mount();
|
|
96
87
|
|
|
97
|
-
expect(await rows()).toEqual([
|
|
88
|
+
expect(await rows()).toEqual([
|
|
89
|
+
"Aardvarktour.malloylinear",
|
|
90
|
+
"plainlinear",
|
|
91
|
+
"Zebraoverview.malloygrid",
|
|
92
|
+
]);
|
|
98
93
|
expect(screen.queryByRole("heading", { name: "Dashboards" })).toBeNull();
|
|
99
94
|
expect(screen.queryByRole("heading", { name: "Notebooks" })).toBeNull();
|
|
95
|
+
expect(screen.queryByRole("heading", { name: "Artifacts" })).toBeNull();
|
|
100
96
|
});
|
|
101
97
|
|
|
102
|
-
it("shows the
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
{ path: "notebooks/story.malloy" },
|
|
106
|
-
{ path: "
|
|
98
|
+
it("shows the path when two reports share a basename, and opens each by its own path", async () => {
|
|
99
|
+
reports = [
|
|
100
|
+
{ path: "dashboards/story.malloy", layout: "grid" },
|
|
101
|
+
{ path: "notebooks/story.malloy", layout: "linear" },
|
|
102
|
+
{ path: "solo.malloy", layout: "linear" },
|
|
107
103
|
];
|
|
108
104
|
mount();
|
|
109
105
|
|
|
110
106
|
expect(await rows()).toEqual([
|
|
111
|
-
"
|
|
112
|
-
"story" + "dashboards/story.malloy",
|
|
113
|
-
"story" + "notebooks/story.malloy",
|
|
107
|
+
"sololinear",
|
|
108
|
+
"story" + "dashboards/story.malloy" + "grid",
|
|
109
|
+
"story" + "notebooks/story.malloy" + "linear",
|
|
114
110
|
]);
|
|
115
111
|
fireEvent.click(screen.getByText("dashboards/story.malloy"));
|
|
116
112
|
fireEvent.click(screen.getByText("notebooks/story.malloy"));
|
|
@@ -120,53 +116,75 @@ it("shows the folder only to tell two files with one slug apart, and opens each
|
|
|
120
116
|
]);
|
|
121
117
|
});
|
|
122
118
|
|
|
123
|
-
it("
|
|
124
|
-
|
|
119
|
+
it("opens a nested report at its path route, encoded segment by segment", async () => {
|
|
120
|
+
reports = [{ path: "sales/q 3.malloy", layout: "grid" }];
|
|
125
121
|
mount();
|
|
126
122
|
|
|
127
|
-
|
|
123
|
+
fireEvent.click(await screen.findByText("sales/q 3.malloy"));
|
|
124
|
+
expect(onClick.mock.calls[0][0]).toBe("/env/pkg/sales/q%203");
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
// DEPRECATED FEATURE COVERAGE — delete together with
|
|
128
|
+
// `.malloynb` notebooks (see RELEASE_NOTES deprecations).
|
|
129
|
+
describe("deprecated: .malloynb notebooks", () => {
|
|
130
|
+
it("keeps a titled .malloynb's path as its secondary text", async () => {
|
|
131
|
+
reports = [
|
|
132
|
+
{ path: "orders.malloynb", layout: "linear", title: "Orders" },
|
|
133
|
+
];
|
|
134
|
+
mount();
|
|
135
|
+
|
|
136
|
+
expect(await rows()).toEqual(["Ordersorders.malloynblinear"]);
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
it("names an untitled .malloynb by its file, extension included, with no secondary text", async () => {
|
|
140
|
+
reports = [{ path: "orders.malloynb", layout: "linear" }];
|
|
141
|
+
mount();
|
|
142
|
+
|
|
143
|
+
expect(await rows()).toEqual(["orders.malloynblinear"]);
|
|
144
|
+
});
|
|
128
145
|
});
|
|
129
146
|
|
|
130
|
-
it("says so when
|
|
131
|
-
|
|
132
|
-
listNotebooks.mockImplementationOnce(() =>
|
|
147
|
+
it("says so when the listing fails", async () => {
|
|
148
|
+
listReports.mockImplementationOnce(() =>
|
|
133
149
|
Promise.reject({ response: { status: 501 } }),
|
|
134
150
|
);
|
|
135
151
|
mount();
|
|
136
152
|
|
|
137
153
|
expect(
|
|
138
|
-
await screen.findByText(/Could not list
|
|
154
|
+
await screen.findByText(/Could not list this package's reports/),
|
|
139
155
|
).toBeDefined();
|
|
140
|
-
expect(await rows()).toEqual(["overview"]);
|
|
141
156
|
});
|
|
142
157
|
|
|
143
|
-
it("treats a 404 on the
|
|
144
|
-
|
|
145
|
-
listNotebooks.mockImplementationOnce(() =>
|
|
158
|
+
it("treats a 404 on the reports list as none, without an error", async () => {
|
|
159
|
+
listReports.mockImplementationOnce(() =>
|
|
146
160
|
Promise.reject({ response: { status: 404 } }),
|
|
147
161
|
);
|
|
148
162
|
mount();
|
|
149
163
|
|
|
150
|
-
expect(await rows()).toEqual([
|
|
164
|
+
expect(await rows()).toEqual([]);
|
|
151
165
|
expect(screen.queryByText(/Could not list/)).toBeNull();
|
|
152
166
|
});
|
|
153
167
|
|
|
154
|
-
it("lists host drafts
|
|
155
|
-
const draft = (
|
|
156
|
-
type: "dashboard" | "notebook",
|
|
157
|
-
slug: string,
|
|
158
|
-
): DocumentLocator => ({
|
|
168
|
+
it("lists host drafts by path whatever layout they record, each opening its editor", async () => {
|
|
169
|
+
const draft = (type: "grid" | "linear", path: string): DocumentLocator => ({
|
|
159
170
|
workspace: "browser",
|
|
160
171
|
type,
|
|
161
|
-
path: `env/pkg/${
|
|
172
|
+
path: `env/pkg/${path}`,
|
|
162
173
|
});
|
|
163
|
-
const stored = [
|
|
174
|
+
const stored = [
|
|
175
|
+
draft("grid", "d-one.malloy"),
|
|
176
|
+
draft("linear", "team/n-one.malloy"),
|
|
177
|
+
// Another package's draft is not this one's.
|
|
178
|
+
{ workspace: "browser", type: "grid", path: "env/other/x.malloy" },
|
|
179
|
+
] as DocumentLocator[];
|
|
164
180
|
const storage: DocumentStorage = {
|
|
165
181
|
listWorkspaces: async () => [
|
|
166
182
|
{ name: "browser", writeable: true, description: "This browser" },
|
|
167
183
|
],
|
|
168
184
|
listDocuments: async (_workspace, type) =>
|
|
169
|
-
stored.filter(
|
|
185
|
+
stored.filter(
|
|
186
|
+
(locator) => type === undefined || locator.type === type,
|
|
187
|
+
),
|
|
170
188
|
getDocument: async () => {
|
|
171
189
|
throw new Error("absent");
|
|
172
190
|
},
|
|
@@ -174,13 +192,14 @@ it("lists host drafts of both kinds, each opening its own editor", async () => {
|
|
|
174
192
|
deleteDocument: async () => {},
|
|
175
193
|
moveDocument: async () => {},
|
|
176
194
|
};
|
|
177
|
-
|
|
195
|
+
reports = [{ path: "overview.malloy", layout: "grid" }];
|
|
178
196
|
mount(storage);
|
|
179
197
|
|
|
180
|
-
fireEvent.click(await screen.findByText("d-one"));
|
|
181
|
-
fireEvent.click(await screen.findByText("n-one"));
|
|
198
|
+
fireEvent.click(await screen.findByText("d-one.malloy"));
|
|
199
|
+
fireEvent.click(await screen.findByText("team/n-one.malloy"));
|
|
200
|
+
expect(screen.queryByText("x.malloy")).toBeNull();
|
|
182
201
|
expect(onClick.mock.calls.map((call) => call[0])).toEqual([
|
|
183
|
-
"/env/pkg/
|
|
184
|
-
"/env/pkg/
|
|
202
|
+
"/env/pkg/d-one?edit",
|
|
203
|
+
"/env/pkg/team/n-one?edit",
|
|
185
204
|
]);
|
|
186
205
|
});
|