@malloy-publisher/sdk 0.9.7 → 0.9.9
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-CkUS04tl.es.js → RenderedResult-BHuJpdSn.es.js} +2 -2
- package/dist/{RenderedResult-qnpbr4tc.cjs.js → RenderedResult-Bw7EQc42.cjs.js} +1 -1
- package/dist/ServerProvider-B0dUY8be.cjs.js +1 -0
- package/dist/{ServerProvider-DnLLeXEX.es.js → ServerProvider-CQy4jVYK.es.js} +1602 -1074
- 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 +893 -104
- package/dist/client/index.cjs.js +1 -1
- package/dist/client/index.es.js +125 -104
- 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/ContentTypeIcon.d.ts +3 -3
- 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 +8216 -7635
- 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-Bf72Ob5v.es.js → useCompiledDocument-1dgF5CC9.es.js} +4593 -4395
- package/dist/useCompiledDocument-BKyRnXmA.cjs.js +141 -0
- 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/ContentTypeIcon.tsx +16 -3
- 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.agents.spec.tsx +76 -0
- 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 +217 -293
- 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
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Creating a
|
|
6
|
-
*
|
|
5
|
+
* Creating a report from the package page: who is offered it, where the file
|
|
6
|
+
* goes (the package root, whatever the layout), where the reader lands, and
|
|
7
|
+
* what is fetched for it.
|
|
7
8
|
*/
|
|
8
9
|
import {
|
|
9
10
|
cleanup,
|
|
@@ -31,25 +32,31 @@ import type { OpenDocumentRequest } from "./Package";
|
|
|
31
32
|
|
|
32
33
|
const listModels = mock((_env: string, _pkg: string, _version?: string) =>
|
|
33
34
|
Promise.resolve({
|
|
34
|
-
data: [
|
|
35
|
+
data: [
|
|
36
|
+
{ path: "storefront.malloy" },
|
|
37
|
+
{ path: "old.malloy" },
|
|
38
|
+
// A model in a directory named like the old folders is still a model.
|
|
39
|
+
{ path: "dashboards/shared.malloy" },
|
|
40
|
+
],
|
|
35
41
|
}),
|
|
36
42
|
);
|
|
37
|
-
const
|
|
43
|
+
const listReports = mock((_env: string, _pkg: string, _version?: string) =>
|
|
38
44
|
Promise.resolve({
|
|
39
|
-
data: [{ name: "old", path: "
|
|
45
|
+
data: [{ name: "old", path: "old.malloy", layout: "grid" }],
|
|
40
46
|
}),
|
|
41
47
|
);
|
|
42
|
-
const
|
|
43
|
-
Promise.resolve({ data: [] }),
|
|
44
|
-
);
|
|
45
|
-
const getModel = mock((_env: string, _pkg: string, _path: string) =>
|
|
48
|
+
const getModel = mock((_env: string, _pkg: string, path: string) =>
|
|
46
49
|
Promise.resolve({
|
|
47
50
|
data: {
|
|
48
|
-
modelPath:
|
|
51
|
+
modelPath: path,
|
|
49
52
|
modelInfo: JSON.stringify({
|
|
50
53
|
entries: [{ kind: "source", name: "order_items" }],
|
|
51
54
|
}),
|
|
52
|
-
|
|
55
|
+
// Only the model the tests start from offers a view.
|
|
56
|
+
sources:
|
|
57
|
+
path === "storefront.malloy"
|
|
58
|
+
? [{ name: "order_items", views: [{ name: "by_category" }] }]
|
|
59
|
+
: [],
|
|
53
60
|
},
|
|
54
61
|
}),
|
|
55
62
|
);
|
|
@@ -62,11 +69,10 @@ const context: Record<string, unknown> = { mutable: true };
|
|
|
62
69
|
mockServerProvider(
|
|
63
70
|
{
|
|
64
71
|
packages: { getPackage: pending },
|
|
65
|
-
|
|
72
|
+
reports: { listReports, getReport: pending },
|
|
66
73
|
models: { listModels, getModel, updateModelSource },
|
|
67
74
|
databases: { listDatabases: () => Promise.resolve({ data: [] }) },
|
|
68
75
|
dataApps: { listDataApps: () => Promise.resolve({ data: [] }) },
|
|
69
|
-
dashboards: { listDashboards },
|
|
70
76
|
materializations: {
|
|
71
77
|
listMaterializations: () => Promise.resolve({ data: [] }),
|
|
72
78
|
},
|
|
@@ -135,14 +141,14 @@ function mount(
|
|
|
135
141
|
}
|
|
136
142
|
|
|
137
143
|
const settled = () => screen.findByText("old");
|
|
144
|
+
const NEW = { name: "New report" } as const;
|
|
138
145
|
|
|
139
146
|
beforeEach(() => {
|
|
140
147
|
clearCache();
|
|
141
148
|
context.mutable = true;
|
|
142
149
|
for (const fn of [
|
|
143
150
|
listModels,
|
|
144
|
-
|
|
145
|
-
listNotebooks,
|
|
151
|
+
listReports,
|
|
146
152
|
getModel,
|
|
147
153
|
updateModelSource,
|
|
148
154
|
onClickPackageFile,
|
|
@@ -151,67 +157,53 @@ beforeEach(() => {
|
|
|
151
157
|
});
|
|
152
158
|
|
|
153
159
|
describe("who is offered New", () => {
|
|
154
|
-
it("a writable package with no host storage", async () => {
|
|
160
|
+
it("a writable package with no host storage, as one New report action", async () => {
|
|
155
161
|
mount();
|
|
156
162
|
await settled();
|
|
157
|
-
expect(screen.
|
|
158
|
-
// One create entry,
|
|
159
|
-
expect(
|
|
160
|
-
|
|
161
|
-
).toBeNull();
|
|
162
|
-
expect(screen.queryByRole("button", { name: "Add notebook" })).toBeNull();
|
|
163
|
+
expect(screen.getAllByRole("button", NEW)).toHaveLength(1);
|
|
164
|
+
// One create entry, and no per-kind menu.
|
|
165
|
+
expect(screen.queryByRole("button", { name: "New" })).toBeNull();
|
|
166
|
+
expect(screen.queryByRole("menuitem")).toBeNull();
|
|
163
167
|
});
|
|
164
168
|
|
|
165
169
|
it("no one when the server takes no writes and nothing authoritative keeps documents", async () => {
|
|
166
170
|
context.mutable = false;
|
|
167
171
|
mount();
|
|
168
172
|
await settled();
|
|
169
|
-
expect(screen.queryByRole("button",
|
|
170
|
-
expect(
|
|
171
|
-
screen.queryByRole("button", { name: "Add dashboard" }),
|
|
172
|
-
).toBeNull();
|
|
173
|
-
expect(screen.queryByRole("button", { name: "Add notebook" })).toBeNull();
|
|
173
|
+
expect(screen.queryByRole("button", NEW)).toBeNull();
|
|
174
174
|
});
|
|
175
175
|
|
|
176
176
|
it("not a browser workspace beside a server that takes no writes", async () => {
|
|
177
177
|
context.mutable = false;
|
|
178
178
|
mount(fakeStorage([BROWSER]).storage);
|
|
179
179
|
await settled();
|
|
180
|
-
await waitFor(() =>
|
|
181
|
-
expect(screen.queryByRole("button", { name: "New" })).toBeNull(),
|
|
182
|
-
);
|
|
183
|
-
expect(screen.queryByRole("button", { name: "Add notebook" })).toBeNull();
|
|
180
|
+
await waitFor(() => expect(screen.queryByRole("button", NEW)).toBeNull());
|
|
184
181
|
});
|
|
185
182
|
|
|
186
183
|
it("the Console's browser workspace beside a writable server, written to the package", async () => {
|
|
187
184
|
mount(fakeStorage([BROWSER]).storage);
|
|
188
185
|
await settled();
|
|
189
186
|
await waitFor(() =>
|
|
190
|
-
expect(screen.
|
|
187
|
+
expect(screen.getAllByRole("button", NEW)).toHaveLength(1),
|
|
191
188
|
);
|
|
192
189
|
});
|
|
193
190
|
|
|
194
|
-
it("an empty list's row offers New, and no one when New is not offered", async () => {
|
|
195
|
-
|
|
196
|
-
Promise.resolve({ data: [] }),
|
|
197
|
-
);
|
|
191
|
+
it("an empty list's row offers New report, and no one when New is not offered", async () => {
|
|
192
|
+
listReports.mockImplementationOnce(() => Promise.resolve({ data: [] }));
|
|
198
193
|
mount();
|
|
199
|
-
await screen.findByText("No
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
).toBeDefined();
|
|
194
|
+
await screen.findByText("No reports yet");
|
|
195
|
+
// The heading's action and the empty row's.
|
|
196
|
+
expect(screen.getAllByRole("button", NEW)).toHaveLength(2);
|
|
203
197
|
cleanup();
|
|
204
198
|
clearCache();
|
|
205
199
|
context.mutable = false;
|
|
206
|
-
|
|
207
|
-
Promise.resolve({ data: [] }),
|
|
208
|
-
);
|
|
200
|
+
listReports.mockImplementationOnce(() => Promise.resolve({ data: [] }));
|
|
209
201
|
mount();
|
|
210
202
|
await new Promise((resolve) => setTimeout(resolve, 20));
|
|
211
|
-
expect(screen.queryByRole("button",
|
|
203
|
+
expect(screen.queryByRole("button", NEW)).toBeNull();
|
|
212
204
|
});
|
|
213
205
|
|
|
214
|
-
it("no New
|
|
206
|
+
it("no New report below 600px, where the editors step aside", async () => {
|
|
215
207
|
const was = window.matchMedia;
|
|
216
208
|
window.matchMedia = ((query: string) => ({
|
|
217
209
|
matches: query.includes("max-width"),
|
|
@@ -227,17 +219,15 @@ describe("who is offered New", () => {
|
|
|
227
219
|
mount();
|
|
228
220
|
await settled();
|
|
229
221
|
await new Promise((resolve) => setTimeout(resolve, 20));
|
|
230
|
-
expect(screen.queryByRole("button",
|
|
222
|
+
expect(screen.queryByRole("button", NEW)).toBeNull();
|
|
231
223
|
cleanup();
|
|
232
224
|
clearCache();
|
|
233
|
-
|
|
225
|
+
listReports.mockImplementationOnce(() =>
|
|
234
226
|
Promise.resolve({ data: [] }),
|
|
235
227
|
);
|
|
236
228
|
mount();
|
|
237
|
-
await screen.findByText("No
|
|
238
|
-
expect(
|
|
239
|
-
screen.queryByRole("button", { name: "New artifact" }),
|
|
240
|
-
).toBeNull();
|
|
229
|
+
await screen.findByText("No reports yet");
|
|
230
|
+
expect(screen.queryByRole("button", NEW)).toBeNull();
|
|
241
231
|
} finally {
|
|
242
232
|
window.matchMedia = was;
|
|
243
233
|
}
|
|
@@ -248,68 +238,68 @@ describe("who is offered New", () => {
|
|
|
248
238
|
mount();
|
|
249
239
|
await settled();
|
|
250
240
|
await new Promise((resolve) => setTimeout(resolve, 20));
|
|
251
|
-
expect(screen.queryByRole("button",
|
|
241
|
+
expect(screen.queryByRole("button", NEW)).toBeNull();
|
|
252
242
|
});
|
|
253
243
|
|
|
254
244
|
it("nothing while the host's workspaces are still being listed, and nothing when they cannot be", async () => {
|
|
255
245
|
mount(fakeStorage(new Error("backend down")).storage);
|
|
256
246
|
await settled();
|
|
257
247
|
await new Promise((resolve) => setTimeout(resolve, 20));
|
|
258
|
-
expect(screen.queryByRole("button",
|
|
248
|
+
expect(screen.queryByRole("button", NEW)).toBeNull();
|
|
259
249
|
});
|
|
260
250
|
});
|
|
261
251
|
|
|
262
|
-
const openNew = async (
|
|
263
|
-
fireEvent.click(await screen.
|
|
264
|
-
fireEvent.click(await screen.findByRole("menuitem", { name: kind }));
|
|
252
|
+
const openNew = async (layout: "linear" | "grid" = "linear") => {
|
|
253
|
+
fireEvent.click((await screen.findAllByRole("button", NEW))[0]);
|
|
265
254
|
await waitFor(() =>
|
|
266
|
-
expect(screen.getByLabelText(
|
|
255
|
+
expect(screen.getByLabelText("Report title")).toHaveProperty(
|
|
267
256
|
"value",
|
|
268
257
|
"by category",
|
|
269
258
|
),
|
|
270
259
|
);
|
|
260
|
+
if (layout === "grid") {
|
|
261
|
+
fireEvent.mouseDown(screen.getByRole("combobox", { name: /Layout/ }));
|
|
262
|
+
fireEvent.click(screen.getByRole("option", { name: /^Grid/ }));
|
|
263
|
+
}
|
|
271
264
|
};
|
|
272
265
|
|
|
273
266
|
describe("creating", () => {
|
|
274
|
-
it("fetches nothing for the dialog until it is opened, then one model each", async () => {
|
|
267
|
+
it("fetches nothing for the dialog until it is opened, then one model each, never a report", async () => {
|
|
275
268
|
mount();
|
|
276
269
|
await settled();
|
|
277
270
|
expect(getModel).not.toHaveBeenCalled();
|
|
278
|
-
await openNew(
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
271
|
+
await openNew();
|
|
272
|
+
// The listed report is not a model to start from; a model in dashboards/ is.
|
|
273
|
+
expect(getModel.mock.calls.map((call) => call[2]).sort()).toEqual([
|
|
274
|
+
"dashboards/shared.malloy",
|
|
275
|
+
"storefront.malloy",
|
|
276
|
+
]);
|
|
282
277
|
});
|
|
283
278
|
|
|
284
|
-
it("opens the
|
|
285
|
-
|
|
286
|
-
Promise.resolve({ data: [] }),
|
|
287
|
-
);
|
|
279
|
+
it("opens the dialog from the empty row, on linear by default", async () => {
|
|
280
|
+
listReports.mockImplementationOnce(() => Promise.resolve({ data: [] }));
|
|
288
281
|
mount();
|
|
289
|
-
fireEvent.click(
|
|
290
|
-
await screen.findByRole("button", { name: "New artifact" }),
|
|
291
|
-
);
|
|
292
|
-
fireEvent.click(
|
|
293
|
-
await screen.findByRole("menuitem", { name: "Notebook" }),
|
|
294
|
-
);
|
|
282
|
+
fireEvent.click((await screen.findAllByRole("button", NEW))[1]);
|
|
295
283
|
await waitFor(() =>
|
|
296
|
-
expect(screen.getByLabelText("
|
|
284
|
+
expect(screen.getByLabelText("Report title")).toBeDefined(),
|
|
297
285
|
);
|
|
286
|
+
expect(
|
|
287
|
+
screen.getByRole("combobox", { name: /Layout/ }).textContent,
|
|
288
|
+
).toMatch(/^Linear/);
|
|
298
289
|
});
|
|
299
290
|
|
|
300
|
-
it("writes a
|
|
291
|
+
it("writes a linear report at the package root, refreshes the listings, and opens its editor", async () => {
|
|
301
292
|
mount();
|
|
302
293
|
await settled();
|
|
303
|
-
await openNew(
|
|
294
|
+
await openNew();
|
|
304
295
|
const before = {
|
|
305
|
-
|
|
306
|
-
notebooks: listNotebooks.mock.calls.length,
|
|
296
|
+
reports: listReports.mock.calls.length,
|
|
307
297
|
models: listModels.mock.calls.length,
|
|
308
298
|
};
|
|
309
|
-
fireEvent.click(screen.getByRole("button", { name: "Create
|
|
299
|
+
fireEvent.click(screen.getByRole("button", { name: "Create report" }));
|
|
310
300
|
await waitFor(() =>
|
|
311
301
|
expect(onClickPackageFile).toHaveBeenCalledWith(
|
|
312
|
-
"/env/pkg/
|
|
302
|
+
"/env/pkg/by-category?edit",
|
|
313
303
|
),
|
|
314
304
|
);
|
|
315
305
|
const [, , path, body] = updateModelSource.mock.calls[0] as unknown as [
|
|
@@ -318,26 +308,46 @@ describe("creating", () => {
|
|
|
318
308
|
string,
|
|
319
309
|
{ source: string },
|
|
320
310
|
];
|
|
321
|
-
expect(path).toBe("
|
|
322
|
-
expect(body.source).toContain(
|
|
323
|
-
|
|
324
|
-
);
|
|
311
|
+
expect(path).toBe("by-category.malloy");
|
|
312
|
+
expect(body.source).toContain("layout=linear");
|
|
313
|
+
expect(body.source).not.toContain("kind=notebook");
|
|
325
314
|
await waitFor(() => {
|
|
326
|
-
expect(
|
|
327
|
-
expect(listNotebooks).toHaveBeenCalledTimes(before.notebooks + 1);
|
|
315
|
+
expect(listReports).toHaveBeenCalledTimes(before.reports + 1);
|
|
328
316
|
expect(listModels).toHaveBeenCalledTimes(before.models + 1);
|
|
329
317
|
});
|
|
330
318
|
});
|
|
331
319
|
|
|
332
|
-
it("
|
|
320
|
+
it("writes a grid report at the package root too: the layout never picks a directory", async () => {
|
|
321
|
+
mount();
|
|
322
|
+
await settled();
|
|
323
|
+
await openNew("grid");
|
|
324
|
+
fireEvent.click(screen.getByRole("button", { name: "Create report" }));
|
|
325
|
+
await waitFor(() =>
|
|
326
|
+
expect(onClickPackageFile).toHaveBeenCalledWith(
|
|
327
|
+
"/env/pkg/by-category?edit",
|
|
328
|
+
),
|
|
329
|
+
);
|
|
330
|
+
const [, , path, body] = updateModelSource.mock.calls[0] as unknown as [
|
|
331
|
+
string,
|
|
332
|
+
string,
|
|
333
|
+
string,
|
|
334
|
+
{ source: string },
|
|
335
|
+
];
|
|
336
|
+
expect(path).toBe("by-category.malloy");
|
|
337
|
+
expect(body.source).toContain("layout=grid");
|
|
338
|
+
expect(body.source).toContain('from "storefront.malloy"');
|
|
339
|
+
});
|
|
340
|
+
|
|
341
|
+
it("hands the new report to the host's onOpenDocument by path, which owns the route", async () => {
|
|
333
342
|
const onOpenDocument = mock((_request: OpenDocumentRequest) => {});
|
|
334
343
|
mount(undefined, onOpenDocument);
|
|
335
344
|
await settled();
|
|
336
|
-
await openNew("
|
|
337
|
-
fireEvent.click(screen.getByRole("button", { name: "Create
|
|
345
|
+
await openNew("grid");
|
|
346
|
+
fireEvent.click(screen.getByRole("button", { name: "Create report" }));
|
|
338
347
|
await waitFor(() =>
|
|
339
348
|
expect(onOpenDocument).toHaveBeenCalledWith({
|
|
340
|
-
|
|
349
|
+
path: "by-category.malloy",
|
|
350
|
+
layout: "grid",
|
|
341
351
|
slug: "by-category",
|
|
342
352
|
mode: "edit",
|
|
343
353
|
}),
|
|
@@ -345,56 +355,60 @@ describe("creating", () => {
|
|
|
345
355
|
expect(onClickPackageFile).not.toHaveBeenCalled();
|
|
346
356
|
});
|
|
347
357
|
|
|
348
|
-
it("writes a
|
|
358
|
+
it("writes at a location the author types, with its import relative to it", async () => {
|
|
349
359
|
mount();
|
|
350
360
|
await settled();
|
|
351
|
-
await openNew(
|
|
352
|
-
fireEvent.
|
|
361
|
+
await openNew();
|
|
362
|
+
fireEvent.change(screen.getByLabelText("Location"), {
|
|
363
|
+
target: { value: "sales/q3" },
|
|
364
|
+
});
|
|
365
|
+
fireEvent.click(screen.getByRole("button", { name: "Create report" }));
|
|
353
366
|
await waitFor(() =>
|
|
354
367
|
expect(onClickPackageFile).toHaveBeenCalledWith(
|
|
355
|
-
"/env/pkg/
|
|
368
|
+
"/env/pkg/sales/q3?edit",
|
|
356
369
|
),
|
|
357
370
|
);
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
371
|
+
const [, , path, body] = updateModelSource.mock.calls[0] as unknown as [
|
|
372
|
+
string,
|
|
373
|
+
string,
|
|
374
|
+
string,
|
|
375
|
+
{ source: string },
|
|
376
|
+
];
|
|
377
|
+
expect(path).toBe("sales/q3.malloy");
|
|
378
|
+
expect(body.source).toContain('from "../storefront.malloy"');
|
|
361
379
|
});
|
|
362
380
|
|
|
363
|
-
it("a
|
|
381
|
+
it("a report that is already there is not written over", async () => {
|
|
364
382
|
mount();
|
|
365
383
|
await settled();
|
|
366
|
-
await openNew(
|
|
367
|
-
fireEvent.change(screen.getByLabelText("
|
|
384
|
+
await openNew();
|
|
385
|
+
fireEvent.change(screen.getByLabelText("Report title"), {
|
|
368
386
|
target: { value: "Old" },
|
|
369
387
|
});
|
|
370
|
-
fireEvent.click(screen.getByRole("button", { name: "Create
|
|
388
|
+
fireEvent.click(screen.getByRole("button", { name: "Create report" }));
|
|
371
389
|
await waitFor(() =>
|
|
372
|
-
expect(onClickPackageFile).toHaveBeenCalledWith(
|
|
373
|
-
"/env/pkg/dashboards/old-2/edit",
|
|
374
|
-
),
|
|
375
|
-
);
|
|
376
|
-
expect(updateModelSource.mock.calls[0][2]).toBe(
|
|
377
|
-
"dashboards/old-2.malloy",
|
|
390
|
+
expect(onClickPackageFile).toHaveBeenCalledWith("/env/pkg/old-2?edit"),
|
|
378
391
|
);
|
|
392
|
+
expect(updateModelSource.mock.calls[0][2]).toBe("old-2.malloy");
|
|
379
393
|
});
|
|
380
394
|
|
|
381
|
-
it("an authoritative host's
|
|
395
|
+
it("an authoritative host's report goes to its store, never the package", async () => {
|
|
382
396
|
const { storage, saved } = fakeStorage([BROWSER, RECORD]);
|
|
383
397
|
mount(storage);
|
|
384
398
|
await settled();
|
|
385
|
-
await openNew(
|
|
386
|
-
fireEvent.click(screen.getByRole("button", { name: "Create
|
|
399
|
+
await openNew();
|
|
400
|
+
fireEvent.click(screen.getByRole("button", { name: "Create report" }));
|
|
387
401
|
await waitFor(() =>
|
|
388
402
|
expect(onClickPackageFile).toHaveBeenCalledWith(
|
|
389
|
-
"/env/pkg/
|
|
403
|
+
"/env/pkg/by-category?edit",
|
|
390
404
|
),
|
|
391
405
|
);
|
|
392
406
|
expect(updateModelSource).not.toHaveBeenCalled();
|
|
393
407
|
expect(saved).toEqual([
|
|
394
408
|
{
|
|
395
409
|
workspace: "record",
|
|
396
|
-
type: "
|
|
397
|
-
path: "env/pkg/
|
|
410
|
+
type: "linear",
|
|
411
|
+
path: "env/pkg/by-category.malloy",
|
|
398
412
|
},
|
|
399
413
|
]);
|
|
400
414
|
});
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// Copyright (c) Credible Data Inc.
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
/** How the package page opens a report, and which one it pins as the README. */
|
|
5
|
+
import { beforeEach, describe, expect, it, mock } from "bun:test";
|
|
5
6
|
import { fireEvent, render, screen, waitFor } from "@testing-library/react";
|
|
6
7
|
import {
|
|
7
8
|
clearCache,
|
|
@@ -10,41 +11,39 @@ import {
|
|
|
10
11
|
serverWrapper,
|
|
11
12
|
} from "../../../test/serverProvider";
|
|
12
13
|
|
|
13
|
-
let listed: { path: string; title?: string }[] = [];
|
|
14
|
+
let listed: { path: string; layout?: string; title?: string }[] = [];
|
|
14
15
|
|
|
15
|
-
const
|
|
16
|
+
const getReport = mock(
|
|
16
17
|
(
|
|
17
18
|
_environmentName: string,
|
|
18
19
|
_packageName: string,
|
|
19
|
-
|
|
20
|
+
_path: string,
|
|
20
21
|
_versionId?: string,
|
|
21
22
|
) => pending(),
|
|
22
23
|
);
|
|
23
24
|
|
|
24
25
|
mockServerProvider({
|
|
25
26
|
packages: { getPackage: pending },
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
executeNotebookCell: pending,
|
|
27
|
+
reports: {
|
|
28
|
+
listReports: () => Promise.resolve({ data: listed }),
|
|
29
|
+
getReport,
|
|
30
30
|
},
|
|
31
31
|
models: { listModels: pending },
|
|
32
32
|
databases: { listDatabases: pending },
|
|
33
33
|
dataApps: { listDataApps: pending },
|
|
34
|
-
dashboards: { listDashboards: () => Promise.resolve({ data: [] }) },
|
|
35
34
|
});
|
|
36
35
|
|
|
37
36
|
const { default: Package } = await import("./Package");
|
|
38
37
|
|
|
39
38
|
beforeEach(() => {
|
|
40
39
|
clearCache();
|
|
41
|
-
|
|
40
|
+
getReport.mockClear();
|
|
42
41
|
});
|
|
43
42
|
|
|
44
|
-
it("
|
|
43
|
+
it("opens a report by its path, and a .malloynb by its file", async () => {
|
|
45
44
|
listed = [
|
|
46
|
-
{ path: "
|
|
47
|
-
{ path: "old.malloynb", title: "Old" },
|
|
45
|
+
{ path: "sales/tour.malloy", layout: "linear", title: "Tour" },
|
|
46
|
+
{ path: "old.malloynb", layout: "linear", title: "Old" },
|
|
48
47
|
];
|
|
49
48
|
const onClick = mock((_to: string) => {});
|
|
50
49
|
render(
|
|
@@ -59,13 +58,13 @@ it("links a served notebook by slug and a .malloynb by path", async () => {
|
|
|
59
58
|
fireEvent.click(await screen.findByText("Old"));
|
|
60
59
|
|
|
61
60
|
expect(onClick.mock.calls.map((call) => call[0])).toEqual([
|
|
62
|
-
"/env/pkg/
|
|
61
|
+
"/env/pkg/sales/tour",
|
|
63
62
|
"/env/pkg/old.malloynb",
|
|
64
63
|
]);
|
|
65
64
|
});
|
|
66
65
|
|
|
67
|
-
it("
|
|
68
|
-
listed = [{ path: "dashboards/story.malloy",
|
|
66
|
+
it("opens a report in dashboards/ by its path too: the directory means nothing", async () => {
|
|
67
|
+
listed = [{ path: "dashboards/story.malloy", layout: "linear" }];
|
|
69
68
|
const onClick = mock((_to: string) => {});
|
|
70
69
|
render(
|
|
71
70
|
<Package
|
|
@@ -75,34 +74,54 @@ it("links a notebook by its slug whichever folder holds it", async () => {
|
|
|
75
74
|
{ wrapper: serverWrapper },
|
|
76
75
|
);
|
|
77
76
|
|
|
78
|
-
fireEvent.click(await screen.findByText("
|
|
77
|
+
fireEvent.click(await screen.findByText("story"));
|
|
79
78
|
|
|
80
79
|
expect(onClick.mock.calls.map((call) => call[0])).toEqual([
|
|
81
|
-
"/env/pkg/
|
|
80
|
+
"/env/pkg/dashboards/story",
|
|
82
81
|
]);
|
|
83
82
|
});
|
|
84
83
|
|
|
85
|
-
it("pins
|
|
86
|
-
listed = [{ path: "
|
|
84
|
+
it("pins a root report named README to the front page, matching case-insensitively", async () => {
|
|
85
|
+
listed = [{ path: "Readme.malloy", layout: "linear" }];
|
|
87
86
|
render(<Package resourceUri="publisher://environments/env/packages/pkg" />, {
|
|
88
87
|
wrapper: serverWrapper,
|
|
89
88
|
});
|
|
90
89
|
|
|
91
|
-
await waitFor(() => expect(
|
|
92
|
-
expect(
|
|
90
|
+
await waitFor(() => expect(getReport).toHaveBeenCalled());
|
|
91
|
+
expect(getReport.mock.calls[0].slice(0, 4)).toEqual([
|
|
93
92
|
"env",
|
|
94
93
|
"pkg",
|
|
95
|
-
"
|
|
94
|
+
"Readme.malloy",
|
|
96
95
|
undefined,
|
|
97
96
|
]);
|
|
98
97
|
});
|
|
99
98
|
|
|
100
|
-
it("
|
|
101
|
-
listed = [{ path: "notebooks/README.malloy"
|
|
99
|
+
it("does not pin a README below the package root", async () => {
|
|
100
|
+
listed = [{ path: "notebooks/README.malloy", layout: "linear" }];
|
|
102
101
|
render(<Package resourceUri="publisher://environments/env/packages/pkg" />, {
|
|
103
102
|
wrapper: serverWrapper,
|
|
104
103
|
});
|
|
105
104
|
|
|
106
|
-
await
|
|
107
|
-
expect(
|
|
105
|
+
await screen.findByText("README");
|
|
106
|
+
expect(getReport).not.toHaveBeenCalled();
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
// DEPRECATED FEATURE COVERAGE — delete together with
|
|
110
|
+
// `.malloynb` notebooks (see RELEASE_NOTES deprecations).
|
|
111
|
+
describe("deprecated: .malloynb notebooks", () => {
|
|
112
|
+
it("pins the root README.malloynb over a root README.malloy when both exist", async () => {
|
|
113
|
+
listed = [
|
|
114
|
+
{ path: "README.malloy", layout: "linear" },
|
|
115
|
+
{ path: "README.malloynb", layout: "linear" },
|
|
116
|
+
];
|
|
117
|
+
render(
|
|
118
|
+
<Package resourceUri="publisher://environments/env/packages/pkg" />,
|
|
119
|
+
{
|
|
120
|
+
wrapper: serverWrapper,
|
|
121
|
+
},
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
await waitFor(() => expect(getReport).toHaveBeenCalled());
|
|
125
|
+
expect(getReport.mock.calls[0][2]).toBe("README.malloynb");
|
|
126
|
+
});
|
|
108
127
|
});
|