@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
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
// Copyright (c) Credible Data Inc.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
import { Add } from "@mui/icons-material";
|
|
5
|
+
import {
|
|
6
|
+
Box,
|
|
7
|
+
Button,
|
|
8
|
+
Dialog,
|
|
9
|
+
DialogActions,
|
|
10
|
+
DialogContent,
|
|
11
|
+
DialogTitle,
|
|
12
|
+
Snackbar,
|
|
13
|
+
Stack,
|
|
14
|
+
TextField,
|
|
15
|
+
Typography,
|
|
16
|
+
} from "@mui/material";
|
|
17
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
18
|
+
import React, { useState } from "react";
|
|
19
|
+
import { Package } from "../../client";
|
|
20
|
+
import { useMutationWithApiError } from "../../hooks/useQueryWithApiError";
|
|
21
|
+
import { parseResourceUri } from "../../utils/formatting";
|
|
22
|
+
import { DOC_LINKS } from "../../constants/docLinks";
|
|
23
|
+
import { useServer } from "../ServerProvider";
|
|
24
|
+
|
|
25
|
+
interface AddPackageDialogProps {
|
|
26
|
+
resourceUri: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export default function AddPackageDialog({
|
|
30
|
+
resourceUri,
|
|
31
|
+
}: AddPackageDialogProps) {
|
|
32
|
+
const [open, setOpen] = useState(false);
|
|
33
|
+
const { apiClients } = useServer();
|
|
34
|
+
const queryClient = useQueryClient();
|
|
35
|
+
const [notificationMessage, setNotificationMessage] = useState("");
|
|
36
|
+
|
|
37
|
+
const { environmentName } = parseResourceUri(resourceUri);
|
|
38
|
+
|
|
39
|
+
const addPackage = useMutationWithApiError({
|
|
40
|
+
async mutationFn(variables: Package) {
|
|
41
|
+
return apiClients.packages.createPackage(environmentName, {
|
|
42
|
+
name: variables.name,
|
|
43
|
+
description: variables.description,
|
|
44
|
+
location: variables.location,
|
|
45
|
+
});
|
|
46
|
+
},
|
|
47
|
+
onSuccess() {
|
|
48
|
+
setOpen(false);
|
|
49
|
+
setNotificationMessage("Package created successfully");
|
|
50
|
+
queryClient.invalidateQueries({
|
|
51
|
+
queryKey: ["packages", environmentName],
|
|
52
|
+
});
|
|
53
|
+
},
|
|
54
|
+
onError(error) {
|
|
55
|
+
setNotificationMessage(
|
|
56
|
+
error instanceof Error
|
|
57
|
+
? error.message
|
|
58
|
+
: "An unknown error occurred",
|
|
59
|
+
);
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => {
|
|
64
|
+
event.preventDefault();
|
|
65
|
+
const formData = new FormData(event.currentTarget);
|
|
66
|
+
const name = formData.get("name")?.toString();
|
|
67
|
+
const description = formData.get("description")?.toString();
|
|
68
|
+
const location = formData.get("location")?.toString();
|
|
69
|
+
addPackage.mutate({ name, description, location });
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<>
|
|
74
|
+
<Button
|
|
75
|
+
onClick={() => setOpen(true)}
|
|
76
|
+
variant="contained"
|
|
77
|
+
color="primary"
|
|
78
|
+
startIcon={<Add />}
|
|
79
|
+
>
|
|
80
|
+
Add Package
|
|
81
|
+
</Button>
|
|
82
|
+
|
|
83
|
+
<Dialog
|
|
84
|
+
open={open}
|
|
85
|
+
onClose={() => setOpen(false)}
|
|
86
|
+
maxWidth="sm"
|
|
87
|
+
fullWidth
|
|
88
|
+
PaperProps={{ sx: { borderRadius: 2 } }}
|
|
89
|
+
>
|
|
90
|
+
<DialogTitle
|
|
91
|
+
sx={{
|
|
92
|
+
fontSize: "1.25rem",
|
|
93
|
+
fontWeight: 600,
|
|
94
|
+
letterSpacing: "-0.025em",
|
|
95
|
+
pt: 3,
|
|
96
|
+
pb: 1,
|
|
97
|
+
px: 3,
|
|
98
|
+
}}
|
|
99
|
+
>
|
|
100
|
+
Create New Package
|
|
101
|
+
</DialogTitle>
|
|
102
|
+
<DialogContent sx={{ px: 3, pb: 0 }}>
|
|
103
|
+
<Box sx={{ mb: 3 }}>
|
|
104
|
+
<Typography
|
|
105
|
+
variant="body2"
|
|
106
|
+
color="text.secondary"
|
|
107
|
+
sx={{ mb: 1.5 }}
|
|
108
|
+
>
|
|
109
|
+
Create a new Malloy package to start exploring your data.
|
|
110
|
+
</Typography>
|
|
111
|
+
<Typography
|
|
112
|
+
variant="body2"
|
|
113
|
+
color="text.secondary"
|
|
114
|
+
sx={{ mb: 1.5 }}
|
|
115
|
+
>
|
|
116
|
+
The location can be a GitHub/S3/GCP URL containing a
|
|
117
|
+
package (zipped or unzipped), or an absolute path to a
|
|
118
|
+
directory the publisher server has access to.
|
|
119
|
+
</Typography>
|
|
120
|
+
<Typography variant="body2" color="text.secondary">
|
|
121
|
+
Make sure to conform to the{" "}
|
|
122
|
+
<Box
|
|
123
|
+
component="a"
|
|
124
|
+
href={DOC_LINKS.publishing}
|
|
125
|
+
target="_blank"
|
|
126
|
+
rel="noopener noreferrer"
|
|
127
|
+
sx={{
|
|
128
|
+
color: "text.primary",
|
|
129
|
+
textDecoration: "underline",
|
|
130
|
+
}}
|
|
131
|
+
>
|
|
132
|
+
Malloy Package Format
|
|
133
|
+
</Box>
|
|
134
|
+
.
|
|
135
|
+
</Typography>
|
|
136
|
+
</Box>
|
|
137
|
+
<form onSubmit={handleSubmit} id="package-form">
|
|
138
|
+
<Stack spacing={2.5}>
|
|
139
|
+
<TextField
|
|
140
|
+
autoFocus
|
|
141
|
+
required
|
|
142
|
+
id="name"
|
|
143
|
+
name="name"
|
|
144
|
+
label="Package Name"
|
|
145
|
+
type="text"
|
|
146
|
+
fullWidth
|
|
147
|
+
variant="outlined"
|
|
148
|
+
size="small"
|
|
149
|
+
InputLabelProps={{ shrink: true }}
|
|
150
|
+
/>
|
|
151
|
+
<TextField
|
|
152
|
+
id="description"
|
|
153
|
+
name="description"
|
|
154
|
+
label="Description"
|
|
155
|
+
multiline
|
|
156
|
+
rows={3}
|
|
157
|
+
fullWidth
|
|
158
|
+
variant="outlined"
|
|
159
|
+
size="small"
|
|
160
|
+
InputLabelProps={{ shrink: true }}
|
|
161
|
+
/>
|
|
162
|
+
<TextField
|
|
163
|
+
id="location"
|
|
164
|
+
name="location"
|
|
165
|
+
label="Location"
|
|
166
|
+
type="text"
|
|
167
|
+
placeholder="e.g. s3://my-bucket/my-package.zip"
|
|
168
|
+
fullWidth
|
|
169
|
+
variant="outlined"
|
|
170
|
+
size="small"
|
|
171
|
+
InputLabelProps={{ shrink: true }}
|
|
172
|
+
/>
|
|
173
|
+
</Stack>
|
|
174
|
+
</form>
|
|
175
|
+
</DialogContent>
|
|
176
|
+
<DialogActions sx={{ px: 3, pt: 2, pb: 3, gap: 1 }}>
|
|
177
|
+
<Button
|
|
178
|
+
variant="outlined"
|
|
179
|
+
disabled={addPackage.isPending}
|
|
180
|
+
onClick={() => setOpen(false)}
|
|
181
|
+
>
|
|
182
|
+
Cancel
|
|
183
|
+
</Button>
|
|
184
|
+
<Button
|
|
185
|
+
type="submit"
|
|
186
|
+
form="package-form"
|
|
187
|
+
variant="contained"
|
|
188
|
+
loading={addPackage.isPending}
|
|
189
|
+
>
|
|
190
|
+
Save Changes
|
|
191
|
+
</Button>
|
|
192
|
+
</DialogActions>
|
|
193
|
+
</Dialog>
|
|
194
|
+
<Snackbar
|
|
195
|
+
open={notificationMessage !== ""}
|
|
196
|
+
autoHideDuration={6000}
|
|
197
|
+
onClose={() => setNotificationMessage("")}
|
|
198
|
+
message={notificationMessage}
|
|
199
|
+
/>
|
|
200
|
+
</>
|
|
201
|
+
);
|
|
202
|
+
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// Copyright (c) Credible Data Inc.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
1
4
|
import {
|
|
2
5
|
Box,
|
|
3
6
|
Divider,
|
|
@@ -62,7 +65,7 @@ export default function ConnectionExplorer({
|
|
|
62
65
|
connection,
|
|
63
66
|
}: ConnectionExplorerProps) {
|
|
64
67
|
const { apiClients } = useServer();
|
|
65
|
-
const {
|
|
68
|
+
const { environmentName: environmentName } = parseResourceUri(resourceUri);
|
|
66
69
|
const [selectedTableResource, setSelectedTableResource] = React.useState<
|
|
67
70
|
string | null
|
|
68
71
|
>(null);
|
|
@@ -76,9 +79,9 @@ export default function ConnectionExplorer({
|
|
|
76
79
|
isLoading: schemasLoading,
|
|
77
80
|
error: schemasErrorObj,
|
|
78
81
|
} = useQueryWithApiError({
|
|
79
|
-
queryKey: ["schemas",
|
|
82
|
+
queryKey: ["schemas", environmentName, connectionName],
|
|
80
83
|
queryFn: () =>
|
|
81
|
-
apiClients.connections.listSchemas(
|
|
84
|
+
apiClients.connections.listSchemas(environmentName, connectionName),
|
|
82
85
|
});
|
|
83
86
|
|
|
84
87
|
const availableSchemas = schemasData?.data || [];
|
|
@@ -119,7 +122,7 @@ export default function ConnectionExplorer({
|
|
|
119
122
|
{schemasError && (
|
|
120
123
|
<ApiErrorDisplay
|
|
121
124
|
error={schemasErrorObj}
|
|
122
|
-
context={`${
|
|
125
|
+
context={`${environmentName} > ${connectionName} > Schemas`}
|
|
123
126
|
/>
|
|
124
127
|
)}
|
|
125
128
|
{!schemasLoading &&
|
|
@@ -181,7 +184,7 @@ export default function ConnectionExplorer({
|
|
|
181
184
|
<Grid size={{ xs: 12, md: schema ? 6 : 4 }}>
|
|
182
185
|
{selectedSchema && selectedTableResource && (
|
|
183
186
|
<SelectedTableDetailPanel
|
|
184
|
-
|
|
187
|
+
environmentName={environmentName}
|
|
185
188
|
connectionName={connectionName}
|
|
186
189
|
schemaName={selectedSchema}
|
|
187
190
|
tableResource={selectedTableResource}
|
|
@@ -198,12 +201,12 @@ type TableSchemaViewerProps = {
|
|
|
198
201
|
};
|
|
199
202
|
|
|
200
203
|
function SelectedTableDetailPanel({
|
|
201
|
-
|
|
204
|
+
environmentName,
|
|
202
205
|
connectionName,
|
|
203
206
|
schemaName,
|
|
204
207
|
tableResource,
|
|
205
208
|
}: {
|
|
206
|
-
|
|
209
|
+
environmentName: string;
|
|
207
210
|
connectionName: string;
|
|
208
211
|
schemaName: string;
|
|
209
212
|
tableResource: string;
|
|
@@ -217,14 +220,14 @@ function SelectedTableDetailPanel({
|
|
|
217
220
|
} = useQueryWithApiError({
|
|
218
221
|
queryKey: [
|
|
219
222
|
"connectionTableDetail",
|
|
220
|
-
|
|
223
|
+
environmentName,
|
|
221
224
|
connectionName,
|
|
222
225
|
schemaName,
|
|
223
226
|
tableResource,
|
|
224
227
|
],
|
|
225
228
|
queryFn: () =>
|
|
226
229
|
apiClients.connections.getTable(
|
|
227
|
-
|
|
230
|
+
environmentName,
|
|
228
231
|
connectionName,
|
|
229
232
|
schemaName,
|
|
230
233
|
tableResource,
|
|
@@ -242,7 +245,7 @@ function SelectedTableDetailPanel({
|
|
|
242
245
|
{tableDetailError && (
|
|
243
246
|
<ApiErrorDisplay
|
|
244
247
|
error={tableDetailErrorObj}
|
|
245
|
-
context={`${
|
|
248
|
+
context={`${environmentName} > ${connectionName} > ${schemaName} > ${tableResource}`}
|
|
246
249
|
/>
|
|
247
250
|
)}
|
|
248
251
|
{!tableDetailError && (
|
|
@@ -319,14 +322,14 @@ function TablesInSchema({
|
|
|
319
322
|
resourceUri,
|
|
320
323
|
connection,
|
|
321
324
|
}: TablesInSchemaProps) {
|
|
322
|
-
const {
|
|
325
|
+
const { environmentName: environmentName } = parseResourceUri(resourceUri);
|
|
323
326
|
const { apiClients } = useServer();
|
|
324
327
|
const [searchTerm, setSearchTerm] = useState("");
|
|
325
328
|
const { data, isSuccess, isError, error, isLoading } = useQueryWithApiError({
|
|
326
|
-
queryKey: ["tablesInSchema",
|
|
329
|
+
queryKey: ["tablesInSchema", environmentName, connectionName, schemaName],
|
|
327
330
|
queryFn: () =>
|
|
328
331
|
apiClients.connections.listTables(
|
|
329
|
-
|
|
332
|
+
environmentName,
|
|
330
333
|
connectionName,
|
|
331
334
|
schemaName,
|
|
332
335
|
),
|
|
@@ -376,7 +379,7 @@ function TablesInSchema({
|
|
|
376
379
|
{isError && (
|
|
377
380
|
<ApiErrorDisplay
|
|
378
381
|
error={error}
|
|
379
|
-
context={`${
|
|
382
|
+
context={`${environmentName} > ${connectionName} > ${schemaName}`}
|
|
380
383
|
/>
|
|
381
384
|
)}
|
|
382
385
|
{isSuccess && filteredTables.length === 0 && (
|
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
// Copyright (c) Credible Data Inc.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
import { MoreVert } from "@mui/icons-material";
|
|
5
|
+
import StorageOutlinedIcon from "@mui/icons-material/StorageOutlined";
|
|
6
|
+
import {
|
|
7
|
+
Box,
|
|
8
|
+
Card,
|
|
9
|
+
CardContent,
|
|
10
|
+
Dialog,
|
|
11
|
+
DialogContent,
|
|
12
|
+
DialogTitle,
|
|
13
|
+
Grid,
|
|
14
|
+
IconButton,
|
|
15
|
+
Menu,
|
|
16
|
+
Snackbar,
|
|
17
|
+
Typography,
|
|
18
|
+
} from "@mui/material";
|
|
19
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
20
|
+
import { useState } from "react";
|
|
21
|
+
import { Connection as ApiConnection } from "../../client/api";
|
|
22
|
+
import {
|
|
23
|
+
useMutationWithApiError,
|
|
24
|
+
useQueryWithApiError,
|
|
25
|
+
} from "../../hooks/useQueryWithApiError";
|
|
26
|
+
import { encodeResourceUri, parseResourceUri } from "../../utils/formatting";
|
|
27
|
+
import { ApiErrorDisplay } from "../ApiErrorDisplay";
|
|
28
|
+
import AddConnectionDialog from "../Connections/AddConnectionDialog";
|
|
29
|
+
import DeleteConnectionDialog from "../Connections/DeleteConnectionDialog";
|
|
30
|
+
import EditConnectionDialog from "../Connections/EditConnectionDialog";
|
|
31
|
+
import { useServer } from "../ServerProvider";
|
|
32
|
+
import ConnectionExplorer from "./ConnectionExplorer";
|
|
33
|
+
|
|
34
|
+
const CONNECTION_TYPE_LABELS: Record<string, string> = {
|
|
35
|
+
bigquery: "BigQuery",
|
|
36
|
+
snowflake: "Snowflake",
|
|
37
|
+
postgres: "PostgreSQL",
|
|
38
|
+
mysql: "MySQL",
|
|
39
|
+
trino: "Trino",
|
|
40
|
+
databricks: "Databricks",
|
|
41
|
+
duckdb: "DuckDB",
|
|
42
|
+
ducklake: "DuckLake",
|
|
43
|
+
s3: "S3",
|
|
44
|
+
gcs: "GCS",
|
|
45
|
+
azure: "Azure",
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
function typeLabel(type: string | undefined): string {
|
|
49
|
+
if (!type) return "";
|
|
50
|
+
return CONNECTION_TYPE_LABELS[type] ?? type;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
type ConnectionsProps = {
|
|
54
|
+
resourceUri: string;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export default function Connections({ resourceUri }: ConnectionsProps) {
|
|
58
|
+
const { apiClients, mutable } = useServer();
|
|
59
|
+
const queryClient = useQueryClient();
|
|
60
|
+
const { environmentName } = parseResourceUri(resourceUri);
|
|
61
|
+
const [notificationMessage, setNotificationMessage] = useState("");
|
|
62
|
+
const [selectedConnection, setSelectedConnection] = useState<string | null>(
|
|
63
|
+
null,
|
|
64
|
+
);
|
|
65
|
+
const selectedConnectionResourceUri = encodeResourceUri({
|
|
66
|
+
environmentName,
|
|
67
|
+
connectionName: selectedConnection,
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const { data, isSuccess, isError, error } = useQueryWithApiError({
|
|
71
|
+
queryKey: ["connections", environmentName],
|
|
72
|
+
queryFn: () => apiClients.connections.listConnections(environmentName),
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
const handleCloseDialog = () => {
|
|
76
|
+
setSelectedConnection(null);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const addConnection = useMutationWithApiError({
|
|
80
|
+
mutationFn: (payload: ApiConnection) => {
|
|
81
|
+
return apiClients.environments.updateEnvironment(environmentName, {
|
|
82
|
+
name: environmentName,
|
|
83
|
+
connections: [...data!.data, payload],
|
|
84
|
+
});
|
|
85
|
+
},
|
|
86
|
+
onSuccess() {
|
|
87
|
+
setNotificationMessage("Connection added successfully");
|
|
88
|
+
queryClient.invalidateQueries({
|
|
89
|
+
queryKey: ["connections", environmentName],
|
|
90
|
+
});
|
|
91
|
+
},
|
|
92
|
+
onError(error) {
|
|
93
|
+
setNotificationMessage(error.message);
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
const updateConnection = useMutationWithApiError({
|
|
98
|
+
mutationFn: (payload: ApiConnection) => {
|
|
99
|
+
return apiClients.environments.updateEnvironment(environmentName, {
|
|
100
|
+
name: environmentName,
|
|
101
|
+
connections: data!.data.map((conn) =>
|
|
102
|
+
conn.name === payload.name ? payload : conn,
|
|
103
|
+
),
|
|
104
|
+
});
|
|
105
|
+
},
|
|
106
|
+
onSuccess(_data, variables) {
|
|
107
|
+
setNotificationMessage(
|
|
108
|
+
`Connection ${variables.name} updated successfully`,
|
|
109
|
+
);
|
|
110
|
+
queryClient.invalidateQueries({
|
|
111
|
+
queryKey: ["connections", environmentName],
|
|
112
|
+
});
|
|
113
|
+
},
|
|
114
|
+
onError(error) {
|
|
115
|
+
setNotificationMessage(error.message);
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
const deleteConnection = useMutationWithApiError({
|
|
120
|
+
mutationFn: (payload: ApiConnection) => {
|
|
121
|
+
return apiClients.environments.updateEnvironment(environmentName, {
|
|
122
|
+
name: environmentName,
|
|
123
|
+
connections: data!.data.filter(
|
|
124
|
+
(conn) => conn.name !== payload.name,
|
|
125
|
+
),
|
|
126
|
+
});
|
|
127
|
+
},
|
|
128
|
+
onSuccess(_data, variables) {
|
|
129
|
+
setNotificationMessage(
|
|
130
|
+
`Connection ${variables.name} deleted successfully`,
|
|
131
|
+
);
|
|
132
|
+
queryClient.invalidateQueries({
|
|
133
|
+
queryKey: ["connections", environmentName],
|
|
134
|
+
});
|
|
135
|
+
},
|
|
136
|
+
onError(error) {
|
|
137
|
+
setNotificationMessage(error.message);
|
|
138
|
+
},
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
const connections = isSuccess
|
|
142
|
+
? [...data.data].sort((a, b) =>
|
|
143
|
+
(a.name ?? "").localeCompare(b.name ?? ""),
|
|
144
|
+
)
|
|
145
|
+
: [];
|
|
146
|
+
|
|
147
|
+
const isMutating =
|
|
148
|
+
addConnection.isPending ||
|
|
149
|
+
updateConnection.isPending ||
|
|
150
|
+
deleteConnection.isPending;
|
|
151
|
+
|
|
152
|
+
return (
|
|
153
|
+
<Box>
|
|
154
|
+
<Box
|
|
155
|
+
sx={{
|
|
156
|
+
display: "flex",
|
|
157
|
+
alignItems: "flex-start",
|
|
158
|
+
justifyContent: "space-between",
|
|
159
|
+
mb: 3,
|
|
160
|
+
}}
|
|
161
|
+
>
|
|
162
|
+
<Box>
|
|
163
|
+
<Typography
|
|
164
|
+
variant="h6"
|
|
165
|
+
sx={{ fontWeight: 600, letterSpacing: "-0.025em" }}
|
|
166
|
+
>
|
|
167
|
+
Connections
|
|
168
|
+
</Typography>
|
|
169
|
+
<Typography variant="body2" color="text.secondary">
|
|
170
|
+
Database connections available to packages in this environment
|
|
171
|
+
</Typography>
|
|
172
|
+
</Box>
|
|
173
|
+
{mutable && isSuccess && (
|
|
174
|
+
<AddConnectionDialog
|
|
175
|
+
onSubmit={(payload) => addConnection.mutateAsync(payload)}
|
|
176
|
+
isSubmitting={addConnection.isPending}
|
|
177
|
+
/>
|
|
178
|
+
)}
|
|
179
|
+
</Box>
|
|
180
|
+
|
|
181
|
+
{!isSuccess && !isError && (
|
|
182
|
+
<Typography variant="body2" color="text.secondary">
|
|
183
|
+
Fetching Connections...
|
|
184
|
+
</Typography>
|
|
185
|
+
)}
|
|
186
|
+
{isError && (
|
|
187
|
+
<ApiErrorDisplay
|
|
188
|
+
error={error}
|
|
189
|
+
context={`${environmentName} > Connections`}
|
|
190
|
+
/>
|
|
191
|
+
)}
|
|
192
|
+
{isSuccess && connections.length === 0 && (
|
|
193
|
+
<Typography variant="body2" color="text.secondary">
|
|
194
|
+
No connections yet.
|
|
195
|
+
</Typography>
|
|
196
|
+
)}
|
|
197
|
+
{isSuccess && connections.length > 0 && (
|
|
198
|
+
<Grid container spacing={2}>
|
|
199
|
+
{connections.map((conn) => (
|
|
200
|
+
<Grid size={{ xs: 12, sm: 6, md: 4 }} key={conn.name}>
|
|
201
|
+
<ConnectionCard
|
|
202
|
+
connection={conn}
|
|
203
|
+
mutable={mutable}
|
|
204
|
+
isMutating={isMutating}
|
|
205
|
+
onOpenExplorer={() =>
|
|
206
|
+
setSelectedConnection(conn.name ?? null)
|
|
207
|
+
}
|
|
208
|
+
onEdit={(payload) =>
|
|
209
|
+
updateConnection.mutateAsync(payload)
|
|
210
|
+
}
|
|
211
|
+
onDelete={(payload) => {
|
|
212
|
+
if (!conn.resource) {
|
|
213
|
+
deleteConnection.mutateAsync(payload);
|
|
214
|
+
} else {
|
|
215
|
+
setNotificationMessage(
|
|
216
|
+
"Cannot delete this connection",
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
}}
|
|
220
|
+
/>
|
|
221
|
+
</Grid>
|
|
222
|
+
))}
|
|
223
|
+
</Grid>
|
|
224
|
+
)}
|
|
225
|
+
|
|
226
|
+
<Snackbar
|
|
227
|
+
open={notificationMessage !== ""}
|
|
228
|
+
autoHideDuration={6000}
|
|
229
|
+
onClose={() => setNotificationMessage("")}
|
|
230
|
+
message={notificationMessage}
|
|
231
|
+
/>
|
|
232
|
+
|
|
233
|
+
<Dialog
|
|
234
|
+
open={selectedConnection !== null}
|
|
235
|
+
onClose={handleCloseDialog}
|
|
236
|
+
maxWidth="lg"
|
|
237
|
+
fullWidth
|
|
238
|
+
>
|
|
239
|
+
<DialogTitle>
|
|
240
|
+
Connection Explorer: {selectedConnection}
|
|
241
|
+
<IconButton
|
|
242
|
+
aria-label="close"
|
|
243
|
+
onClick={handleCloseDialog}
|
|
244
|
+
sx={{ position: "absolute", right: 8, top: 8 }}
|
|
245
|
+
>
|
|
246
|
+
<Box
|
|
247
|
+
sx={{
|
|
248
|
+
width: 24,
|
|
249
|
+
height: 24,
|
|
250
|
+
display: "flex",
|
|
251
|
+
alignItems: "center",
|
|
252
|
+
justifyContent: "center",
|
|
253
|
+
}}
|
|
254
|
+
>
|
|
255
|
+
X
|
|
256
|
+
</Box>
|
|
257
|
+
</IconButton>
|
|
258
|
+
</DialogTitle>
|
|
259
|
+
<DialogContent>
|
|
260
|
+
{selectedConnection && (
|
|
261
|
+
<ConnectionExplorer
|
|
262
|
+
resourceUri={selectedConnectionResourceUri}
|
|
263
|
+
connectionName={selectedConnection}
|
|
264
|
+
connection={data?.data?.find(
|
|
265
|
+
(c) => c.name === selectedConnection,
|
|
266
|
+
)}
|
|
267
|
+
/>
|
|
268
|
+
)}
|
|
269
|
+
</DialogContent>
|
|
270
|
+
</Dialog>
|
|
271
|
+
</Box>
|
|
272
|
+
);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
type ConnectionCardProps = {
|
|
276
|
+
connection: ApiConnection;
|
|
277
|
+
mutable: boolean;
|
|
278
|
+
isMutating: boolean;
|
|
279
|
+
onOpenExplorer: () => void;
|
|
280
|
+
onEdit: (connection: ApiConnection) => Promise<unknown>;
|
|
281
|
+
onDelete: (connection: ApiConnection) => Promise<unknown> | void;
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
function ConnectionCard({
|
|
285
|
+
connection,
|
|
286
|
+
mutable,
|
|
287
|
+
isMutating,
|
|
288
|
+
onOpenExplorer,
|
|
289
|
+
onEdit,
|
|
290
|
+
onDelete,
|
|
291
|
+
}: ConnectionCardProps) {
|
|
292
|
+
const [menuAnchorEl, setMenuAnchorEl] = useState<null | HTMLElement>(null);
|
|
293
|
+
const menuOpen = Boolean(menuAnchorEl);
|
|
294
|
+
|
|
295
|
+
const handleMenuClick = (event: React.MouseEvent<HTMLElement>) => {
|
|
296
|
+
event.stopPropagation();
|
|
297
|
+
setMenuAnchorEl(event.currentTarget);
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
const handleMenuClose = () => {
|
|
301
|
+
setMenuAnchorEl(null);
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
return (
|
|
305
|
+
<Card
|
|
306
|
+
variant="outlined"
|
|
307
|
+
onClick={onOpenExplorer}
|
|
308
|
+
sx={{
|
|
309
|
+
height: "100%",
|
|
310
|
+
cursor: "pointer",
|
|
311
|
+
borderRadius: 3,
|
|
312
|
+
borderColor: "divider",
|
|
313
|
+
boxShadow: "none",
|
|
314
|
+
transition: "all 0.2s ease-in-out",
|
|
315
|
+
"&:hover": { boxShadow: 2, borderColor: "primary.main" },
|
|
316
|
+
}}
|
|
317
|
+
>
|
|
318
|
+
<CardContent sx={{ p: 2.5, "&:last-child": { pb: 2.5 } }}>
|
|
319
|
+
<Box sx={{ display: "flex", alignItems: "flex-start", gap: 1.5 }}>
|
|
320
|
+
<Box
|
|
321
|
+
sx={{
|
|
322
|
+
width: 36,
|
|
323
|
+
height: 36,
|
|
324
|
+
borderRadius: 1.5,
|
|
325
|
+
bgcolor: "warning.light",
|
|
326
|
+
display: "flex",
|
|
327
|
+
alignItems: "center",
|
|
328
|
+
justifyContent: "center",
|
|
329
|
+
flexShrink: 0,
|
|
330
|
+
color: "warning.main",
|
|
331
|
+
}}
|
|
332
|
+
>
|
|
333
|
+
<StorageOutlinedIcon sx={{ fontSize: 20 }} />
|
|
334
|
+
</Box>
|
|
335
|
+
<Box sx={{ flex: 1, minWidth: 0 }}>
|
|
336
|
+
<Typography
|
|
337
|
+
variant="subtitle1"
|
|
338
|
+
component="h6"
|
|
339
|
+
noWrap
|
|
340
|
+
sx={{ fontWeight: 600, mb: 0.5 }}
|
|
341
|
+
>
|
|
342
|
+
{connection.name}
|
|
343
|
+
</Typography>
|
|
344
|
+
<Typography variant="body2" color="text.secondary" noWrap>
|
|
345
|
+
{typeLabel(connection.type)}
|
|
346
|
+
</Typography>
|
|
347
|
+
</Box>
|
|
348
|
+
{mutable && (
|
|
349
|
+
<>
|
|
350
|
+
<IconButton
|
|
351
|
+
size="small"
|
|
352
|
+
onClick={handleMenuClick}
|
|
353
|
+
aria-label={`Connection actions for ${connection.name ?? ""}`.trim()}
|
|
354
|
+
sx={{ flexShrink: 0, mt: -0.5, mr: -0.5 }}
|
|
355
|
+
>
|
|
356
|
+
<MoreVert fontSize="small" />
|
|
357
|
+
</IconButton>
|
|
358
|
+
<Menu
|
|
359
|
+
anchorEl={menuAnchorEl}
|
|
360
|
+
open={menuOpen}
|
|
361
|
+
onClose={handleMenuClose}
|
|
362
|
+
onClick={(e) => e.stopPropagation()}
|
|
363
|
+
anchorOrigin={{
|
|
364
|
+
vertical: "bottom",
|
|
365
|
+
horizontal: "right",
|
|
366
|
+
}}
|
|
367
|
+
transformOrigin={{
|
|
368
|
+
vertical: "top",
|
|
369
|
+
horizontal: "right",
|
|
370
|
+
}}
|
|
371
|
+
>
|
|
372
|
+
<EditConnectionDialog
|
|
373
|
+
connection={connection}
|
|
374
|
+
onSubmit={onEdit}
|
|
375
|
+
isSubmitting={isMutating}
|
|
376
|
+
onCloseDialog={handleMenuClose}
|
|
377
|
+
/>
|
|
378
|
+
<DeleteConnectionDialog
|
|
379
|
+
connection={connection}
|
|
380
|
+
onCloseDialog={handleMenuClose}
|
|
381
|
+
isMutating={isMutating}
|
|
382
|
+
onDelete={() => onDelete(connection)}
|
|
383
|
+
/>
|
|
384
|
+
</Menu>
|
|
385
|
+
</>
|
|
386
|
+
)}
|
|
387
|
+
</Box>
|
|
388
|
+
</CardContent>
|
|
389
|
+
</Card>
|
|
390
|
+
);
|
|
391
|
+
}
|