@malloy-publisher/sdk 0.0.382-dev → 0.2.1
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 +115 -95
- package/TREE_SHAKING.md +16 -11
- package/bunfig.toml +7 -0
- package/dist/ServerProvider-Cn_LhKda.cjs.js +1 -0
- package/dist/ServerProvider-sfabtriY.es.js +4076 -0
- package/dist/client/api.d.ts +3773 -1515
- package/dist/client/configuration.d.ts +1 -1
- package/dist/client/index.cjs.js +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.es.js +86 -59
- package/dist/components/Connections/EditConnectionDialog.d.ts +2 -1
- package/dist/components/Connections/common.d.ts +8 -2
- package/dist/components/Dashboard/Dashboard.d.ts +62 -0
- package/dist/components/Dashboard/DashboardTile.d.ts +57 -0
- package/dist/components/Dashboard/index.d.ts +2 -0
- package/dist/components/DataAppViewer/DataAppViewer.d.ts +23 -0
- package/dist/components/DataAppViewer/index.d.ts +1 -0
- package/dist/components/Environment/Environment.d.ts +6 -0
- package/dist/components/Environment/index.d.ts +2 -0
- package/dist/components/Home/AddEnvironmentDialog.d.ts +1 -0
- package/dist/components/Home/DeleteEnvironmentDialog.d.ts +5 -0
- package/dist/components/Home/EditEnvironmentDialog.d.ts +7 -0
- package/dist/components/Home/Home.d.ts +2 -2
- package/dist/components/Materializations/CreateEnvMaterializationDialog.d.ts +14 -0
- package/dist/components/Materializations/CreateMaterializationDialog.d.ts +10 -0
- package/dist/components/Materializations/DeleteMaterializationDialog.d.ts +7 -0
- package/dist/components/Materializations/EnvironmentMaterializations.d.ts +7 -0
- package/dist/components/Materializations/ManifestView.d.ts +13 -0
- package/dist/components/Materializations/MaterializationDetailDialog.d.ts +9 -0
- package/dist/components/Materializations/MaterializationRunsList.d.ts +15 -0
- package/dist/components/Materializations/Materializations.d.ts +7 -0
- package/dist/components/Materializations/ScheduleCard.d.ts +20 -0
- package/dist/components/Materializations/SectionLabel.d.ts +10 -0
- package/dist/components/Materializations/SetScheduleDialog.d.ts +11 -0
- package/dist/components/Materializations/TriggerChip.d.ts +10 -0
- package/dist/components/Materializations/cron.d.ts +23 -0
- package/dist/components/Materializations/index.d.ts +2 -0
- package/dist/components/Materializations/utils.d.ts +46 -0
- package/dist/components/Notebook/Notebook.d.ts +47 -4
- package/dist/components/Notebook/NotebookCell.d.ts +37 -1
- package/dist/components/Notebook/runPlan.d.ts +29 -0
- package/dist/components/Notebook/types.d.ts +10 -0
- package/dist/components/Package/ContentTypeIcon.d.ts +31 -0
- package/dist/components/Package/Package.d.ts +1 -4
- package/dist/components/RenderedResult/RenderedResult.d.ts +7 -1
- package/dist/components/RenderedResult/ResultContainer.d.ts +5 -1
- package/dist/components/RenderedResult/renderLogs.d.ts +6 -0
- package/dist/components/ResultsDialog.d.ts +6 -1
- package/dist/components/ServerProvider.d.ts +28 -4
- package/dist/components/click_helper.d.ts +10 -1
- package/dist/components/drill/index.d.ts +3 -0
- package/dist/components/drill/markDrillableCells.d.ts +55 -0
- package/dist/components/drill/resolveDrill.d.ts +139 -0
- package/dist/components/drill/useDrill.d.ts +63 -0
- package/dist/components/given/GivenInput.d.ts +52 -0
- package/dist/components/given/GivensPanel.d.ts +47 -0
- package/dist/components/given/filterValue.d.ts +97 -0
- package/dist/components/given/index.d.ts +2 -0
- package/dist/components/given/paramCodec.d.ts +60 -0
- package/dist/components/given/utils.d.ts +17 -0
- package/dist/components/highlighter.d.ts +6 -1
- package/dist/components/index.d.ts +7 -2
- package/dist/components/styles.d.ts +47 -0
- package/dist/constants/docLinks.d.ts +12 -0
- package/dist/{core-YNpOLuB1.cjs.js → core-CqRKhtoy.cjs.js} +1 -1
- package/dist/{core-CjeTkq8O.es.js → core-DyU47reh.es.js} +1 -1
- package/dist/github-dark-BKL9xNgN.cjs.js +1 -0
- package/dist/github-dark-DenFmJkN.es.js +4 -0
- package/dist/hooks/givenValue.d.ts +10 -0
- package/dist/hooks/index.d.ts +4 -0
- package/dist/hooks/useDimensionFiltersFromSpec.d.ts +3 -3
- package/dist/hooks/useDimensionFiltersQuery.d.ts +3 -3
- package/dist/hooks/useDimensionalFilterRangeData.d.ts +4 -4
- package/dist/hooks/useGivensState.d.ts +64 -0
- package/dist/hooks/useModelGivens.d.ts +10 -0
- package/dist/hooks/useSuggestOptions.d.ts +78 -0
- package/dist/{index-DRDu9kIV.es.js → index-CAkFE4Ol.es.js} +41278 -28504
- package/dist/index-DD4b_bt0.cjs.js +356 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.es.js +79 -48
- package/dist/malloy-explorer.css +12 -1
- package/dist/sdk.css +1 -1
- package/dist/theme/ThemeContext.d.ts +45 -0
- package/dist/theme/buildMalloyExplicitTheme.d.ts +34 -0
- package/dist/theme/buildTableCssVars.d.ts +41 -0
- package/dist/theme/buildVegaThemeOverride.d.ts +16 -0
- package/dist/theme/defaults.d.ts +7 -0
- package/dist/theme/index.d.ts +8 -0
- package/dist/theme/keys.d.ts +20 -0
- package/dist/theme/readChartAnnotations.d.ts +23 -0
- package/dist/theme/resolveTheme.d.ts +22 -0
- package/dist/theme/types.d.ts +70 -0
- package/dist/utils/dataAppEmbed.d.ts +44 -0
- package/dist/utils/formatting.d.ts +1 -1
- package/dist/utils/malloyString.d.ts +7 -0
- package/dist/utils/parsing.d.ts +2 -2
- package/dist/utils/queryClient.d.ts +5 -0
- package/package.json +19 -8
- package/src/client-entry.ts +3 -0
- package/src/components/AnalyzePackageButton.tsx +9 -3
- package/src/components/ApiErrorDisplay.tsx +3 -0
- package/src/components/Connections/AddConnectionDialog.tsx +132 -25
- package/src/components/Connections/DeleteConnectionDialog.tsx +14 -3
- package/src/components/Connections/EditConnectionDialog.tsx +167 -37
- package/src/components/Connections/common.ts +94 -3
- package/src/components/DOMElement/DOMElement.tsx +3 -0
- package/src/components/DOMElement/index.ts +3 -0
- package/src/components/Dashboard/Dashboard.spec.tsx +216 -0
- package/src/components/Dashboard/Dashboard.tsx +458 -0
- package/src/components/Dashboard/DashboardTile.spec.tsx +81 -0
- package/src/components/Dashboard/DashboardTile.tsx +199 -0
- package/src/components/Dashboard/index.ts +5 -0
- package/src/components/Dashboard/tileGridColumn.spec.ts +35 -0
- package/src/components/DataAppViewer/DataAppViewer.tsx +214 -0
- package/src/components/DataAppViewer/index.ts +4 -0
- package/src/components/{Project → Environment}/About.tsx +11 -4
- package/src/components/Environment/AddPackageDialog.tsx +202 -0
- package/src/components/{Project → Environment}/ConnectionExplorer.tsx +17 -14
- package/src/components/Environment/Connections.tsx +391 -0
- package/src/components/{Project → Environment}/DeletePackageDialog.tsx +8 -4
- package/src/components/{Project → Environment}/EditPackageDialog.tsx +21 -13
- package/src/components/Environment/Environment.tsx +89 -0
- package/src/components/Environment/Packages.tsx +206 -0
- package/src/components/Environment/index.ts +5 -0
- package/src/components/Home/{AddProjectDialog.tsx → AddEnvironmentDialog.tsx} +25 -19
- package/src/components/Home/{DeleteProjectDialog.tsx → DeleteEnvironmentDialog.tsx} +20 -15
- package/src/components/Home/{EditProjectDialog.tsx → EditEnvironmentDialog.tsx} +35 -28
- package/src/components/Home/Home.tsx +386 -408
- package/src/components/Home/index.ts +3 -0
- package/src/components/Loading.tsx +3 -0
- package/src/components/Materializations/CreateEnvMaterializationDialog.tsx +179 -0
- package/src/components/Materializations/CreateMaterializationDialog.tsx +112 -0
- package/src/components/Materializations/DeleteMaterializationDialog.tsx +109 -0
- package/src/components/Materializations/EnvironmentMaterializations.tsx +267 -0
- package/src/components/Materializations/ManifestView.tsx +87 -0
- package/src/components/Materializations/MaterializationDetailDialog.tsx +259 -0
- package/src/components/Materializations/MaterializationRunsList.tsx +256 -0
- package/src/components/Materializations/Materializations.tsx +355 -0
- package/src/components/Materializations/ScheduleCard.tsx +231 -0
- package/src/components/Materializations/SectionLabel.tsx +30 -0
- package/src/components/Materializations/SetScheduleDialog.tsx +162 -0
- package/src/components/Materializations/TriggerChip.tsx +44 -0
- package/src/components/Materializations/cron.ts +124 -0
- package/src/components/Materializations/index.ts +5 -0
- package/src/components/Materializations/utils.ts +145 -0
- package/src/components/Model/Model.tsx +44 -2
- package/src/components/Model/ModelCell.tsx +14 -5
- package/src/components/Model/ModelExplorer.tsx +3 -0
- package/src/components/Model/ModelExplorerDialog.tsx +4 -1
- package/src/components/Model/SourcesExplorer.tsx +9 -6
- package/src/components/Model/index.ts +3 -0
- package/src/components/Model/useModelData.ts +6 -3
- package/src/components/Notebook/Notebook.spec.tsx +88 -0
- package/src/components/Notebook/Notebook.tsx +476 -339
- package/src/components/Notebook/NotebookCell.tsx +264 -25
- package/src/components/Notebook/index.ts +3 -0
- package/src/components/Notebook/runPlan.spec.ts +155 -0
- package/src/components/Notebook/runPlan.ts +67 -0
- package/src/components/Notebook/types.ts +14 -0
- package/src/components/Package/ContentTypeIcon.spec.ts +91 -0
- package/src/components/Package/ContentTypeIcon.tsx +177 -0
- package/src/components/Package/FileTreeView.tsx +3 -0
- package/src/components/Package/Models.tsx +7 -4
- package/src/components/Package/Package.spec.tsx +113 -0
- package/src/components/Package/Package.tsx +692 -59
- package/src/components/Package/index.ts +3 -0
- package/src/components/QueryResult/QueryResult.tsx +17 -8
- package/src/components/QueryResult/index.ts +3 -0
- package/src/components/RenderedResult/RenderedResult.tsx +725 -67
- package/src/components/RenderedResult/ResultContainer.tsx +71 -2
- package/src/components/RenderedResult/index.ts +3 -0
- package/src/components/RenderedResult/renderLogs.spec.ts +58 -0
- package/src/components/RenderedResult/renderLogs.ts +43 -0
- package/src/components/ResultsDialog.tsx +13 -1
- package/src/components/ServerProvider.tsx +175 -51
- package/src/components/Workbook/BrowserWorkbookStorage.ts +3 -0
- package/src/components/Workbook/EditableMalloyCell.tsx +3 -0
- package/src/components/Workbook/ModelPicker.tsx +7 -4
- package/src/components/Workbook/MutableCell.tsx +10 -5
- package/src/components/Workbook/Workbook.tsx +8 -5
- package/src/components/Workbook/WorkbookList.tsx +3 -0
- package/src/components/Workbook/WorkbookManager.ts +3 -0
- package/src/components/Workbook/WorkbookStorage.ts +3 -0
- package/src/components/Workbook/WorkbookStorageProvider.tsx +3 -0
- package/src/components/Workbook/index.ts +3 -0
- package/src/components/click_helper.ts +17 -1
- package/src/components/drill/index.ts +28 -0
- package/src/components/drill/markDrillableCells.dom.spec.ts +313 -0
- package/src/components/drill/markDrillableCells.spec.ts +109 -0
- package/src/components/drill/markDrillableCells.ts +314 -0
- package/src/components/drill/resolveDrill.spec.ts +449 -0
- package/src/components/drill/resolveDrill.ts +375 -0
- package/src/components/drill/useDrill.tsx +203 -0
- package/src/components/filter/DimensionFilter.tsx +3 -0
- package/src/components/filter/index.ts +3 -0
- package/src/components/filter/utils.ts +16 -5
- package/src/components/given/GivenInput.spec.tsx +689 -0
- package/src/components/given/GivenInput.tsx +801 -0
- package/src/components/given/GivensPanel.spec.tsx +175 -0
- package/src/components/given/GivensPanel.tsx +195 -0
- package/src/components/given/filterValue.spec.ts +364 -0
- package/src/components/given/filterValue.ts +207 -0
- package/src/components/given/index.ts +9 -0
- package/src/components/given/paramCodec.spec.ts +857 -0
- package/src/components/given/paramCodec.ts +483 -0
- package/src/components/given/utils.spec.ts +60 -0
- package/src/components/given/utils.ts +79 -0
- package/src/components/highlighter.ts +22 -5
- package/src/components/index.ts +10 -2
- package/src/components/styles.ts +82 -33
- package/src/constants/docLinks.spec.ts +54 -0
- package/src/constants/docLinks.ts +46 -0
- package/src/hooks/givenValue.ts +13 -0
- package/src/hooks/index.ts +13 -0
- package/src/hooks/useDimensionFilters.ts +4 -7
- package/src/hooks/useDimensionFiltersFromSpec.ts +8 -5
- package/src/hooks/useDimensionFiltersQuery.ts +10 -13
- package/src/hooks/useDimensionalFilterRangeData.ts +11 -14
- package/src/hooks/useGivensState.spec.ts +449 -0
- package/src/hooks/useGivensState.ts +340 -0
- package/src/hooks/useModelGivens.ts +29 -0
- package/src/hooks/useQueryWithApiError.ts +3 -0
- package/src/hooks/useRawQueryData.ts +6 -3
- package/src/hooks/useSuggestOptions.dom.spec.ts +91 -0
- package/src/hooks/useSuggestOptions.spec.ts +112 -0
- package/src/hooks/useSuggestOptions.ts +268 -0
- package/src/index.ts +10 -1
- package/src/react-app-env.d.ts +3 -0
- package/src/theme/ThemeContext.tsx +86 -0
- package/src/theme/buildMalloyExplicitTheme.ts +61 -0
- package/src/theme/buildTableCssVars.spec.ts +86 -0
- package/src/theme/buildTableCssVars.ts +98 -0
- package/src/theme/buildVegaThemeOverride.spec.ts +56 -0
- package/src/theme/buildVegaThemeOverride.ts +47 -0
- package/src/theme/defaults.ts +78 -0
- package/src/theme/index.ts +11 -0
- package/src/theme/keys.ts +32 -0
- package/src/theme/readChartAnnotations.spec.ts +58 -0
- package/src/theme/readChartAnnotations.ts +69 -0
- package/src/theme/resolveTheme.spec.ts +160 -0
- package/src/theme/resolveTheme.ts +121 -0
- package/src/theme/types.ts +79 -0
- package/src/utils/dataAppEmbed.spec.ts +63 -0
- package/src/utils/dataAppEmbed.ts +84 -0
- package/src/utils/formatting.spec.ts +25 -21
- package/src/utils/formatting.ts +11 -7
- package/src/utils/malloyString.spec.ts +24 -0
- package/src/utils/malloyString.ts +12 -0
- package/src/utils/parsing.spec.ts +26 -19
- package/src/utils/parsing.ts +11 -6
- package/src/utils/queryClient.ts +17 -0
- package/test/README.md +185 -0
- package/test/serverProvider.tsx +72 -0
- package/test/setup.ts +29 -0
- package/tsconfig.json +12 -1
- package/tsconfig.spec.json +22 -0
- package/vite.config.ts +3 -0
- package/dist/ServerProvider-lOQXDlqB.cjs.js +0 -1
- package/dist/ServerProvider-on-8FH5Z.es.js +0 -3060
- package/dist/components/Home/AddProjectDialog.d.ts +0 -1
- package/dist/components/Home/DeleteProjectDialog.d.ts +0 -5
- package/dist/components/Home/EditProjectDialog.d.ts +0 -7
- package/dist/components/Package/Config.d.ts +0 -5
- package/dist/components/Package/Databases.d.ts +0 -5
- package/dist/components/Package/Notebooks.d.ts +0 -6
- package/dist/components/Project/Project.d.ts +0 -6
- package/dist/components/Project/index.d.ts +0 -2
- package/dist/index-BOLBP6_i.cjs.js +0 -233
- package/src/components/Package/Config.tsx +0 -97
- package/src/components/Package/Connections.tsx +0 -373
- package/src/components/Package/Databases.tsx +0 -228
- package/src/components/Package/Notebooks.tsx +0 -77
- package/src/components/Project/AddPackageDialog.tsx +0 -159
- package/src/components/Project/Packages.tsx +0 -191
- package/src/components/Project/Project.tsx +0 -52
- package/src/components/Project/index.ts +0 -2
- /package/dist/components/{Project → Environment}/About.d.ts +0 -0
- /package/dist/components/{Project → Environment}/AddPackageDialog.d.ts +0 -0
- /package/dist/components/{Project → Environment}/ConnectionExplorer.d.ts +0 -0
- /package/dist/components/{Package → Environment}/Connections.d.ts +0 -0
- /package/dist/components/{Project → Environment}/DeletePackageDialog.d.ts +0 -0
- /package/dist/components/{Project → Environment}/EditPackageDialog.d.ts +0 -0
- /package/dist/components/{Project → Environment}/Packages.d.ts +0 -0
|
@@ -1,467 +1,445 @@
|
|
|
1
|
+
// Copyright (c) Credible Data Inc.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
1
4
|
import { MoreVert } from "@mui/icons-material";
|
|
2
|
-
import
|
|
3
|
-
import ArrowForwardRoundedIcon from "@mui/icons-material/ArrowForwardRounded";
|
|
4
|
-
import AutoAwesomeRoundedIcon from "@mui/icons-material/AutoAwesomeRounded";
|
|
5
|
-
import CodeRoundedIcon from "@mui/icons-material/CodeRounded";
|
|
6
|
-
import ExploreRoundedIcon from "@mui/icons-material/ExploreRounded";
|
|
7
|
-
import PsychologyRoundedIcon from "@mui/icons-material/PsychologyRounded";
|
|
8
|
-
import StorageRoundedIcon from "@mui/icons-material/StorageRounded";
|
|
5
|
+
import FolderOutlinedIcon from "@mui/icons-material/FolderOutlined";
|
|
9
6
|
import {
|
|
10
7
|
Box,
|
|
11
8
|
Button,
|
|
12
9
|
Card,
|
|
13
10
|
CardContent,
|
|
14
|
-
Chip,
|
|
15
11
|
Container,
|
|
16
12
|
Divider,
|
|
17
13
|
Grid,
|
|
18
14
|
IconButton,
|
|
19
15
|
Menu,
|
|
20
16
|
Stack,
|
|
17
|
+
Tooltip,
|
|
21
18
|
Typography,
|
|
22
19
|
} from "@mui/material";
|
|
23
20
|
import { useState } from "react";
|
|
24
|
-
import {
|
|
21
|
+
import { Environment } from "../../client";
|
|
25
22
|
import { useQueryWithApiError } from "../../hooks/useQueryWithApiError";
|
|
26
|
-
import {
|
|
23
|
+
import { serverBaseUrl } from "../../utils/dataAppEmbed";
|
|
24
|
+
import { getEnvironmentDescription } from "../../utils/parsing";
|
|
25
|
+
import { DOC_LINKS } from "../../constants/docLinks";
|
|
27
26
|
import { ApiErrorDisplay } from "../ApiErrorDisplay";
|
|
28
27
|
import { Loading } from "../Loading";
|
|
29
28
|
import { useServer } from "../ServerProvider";
|
|
30
|
-
import
|
|
31
|
-
import
|
|
32
|
-
import
|
|
29
|
+
import AddEnvironmentDialog from "./AddEnvironmentDialog";
|
|
30
|
+
import DeleteEnvironmentDialog from "./DeleteEnvironmentDialog";
|
|
31
|
+
import EditEnvironmentDialog from "./EditEnvironmentDialog";
|
|
33
32
|
|
|
34
33
|
interface HomeProps {
|
|
35
|
-
|
|
34
|
+
onClickEnvironment?: (to: string, event?: React.MouseEvent) => void;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* What this server can do, in the order someone meets it: exploring first, then
|
|
39
|
+
* the three analytics surfaces a package can hold, then the endpoint agents come
|
|
40
|
+
* in through and the rules that govern all of it. Anything that does not earn a
|
|
41
|
+
* card is named in the closing paragraph rather than crowding this list.
|
|
42
|
+
*/
|
|
43
|
+
const FEATURES: Array<{ title: string; body: string; href: string }> = [
|
|
44
|
+
{
|
|
45
|
+
title: "Ad-hoc analysis",
|
|
46
|
+
body: "Browse the semantic sources on this server and build nested queries in Explorer. Every click writes valid Malloy, so metrics stay correct even across joins.",
|
|
47
|
+
href: DOC_LINKS.explorer,
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
title: "Notebooks",
|
|
51
|
+
body: "A data story: markdown and live query cells in one file, versioned beside the model it reads. Any givens it imports become a panel of filter controls above the cells.",
|
|
52
|
+
href: DOC_LINKS.surfaces,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
title: "Dashboards",
|
|
56
|
+
body: "A tagged Malloy file is the page. Tags lay out the grid, the filter row is rendered from the query's parameters, and a tagged dimension clicks through to a detail page. No front-end code.",
|
|
57
|
+
href: DOC_LINKS.dashboards,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
title: "Data apps",
|
|
61
|
+
body: "Hand-author an HTML page in a package's public directory and Publisher serves it, backed by that package's models. No build step, and it embeds in a host page.",
|
|
62
|
+
href: DOC_LINKS.dataApps,
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
title: "AI data agents",
|
|
66
|
+
body: "One MCP endpoint. Agents discover the sources, compile-check the Malloy they write, and ask well-formed questions instead of guessing at raw tables.",
|
|
67
|
+
href: DOC_LINKS.mcpAgents,
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
// Deliberately not "so every caller sees only their rows". Givens are
|
|
71
|
+
// caller-asserted (docs/row-level-access.md), so a row-level filter is not
|
|
72
|
+
// a boundary on its own; `#(authorize)` is the thing that refuses. What is
|
|
73
|
+
// true, and what this says, is that the declarations live in the model, so
|
|
74
|
+
// no surface can define its own.
|
|
75
|
+
title: "Governed access",
|
|
76
|
+
body: "Runtime parameters, row-level filters, and per-source access gates are declared in the model, so every surface reads the same rules rather than reimplementing them.",
|
|
77
|
+
href: DOC_LINKS.givens,
|
|
78
|
+
},
|
|
79
|
+
];
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Always a new tab. `Home` is exported from the SDK, so it renders inside other
|
|
83
|
+
* people's pages as well as the standalone console, and same-tab navigation
|
|
84
|
+
* there unloads the host application. That includes the API spec, which is
|
|
85
|
+
* served by the Publisher server but not necessarily by the page's own origin.
|
|
86
|
+
* `target` and `rel` are set together so they cannot desynchronise.
|
|
87
|
+
*/
|
|
88
|
+
function InlineLink({
|
|
89
|
+
href,
|
|
90
|
+
children,
|
|
91
|
+
}: {
|
|
92
|
+
href: string;
|
|
93
|
+
children: React.ReactNode;
|
|
94
|
+
}) {
|
|
95
|
+
return (
|
|
96
|
+
<Box
|
|
97
|
+
component="a"
|
|
98
|
+
href={href}
|
|
99
|
+
target="_blank"
|
|
100
|
+
rel="noopener noreferrer"
|
|
101
|
+
sx={{ color: "text.primary", textDecoration: "underline" }}
|
|
102
|
+
>
|
|
103
|
+
{children}
|
|
104
|
+
</Box>
|
|
105
|
+
);
|
|
36
106
|
}
|
|
37
107
|
|
|
38
|
-
export default function Home({
|
|
39
|
-
const { apiClients, mutable } = useServer();
|
|
108
|
+
export default function Home({ onClickEnvironment }: HomeProps) {
|
|
109
|
+
const { apiClients, mutable, server } = useServer();
|
|
40
110
|
|
|
41
111
|
const { data, isSuccess, isError, error } = useQueryWithApiError({
|
|
42
|
-
queryKey: ["
|
|
43
|
-
queryFn: () => apiClients.
|
|
112
|
+
queryKey: ["environments"],
|
|
113
|
+
queryFn: () => apiClients.environments.listEnvironments(),
|
|
44
114
|
});
|
|
45
115
|
|
|
46
116
|
if (isError) {
|
|
47
|
-
return <ApiErrorDisplay error={error} context="
|
|
117
|
+
return <ApiErrorDisplay error={error} context="Environments List" />;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (!isSuccess) {
|
|
121
|
+
return <Loading text="Loading environments..." />;
|
|
48
122
|
}
|
|
49
123
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
124
|
+
const environments = data.data ?? [];
|
|
125
|
+
|
|
126
|
+
return (
|
|
127
|
+
<Container maxWidth="md" sx={{ py: 6 }}>
|
|
128
|
+
<Box sx={{ mb: 5 }}>
|
|
129
|
+
<Typography
|
|
130
|
+
variant="h3"
|
|
131
|
+
component="h1"
|
|
132
|
+
sx={{ fontWeight: 500, letterSpacing: "-0.025em", mb: 1 }}
|
|
133
|
+
>
|
|
134
|
+
Publisher
|
|
135
|
+
</Typography>
|
|
136
|
+
<Typography variant="body1" color="text.secondary" sx={{ mb: 3 }}>
|
|
137
|
+
The open-source semantic model server for the Malloy data
|
|
138
|
+
language.
|
|
139
|
+
</Typography>
|
|
140
|
+
<Typography
|
|
141
|
+
variant="body2"
|
|
142
|
+
color="text.secondary"
|
|
143
|
+
sx={{ maxWidth: 720, lineHeight: 1.6 }}
|
|
144
|
+
>
|
|
145
|
+
Define semantic models once and use them everywhere. Publisher
|
|
146
|
+
serves Malloy models over a REST API and a single MCP endpoint,
|
|
147
|
+
so applications, BI tools, and AI agents compose queries against
|
|
148
|
+
the model instead of writing SQL, and the numbers come back right
|
|
149
|
+
by construction.
|
|
150
|
+
</Typography>
|
|
151
|
+
</Box>
|
|
152
|
+
|
|
153
|
+
{/* Two columns at every width above the phone breakpoint, and
|
|
154
|
+
deliberately not the three the environment grid below uses: these
|
|
155
|
+
bodies are prose rather than a name. Measured at 1440px, two across
|
|
156
|
+
gives every card a 410px column and a uniform three lines. Three
|
|
157
|
+
across is narrower than a third of the container, since the grid
|
|
158
|
+
subtracts its gutters, and the bodies then wrap unevenly so the row
|
|
159
|
+
heights stop matching. */}
|
|
160
|
+
<Grid container spacing={4} sx={{ mb: 5 }}>
|
|
161
|
+
{FEATURES.map((feature) => (
|
|
162
|
+
<Grid size={{ xs: 12, sm: 6 }} key={feature.title}>
|
|
163
|
+
<Stack spacing={1}>
|
|
164
|
+
<Typography
|
|
165
|
+
variant="body2"
|
|
166
|
+
component="a"
|
|
167
|
+
href={feature.href}
|
|
168
|
+
target="_blank"
|
|
169
|
+
rel="noopener noreferrer"
|
|
170
|
+
sx={{
|
|
171
|
+
fontWeight: 500,
|
|
172
|
+
color: "text.primary",
|
|
173
|
+
textDecoration: "none",
|
|
174
|
+
"&:hover": { textDecoration: "underline" },
|
|
175
|
+
}}
|
|
176
|
+
>
|
|
177
|
+
{feature.title}
|
|
178
|
+
</Typography>
|
|
179
|
+
<Typography
|
|
180
|
+
variant="body2"
|
|
181
|
+
color="text.secondary"
|
|
182
|
+
sx={{ lineHeight: 1.6 }}
|
|
183
|
+
>
|
|
184
|
+
{feature.body}
|
|
185
|
+
</Typography>
|
|
186
|
+
</Stack>
|
|
187
|
+
</Grid>
|
|
188
|
+
))}
|
|
189
|
+
</Grid>
|
|
190
|
+
|
|
191
|
+
<Divider sx={{ my: 4 }} />
|
|
192
|
+
|
|
193
|
+
{environments.length > 0 ? (
|
|
194
|
+
<Box sx={{ mb: 4 }}>
|
|
55
195
|
<Stack
|
|
56
196
|
direction="row"
|
|
57
|
-
justifyContent="
|
|
58
|
-
alignItems="
|
|
59
|
-
|
|
60
|
-
sx={{ mb: 2 }}
|
|
197
|
+
justifyContent="space-between"
|
|
198
|
+
alignItems="flex-start"
|
|
199
|
+
sx={{ mb: 3 }}
|
|
61
200
|
>
|
|
62
|
-
<
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
201
|
+
<Box>
|
|
202
|
+
<Typography
|
|
203
|
+
variant="h5"
|
|
204
|
+
sx={{
|
|
205
|
+
fontWeight: 500,
|
|
206
|
+
letterSpacing: "-0.025em",
|
|
207
|
+
mb: 0.5,
|
|
208
|
+
}}
|
|
209
|
+
>
|
|
210
|
+
Environments
|
|
211
|
+
</Typography>
|
|
212
|
+
<Typography variant="body2" color="text.secondary">
|
|
213
|
+
Published environments available on this server
|
|
214
|
+
</Typography>
|
|
215
|
+
</Box>
|
|
216
|
+
{mutable && <AddEnvironmentDialog />}
|
|
68
217
|
</Stack>
|
|
218
|
+
<Grid container spacing={2}>
|
|
219
|
+
{environments.map((environment) => (
|
|
220
|
+
<Grid
|
|
221
|
+
size={{ xs: 12, sm: 6, md: 4 }}
|
|
222
|
+
key={environment.name}
|
|
223
|
+
>
|
|
224
|
+
<EnvironmentCard
|
|
225
|
+
environment={environment}
|
|
226
|
+
onClickEnvironment={onClickEnvironment}
|
|
227
|
+
/>
|
|
228
|
+
</Grid>
|
|
229
|
+
))}
|
|
230
|
+
</Grid>
|
|
231
|
+
</Box>
|
|
232
|
+
) : (
|
|
233
|
+
<Box sx={{ mb: 4 }}>
|
|
69
234
|
<Typography
|
|
70
235
|
variant="h5"
|
|
71
|
-
|
|
72
|
-
sx={{ mb: 3, maxWidth: 600, mx: "auto" }}
|
|
236
|
+
sx={{ fontWeight: 500, letterSpacing: "-0.025em", mb: 1 }}
|
|
73
237
|
>
|
|
74
|
-
|
|
75
|
-
language
|
|
238
|
+
Get started
|
|
76
239
|
</Typography>
|
|
77
240
|
<Typography
|
|
78
|
-
variant="
|
|
241
|
+
variant="body2"
|
|
79
242
|
color="text.secondary"
|
|
80
|
-
sx={{
|
|
243
|
+
sx={{ mb: 3, maxWidth: 600 }}
|
|
81
244
|
>
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
consistent, interpretable, and AI-ready data access for tools,
|
|
85
|
-
applications, and agents.
|
|
245
|
+
Create your first Malloy environment to start exploring
|
|
246
|
+
semantic models and building data experiences.
|
|
86
247
|
</Typography>
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
onClick={() => {
|
|
95
|
-
window.open(
|
|
96
|
-
"https://github.com/malloydata/publisher/blob/main/README.md#ad-hoc-data-analysis",
|
|
97
|
-
"_blank",
|
|
98
|
-
);
|
|
99
|
-
}}
|
|
100
|
-
sx={{
|
|
101
|
-
height: "100%",
|
|
102
|
-
cursor: "pointer",
|
|
103
|
-
transition: "all 0.2s ease",
|
|
104
|
-
"&:hover": {
|
|
105
|
-
transform: "translateY(-2px)",
|
|
106
|
-
boxShadow: 2,
|
|
107
|
-
},
|
|
108
|
-
}}
|
|
109
|
-
>
|
|
110
|
-
<CardContent sx={{ p: 3 }}>
|
|
111
|
-
<Stack
|
|
112
|
-
direction="row"
|
|
113
|
-
alignItems="center"
|
|
114
|
-
spacing={1}
|
|
115
|
-
sx={{ mb: 2 }}
|
|
116
|
-
>
|
|
117
|
-
<AnalyticsRoundedIcon
|
|
118
|
-
sx={{ color: "info.main", fontSize: 28 }}
|
|
119
|
-
/>
|
|
120
|
-
<Typography variant="h6" fontWeight={600}>
|
|
121
|
-
Ad Hoc Analysis
|
|
122
|
-
</Typography>
|
|
123
|
-
</Stack>
|
|
124
|
-
<Typography
|
|
125
|
-
variant="body2"
|
|
126
|
-
color="text.secondary"
|
|
127
|
-
sx={{ mb: 2 }}
|
|
128
|
-
>
|
|
129
|
-
Use Explorer, a visual query builder that allows
|
|
130
|
-
analysts to browse semantic sources, build queries,
|
|
131
|
-
and run nested logic — all without writing code.
|
|
132
|
-
</Typography>
|
|
133
|
-
<Chip
|
|
134
|
-
label="No-code"
|
|
135
|
-
size="small"
|
|
136
|
-
color="primary"
|
|
137
|
-
variant="outlined"
|
|
138
|
-
/>
|
|
139
|
-
</CardContent>
|
|
140
|
-
</Card>
|
|
141
|
-
</Grid>
|
|
142
|
-
|
|
143
|
-
<Grid size={{ xs: 12, md: 4 }}>
|
|
144
|
-
<Card
|
|
145
|
-
variant="outlined"
|
|
146
|
-
onClick={() => {
|
|
147
|
-
window.open(
|
|
148
|
-
"https://github.com/malloydata/publisher/blob/main/README.md#notebook-based-dashboards",
|
|
149
|
-
"_blank",
|
|
150
|
-
);
|
|
151
|
-
}}
|
|
152
|
-
sx={{
|
|
153
|
-
height: "100%",
|
|
154
|
-
cursor: "pointer",
|
|
155
|
-
transition: "all 0.2s ease",
|
|
156
|
-
"&:hover": {
|
|
157
|
-
transform: "translateY(-2px)",
|
|
158
|
-
boxShadow: 2,
|
|
159
|
-
},
|
|
160
|
-
}}
|
|
161
|
-
>
|
|
162
|
-
<CardContent sx={{ p: 3 }}>
|
|
163
|
-
<Stack
|
|
164
|
-
direction="row"
|
|
165
|
-
alignItems="center"
|
|
166
|
-
spacing={1}
|
|
167
|
-
sx={{ mb: 2 }}
|
|
168
|
-
>
|
|
169
|
-
<CodeRoundedIcon
|
|
170
|
-
sx={{ color: "warning.main", fontSize: 28 }}
|
|
171
|
-
/>
|
|
172
|
-
<Typography variant="h6" fontWeight={600}>
|
|
173
|
-
Notebook Dashboards
|
|
174
|
-
</Typography>
|
|
175
|
-
</Stack>
|
|
176
|
-
<Typography
|
|
177
|
-
variant="body2"
|
|
178
|
-
color="text.secondary"
|
|
179
|
-
sx={{ mb: 2 }}
|
|
180
|
-
>
|
|
181
|
-
Create shareable, code-first dashboards using Malloy
|
|
182
|
-
notebooks. Include text, charts, and reusable views —
|
|
183
|
-
all versioned alongside your models.
|
|
184
|
-
</Typography>
|
|
185
|
-
<Chip
|
|
186
|
-
label="Versioned"
|
|
187
|
-
size="small"
|
|
188
|
-
color="warning"
|
|
189
|
-
variant="outlined"
|
|
190
|
-
/>
|
|
191
|
-
</CardContent>
|
|
192
|
-
</Card>
|
|
193
|
-
</Grid>
|
|
194
|
-
|
|
195
|
-
<Grid size={{ xs: 12, md: 4 }}>
|
|
196
|
-
<Card
|
|
197
|
-
variant="outlined"
|
|
198
|
-
onClick={() => {
|
|
199
|
-
window.open(
|
|
200
|
-
"https://github.com/malloydata/publisher/blob/main/README.md#mcp-based-ai-data-agents",
|
|
201
|
-
"_blank",
|
|
202
|
-
);
|
|
203
|
-
}}
|
|
204
|
-
sx={{
|
|
205
|
-
height: "100%",
|
|
206
|
-
cursor: "pointer",
|
|
207
|
-
transition: "all 0.2s ease",
|
|
208
|
-
"&:hover": {
|
|
209
|
-
transform: "translateY(-2px)",
|
|
210
|
-
boxShadow: 2,
|
|
211
|
-
},
|
|
212
|
-
}}
|
|
213
|
-
>
|
|
214
|
-
<CardContent sx={{ p: 3 }}>
|
|
215
|
-
<Stack
|
|
216
|
-
direction="row"
|
|
217
|
-
alignItems="center"
|
|
218
|
-
spacing={1}
|
|
219
|
-
sx={{ mb: 2 }}
|
|
220
|
-
>
|
|
221
|
-
<PsychologyRoundedIcon
|
|
222
|
-
sx={{ color: "success.main", fontSize: 28 }}
|
|
223
|
-
/>
|
|
224
|
-
<Typography variant="h6" fontWeight={600}>
|
|
225
|
-
AI Data Agents
|
|
226
|
-
</Typography>
|
|
227
|
-
</Stack>
|
|
228
|
-
<Typography
|
|
229
|
-
variant="body2"
|
|
230
|
-
color="text.secondary"
|
|
231
|
-
sx={{ mb: 2 }}
|
|
232
|
-
>
|
|
233
|
-
Expose your semantic models via the Model Context
|
|
234
|
-
Protocol (MCP), enabling AI agents to discover
|
|
235
|
-
sources and ask well-formed questions.
|
|
236
|
-
</Typography>
|
|
237
|
-
<Chip
|
|
238
|
-
label="AI-Ready"
|
|
239
|
-
size="small"
|
|
240
|
-
color="success"
|
|
241
|
-
variant="outlined"
|
|
242
|
-
/>
|
|
243
|
-
</CardContent>
|
|
244
|
-
</Card>
|
|
245
|
-
</Grid>
|
|
246
|
-
</Grid>
|
|
247
|
-
|
|
248
|
-
<Divider sx={{ my: 4 }} />
|
|
249
|
-
|
|
250
|
-
{/* Project Selection Section */}
|
|
251
|
-
{data.data.length > 0 ? (
|
|
252
|
-
<>
|
|
253
|
-
<Box sx={{ textAlign: "center", mb: 4 }}>
|
|
254
|
-
<Stack
|
|
255
|
-
direction="row"
|
|
256
|
-
justifyContent="center"
|
|
257
|
-
alignItems="center"
|
|
258
|
-
spacing={1}
|
|
259
|
-
sx={{ mb: 2 }}
|
|
260
|
-
>
|
|
261
|
-
<StorageRoundedIcon
|
|
262
|
-
sx={{ color: "primary.main", fontSize: 24 }}
|
|
263
|
-
/>
|
|
264
|
-
<Typography variant="h4" fontWeight={600}>
|
|
265
|
-
Select a Project
|
|
266
|
-
</Typography>
|
|
267
|
-
</Stack>
|
|
268
|
-
<Typography variant="body1" color="text.secondary">
|
|
269
|
-
Choose a project to explore its semantic models and
|
|
270
|
-
start analyzing your data
|
|
271
|
-
</Typography>
|
|
272
|
-
{mutable && <AddProjectDialog />}
|
|
273
|
-
</Box>
|
|
274
|
-
<Grid container spacing={3} justifyContent="center">
|
|
275
|
-
{data.data.map((project) => (
|
|
276
|
-
<Grid
|
|
277
|
-
size={{ xs: 12, sm: 6, md: 4 }}
|
|
278
|
-
key={project.name}
|
|
279
|
-
>
|
|
280
|
-
<ProjectCard
|
|
281
|
-
project={project}
|
|
282
|
-
onClickProject={onClickProject}
|
|
283
|
-
/>
|
|
284
|
-
</Grid>
|
|
285
|
-
))}
|
|
286
|
-
</Grid>
|
|
287
|
-
</>
|
|
288
|
-
) : (
|
|
289
|
-
<Box sx={{ textAlign: "center", mb: 4 }}>
|
|
290
|
-
<Stack
|
|
291
|
-
direction="row"
|
|
292
|
-
justifyContent="center"
|
|
293
|
-
alignItems="center"
|
|
294
|
-
spacing={1}
|
|
295
|
-
sx={{ mb: 2 }}
|
|
296
|
-
>
|
|
297
|
-
<StorageRoundedIcon
|
|
298
|
-
sx={{ color: "primary.main", fontSize: 24 }}
|
|
299
|
-
/>
|
|
300
|
-
<Typography variant="h4" fontWeight={600}>
|
|
301
|
-
Get Started
|
|
302
|
-
</Typography>
|
|
303
|
-
</Stack>
|
|
304
|
-
<Typography
|
|
305
|
-
variant="body1"
|
|
306
|
-
color="text.secondary"
|
|
307
|
-
sx={{ mb: 3 }}
|
|
308
|
-
>
|
|
309
|
-
No projects found. Create your first Malloy project to
|
|
310
|
-
start exploring semantic models and building data
|
|
311
|
-
experiences.
|
|
312
|
-
</Typography>
|
|
313
|
-
{mutable ? (
|
|
314
|
-
<AddProjectDialog />
|
|
315
|
-
) : (
|
|
316
|
-
<Button
|
|
317
|
-
variant="contained"
|
|
318
|
-
size="large"
|
|
319
|
-
color="primary"
|
|
320
|
-
startIcon={<AutoAwesomeRoundedIcon />}
|
|
321
|
-
href="https://github.com/malloydata/publisher/blob/main/README.md#server-configuration"
|
|
322
|
-
target="_blank"
|
|
323
|
-
rel="noopener noreferrer"
|
|
324
|
-
>
|
|
325
|
-
Learn How to Create Models
|
|
326
|
-
</Button>
|
|
327
|
-
)}
|
|
328
|
-
</Box>
|
|
329
|
-
)}
|
|
330
|
-
|
|
331
|
-
{/* Footer Section */}
|
|
332
|
-
<Box
|
|
333
|
-
sx={{
|
|
334
|
-
textAlign: "center",
|
|
335
|
-
mt: 6,
|
|
336
|
-
pt: 4,
|
|
337
|
-
borderTop: 1,
|
|
338
|
-
borderColor: "divider",
|
|
339
|
-
}}
|
|
340
|
-
>
|
|
341
|
-
<Typography variant="body2" color="text.secondary">
|
|
342
|
-
Publisher is built on fully open infrastructure and designed
|
|
343
|
-
for the AI era. Join the{" "}
|
|
344
|
-
<a
|
|
345
|
-
href="https://join.slack.com/t/malloy-community/shared_invite/zt-1kgfwgi5g-CrsdaRqs81QY67QW0~t_uw"
|
|
248
|
+
{mutable ? (
|
|
249
|
+
<AddEnvironmentDialog />
|
|
250
|
+
) : (
|
|
251
|
+
<Button
|
|
252
|
+
variant="contained"
|
|
253
|
+
color="primary"
|
|
254
|
+
href={DOC_LINKS.publishing}
|
|
346
255
|
target="_blank"
|
|
347
256
|
rel="noopener noreferrer"
|
|
348
|
-
style={{
|
|
349
|
-
color: "primary.main",
|
|
350
|
-
textDecoration: "underline",
|
|
351
|
-
}}
|
|
352
257
|
>
|
|
353
|
-
|
|
354
|
-
</
|
|
355
|
-
|
|
356
|
-
data modeling.
|
|
357
|
-
</Typography>
|
|
258
|
+
Learn how to create models
|
|
259
|
+
</Button>
|
|
260
|
+
)}
|
|
358
261
|
</Box>
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
262
|
+
)}
|
|
263
|
+
|
|
264
|
+
<Divider sx={{ my: 4 }} />
|
|
265
|
+
|
|
266
|
+
<Typography
|
|
267
|
+
variant="body2"
|
|
268
|
+
color="text.secondary"
|
|
269
|
+
sx={{ maxWidth: 720, lineHeight: 1.6 }}
|
|
270
|
+
>
|
|
271
|
+
{/* Six of the ten types in the api-doc.yaml enum. connections.md
|
|
272
|
+
names eight. Two of the six named here, mysql and trino,
|
|
273
|
+
appear in connections.md exactly once, in the parenthetical that
|
|
274
|
+
ends "etc."; Databricks and MotherDuck it never names at all. "And more"
|
|
275
|
+
rather than a full list, because a list that reads as complete
|
|
276
|
+
while omitting Databricks is worse than a short one that says
|
|
277
|
+
it is short. */}
|
|
278
|
+
Also here:{" "}
|
|
279
|
+
<InlineLink href={DOC_LINKS.connections}>connections</InlineLink> to
|
|
280
|
+
BigQuery, Snowflake, Postgres, MySQL, Trino, DuckDB and more;{" "}
|
|
281
|
+
<InlineLink href={DOC_LINKS.materialization}>
|
|
282
|
+
materialized tables
|
|
283
|
+
</InlineLink>{" "}
|
|
284
|
+
built on demand or on a schedule; and a{" "}
|
|
285
|
+
{/* Built from the configured server rather than written as
|
|
286
|
+
"/api-doc.html". The spec is a static file off the Publisher
|
|
287
|
+
server's root, and an SDK consumer's page origin need not be
|
|
288
|
+
that server: a root-relative href resolves against the host and
|
|
289
|
+
404s. serverBaseUrl exists for exactly this. */}
|
|
290
|
+
<InlineLink href={`${serverBaseUrl(server)}/api-doc.html`}>
|
|
291
|
+
REST API
|
|
292
|
+
</InlineLink>{" "}
|
|
293
|
+
that does everything this console does.
|
|
294
|
+
</Typography>
|
|
295
|
+
|
|
296
|
+
<Typography
|
|
297
|
+
variant="body2"
|
|
298
|
+
color="text.secondary"
|
|
299
|
+
sx={{ maxWidth: 720, lineHeight: 1.6, mt: 2 }}
|
|
300
|
+
>
|
|
301
|
+
Publisher is built on fully open infrastructure and designed for the
|
|
302
|
+
AI era. Join the{" "}
|
|
303
|
+
<InlineLink href="https://join.slack.com/t/malloy-community/shared_invite/zt-1kgfwgi5g-CrsdaRqs81QY67QW0~t_uw">
|
|
304
|
+
Malloy Slack community
|
|
305
|
+
</InlineLink>{" "}
|
|
306
|
+
to ask questions, share ideas, and contribute.
|
|
307
|
+
</Typography>
|
|
308
|
+
</Container>
|
|
309
|
+
);
|
|
364
310
|
}
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
311
|
+
|
|
312
|
+
function EnvironmentCard({
|
|
313
|
+
environment,
|
|
314
|
+
onClickEnvironment,
|
|
368
315
|
}: {
|
|
369
|
-
|
|
370
|
-
|
|
316
|
+
environment: Environment;
|
|
317
|
+
onClickEnvironment?: (to: string, event?: React.MouseEvent) => void;
|
|
371
318
|
}) {
|
|
372
319
|
const { mutable } = useServer();
|
|
373
320
|
const [menuAnchorEl, setMenuAnchorEl] = useState<null | HTMLElement>(null);
|
|
374
|
-
const
|
|
375
|
-
|
|
321
|
+
const menuOpen = Boolean(menuAnchorEl);
|
|
322
|
+
|
|
323
|
+
const description = getEnvironmentDescription(environment.readme);
|
|
324
|
+
|
|
325
|
+
const handleClick = (event: React.MouseEvent) => {
|
|
326
|
+
if (environment.name && onClickEnvironment) {
|
|
327
|
+
onClickEnvironment(`/${environment.name}/`, event);
|
|
328
|
+
}
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
const handleMenuClick = (event: React.MouseEvent<HTMLElement>) => {
|
|
332
|
+
event.stopPropagation();
|
|
376
333
|
setMenuAnchorEl(event.currentTarget);
|
|
377
334
|
};
|
|
378
|
-
|
|
335
|
+
|
|
336
|
+
const handleMenuClose = () => {
|
|
379
337
|
setMenuAnchorEl(null);
|
|
380
338
|
};
|
|
339
|
+
|
|
381
340
|
return (
|
|
382
|
-
<
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
transformOrigin={{
|
|
419
|
-
vertical: "top",
|
|
420
|
-
horizontal: "right",
|
|
421
|
-
}}
|
|
422
|
-
>
|
|
423
|
-
<EditProjectDialog
|
|
424
|
-
project={project}
|
|
425
|
-
onCloseDialog={closeMenu}
|
|
426
|
-
/>
|
|
427
|
-
<DeleteProjectDialog
|
|
428
|
-
project={project}
|
|
429
|
-
onCloseDialog={closeMenu}
|
|
430
|
-
/>
|
|
431
|
-
</Menu>
|
|
432
|
-
</>
|
|
433
|
-
)}
|
|
434
|
-
<CardContent sx={{ p: 3, textAlign: "center" }}>
|
|
435
|
-
<ExploreRoundedIcon
|
|
436
|
-
sx={{
|
|
437
|
-
fontSize: 48,
|
|
438
|
-
color: "primary.main",
|
|
439
|
-
mb: 2,
|
|
440
|
-
}}
|
|
441
|
-
/>
|
|
442
|
-
<Typography variant="h6" fontWeight={600} gutterBottom>
|
|
443
|
-
{project.name}
|
|
444
|
-
</Typography>
|
|
445
|
-
<Typography
|
|
446
|
-
variant="body2"
|
|
447
|
-
color="text.secondary"
|
|
448
|
-
sx={{ mb: 2, minHeight: "60px" }}
|
|
449
|
-
>
|
|
450
|
-
{getProjectDescription(project.readme)}
|
|
451
|
-
</Typography>
|
|
452
|
-
<Button
|
|
453
|
-
variant="contained"
|
|
454
|
-
color="secondary"
|
|
455
|
-
endIcon={<ArrowForwardRoundedIcon />}
|
|
456
|
-
fullWidth
|
|
457
|
-
onClick={(event) =>
|
|
458
|
-
onClickProject(`/${project.name}/`, event)
|
|
459
|
-
}
|
|
341
|
+
<Card
|
|
342
|
+
variant="outlined"
|
|
343
|
+
onClick={handleClick}
|
|
344
|
+
sx={{
|
|
345
|
+
height: "100%",
|
|
346
|
+
cursor: "pointer",
|
|
347
|
+
borderRadius: 3,
|
|
348
|
+
borderColor: "divider",
|
|
349
|
+
boxShadow: "none",
|
|
350
|
+
transition: "all 0.2s ease-in-out",
|
|
351
|
+
"&:hover": { boxShadow: 2, borderColor: "primary.main" },
|
|
352
|
+
}}
|
|
353
|
+
>
|
|
354
|
+
<CardContent sx={{ p: 2.5, "&:last-child": { pb: 2.5 } }}>
|
|
355
|
+
<Box
|
|
356
|
+
sx={{
|
|
357
|
+
display: "flex",
|
|
358
|
+
alignItems: "flex-start",
|
|
359
|
+
gap: 1.5,
|
|
360
|
+
}}
|
|
361
|
+
>
|
|
362
|
+
<Box
|
|
363
|
+
sx={(theme) => ({
|
|
364
|
+
width: 36,
|
|
365
|
+
height: 36,
|
|
366
|
+
borderRadius: 1.5,
|
|
367
|
+
bgcolor:
|
|
368
|
+
theme.palette.mode === "dark"
|
|
369
|
+
? "rgba(255, 255, 255, 0.08)"
|
|
370
|
+
: "grey.100",
|
|
371
|
+
display: "flex",
|
|
372
|
+
alignItems: "center",
|
|
373
|
+
justifyContent: "center",
|
|
374
|
+
flexShrink: 0,
|
|
375
|
+
color: "text.primary",
|
|
376
|
+
})}
|
|
460
377
|
>
|
|
461
|
-
|
|
462
|
-
</
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
378
|
+
<FolderOutlinedIcon sx={{ fontSize: 20 }} />
|
|
379
|
+
</Box>
|
|
380
|
+
<Box sx={{ flex: 1, minWidth: 0 }}>
|
|
381
|
+
<Typography
|
|
382
|
+
variant="subtitle1"
|
|
383
|
+
component="h6"
|
|
384
|
+
noWrap
|
|
385
|
+
sx={{ fontWeight: 600, mb: 0.5 }}
|
|
386
|
+
>
|
|
387
|
+
{environment.name}
|
|
388
|
+
</Typography>
|
|
389
|
+
<Tooltip title={description} followCursor enterDelay={1000}>
|
|
390
|
+
<Typography
|
|
391
|
+
variant="body2"
|
|
392
|
+
color="text.secondary"
|
|
393
|
+
sx={{
|
|
394
|
+
overflow: "hidden",
|
|
395
|
+
textOverflow: "ellipsis",
|
|
396
|
+
display: "-webkit-box",
|
|
397
|
+
WebkitLineClamp: 2,
|
|
398
|
+
WebkitBoxOrient: "vertical",
|
|
399
|
+
lineHeight: 1.5,
|
|
400
|
+
}}
|
|
401
|
+
>
|
|
402
|
+
{description}
|
|
403
|
+
</Typography>
|
|
404
|
+
</Tooltip>
|
|
405
|
+
</Box>
|
|
406
|
+
{mutable && (
|
|
407
|
+
<>
|
|
408
|
+
<IconButton
|
|
409
|
+
size="small"
|
|
410
|
+
onClick={handleMenuClick}
|
|
411
|
+
aria-label={`Environment actions for ${environment.name}`}
|
|
412
|
+
sx={{ flexShrink: 0, mt: -0.5, mr: -0.5 }}
|
|
413
|
+
>
|
|
414
|
+
<MoreVert fontSize="small" />
|
|
415
|
+
</IconButton>
|
|
416
|
+
<Menu
|
|
417
|
+
anchorEl={menuAnchorEl}
|
|
418
|
+
open={menuOpen}
|
|
419
|
+
onClose={handleMenuClose}
|
|
420
|
+
onClick={(e) => e.stopPropagation()}
|
|
421
|
+
anchorOrigin={{
|
|
422
|
+
vertical: "bottom",
|
|
423
|
+
horizontal: "right",
|
|
424
|
+
}}
|
|
425
|
+
transformOrigin={{
|
|
426
|
+
vertical: "top",
|
|
427
|
+
horizontal: "right",
|
|
428
|
+
}}
|
|
429
|
+
>
|
|
430
|
+
<EditEnvironmentDialog
|
|
431
|
+
environment={environment}
|
|
432
|
+
onCloseDialog={handleMenuClose}
|
|
433
|
+
/>
|
|
434
|
+
<DeleteEnvironmentDialog
|
|
435
|
+
environment={environment}
|
|
436
|
+
onCloseDialog={handleMenuClose}
|
|
437
|
+
/>
|
|
438
|
+
</Menu>
|
|
439
|
+
</>
|
|
440
|
+
)}
|
|
441
|
+
</Box>
|
|
442
|
+
</CardContent>
|
|
443
|
+
</Card>
|
|
466
444
|
);
|
|
467
445
|
}
|