@malloy-publisher/sdk 0.0.198-dev → 0.0.198-dev1
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/dist/{ServerProvider-DDScRRDc.es.js → ServerProvider-BuM1usxf.es.js} +181 -177
- package/dist/{ServerProvider-IhQ4aYBm.cjs.js → ServerProvider-C_Mnvmgc.cjs.js} +1 -1
- package/dist/client/api.d.ts +61 -4
- package/dist/client/index.cjs.js +1 -1
- package/dist/client/index.es.js +1 -1
- package/dist/components/Package/ContentTypeIcon.d.ts +16 -0
- package/dist/components/Package/index.d.ts +0 -1
- package/dist/components/styles.d.ts +16 -0
- package/dist/{core-w79IMXAG.es.js → core-DfcpQGVP.es.js} +1 -1
- package/dist/{core-7-3Jcsb0.cjs.js → core-yDgxkpo0.cjs.js} +1 -1
- package/dist/index-CMA8U4-B.cjs.js +228 -0
- package/dist/{index-CN0_kZSF.es.js → index-Y4ooZDYA.es.js} +17654 -20603
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +33 -34
- package/package.json +5 -5
- package/src/components/Environment/AddPackageDialog.tsx +116 -79
- package/src/components/Environment/DeletePackageDialog.tsx +3 -2
- package/src/components/Environment/Environment.tsx +44 -23
- package/src/components/Environment/Packages.tsx +164 -156
- package/src/components/Home/DeleteEnvironmentDialog.tsx +3 -2
- package/src/components/Home/Home.tsx +272 -389
- package/src/components/Model/Model.tsx +2 -2
- package/src/components/Model/ModelCell.tsx +1 -1
- package/src/components/Model/ModelExplorerDialog.tsx +1 -1
- package/src/components/Model/SourcesExplorer.tsx +4 -4
- package/src/components/Notebook/Notebook.tsx +4 -9
- package/src/components/Notebook/NotebookCell.tsx +10 -7
- package/src/components/Package/ContentTypeIcon.tsx +79 -0
- package/src/components/Package/Package.tsx +387 -55
- package/src/components/Package/index.ts +0 -1
- package/src/components/QueryResult/QueryResult.tsx +1 -1
- package/src/components/RenderedResult/RenderedResult.tsx +9 -8
- package/src/components/ResultsDialog.tsx +1 -1
- package/src/components/styles.ts +28 -15
- package/dist/components/Package/Config.d.ts +0 -5
- package/dist/components/Package/Databases.d.ts +0 -5
- package/dist/components/Package/FileTreeView.d.ts +0 -9
- package/dist/components/Package/Models.d.ts +0 -6
- package/dist/components/Package/Notebooks.d.ts +0 -6
- package/dist/index-Xo_ADux9.cjs.js +0 -233
- package/src/components/Package/Config.tsx +0 -97
- package/src/components/Package/Databases.tsx +0 -228
- package/src/components/Package/FileTreeView.tsx +0 -241
- package/src/components/Package/Models.tsx +0 -68
- package/src/components/Package/Notebooks.tsx +0 -77
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { MoreVert } from "@mui/icons-material";
|
|
2
|
+
import Inventory2OutlinedIcon from "@mui/icons-material/Inventory2Outlined";
|
|
2
3
|
import {
|
|
3
4
|
Box,
|
|
4
|
-
|
|
5
|
+
Card,
|
|
6
|
+
CardContent,
|
|
5
7
|
Grid,
|
|
6
8
|
IconButton,
|
|
7
9
|
Menu,
|
|
10
|
+
Tooltip,
|
|
8
11
|
Typography,
|
|
9
12
|
} from "@mui/material";
|
|
10
13
|
import { useState } from "react";
|
|
@@ -14,7 +17,6 @@ import { encodeResourceUri, parseResourceUri } from "../../utils/formatting";
|
|
|
14
17
|
import { ApiErrorDisplay } from "../ApiErrorDisplay";
|
|
15
18
|
import { Loading } from "../Loading";
|
|
16
19
|
import { useServer } from "../ServerProvider";
|
|
17
|
-
import { PackageCard, PackageCardContent } from "../styles";
|
|
18
20
|
import DeletePackageDialog from "./DeletePackageDialog";
|
|
19
21
|
import EditPackageDialog from "./EditPackageDialog";
|
|
20
22
|
|
|
@@ -23,170 +25,176 @@ interface PackagesProps {
|
|
|
23
25
|
resourceUri: string;
|
|
24
26
|
}
|
|
25
27
|
|
|
26
|
-
const PackageMenu = ({
|
|
27
|
-
package: p,
|
|
28
|
-
resourceUri: packageResourceUri,
|
|
29
|
-
}: {
|
|
30
|
-
package: Package;
|
|
31
|
-
resourceUri: string;
|
|
32
|
-
}) => {
|
|
33
|
-
const { mutable } = useServer();
|
|
34
|
-
const [menuAnchorEl, setMenuAnchorEl] = useState<null | HTMLElement>(null);
|
|
35
|
-
const isMenuOpen = Boolean(menuAnchorEl);
|
|
36
|
-
const openMenu = (event: React.MouseEvent<HTMLElement>) => {
|
|
37
|
-
setMenuAnchorEl(event.currentTarget);
|
|
38
|
-
};
|
|
39
|
-
const closeMenu = () => {
|
|
40
|
-
setMenuAnchorEl(null);
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
return (
|
|
44
|
-
<>
|
|
45
|
-
{mutable && (
|
|
46
|
-
<>
|
|
47
|
-
<IconButton
|
|
48
|
-
aria-label={`Package actions for ${p.name}`}
|
|
49
|
-
onClick={(event) => {
|
|
50
|
-
event.stopPropagation();
|
|
51
|
-
openMenu(event);
|
|
52
|
-
}}
|
|
53
|
-
aria-controls={isMenuOpen ? "package-menu" : undefined}
|
|
54
|
-
aria-haspopup="true"
|
|
55
|
-
aria-expanded={isMenuOpen ? "true" : undefined}
|
|
56
|
-
>
|
|
57
|
-
<MoreVert fontSize="small" />
|
|
58
|
-
</IconButton>
|
|
59
|
-
<Menu
|
|
60
|
-
id="package-menu"
|
|
61
|
-
aria-haspopup="true"
|
|
62
|
-
aria-expanded={isMenuOpen ? "true" : undefined}
|
|
63
|
-
open={isMenuOpen}
|
|
64
|
-
anchorEl={menuAnchorEl}
|
|
65
|
-
onClose={closeMenu}
|
|
66
|
-
disableRestoreFocus
|
|
67
|
-
anchorOrigin={{
|
|
68
|
-
vertical: "top",
|
|
69
|
-
horizontal: "left",
|
|
70
|
-
}}
|
|
71
|
-
transformOrigin={{
|
|
72
|
-
vertical: "top",
|
|
73
|
-
horizontal: "right",
|
|
74
|
-
}}
|
|
75
|
-
onClick={(event) => {
|
|
76
|
-
event.stopPropagation();
|
|
77
|
-
}}
|
|
78
|
-
>
|
|
79
|
-
<EditPackageDialog
|
|
80
|
-
package={p}
|
|
81
|
-
resourceUri={packageResourceUri}
|
|
82
|
-
onCloseDialog={closeMenu}
|
|
83
|
-
/>
|
|
84
|
-
<DeletePackageDialog
|
|
85
|
-
resourceUri={packageResourceUri}
|
|
86
|
-
onCloseDialog={closeMenu}
|
|
87
|
-
/>
|
|
88
|
-
</Menu>
|
|
89
|
-
</>
|
|
90
|
-
)}
|
|
91
|
-
</>
|
|
92
|
-
);
|
|
93
|
-
};
|
|
94
|
-
|
|
95
28
|
export default function Packages({
|
|
96
29
|
onSelectPackage,
|
|
97
30
|
resourceUri,
|
|
98
31
|
}: PackagesProps) {
|
|
99
32
|
const { apiClients } = useServer();
|
|
100
|
-
const { environmentName
|
|
33
|
+
const { environmentName } = parseResourceUri(resourceUri);
|
|
101
34
|
const { data, isSuccess, isError, error } = useQueryWithApiError({
|
|
102
35
|
queryKey: ["packages", environmentName],
|
|
103
36
|
queryFn: () => apiClients.packages.listPackages(environmentName),
|
|
104
37
|
});
|
|
105
38
|
|
|
39
|
+
if (isError) {
|
|
40
|
+
return (
|
|
41
|
+
<ApiErrorDisplay
|
|
42
|
+
error={error}
|
|
43
|
+
context={`${environmentName} > Packages`}
|
|
44
|
+
/>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (!isSuccess) {
|
|
49
|
+
return <Loading text="Fetching Packages..." />;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const packages = [...data.data].sort((a, b) => a.name.localeCompare(b.name));
|
|
53
|
+
|
|
106
54
|
return (
|
|
107
|
-
|
|
108
|
-
{
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
55
|
+
<Grid container spacing={2}>
|
|
56
|
+
{packages.map((pkg) => {
|
|
57
|
+
const packageResourceUri = encodeResourceUri({
|
|
58
|
+
environmentName,
|
|
59
|
+
packageName: pkg.name,
|
|
60
|
+
});
|
|
61
|
+
return (
|
|
62
|
+
<Grid size={{ xs: 12, sm: 6, md: 4 }} key={pkg.name}>
|
|
63
|
+
<PackageCard
|
|
64
|
+
pkg={pkg}
|
|
65
|
+
packageResourceUri={packageResourceUri}
|
|
66
|
+
onSelectPackage={onSelectPackage}
|
|
67
|
+
/>
|
|
68
|
+
</Grid>
|
|
69
|
+
);
|
|
70
|
+
})}
|
|
71
|
+
</Grid>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function PackageCard({
|
|
76
|
+
pkg,
|
|
77
|
+
packageResourceUri,
|
|
78
|
+
onSelectPackage,
|
|
79
|
+
}: {
|
|
80
|
+
pkg: Package;
|
|
81
|
+
packageResourceUri: string;
|
|
82
|
+
onSelectPackage: (to: string, event?: React.MouseEvent) => void;
|
|
83
|
+
}) {
|
|
84
|
+
const { mutable } = useServer();
|
|
85
|
+
const [menuAnchorEl, setMenuAnchorEl] = useState<null | HTMLElement>(null);
|
|
86
|
+
const menuOpen = Boolean(menuAnchorEl);
|
|
87
|
+
|
|
88
|
+
const handleClick = (event: React.MouseEvent) => {
|
|
89
|
+
onSelectPackage(pkg.name, event);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const handleMenuClick = (event: React.MouseEvent<HTMLElement>) => {
|
|
93
|
+
event.stopPropagation();
|
|
94
|
+
setMenuAnchorEl(event.currentTarget);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const handleMenuClose = () => {
|
|
98
|
+
setMenuAnchorEl(null);
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
const description = pkg.description ?? "";
|
|
102
|
+
|
|
103
|
+
return (
|
|
104
|
+
<Card
|
|
105
|
+
variant="outlined"
|
|
106
|
+
onClick={handleClick}
|
|
107
|
+
sx={{
|
|
108
|
+
height: "100%",
|
|
109
|
+
cursor: "pointer",
|
|
110
|
+
borderRadius: 3,
|
|
111
|
+
borderColor: "divider",
|
|
112
|
+
boxShadow: "none",
|
|
113
|
+
transition: "all 0.2s ease-in-out",
|
|
114
|
+
"&:hover": { boxShadow: 2, borderColor: "primary.main" },
|
|
115
|
+
}}
|
|
116
|
+
>
|
|
117
|
+
<CardContent sx={{ p: 2.5, "&:last-child": { pb: 2.5 } }}>
|
|
118
|
+
<Box sx={{ display: "flex", alignItems: "flex-start", gap: 1.5 }}>
|
|
119
|
+
<Box
|
|
120
|
+
sx={{
|
|
121
|
+
width: 36,
|
|
122
|
+
height: 36,
|
|
123
|
+
borderRadius: 1.5,
|
|
124
|
+
bgcolor: "grey.100",
|
|
125
|
+
display: "flex",
|
|
126
|
+
alignItems: "center",
|
|
127
|
+
justifyContent: "center",
|
|
128
|
+
flexShrink: 0,
|
|
129
|
+
color: "text.primary",
|
|
130
|
+
}}
|
|
131
|
+
>
|
|
132
|
+
<Inventory2OutlinedIcon sx={{ fontSize: 20 }} />
|
|
133
|
+
</Box>
|
|
134
|
+
<Box sx={{ flex: 1, minWidth: 0 }}>
|
|
135
|
+
<Typography
|
|
136
|
+
variant="subtitle1"
|
|
137
|
+
component="h6"
|
|
138
|
+
noWrap
|
|
139
|
+
sx={{ fontWeight: 600, mb: 0.5 }}
|
|
140
|
+
>
|
|
141
|
+
{pkg.name}
|
|
142
|
+
</Typography>
|
|
143
|
+
<Tooltip title={description} followCursor enterDelay={1000}>
|
|
144
|
+
<Typography
|
|
145
|
+
variant="body2"
|
|
146
|
+
color="text.secondary"
|
|
147
|
+
sx={{
|
|
148
|
+
overflow: "hidden",
|
|
149
|
+
textOverflow: "ellipsis",
|
|
150
|
+
display: "-webkit-box",
|
|
151
|
+
WebkitLineClamp: 2,
|
|
152
|
+
WebkitBoxOrient: "vertical",
|
|
153
|
+
lineHeight: 1.5,
|
|
154
|
+
}}
|
|
155
|
+
>
|
|
156
|
+
{description}
|
|
157
|
+
</Typography>
|
|
158
|
+
</Tooltip>
|
|
159
|
+
</Box>
|
|
160
|
+
{mutable && (
|
|
161
|
+
<>
|
|
162
|
+
<IconButton
|
|
163
|
+
size="small"
|
|
164
|
+
onClick={handleMenuClick}
|
|
165
|
+
aria-label={`Package actions for ${pkg.name}`}
|
|
166
|
+
sx={{ flexShrink: 0, mt: -0.5, mr: -0.5 }}
|
|
167
|
+
>
|
|
168
|
+
<MoreVert fontSize="small" />
|
|
169
|
+
</IconButton>
|
|
170
|
+
<Menu
|
|
171
|
+
anchorEl={menuAnchorEl}
|
|
172
|
+
open={menuOpen}
|
|
173
|
+
onClose={handleMenuClose}
|
|
174
|
+
onClick={(e) => e.stopPropagation()}
|
|
175
|
+
anchorOrigin={{
|
|
176
|
+
vertical: "bottom",
|
|
177
|
+
horizontal: "right",
|
|
178
|
+
}}
|
|
179
|
+
transformOrigin={{
|
|
180
|
+
vertical: "top",
|
|
181
|
+
horizontal: "right",
|
|
182
|
+
}}
|
|
183
|
+
>
|
|
184
|
+
<EditPackageDialog
|
|
185
|
+
package={pkg}
|
|
186
|
+
resourceUri={packageResourceUri}
|
|
187
|
+
onCloseDialog={handleMenuClose}
|
|
188
|
+
/>
|
|
189
|
+
<DeletePackageDialog
|
|
190
|
+
resourceUri={packageResourceUri}
|
|
191
|
+
onCloseDialog={handleMenuClose}
|
|
192
|
+
/>
|
|
193
|
+
</Menu>
|
|
194
|
+
</>
|
|
195
|
+
)}
|
|
196
|
+
</Box>
|
|
197
|
+
</CardContent>
|
|
198
|
+
</Card>
|
|
191
199
|
);
|
|
192
200
|
}
|
|
@@ -13,6 +13,7 @@ import { Environment } from "../../client";
|
|
|
13
13
|
import { useMutationWithApiError } from "../../hooks/useQueryWithApiError";
|
|
14
14
|
import { useServer } from "../ServerProvider";
|
|
15
15
|
import { useQueryClient } from "@tanstack/react-query";
|
|
16
|
+
import { MALLOY_BRAND } from "../styles";
|
|
16
17
|
|
|
17
18
|
export default function DeleteEnvironmentDialog({
|
|
18
19
|
environment,
|
|
@@ -89,8 +90,8 @@ export default function DeleteEnvironmentDialog({
|
|
|
89
90
|
variant="outlined"
|
|
90
91
|
onClick={handleClose}
|
|
91
92
|
style={{
|
|
92
|
-
borderColor:
|
|
93
|
-
color:
|
|
93
|
+
borderColor: MALLOY_BRAND.teal,
|
|
94
|
+
color: MALLOY_BRAND.teal,
|
|
94
95
|
}}
|
|
95
96
|
>
|
|
96
97
|
Cancel
|