@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
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// Copyright (c) Credible Data Inc.
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
|
|
4
|
-
import ArrowDropDownIcon from "@mui/icons-material/ArrowDropDown";
|
|
5
4
|
import DeleteOutlineIcon from "@mui/icons-material/DeleteOutline";
|
|
6
5
|
import OpenInNewIcon from "@mui/icons-material/OpenInNew";
|
|
7
6
|
import {
|
|
@@ -10,14 +9,7 @@ import {
|
|
|
10
9
|
Button,
|
|
11
10
|
Container,
|
|
12
11
|
IconButton,
|
|
13
|
-
Menu,
|
|
14
|
-
MenuItem,
|
|
15
12
|
Stack,
|
|
16
|
-
Table,
|
|
17
|
-
TableBody,
|
|
18
|
-
TableCell,
|
|
19
|
-
TableHead,
|
|
20
|
-
TableRow,
|
|
21
13
|
Tooltip,
|
|
22
14
|
Typography,
|
|
23
15
|
} from "@mui/material";
|
|
@@ -28,49 +20,56 @@ import { useNarrowScreen } from "../../hooks/useNarrowScreen";
|
|
|
28
20
|
import { useQueryWithApiError } from "../../hooks/useQueryWithApiError";
|
|
29
21
|
import { ApiErrorDisplay } from "../ApiErrorDisplay";
|
|
30
22
|
import { Loading } from "../Loading";
|
|
31
|
-
import { chooseWorkspace } from "../
|
|
23
|
+
import { chooseWorkspace } from "../ReportBuilder/documentSession";
|
|
32
24
|
import { createRoute, type CreateTarget } from "../DocumentCreate";
|
|
33
25
|
import type {
|
|
34
26
|
DocumentLocator,
|
|
35
|
-
DocumentType,
|
|
36
27
|
Workspace,
|
|
37
28
|
} from "../DocumentStorage/DocumentStorage";
|
|
38
29
|
import { useOptionalDocumentStorage } from "../DocumentStorage/DocumentStorageProvider";
|
|
39
|
-
import {
|
|
30
|
+
import { Report } from "../Report";
|
|
40
31
|
import { useServer } from "../ServerProvider";
|
|
41
32
|
import { NewDocumentDialog } from "./NewDocumentDialog";
|
|
33
|
+
import type { ReportEventHandler } from "../Report/telemetry";
|
|
34
|
+
import { DataSchemaDialog, formatRowCount } from "./DataSchemaDialog";
|
|
42
35
|
import { encodeResourceUri, parseResourceUri } from "../../utils/formatting";
|
|
43
36
|
import { serverBaseUrl } from "../../utils/dataAppEmbed";
|
|
44
37
|
import ContentTypeIcon, {
|
|
45
38
|
CONTENT_TINT,
|
|
46
39
|
type ContentType,
|
|
47
40
|
} from "./ContentTypeIcon";
|
|
48
|
-
import { AppDialog } from "../AppDialog";
|
|
49
41
|
import { ItemRow } from "../ItemRow";
|
|
50
42
|
import { Materializations } from "../Materializations";
|
|
51
43
|
import { PackageSection } from "../PackageSection";
|
|
44
|
+
import { draftKey } from "../DocumentCreate/documentPath";
|
|
52
45
|
import {
|
|
53
|
-
documentRoute,
|
|
54
46
|
documentSlug,
|
|
55
|
-
|
|
47
|
+
listedLayout,
|
|
48
|
+
reportEditRoute,
|
|
49
|
+
reportRoute,
|
|
50
|
+
type ListedReport,
|
|
51
|
+
type ReportLayout,
|
|
56
52
|
} from "./documentLocation";
|
|
57
|
-
|
|
58
|
-
|
|
53
|
+
import { invalidateReportQueries } from "./reportQueries";
|
|
54
|
+
import { useReportListing } from "./useDocumentLocation";
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* The pinned README: a report at the package root whose basename is README,
|
|
58
|
+
* in any case. The legacy root `README.malloynb` wins when both exist, so a
|
|
59
|
+
* listing order never flips the pin.
|
|
60
|
+
*/
|
|
59
61
|
const README_NOTEBOOK = "README.malloynb";
|
|
60
|
-
const
|
|
61
|
-
path
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
environmentName: string,
|
|
65
|
-
packageName: string,
|
|
66
|
-
kind: DocumentType,
|
|
67
|
-
) => `${environmentName}/${packageName}/${kind}s/`;
|
|
62
|
+
const isRootReadme = (path: string | undefined) =>
|
|
63
|
+
!!path &&
|
|
64
|
+
!path.includes("/") &&
|
|
65
|
+
documentSlug(path)?.toLowerCase() === "readme";
|
|
68
66
|
|
|
69
|
-
/** A
|
|
70
|
-
|
|
71
|
-
/** A dashboard or notebook the package page asks its host to open, and how. */
|
|
67
|
+
/** A report the package page asks its host to open, and how. */
|
|
72
68
|
export interface OpenDocumentRequest {
|
|
73
|
-
|
|
69
|
+
/** The report's package path, `sales/q3.malloy`: its identity, and how to open it. */
|
|
70
|
+
path: string;
|
|
71
|
+
layout: ReportLayout;
|
|
72
|
+
/** @deprecated The basename, a label only: two reports may share it. Open by `path`. */
|
|
74
73
|
slug: string;
|
|
75
74
|
/** `edit` for a document just created or a draft picked up; `view` otherwise. */
|
|
76
75
|
mode: "view" | "edit";
|
|
@@ -79,22 +78,25 @@ export interface OpenDocumentRequest {
|
|
|
79
78
|
interface PackageProps {
|
|
80
79
|
onClickPackageFile?: (to: string, event?: React.MouseEvent) => void;
|
|
81
80
|
/**
|
|
82
|
-
* Open a
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
81
|
+
* Open a report, to read or to edit. Where reading and editing live is the
|
|
82
|
+
* host's business, not the package page's, so a host with a builder of its
|
|
83
|
+
* own routes this. Absent, the page navigates to the Console's own routes:
|
|
84
|
+
* the report's path, and the same path with `?edit` to edit.
|
|
86
85
|
*/
|
|
87
86
|
onOpenDocument?: (
|
|
88
87
|
request: OpenDocumentRequest,
|
|
89
88
|
event?: React.MouseEvent,
|
|
90
89
|
) => void;
|
|
91
90
|
resourceUri: string;
|
|
91
|
+
/** What the New report dialog creates, or why it could not; see `ReportEvent`. */
|
|
92
|
+
onEvent?: ReportEventHandler;
|
|
92
93
|
}
|
|
93
94
|
|
|
94
95
|
export default function Package({
|
|
95
96
|
onClickPackageFile,
|
|
96
97
|
onOpenDocument,
|
|
97
98
|
resourceUri,
|
|
99
|
+
onEvent,
|
|
98
100
|
}: PackageProps) {
|
|
99
101
|
const { apiClients, server, mutable } = useServer();
|
|
100
102
|
const queryClient = useQueryClient();
|
|
@@ -108,22 +110,22 @@ export default function Package({
|
|
|
108
110
|
const openDocument =
|
|
109
111
|
onOpenDocument ??
|
|
110
112
|
((request: OpenDocumentRequest, event?: React.MouseEvent) => {
|
|
111
|
-
const to =
|
|
113
|
+
const to =
|
|
114
|
+
request.mode === "edit"
|
|
115
|
+
? reportEditRoute(environmentName, packageName, request.path)
|
|
116
|
+
: reportRoute(environmentName, packageName, request.path);
|
|
112
117
|
// Without an event, called exactly as before this hook existed.
|
|
113
118
|
if (event) onClick(to, event);
|
|
114
119
|
else onClick(to);
|
|
115
120
|
});
|
|
116
121
|
|
|
117
122
|
const [schemaDatabase, setSchemaDatabase] = useState<Database | null>(null);
|
|
118
|
-
const [creating, setCreating] = useState
|
|
119
|
-
undefined,
|
|
120
|
-
);
|
|
121
|
-
const [newMenu, setNewMenu] = useState<HTMLElement | null>(null);
|
|
123
|
+
const [creating, setCreating] = useState(false);
|
|
122
124
|
const narrow = useNarrowScreen();
|
|
123
125
|
|
|
124
|
-
//
|
|
125
|
-
//
|
|
126
|
-
// stumbled on.
|
|
126
|
+
// Every report the host keeps for this package in a writeable workspace: the
|
|
127
|
+
// builder's drafts, both of reports the package does not have yet and of
|
|
128
|
+
// reports it does, listed so they are found rather than stumbled on.
|
|
127
129
|
// Each carries the workspace's own description, because where a document is
|
|
128
130
|
// kept is the backend's to say and only one host's answer is "this browser".
|
|
129
131
|
const storage = useOptionalDocumentStorage()?.documentStorage;
|
|
@@ -147,24 +149,19 @@ export default function Package({
|
|
|
147
149
|
}
|
|
148
150
|
setWorkspace({ state: "ready", chosen: chooseWorkspace(workspaces) });
|
|
149
151
|
const found: { locator: DocumentLocator; where: string }[] = [];
|
|
152
|
+
// One listing per workspace, every layout: a draft is found by its path under this package.
|
|
153
|
+
const prefix = draftKey(environmentName, packageName, "");
|
|
150
154
|
for (const candidate of workspaces.filter((w) => w.writeable))
|
|
151
|
-
for (const
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
locator.path.startsWith(
|
|
155
|
-
draftPrefix(environmentName, packageName, kind),
|
|
156
|
-
)
|
|
157
|
-
)
|
|
158
|
-
found.push({ locator, where: candidate.description });
|
|
155
|
+
for (const locator of await storage.listDocuments(candidate))
|
|
156
|
+
if (locator.path.startsWith(prefix))
|
|
157
|
+
found.push({ locator, where: candidate.description });
|
|
159
158
|
setDrafts(found);
|
|
160
159
|
}, [storage, environmentName, packageName]);
|
|
161
160
|
useEffect(() => {
|
|
162
161
|
void refreshDrafts();
|
|
163
162
|
}, [refreshDrafts]);
|
|
164
|
-
const
|
|
165
|
-
locator.path
|
|
166
|
-
.slice(draftPrefix(environmentName, packageName, locator.type).length)
|
|
167
|
-
.replace(/\.malloy$/, "");
|
|
163
|
+
const draftPath = (locator: DocumentLocator) =>
|
|
164
|
+
locator.path.slice(draftKey(environmentName, packageName, "").length);
|
|
168
165
|
|
|
169
166
|
const pkgQuery = useQueryWithApiError({
|
|
170
167
|
queryKey: ["package", environmentName, packageName, versionId],
|
|
@@ -177,29 +174,12 @@ export default function Package({
|
|
|
177
174
|
),
|
|
178
175
|
});
|
|
179
176
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
packageName,
|
|
187
|
-
versionId,
|
|
188
|
-
);
|
|
189
|
-
} catch (e) {
|
|
190
|
-
// Non-fatal like the dashboards list: an older Publisher without
|
|
191
|
-
// the route has no notebooks to list.
|
|
192
|
-
const status = (e as { response?: { status?: number } })?.response
|
|
193
|
-
?.status;
|
|
194
|
-
if (status === 404 || status === undefined) {
|
|
195
|
-
return { data: [] } as Awaited<
|
|
196
|
-
ReturnType<typeof apiClients.notebooks.listNotebooks>
|
|
197
|
-
>;
|
|
198
|
-
}
|
|
199
|
-
throw e;
|
|
200
|
-
}
|
|
201
|
-
},
|
|
202
|
-
});
|
|
177
|
+
// One listing for both layouts, by path, shared with every other reader.
|
|
178
|
+
const reportListing = useReportListing(
|
|
179
|
+
environmentName,
|
|
180
|
+
packageName,
|
|
181
|
+
versionId,
|
|
182
|
+
);
|
|
203
183
|
|
|
204
184
|
const modelsQuery = useQueryWithApiError({
|
|
205
185
|
queryKey: ["models", environmentName, packageName, versionId],
|
|
@@ -236,7 +216,7 @@ export default function Package({
|
|
|
236
216
|
} catch (e) {
|
|
237
217
|
// A 404 or transport-level failure (older Publisher without the
|
|
238
218
|
// /data-apps route, network blip) is non-fatal: render the package
|
|
239
|
-
// page without
|
|
219
|
+
// page without an Apps section. A genuinely missing package
|
|
240
220
|
// surfaces its own error via the package query above, so an empty
|
|
241
221
|
// list here can't hide it.
|
|
242
222
|
const status = (e as { response?: { status?: number } })?.response
|
|
@@ -252,48 +232,22 @@ export default function Package({
|
|
|
252
232
|
});
|
|
253
233
|
const dataApps = dataAppsQuery.data?.data ?? [];
|
|
254
234
|
|
|
255
|
-
const
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
// older Publisher without the route should render a package page
|
|
267
|
-
// without a Dashboards section, not an error.
|
|
268
|
-
const status = (e as { response?: { status?: number } })?.response
|
|
269
|
-
?.status;
|
|
270
|
-
if (status === 404 || status === undefined) {
|
|
271
|
-
return { data: [] } as Awaited<
|
|
272
|
-
ReturnType<typeof apiClients.dashboards.listDashboards>
|
|
273
|
-
>;
|
|
274
|
-
}
|
|
275
|
-
throw e;
|
|
276
|
-
}
|
|
277
|
-
},
|
|
278
|
-
});
|
|
279
|
-
const dashboards = dashboardsQuery.data?.data ?? [];
|
|
280
|
-
const notebooks = (notebooksQuery.data?.data ?? [])
|
|
281
|
-
.slice()
|
|
282
|
-
.sort((a, b) => (a.path ?? "").localeCompare(b.path ?? ""));
|
|
283
|
-
const artifacts = artifactRows(dashboards, notebooks);
|
|
284
|
-
// A dashboard is listed once, under Artifacts. Its file is a model like any
|
|
285
|
-
// other, so it would otherwise appear a second time under Semantic Models
|
|
286
|
-
// where clicking it opens the Explorer rather than the dashboard. Untagged
|
|
287
|
-
// shared includes in `dashboards/` are not dashboards and stay in the model
|
|
288
|
-
// list, which is where they belong.
|
|
289
|
-
const dashboardPaths = new Set(
|
|
290
|
-
dashboards
|
|
291
|
-
.map((dashboard) => dashboard.path)
|
|
235
|
+
const reports: ListedReport[] = reportListing.reports.filter(
|
|
236
|
+
(r) => !!r.path,
|
|
237
|
+
);
|
|
238
|
+
const artifacts = reportRows(reports);
|
|
239
|
+
// A report is listed once, under Reports. Its file is a model like any
|
|
240
|
+
// other, so it would otherwise appear a second time under Models
|
|
241
|
+
// where clicking it opens the Explorer rather than the report. The listed
|
|
242
|
+
// paths decide it, never a directory name.
|
|
243
|
+
const reportPaths = new Set(
|
|
244
|
+
reports
|
|
245
|
+
.map((report) => report.path)
|
|
292
246
|
.filter((path): path is string => path !== undefined),
|
|
293
247
|
);
|
|
294
248
|
const models = (modelsQuery.data?.data ?? [])
|
|
295
249
|
.slice()
|
|
296
|
-
.filter((model) => !
|
|
250
|
+
.filter((model) => !reportPaths.has(model.path))
|
|
297
251
|
.sort((a, b) => a.path.localeCompare(b.path));
|
|
298
252
|
const databases = (databasesQuery.data?.data ?? [])
|
|
299
253
|
.slice()
|
|
@@ -310,22 +264,16 @@ export default function Package({
|
|
|
310
264
|
...(versionId === undefined ? {} : { versionId }),
|
|
311
265
|
})
|
|
312
266
|
: undefined;
|
|
313
|
-
// A name is chosen against the listings, so New waits for
|
|
314
|
-
const listingsSettled =
|
|
315
|
-
|
|
316
|
-
);
|
|
267
|
+
// A name is chosen against the listings, so New waits for both rather than offering names a still-loading listing would have taken.
|
|
268
|
+
const listingsSettled =
|
|
269
|
+
reportListing.settled && (modelsQuery.isSuccess || modelsQuery.isError);
|
|
317
270
|
const canCreate = route !== undefined && listingsSettled;
|
|
318
271
|
// The editors step aside on a narrow screen, so no entry point to one is offered there.
|
|
319
272
|
const canNew = canCreate && !narrow;
|
|
320
273
|
const createTarget = useMemo((): CreateTarget | undefined => {
|
|
321
274
|
if (!canCreate) return undefined;
|
|
322
275
|
const existing = [
|
|
323
|
-
...(
|
|
324
|
-
d.path ? [d.path] : [],
|
|
325
|
-
),
|
|
326
|
-
...(notebooksQuery.data?.data ?? []).flatMap((n) =>
|
|
327
|
-
n.path ? [n.path] : [],
|
|
328
|
-
),
|
|
276
|
+
...reportListing.reports.flatMap((r) => (r.path ? [r.path] : [])),
|
|
329
277
|
...(modelsQuery.data?.data ?? []).flatMap((m) =>
|
|
330
278
|
m.path ? [m.path] : [],
|
|
331
279
|
),
|
|
@@ -362,48 +310,22 @@ export default function Package({
|
|
|
362
310
|
environmentName,
|
|
363
311
|
packageName,
|
|
364
312
|
apiClients,
|
|
365
|
-
|
|
366
|
-
notebooksQuery.data,
|
|
313
|
+
reportListing.reports,
|
|
367
314
|
modelsQuery.data,
|
|
368
315
|
]);
|
|
369
316
|
|
|
370
317
|
const description = pkgQuery.data?.data?.description ?? "";
|
|
371
|
-
// The root `.malloynb` wins when both exist, so a listing order never flips the pin.
|
|
372
318
|
const readmePath = (
|
|
373
|
-
|
|
374
|
-
|
|
319
|
+
reports.find((r) => r.path === README_NOTEBOOK) ??
|
|
320
|
+
reports.find((r) => isRootReadme(r.path))
|
|
375
321
|
)?.path;
|
|
376
|
-
const readmeResourceUri = encodeResourceUri({
|
|
377
|
-
environmentName,
|
|
378
|
-
packageName,
|
|
379
|
-
versionId,
|
|
380
|
-
modelPath: readmePath,
|
|
381
|
-
});
|
|
382
322
|
|
|
383
|
-
// The
|
|
384
|
-
//
|
|
385
|
-
//
|
|
386
|
-
//
|
|
387
|
-
//
|
|
388
|
-
|
|
389
|
-
//
|
|
390
|
-
// What this covers and what it COSTS, since the two are different questions.
|
|
391
|
-
// It cannot hang the page on a FAILURE: the query above turns a 404 or a
|
|
392
|
-
// transport failure into an empty list. It does add LATENCY, and to every
|
|
393
|
-
// section rather than to the one that needs it: Notebooks, Semantic Models,
|
|
394
|
-
// Data Apps and Databases now wait on the dashboards call where they used to
|
|
395
|
-
// render as soon as notebooks resolved. The only thing that actually needs
|
|
396
|
-
// the gate is the `dashboardPaths` filter on the models list.
|
|
397
|
-
//
|
|
398
|
-
// Accepted rather than narrowed because the cost is bounded and small:
|
|
399
|
-
// `listDashboards` is a synchronous read off the already-loaded package
|
|
400
|
-
// (`service/package.ts`, reached with `getPackage(name, false)`, so no
|
|
401
|
-
// reload), which makes this one more parallel request and not a compile.
|
|
402
|
-
// Narrowing it means gating only the models section, which trades this
|
|
403
|
-
// whole-page wait for a models list that pops in after its neighbours.
|
|
404
|
-
const isLoading =
|
|
405
|
-
(!notebooksQuery.isSuccess && !notebooksQuery.isError) ||
|
|
406
|
-
(!dashboardsQuery.isSuccess && !dashboardsQuery.isError);
|
|
323
|
+
// The models list is FILTERED by the report listing, so every section waits
|
|
324
|
+
// for it: gated on anything less, a late listing would show a report under
|
|
325
|
+
// Models and then take it away. A failure cannot hang the page, since the
|
|
326
|
+
// query turns a 404 or a transport failure into an empty list; the cost is
|
|
327
|
+
// one parallel request's latency.
|
|
328
|
+
const isLoading = !reportListing.settled;
|
|
407
329
|
|
|
408
330
|
if (pkgQuery.isError) {
|
|
409
331
|
return (
|
|
@@ -440,28 +362,10 @@ export default function Package({
|
|
|
440
362
|
|
|
441
363
|
{isLoading && <Loading text="Loading package..." />}
|
|
442
364
|
|
|
443
|
-
<Menu
|
|
444
|
-
anchorEl={newMenu}
|
|
445
|
-
open={newMenu !== null}
|
|
446
|
-
onClose={() => setNewMenu(null)}
|
|
447
|
-
>
|
|
448
|
-
{(["dashboard", "notebook"] as const).map((kind) => (
|
|
449
|
-
<MenuItem
|
|
450
|
-
key={kind}
|
|
451
|
-
onClick={() => {
|
|
452
|
-
setNewMenu(null);
|
|
453
|
-
setCreating(kind);
|
|
454
|
-
}}
|
|
455
|
-
>
|
|
456
|
-
{kind === "dashboard" ? "Dashboard" : "Notebook"}
|
|
457
|
-
</MenuItem>
|
|
458
|
-
))}
|
|
459
|
-
</Menu>
|
|
460
|
-
|
|
461
365
|
{createTarget && (
|
|
462
366
|
<NewDocumentDialog
|
|
463
|
-
open={creating
|
|
464
|
-
|
|
367
|
+
open={creating}
|
|
368
|
+
layout="linear"
|
|
465
369
|
environmentName={environmentName}
|
|
466
370
|
packageName={packageName}
|
|
467
371
|
{...(versionId !== undefined ? { versionId } : {})}
|
|
@@ -471,8 +375,7 @@ export default function Package({
|
|
|
471
375
|
(path): path is string =>
|
|
472
376
|
typeof path === "string" &&
|
|
473
377
|
path.endsWith(".malloy") &&
|
|
474
|
-
!
|
|
475
|
-
!path.startsWith("notebooks/"),
|
|
378
|
+
!reportPaths.has(path),
|
|
476
379
|
)}
|
|
477
380
|
modelsLoading={modelsQuery.isPending}
|
|
478
381
|
{...(modelsQuery.isError
|
|
@@ -480,13 +383,19 @@ export default function Package({
|
|
|
480
383
|
: {})}
|
|
481
384
|
onRetryModels={() => void modelsQuery.refetch()}
|
|
482
385
|
target={createTarget}
|
|
483
|
-
|
|
386
|
+
{...(onEvent ? { onEvent } : {})}
|
|
387
|
+
onClose={() => setCreating(false)}
|
|
484
388
|
onCreated={(created) => {
|
|
485
|
-
setCreating(
|
|
486
|
-
|
|
487
|
-
|
|
389
|
+
setCreating(false);
|
|
390
|
+
invalidateReportQueries(
|
|
391
|
+
queryClient,
|
|
392
|
+
environmentName,
|
|
393
|
+
packageName,
|
|
394
|
+
);
|
|
395
|
+
void queryClient.invalidateQueries({ queryKey: ["models"] });
|
|
488
396
|
openDocument({
|
|
489
|
-
|
|
397
|
+
path: created.path,
|
|
398
|
+
layout: created.layout,
|
|
490
399
|
slug: created.slug,
|
|
491
400
|
mode: "edit",
|
|
492
401
|
});
|
|
@@ -502,17 +411,28 @@ export default function Package({
|
|
|
502
411
|
else here would say a word, and one failed list hides only
|
|
503
412
|
half the artifacts. The 404 swallowed in each query is an
|
|
504
413
|
older Publisher with no route, which genuinely has none. */}
|
|
505
|
-
{
|
|
414
|
+
{reportListing.isError && (
|
|
506
415
|
<Box sx={{ mb: 4 }}>
|
|
507
|
-
<Alert
|
|
508
|
-
|
|
509
|
-
|
|
416
|
+
<Alert
|
|
417
|
+
severity="warning"
|
|
418
|
+
action={
|
|
419
|
+
<Button
|
|
420
|
+
color="inherit"
|
|
421
|
+
size="small"
|
|
422
|
+
onClick={() => void reportListing.refetch()}
|
|
423
|
+
>
|
|
424
|
+
Retry
|
|
425
|
+
</Button>
|
|
426
|
+
}
|
|
427
|
+
>
|
|
428
|
+
Could not list this package's reports, so any it
|
|
429
|
+
has are missing from this page.
|
|
510
430
|
</Alert>
|
|
511
431
|
</Box>
|
|
512
432
|
)}
|
|
513
433
|
{(artifacts.length > 0 || canCreate) && (
|
|
514
434
|
<PackageSection
|
|
515
|
-
title="
|
|
435
|
+
title="Reports"
|
|
516
436
|
count={artifacts.length}
|
|
517
437
|
{...(canNew
|
|
518
438
|
? {
|
|
@@ -520,14 +440,9 @@ export default function Package({
|
|
|
520
440
|
<Button
|
|
521
441
|
variant="outlined"
|
|
522
442
|
size="small"
|
|
523
|
-
|
|
524
|
-
aria-haspopup="menu"
|
|
525
|
-
aria-label="New"
|
|
526
|
-
onClick={(event) =>
|
|
527
|
-
setNewMenu(event.currentTarget)
|
|
528
|
-
}
|
|
443
|
+
onClick={() => setCreating(true)}
|
|
529
444
|
>
|
|
530
|
-
New
|
|
445
|
+
New report
|
|
531
446
|
</Button>
|
|
532
447
|
),
|
|
533
448
|
}
|
|
@@ -535,13 +450,12 @@ export default function Package({
|
|
|
535
450
|
>
|
|
536
451
|
{artifacts.length === 0 && (
|
|
537
452
|
<EmptyRow
|
|
538
|
-
label="No
|
|
453
|
+
label="No reports yet"
|
|
539
454
|
{...(canNew
|
|
540
455
|
? {
|
|
541
456
|
action: {
|
|
542
|
-
label: "New
|
|
543
|
-
onClick: (
|
|
544
|
-
setNewMenu(event.currentTarget),
|
|
457
|
+
label: "New report",
|
|
458
|
+
onClick: () => setCreating(true),
|
|
545
459
|
},
|
|
546
460
|
}
|
|
547
461
|
: {})}
|
|
@@ -549,25 +463,27 @@ export default function Package({
|
|
|
549
463
|
)}
|
|
550
464
|
{artifacts.map((artifact) => (
|
|
551
465
|
<PackageItemRow
|
|
552
|
-
key={
|
|
466
|
+
key={artifact.path}
|
|
553
467
|
type={
|
|
554
|
-
artifact.
|
|
468
|
+
artifact.layout === "grid"
|
|
555
469
|
? "dashboard"
|
|
556
470
|
: "report"
|
|
557
471
|
}
|
|
558
472
|
label={artifact.label}
|
|
473
|
+
rightLabel={artifact.layout}
|
|
559
474
|
{...(artifact.secondary === undefined
|
|
560
475
|
? {}
|
|
561
476
|
: { description: artifact.secondary })}
|
|
562
477
|
onClick={(event) =>
|
|
563
|
-
artifact.
|
|
478
|
+
artifact.path.endsWith(".malloynb")
|
|
564
479
|
? onClick(
|
|
565
480
|
`/${environmentName}/${packageName}/${artifact.path}`,
|
|
566
481
|
event,
|
|
567
482
|
)
|
|
568
483
|
: openDocument(
|
|
569
484
|
{
|
|
570
|
-
|
|
485
|
+
path: artifact.path,
|
|
486
|
+
layout: artifact.layout,
|
|
571
487
|
slug: artifact.slug,
|
|
572
488
|
mode: "view",
|
|
573
489
|
},
|
|
@@ -582,19 +498,19 @@ export default function Package({
|
|
|
582
498
|
<PackageSection title="Drafts" count={drafts.length}>
|
|
583
499
|
{drafts.map(({ locator, where }) => (
|
|
584
500
|
<PackageItemRow
|
|
585
|
-
key={`${locator.
|
|
501
|
+
key={`${locator.workspace}:${locator.path}`}
|
|
586
502
|
type={
|
|
587
|
-
locator.type === "dashboard"
|
|
588
|
-
? "dashboard"
|
|
589
|
-
: "report"
|
|
503
|
+
locator.type === "grid" ? "dashboard" : "report"
|
|
590
504
|
}
|
|
591
|
-
label={
|
|
505
|
+
label={draftPath(locator)}
|
|
592
506
|
rightLabel={where}
|
|
593
507
|
onClick={(event) =>
|
|
594
508
|
openDocument(
|
|
595
509
|
{
|
|
596
|
-
|
|
597
|
-
|
|
510
|
+
path: draftPath(locator),
|
|
511
|
+
layout: locator.type,
|
|
512
|
+
slug:
|
|
513
|
+
documentSlug(draftPath(locator)) ?? "",
|
|
598
514
|
mode: "edit",
|
|
599
515
|
},
|
|
600
516
|
event,
|
|
@@ -604,7 +520,7 @@ export default function Package({
|
|
|
604
520
|
<Tooltip title="Delete this draft">
|
|
605
521
|
<IconButton
|
|
606
522
|
size="small"
|
|
607
|
-
aria-label={`Delete draft ${
|
|
523
|
+
aria-label={`Delete draft ${draftPath(locator)}`}
|
|
608
524
|
onClick={(event) => {
|
|
609
525
|
event.stopPropagation();
|
|
610
526
|
void storage
|
|
@@ -622,7 +538,7 @@ export default function Package({
|
|
|
622
538
|
)}
|
|
623
539
|
|
|
624
540
|
{dataApps.length > 0 && (
|
|
625
|
-
<PackageSection title="
|
|
541
|
+
<PackageSection title="Apps" count={dataApps.length}>
|
|
626
542
|
{dataApps.map((dataApp) => {
|
|
627
543
|
const hasTitle =
|
|
628
544
|
!!dataApp.title && dataApp.title !== dataApp.path;
|
|
@@ -686,7 +602,7 @@ export default function Package({
|
|
|
686
602
|
</PackageSection>
|
|
687
603
|
)}
|
|
688
604
|
|
|
689
|
-
<PackageSection title="
|
|
605
|
+
<PackageSection title="Models" count={models.length}>
|
|
690
606
|
{models.map((model) => (
|
|
691
607
|
<PackageItemRow
|
|
692
608
|
key={model.path}
|
|
@@ -703,7 +619,7 @@ export default function Package({
|
|
|
703
619
|
{models.length === 0 && <EmptyRow label="No models" />}
|
|
704
620
|
</PackageSection>
|
|
705
621
|
|
|
706
|
-
<PackageSection title="
|
|
622
|
+
<PackageSection title="Data" count={databases.length}>
|
|
707
623
|
{databases.map((database) => (
|
|
708
624
|
<PackageItemRow
|
|
709
625
|
key={database.path}
|
|
@@ -727,47 +643,24 @@ export default function Package({
|
|
|
727
643
|
|
|
728
644
|
{readmePath && (
|
|
729
645
|
<Box sx={{ mt: 6 }}>
|
|
730
|
-
<
|
|
731
|
-
resourceUri={
|
|
732
|
-
|
|
646
|
+
<Report
|
|
647
|
+
resourceUri={encodeResourceUri({
|
|
648
|
+
environmentName,
|
|
649
|
+
packageName,
|
|
650
|
+
versionId,
|
|
651
|
+
})}
|
|
652
|
+
path={readmePath}
|
|
653
|
+
onLinkNavigate={onClick}
|
|
733
654
|
/>
|
|
734
655
|
</Box>
|
|
735
656
|
)}
|
|
736
657
|
</>
|
|
737
658
|
)}
|
|
738
659
|
|
|
739
|
-
<
|
|
740
|
-
|
|
660
|
+
<DataSchemaDialog
|
|
661
|
+
database={schemaDatabase}
|
|
741
662
|
onClose={() => setSchemaDatabase(null)}
|
|
742
|
-
|
|
743
|
-
showClose
|
|
744
|
-
>
|
|
745
|
-
{schemaDatabase?.error && (
|
|
746
|
-
<Typography variant="body2" color="error">
|
|
747
|
-
{schemaDatabase.error}
|
|
748
|
-
</Typography>
|
|
749
|
-
)}
|
|
750
|
-
{schemaDatabase?.info?.columns && (
|
|
751
|
-
<Table size="small">
|
|
752
|
-
<TableHead>
|
|
753
|
-
<TableRow>
|
|
754
|
-
<TableCell>Column</TableCell>
|
|
755
|
-
<TableCell>Type</TableCell>
|
|
756
|
-
</TableRow>
|
|
757
|
-
</TableHead>
|
|
758
|
-
<TableBody>
|
|
759
|
-
{schemaDatabase.info.columns.map((column) => (
|
|
760
|
-
<TableRow key={column.name}>
|
|
761
|
-
<TableCell component="th" scope="row">
|
|
762
|
-
{column.name}
|
|
763
|
-
</TableCell>
|
|
764
|
-
<TableCell>{column.type}</TableCell>
|
|
765
|
-
</TableRow>
|
|
766
|
-
))}
|
|
767
|
-
</TableBody>
|
|
768
|
-
</Table>
|
|
769
|
-
)}
|
|
770
|
-
</AppDialog>
|
|
663
|
+
/>
|
|
771
664
|
</Container>
|
|
772
665
|
);
|
|
773
666
|
}
|
|
@@ -804,51 +697,47 @@ function PackageItemRow({
|
|
|
804
697
|
);
|
|
805
698
|
}
|
|
806
699
|
|
|
807
|
-
interface
|
|
808
|
-
kind: DocumentKind;
|
|
700
|
+
interface ReportRow {
|
|
809
701
|
path: string;
|
|
810
|
-
|
|
811
|
-
|
|
702
|
+
layout: ReportLayout;
|
|
703
|
+
/** The basename, a label. */
|
|
704
|
+
slug: string;
|
|
812
705
|
label: string;
|
|
813
706
|
/** The path, when the label alone does not say which file this is. */
|
|
814
707
|
secondary: string | undefined;
|
|
815
708
|
}
|
|
816
709
|
|
|
817
|
-
/**
|
|
818
|
-
function
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
path: d.path ?? "",
|
|
826
|
-
slug: d.name ?? documentSlug(d.path),
|
|
827
|
-
title: d.title,
|
|
828
|
-
})),
|
|
829
|
-
...notebooks.map((n) => ({
|
|
830
|
-
kind: "notebook" as const,
|
|
831
|
-
path: n.path ?? "",
|
|
832
|
-
slug: documentSlug(n.path),
|
|
833
|
-
title: n.title,
|
|
834
|
-
})),
|
|
835
|
-
];
|
|
710
|
+
/** Every report as one list: the title when set, else the basename, ordered by what is shown. */
|
|
711
|
+
function reportRows(reports: readonly ListedReport[]): ReportRow[] {
|
|
712
|
+
const rows = reports.map((r) => ({
|
|
713
|
+
path: r.path ?? "",
|
|
714
|
+
layout: listedLayout(r),
|
|
715
|
+
slug: documentSlug(r.path) ?? r.path ?? "",
|
|
716
|
+
title: r.title,
|
|
717
|
+
}));
|
|
836
718
|
const slugCount = new Map<string, number>();
|
|
837
719
|
for (const row of rows)
|
|
838
|
-
|
|
839
|
-
slugCount.set(row.slug, (slugCount.get(row.slug) ?? 0) + 1);
|
|
720
|
+
slugCount.set(row.slug, (slugCount.get(row.slug) ?? 0) + 1);
|
|
840
721
|
return rows
|
|
841
|
-
.map(({ title, ...row }):
|
|
842
|
-
// A title equal to the
|
|
722
|
+
.map(({ title, ...row }): ReportRow => {
|
|
723
|
+
// A title equal to the basename or path is the server's fallback for a file that names itself neither way.
|
|
843
724
|
const hasTitle = !!title && title !== row.slug && title !== row.path;
|
|
844
|
-
|
|
845
|
-
|
|
725
|
+
// The path is shown whenever the label alone does not name the file: a title, a basename two reports share, or a report below the root.
|
|
726
|
+
const ambiguous = (slugCount.get(row.slug) ?? 0) > 1;
|
|
727
|
+
// A legacy `.malloynb` with no title of its own is named by its file, extension included.
|
|
728
|
+
const label = hasTitle
|
|
729
|
+
? title
|
|
730
|
+
: row.path.endsWith(".malloynb")
|
|
731
|
+
? row.path
|
|
732
|
+
: row.slug;
|
|
846
733
|
return {
|
|
847
734
|
...row,
|
|
848
|
-
label
|
|
849
|
-
secondary:
|
|
850
|
-
|
|
851
|
-
|
|
735
|
+
label,
|
|
736
|
+
secondary:
|
|
737
|
+
label !== row.path &&
|
|
738
|
+
(hasTitle || ambiguous || row.path.includes("/"))
|
|
739
|
+
? row.path
|
|
740
|
+
: undefined,
|
|
852
741
|
};
|
|
853
742
|
})
|
|
854
743
|
.sort(
|
|
@@ -884,11 +773,3 @@ function EmptyRow({
|
|
|
884
773
|
</Stack>
|
|
885
774
|
);
|
|
886
775
|
}
|
|
887
|
-
|
|
888
|
-
function formatRowCount(rows: number): string {
|
|
889
|
-
if (rows >= 1_000_000_000)
|
|
890
|
-
return `${(rows / 1_000_000_000).toFixed(1)} B rows`;
|
|
891
|
-
if (rows >= 1_000_000) return `${(rows / 1_000_000).toFixed(1)} M rows`;
|
|
892
|
-
if (rows >= 1_000) return `${(rows / 1_000).toFixed(1)} K rows`;
|
|
893
|
-
return `${rows} rows`;
|
|
894
|
-
}
|