@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
|
@@ -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,67 +9,68 @@ 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";
|
|
24
16
|
import { useQueryClient } from "@tanstack/react-query";
|
|
25
17
|
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
|
26
|
-
import { Database } from "../../client";
|
|
18
|
+
import { Database, type AgentSummary } from "../../client";
|
|
27
19
|
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";
|
|
43
|
+
import { describeCron } from "../Materializations/cron";
|
|
51
44
|
import { PackageSection } from "../PackageSection";
|
|
45
|
+
import { draftKey } from "../DocumentCreate/documentPath";
|
|
52
46
|
import {
|
|
53
|
-
documentRoute,
|
|
54
47
|
documentSlug,
|
|
55
|
-
|
|
48
|
+
listedLayout,
|
|
49
|
+
reportEditRoute,
|
|
50
|
+
reportRoute,
|
|
51
|
+
type ListedReport,
|
|
52
|
+
type ReportLayout,
|
|
56
53
|
} from "./documentLocation";
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
import { invalidateReportQueries } from "./reportQueries";
|
|
55
|
+
import { useReportListing } from "./useDocumentLocation";
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The pinned README: a report at the package root whose basename is README,
|
|
59
|
+
* in any case. The legacy root `README.malloynb` wins when both exist, so a
|
|
60
|
+
* listing order never flips the pin.
|
|
61
|
+
*/
|
|
59
62
|
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/`;
|
|
68
|
-
|
|
69
|
-
/** A served notebook opens by slug, like a dashboard; a `.malloynb` opens by path. */
|
|
63
|
+
const isRootReadme = (path: string | undefined) =>
|
|
64
|
+
!!path &&
|
|
65
|
+
!path.includes("/") &&
|
|
66
|
+
documentSlug(path)?.toLowerCase() === "readme";
|
|
70
67
|
|
|
71
|
-
/** A
|
|
68
|
+
/** A report the package page asks its host to open, and how. */
|
|
72
69
|
export interface OpenDocumentRequest {
|
|
73
|
-
|
|
70
|
+
/** The report's package path, `sales/q3.malloy`: its identity, and how to open it. */
|
|
71
|
+
path: string;
|
|
72
|
+
layout: ReportLayout;
|
|
73
|
+
/** @deprecated The basename, a label only: two reports may share it. Open by `path`. */
|
|
74
74
|
slug: string;
|
|
75
75
|
/** `edit` for a document just created or a draft picked up; `view` otherwise. */
|
|
76
76
|
mode: "view" | "edit";
|
|
@@ -79,22 +79,25 @@ export interface OpenDocumentRequest {
|
|
|
79
79
|
interface PackageProps {
|
|
80
80
|
onClickPackageFile?: (to: string, event?: React.MouseEvent) => void;
|
|
81
81
|
/**
|
|
82
|
-
* Open a
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
82
|
+
* Open a report, to read or to edit. Where reading and editing live is the
|
|
83
|
+
* host's business, not the package page's, so a host with a builder of its
|
|
84
|
+
* own routes this. Absent, the page navigates to the Console's own routes:
|
|
85
|
+
* the report's path, and the same path with `?edit` to edit.
|
|
86
86
|
*/
|
|
87
87
|
onOpenDocument?: (
|
|
88
88
|
request: OpenDocumentRequest,
|
|
89
89
|
event?: React.MouseEvent,
|
|
90
90
|
) => void;
|
|
91
91
|
resourceUri: string;
|
|
92
|
+
/** What the New report dialog creates, or why it could not; see `ReportEvent`. */
|
|
93
|
+
onEvent?: ReportEventHandler;
|
|
92
94
|
}
|
|
93
95
|
|
|
94
96
|
export default function Package({
|
|
95
97
|
onClickPackageFile,
|
|
96
98
|
onOpenDocument,
|
|
97
99
|
resourceUri,
|
|
100
|
+
onEvent,
|
|
98
101
|
}: PackageProps) {
|
|
99
102
|
const { apiClients, server, mutable } = useServer();
|
|
100
103
|
const queryClient = useQueryClient();
|
|
@@ -108,22 +111,22 @@ export default function Package({
|
|
|
108
111
|
const openDocument =
|
|
109
112
|
onOpenDocument ??
|
|
110
113
|
((request: OpenDocumentRequest, event?: React.MouseEvent) => {
|
|
111
|
-
const to =
|
|
114
|
+
const to =
|
|
115
|
+
request.mode === "edit"
|
|
116
|
+
? reportEditRoute(environmentName, packageName, request.path)
|
|
117
|
+
: reportRoute(environmentName, packageName, request.path);
|
|
112
118
|
// Without an event, called exactly as before this hook existed.
|
|
113
119
|
if (event) onClick(to, event);
|
|
114
120
|
else onClick(to);
|
|
115
121
|
});
|
|
116
122
|
|
|
117
123
|
const [schemaDatabase, setSchemaDatabase] = useState<Database | null>(null);
|
|
118
|
-
const [creating, setCreating] = useState
|
|
119
|
-
undefined,
|
|
120
|
-
);
|
|
121
|
-
const [newMenu, setNewMenu] = useState<HTMLElement | null>(null);
|
|
124
|
+
const [creating, setCreating] = useState(false);
|
|
122
125
|
const narrow = useNarrowScreen();
|
|
123
126
|
|
|
124
|
-
//
|
|
125
|
-
//
|
|
126
|
-
// stumbled on.
|
|
127
|
+
// Every report the host keeps for this package in a writeable workspace: the
|
|
128
|
+
// builder's drafts, both of reports the package does not have yet and of
|
|
129
|
+
// reports it does, listed so they are found rather than stumbled on.
|
|
127
130
|
// Each carries the workspace's own description, because where a document is
|
|
128
131
|
// kept is the backend's to say and only one host's answer is "this browser".
|
|
129
132
|
const storage = useOptionalDocumentStorage()?.documentStorage;
|
|
@@ -147,24 +150,19 @@ export default function Package({
|
|
|
147
150
|
}
|
|
148
151
|
setWorkspace({ state: "ready", chosen: chooseWorkspace(workspaces) });
|
|
149
152
|
const found: { locator: DocumentLocator; where: string }[] = [];
|
|
153
|
+
// One listing per workspace, every layout: a draft is found by its path under this package.
|
|
154
|
+
const prefix = draftKey(environmentName, packageName, "");
|
|
150
155
|
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 });
|
|
156
|
+
for (const locator of await storage.listDocuments(candidate))
|
|
157
|
+
if (locator.path.startsWith(prefix))
|
|
158
|
+
found.push({ locator, where: candidate.description });
|
|
159
159
|
setDrafts(found);
|
|
160
160
|
}, [storage, environmentName, packageName]);
|
|
161
161
|
useEffect(() => {
|
|
162
162
|
void refreshDrafts();
|
|
163
163
|
}, [refreshDrafts]);
|
|
164
|
-
const
|
|
165
|
-
locator.path
|
|
166
|
-
.slice(draftPrefix(environmentName, packageName, locator.type).length)
|
|
167
|
-
.replace(/\.malloy$/, "");
|
|
164
|
+
const draftPath = (locator: DocumentLocator) =>
|
|
165
|
+
locator.path.slice(draftKey(environmentName, packageName, "").length);
|
|
168
166
|
|
|
169
167
|
const pkgQuery = useQueryWithApiError({
|
|
170
168
|
queryKey: ["package", environmentName, packageName, versionId],
|
|
@@ -177,29 +175,12 @@ export default function Package({
|
|
|
177
175
|
),
|
|
178
176
|
});
|
|
179
177
|
|
|
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
|
-
});
|
|
178
|
+
// One listing for both layouts, by path, shared with every other reader.
|
|
179
|
+
const reportListing = useReportListing(
|
|
180
|
+
environmentName,
|
|
181
|
+
packageName,
|
|
182
|
+
versionId,
|
|
183
|
+
);
|
|
203
184
|
|
|
204
185
|
const modelsQuery = useQueryWithApiError({
|
|
205
186
|
queryKey: ["models", environmentName, packageName, versionId],
|
|
@@ -236,7 +217,7 @@ export default function Package({
|
|
|
236
217
|
} catch (e) {
|
|
237
218
|
// A 404 or transport-level failure (older Publisher without the
|
|
238
219
|
// /data-apps route, network blip) is non-fatal: render the package
|
|
239
|
-
// page without
|
|
220
|
+
// page without an Apps section. A genuinely missing package
|
|
240
221
|
// surfaces its own error via the package query above, so an empty
|
|
241
222
|
// list here can't hide it.
|
|
242
223
|
const status = (e as { response?: { status?: number } })?.response
|
|
@@ -252,48 +233,22 @@ export default function Package({
|
|
|
252
233
|
});
|
|
253
234
|
const dataApps = dataAppsQuery.data?.data ?? [];
|
|
254
235
|
|
|
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)
|
|
236
|
+
const reports: ListedReport[] = reportListing.reports.filter(
|
|
237
|
+
(r) => !!r.path,
|
|
238
|
+
);
|
|
239
|
+
const artifacts = reportRows(reports);
|
|
240
|
+
// A report is listed once, under Reports. Its file is a model like any
|
|
241
|
+
// other, so it would otherwise appear a second time under Models
|
|
242
|
+
// where clicking it opens the Explorer rather than the report. The listed
|
|
243
|
+
// paths decide it, never a directory name.
|
|
244
|
+
const reportPaths = new Set(
|
|
245
|
+
reports
|
|
246
|
+
.map((report) => report.path)
|
|
292
247
|
.filter((path): path is string => path !== undefined),
|
|
293
248
|
);
|
|
294
249
|
const models = (modelsQuery.data?.data ?? [])
|
|
295
250
|
.slice()
|
|
296
|
-
.filter((model) => !
|
|
251
|
+
.filter((model) => !reportPaths.has(model.path))
|
|
297
252
|
.sort((a, b) => a.path.localeCompare(b.path));
|
|
298
253
|
const databases = (databasesQuery.data?.data ?? [])
|
|
299
254
|
.slice()
|
|
@@ -310,22 +265,16 @@ export default function Package({
|
|
|
310
265
|
...(versionId === undefined ? {} : { versionId }),
|
|
311
266
|
})
|
|
312
267
|
: undefined;
|
|
313
|
-
// A name is chosen against the listings, so New waits for
|
|
314
|
-
const listingsSettled =
|
|
315
|
-
|
|
316
|
-
);
|
|
268
|
+
// A name is chosen against the listings, so New waits for both rather than offering names a still-loading listing would have taken.
|
|
269
|
+
const listingsSettled =
|
|
270
|
+
reportListing.settled && (modelsQuery.isSuccess || modelsQuery.isError);
|
|
317
271
|
const canCreate = route !== undefined && listingsSettled;
|
|
318
272
|
// The editors step aside on a narrow screen, so no entry point to one is offered there.
|
|
319
273
|
const canNew = canCreate && !narrow;
|
|
320
274
|
const createTarget = useMemo((): CreateTarget | undefined => {
|
|
321
275
|
if (!canCreate) return undefined;
|
|
322
276
|
const existing = [
|
|
323
|
-
...(
|
|
324
|
-
d.path ? [d.path] : [],
|
|
325
|
-
),
|
|
326
|
-
...(notebooksQuery.data?.data ?? []).flatMap((n) =>
|
|
327
|
-
n.path ? [n.path] : [],
|
|
328
|
-
),
|
|
277
|
+
...reportListing.reports.flatMap((r) => (r.path ? [r.path] : [])),
|
|
329
278
|
...(modelsQuery.data?.data ?? []).flatMap((m) =>
|
|
330
279
|
m.path ? [m.path] : [],
|
|
331
280
|
),
|
|
@@ -362,48 +311,23 @@ export default function Package({
|
|
|
362
311
|
environmentName,
|
|
363
312
|
packageName,
|
|
364
313
|
apiClients,
|
|
365
|
-
|
|
366
|
-
notebooksQuery.data,
|
|
314
|
+
reportListing.reports,
|
|
367
315
|
modelsQuery.data,
|
|
368
316
|
]);
|
|
369
317
|
|
|
370
318
|
const description = pkgQuery.data?.data?.description ?? "";
|
|
371
|
-
|
|
319
|
+
const agents = pkgQuery.data?.data?.agents ?? [];
|
|
372
320
|
const readmePath = (
|
|
373
|
-
|
|
374
|
-
|
|
321
|
+
reports.find((r) => r.path === README_NOTEBOOK) ??
|
|
322
|
+
reports.find((r) => isRootReadme(r.path))
|
|
375
323
|
)?.path;
|
|
376
|
-
const readmeResourceUri = encodeResourceUri({
|
|
377
|
-
environmentName,
|
|
378
|
-
packageName,
|
|
379
|
-
versionId,
|
|
380
|
-
modelPath: readmePath,
|
|
381
|
-
});
|
|
382
324
|
|
|
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);
|
|
325
|
+
// The models list is FILTERED by the report listing, so every section waits
|
|
326
|
+
// for it: gated on anything less, a late listing would show a report under
|
|
327
|
+
// Models and then take it away. A failure cannot hang the page, since the
|
|
328
|
+
// query turns a 404 or a transport failure into an empty list; the cost is
|
|
329
|
+
// one parallel request's latency.
|
|
330
|
+
const isLoading = !reportListing.settled;
|
|
407
331
|
|
|
408
332
|
if (pkgQuery.isError) {
|
|
409
333
|
return (
|
|
@@ -440,28 +364,10 @@ export default function Package({
|
|
|
440
364
|
|
|
441
365
|
{isLoading && <Loading text="Loading package..." />}
|
|
442
366
|
|
|
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
367
|
{createTarget && (
|
|
462
368
|
<NewDocumentDialog
|
|
463
|
-
open={creating
|
|
464
|
-
|
|
369
|
+
open={creating}
|
|
370
|
+
layout="linear"
|
|
465
371
|
environmentName={environmentName}
|
|
466
372
|
packageName={packageName}
|
|
467
373
|
{...(versionId !== undefined ? { versionId } : {})}
|
|
@@ -471,8 +377,7 @@ export default function Package({
|
|
|
471
377
|
(path): path is string =>
|
|
472
378
|
typeof path === "string" &&
|
|
473
379
|
path.endsWith(".malloy") &&
|
|
474
|
-
!
|
|
475
|
-
!path.startsWith("notebooks/"),
|
|
380
|
+
!reportPaths.has(path),
|
|
476
381
|
)}
|
|
477
382
|
modelsLoading={modelsQuery.isPending}
|
|
478
383
|
{...(modelsQuery.isError
|
|
@@ -480,13 +385,19 @@ export default function Package({
|
|
|
480
385
|
: {})}
|
|
481
386
|
onRetryModels={() => void modelsQuery.refetch()}
|
|
482
387
|
target={createTarget}
|
|
483
|
-
|
|
388
|
+
{...(onEvent ? { onEvent } : {})}
|
|
389
|
+
onClose={() => setCreating(false)}
|
|
484
390
|
onCreated={(created) => {
|
|
485
|
-
setCreating(
|
|
486
|
-
|
|
487
|
-
|
|
391
|
+
setCreating(false);
|
|
392
|
+
invalidateReportQueries(
|
|
393
|
+
queryClient,
|
|
394
|
+
environmentName,
|
|
395
|
+
packageName,
|
|
396
|
+
);
|
|
397
|
+
void queryClient.invalidateQueries({ queryKey: ["models"] });
|
|
488
398
|
openDocument({
|
|
489
|
-
|
|
399
|
+
path: created.path,
|
|
400
|
+
layout: created.layout,
|
|
490
401
|
slug: created.slug,
|
|
491
402
|
mode: "edit",
|
|
492
403
|
});
|
|
@@ -502,17 +413,28 @@ export default function Package({
|
|
|
502
413
|
else here would say a word, and one failed list hides only
|
|
503
414
|
half the artifacts. The 404 swallowed in each query is an
|
|
504
415
|
older Publisher with no route, which genuinely has none. */}
|
|
505
|
-
{
|
|
416
|
+
{reportListing.isError && (
|
|
506
417
|
<Box sx={{ mb: 4 }}>
|
|
507
|
-
<Alert
|
|
508
|
-
|
|
509
|
-
|
|
418
|
+
<Alert
|
|
419
|
+
severity="warning"
|
|
420
|
+
action={
|
|
421
|
+
<Button
|
|
422
|
+
color="inherit"
|
|
423
|
+
size="small"
|
|
424
|
+
onClick={() => void reportListing.refetch()}
|
|
425
|
+
>
|
|
426
|
+
Retry
|
|
427
|
+
</Button>
|
|
428
|
+
}
|
|
429
|
+
>
|
|
430
|
+
Could not list this package's reports, so any it
|
|
431
|
+
has are missing from this page.
|
|
510
432
|
</Alert>
|
|
511
433
|
</Box>
|
|
512
434
|
)}
|
|
513
435
|
{(artifacts.length > 0 || canCreate) && (
|
|
514
436
|
<PackageSection
|
|
515
|
-
title="
|
|
437
|
+
title="Reports"
|
|
516
438
|
count={artifacts.length}
|
|
517
439
|
{...(canNew
|
|
518
440
|
? {
|
|
@@ -520,14 +442,9 @@ export default function Package({
|
|
|
520
442
|
<Button
|
|
521
443
|
variant="outlined"
|
|
522
444
|
size="small"
|
|
523
|
-
|
|
524
|
-
aria-haspopup="menu"
|
|
525
|
-
aria-label="New"
|
|
526
|
-
onClick={(event) =>
|
|
527
|
-
setNewMenu(event.currentTarget)
|
|
528
|
-
}
|
|
445
|
+
onClick={() => setCreating(true)}
|
|
529
446
|
>
|
|
530
|
-
New
|
|
447
|
+
New report
|
|
531
448
|
</Button>
|
|
532
449
|
),
|
|
533
450
|
}
|
|
@@ -535,13 +452,12 @@ export default function Package({
|
|
|
535
452
|
>
|
|
536
453
|
{artifacts.length === 0 && (
|
|
537
454
|
<EmptyRow
|
|
538
|
-
label="No
|
|
455
|
+
label="No reports yet"
|
|
539
456
|
{...(canNew
|
|
540
457
|
? {
|
|
541
458
|
action: {
|
|
542
|
-
label: "New
|
|
543
|
-
onClick: (
|
|
544
|
-
setNewMenu(event.currentTarget),
|
|
459
|
+
label: "New report",
|
|
460
|
+
onClick: () => setCreating(true),
|
|
545
461
|
},
|
|
546
462
|
}
|
|
547
463
|
: {})}
|
|
@@ -549,25 +465,27 @@ export default function Package({
|
|
|
549
465
|
)}
|
|
550
466
|
{artifacts.map((artifact) => (
|
|
551
467
|
<PackageItemRow
|
|
552
|
-
key={
|
|
468
|
+
key={artifact.path}
|
|
553
469
|
type={
|
|
554
|
-
artifact.
|
|
470
|
+
artifact.layout === "grid"
|
|
555
471
|
? "dashboard"
|
|
556
472
|
: "report"
|
|
557
473
|
}
|
|
558
474
|
label={artifact.label}
|
|
475
|
+
rightLabel={artifact.layout}
|
|
559
476
|
{...(artifact.secondary === undefined
|
|
560
477
|
? {}
|
|
561
478
|
: { description: artifact.secondary })}
|
|
562
479
|
onClick={(event) =>
|
|
563
|
-
artifact.
|
|
480
|
+
artifact.path.endsWith(".malloynb")
|
|
564
481
|
? onClick(
|
|
565
482
|
`/${environmentName}/${packageName}/${artifact.path}`,
|
|
566
483
|
event,
|
|
567
484
|
)
|
|
568
485
|
: openDocument(
|
|
569
486
|
{
|
|
570
|
-
|
|
487
|
+
path: artifact.path,
|
|
488
|
+
layout: artifact.layout,
|
|
571
489
|
slug: artifact.slug,
|
|
572
490
|
mode: "view",
|
|
573
491
|
},
|
|
@@ -582,19 +500,19 @@ export default function Package({
|
|
|
582
500
|
<PackageSection title="Drafts" count={drafts.length}>
|
|
583
501
|
{drafts.map(({ locator, where }) => (
|
|
584
502
|
<PackageItemRow
|
|
585
|
-
key={`${locator.
|
|
503
|
+
key={`${locator.workspace}:${locator.path}`}
|
|
586
504
|
type={
|
|
587
|
-
locator.type === "dashboard"
|
|
588
|
-
? "dashboard"
|
|
589
|
-
: "report"
|
|
505
|
+
locator.type === "grid" ? "dashboard" : "report"
|
|
590
506
|
}
|
|
591
|
-
label={
|
|
507
|
+
label={draftPath(locator)}
|
|
592
508
|
rightLabel={where}
|
|
593
509
|
onClick={(event) =>
|
|
594
510
|
openDocument(
|
|
595
511
|
{
|
|
596
|
-
|
|
597
|
-
|
|
512
|
+
path: draftPath(locator),
|
|
513
|
+
layout: locator.type,
|
|
514
|
+
slug:
|
|
515
|
+
documentSlug(draftPath(locator)) ?? "",
|
|
598
516
|
mode: "edit",
|
|
599
517
|
},
|
|
600
518
|
event,
|
|
@@ -604,7 +522,7 @@ export default function Package({
|
|
|
604
522
|
<Tooltip title="Delete this draft">
|
|
605
523
|
<IconButton
|
|
606
524
|
size="small"
|
|
607
|
-
aria-label={`Delete draft ${
|
|
525
|
+
aria-label={`Delete draft ${draftPath(locator)}`}
|
|
608
526
|
onClick={(event) => {
|
|
609
527
|
event.stopPropagation();
|
|
610
528
|
void storage
|
|
@@ -622,7 +540,7 @@ export default function Package({
|
|
|
622
540
|
)}
|
|
623
541
|
|
|
624
542
|
{dataApps.length > 0 && (
|
|
625
|
-
<PackageSection title="
|
|
543
|
+
<PackageSection title="Apps" count={dataApps.length}>
|
|
626
544
|
{dataApps.map((dataApp) => {
|
|
627
545
|
const hasTitle =
|
|
628
546
|
!!dataApp.title && dataApp.title !== dataApp.path;
|
|
@@ -686,7 +604,7 @@ export default function Package({
|
|
|
686
604
|
</PackageSection>
|
|
687
605
|
)}
|
|
688
606
|
|
|
689
|
-
<PackageSection title="
|
|
607
|
+
<PackageSection title="Models" count={models.length}>
|
|
690
608
|
{models.map((model) => (
|
|
691
609
|
<PackageItemRow
|
|
692
610
|
key={model.path}
|
|
@@ -703,7 +621,19 @@ export default function Package({
|
|
|
703
621
|
{models.length === 0 && <EmptyRow label="No models" />}
|
|
704
622
|
</PackageSection>
|
|
705
623
|
|
|
706
|
-
|
|
624
|
+
{agents.length > 0 && (
|
|
625
|
+
<PackageSection
|
|
626
|
+
title="Agents"
|
|
627
|
+
count={agents.length}
|
|
628
|
+
description="Declared in publisher.json. Name one in an agent session to work as it. Schedules are listed only; nothing runs them yet."
|
|
629
|
+
>
|
|
630
|
+
{agents.map((agent) => (
|
|
631
|
+
<PackageAgentRow key={agent.name} agent={agent} />
|
|
632
|
+
))}
|
|
633
|
+
</PackageSection>
|
|
634
|
+
)}
|
|
635
|
+
|
|
636
|
+
<PackageSection title="Data" count={databases.length}>
|
|
707
637
|
{databases.map((database) => (
|
|
708
638
|
<PackageItemRow
|
|
709
639
|
key={database.path}
|
|
@@ -727,47 +657,24 @@ export default function Package({
|
|
|
727
657
|
|
|
728
658
|
{readmePath && (
|
|
729
659
|
<Box sx={{ mt: 6 }}>
|
|
730
|
-
<
|
|
731
|
-
resourceUri={
|
|
732
|
-
|
|
660
|
+
<Report
|
|
661
|
+
resourceUri={encodeResourceUri({
|
|
662
|
+
environmentName,
|
|
663
|
+
packageName,
|
|
664
|
+
versionId,
|
|
665
|
+
})}
|
|
666
|
+
path={readmePath}
|
|
667
|
+
onLinkNavigate={onClick}
|
|
733
668
|
/>
|
|
734
669
|
</Box>
|
|
735
670
|
)}
|
|
736
671
|
</>
|
|
737
672
|
)}
|
|
738
673
|
|
|
739
|
-
<
|
|
740
|
-
|
|
674
|
+
<DataSchemaDialog
|
|
675
|
+
database={schemaDatabase}
|
|
741
676
|
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>
|
|
677
|
+
/>
|
|
771
678
|
</Container>
|
|
772
679
|
);
|
|
773
680
|
}
|
|
@@ -804,51 +711,76 @@ function PackageItemRow({
|
|
|
804
711
|
);
|
|
805
712
|
}
|
|
806
713
|
|
|
807
|
-
|
|
808
|
-
|
|
714
|
+
function PackageAgentRow({ agent }: { agent: AgentSummary }) {
|
|
715
|
+
return (
|
|
716
|
+
<>
|
|
717
|
+
<PackageItemRow
|
|
718
|
+
type="agent"
|
|
719
|
+
label={agent.name ?? ""}
|
|
720
|
+
{...(agent.description ? { description: agent.description } : {})}
|
|
721
|
+
{...(agent.model && agent.model !== "inherit"
|
|
722
|
+
? { rightLabel: agent.model }
|
|
723
|
+
: {})}
|
|
724
|
+
/>
|
|
725
|
+
{(agent.schedules ?? []).map((schedule) => {
|
|
726
|
+
const cron = describeCron(schedule.cron ?? "");
|
|
727
|
+
return (
|
|
728
|
+
<Typography
|
|
729
|
+
key={`${schedule.cron}|${schedule.task}`}
|
|
730
|
+
variant="caption"
|
|
731
|
+
color="text.secondary"
|
|
732
|
+
sx={{ display: "block", ml: 6, mb: 0.5 }}
|
|
733
|
+
>
|
|
734
|
+
{cron.valid ? cron.description : schedule.cron} (UTC), task{" "}
|
|
735
|
+
{schedule.task}. Not run yet.
|
|
736
|
+
</Typography>
|
|
737
|
+
);
|
|
738
|
+
})}
|
|
739
|
+
</>
|
|
740
|
+
);
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
interface ReportRow {
|
|
809
744
|
path: string;
|
|
810
|
-
|
|
811
|
-
|
|
745
|
+
layout: ReportLayout;
|
|
746
|
+
/** The basename, a label. */
|
|
747
|
+
slug: string;
|
|
812
748
|
label: string;
|
|
813
749
|
/** The path, when the label alone does not say which file this is. */
|
|
814
750
|
secondary: string | undefined;
|
|
815
751
|
}
|
|
816
752
|
|
|
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
|
-
];
|
|
753
|
+
/** Every report as one list: the title when set, else the basename, ordered by what is shown. */
|
|
754
|
+
function reportRows(reports: readonly ListedReport[]): ReportRow[] {
|
|
755
|
+
const rows = reports.map((r) => ({
|
|
756
|
+
path: r.path ?? "",
|
|
757
|
+
layout: listedLayout(r),
|
|
758
|
+
slug: documentSlug(r.path) ?? r.path ?? "",
|
|
759
|
+
title: r.title,
|
|
760
|
+
}));
|
|
836
761
|
const slugCount = new Map<string, number>();
|
|
837
762
|
for (const row of rows)
|
|
838
|
-
|
|
839
|
-
slugCount.set(row.slug, (slugCount.get(row.slug) ?? 0) + 1);
|
|
763
|
+
slugCount.set(row.slug, (slugCount.get(row.slug) ?? 0) + 1);
|
|
840
764
|
return rows
|
|
841
|
-
.map(({ title, ...row }):
|
|
842
|
-
// A title equal to the
|
|
765
|
+
.map(({ title, ...row }): ReportRow => {
|
|
766
|
+
// A title equal to the basename or path is the server's fallback for a file that names itself neither way.
|
|
843
767
|
const hasTitle = !!title && title !== row.slug && title !== row.path;
|
|
844
|
-
|
|
845
|
-
|
|
768
|
+
// 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.
|
|
769
|
+
const ambiguous = (slugCount.get(row.slug) ?? 0) > 1;
|
|
770
|
+
// A legacy `.malloynb` with no title of its own is named by its file, extension included.
|
|
771
|
+
const label = hasTitle
|
|
772
|
+
? title
|
|
773
|
+
: row.path.endsWith(".malloynb")
|
|
774
|
+
? row.path
|
|
775
|
+
: row.slug;
|
|
846
776
|
return {
|
|
847
777
|
...row,
|
|
848
|
-
label
|
|
849
|
-
secondary:
|
|
850
|
-
|
|
851
|
-
|
|
778
|
+
label,
|
|
779
|
+
secondary:
|
|
780
|
+
label !== row.path &&
|
|
781
|
+
(hasTitle || ambiguous || row.path.includes("/"))
|
|
782
|
+
? row.path
|
|
783
|
+
: undefined,
|
|
852
784
|
};
|
|
853
785
|
})
|
|
854
786
|
.sort(
|
|
@@ -884,11 +816,3 @@ function EmptyRow({
|
|
|
884
816
|
</Stack>
|
|
885
817
|
);
|
|
886
818
|
}
|
|
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
|
-
}
|