@malloy-publisher/sdk 0.3.1 → 0.4.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 +33 -9
- package/dist/{DocumentStorageProvider-tGvodI8f.es.js → DocumentStorage-BiFqO15i.es.js} +7126 -6943
- package/dist/DocumentStorage-CMyLifsz.cjs.js +134 -0
- package/dist/RenderedResult-CZzE8wv-.cjs.js +115 -0
- package/dist/{RenderedResult-mDE-4u8S.es.js → RenderedResult-CvrmYyr5.es.js} +64 -57
- package/dist/{ServerProvider-X2Ma0HRs.es.js → ServerProvider-BWOEKg0O.es.js} +1217 -1244
- package/dist/ServerProvider-Cc489A3f.cjs.js +1 -0
- package/dist/builder/index.cjs.js +52 -52
- package/dist/builder/index.es.js +3961 -3960
- package/dist/client/api.d.ts +100 -42
- package/dist/client/index.cjs.js +1 -1
- package/dist/client/index.es.js +1 -1
- package/dist/components/AppDialog.d.ts +30 -0
- package/dist/components/BackLink.d.ts +32 -0
- package/dist/components/Dashboard/DashboardBar.d.ts +21 -0
- package/dist/components/Dashboard/telemetry.d.ts +24 -7
- package/dist/components/DashboardBuilder/BuilderToolbar.d.ts +12 -10
- package/dist/components/DashboardBuilder/DashboardBuilder.d.ts +20 -2
- package/dist/components/DashboardBuilder/DashboardEditor.d.ts +21 -11
- package/dist/components/DashboardBuilder/newDashboard.d.ts +17 -0
- package/dist/components/DashboardBuilder/spliceDocument.d.ts +10 -1
- package/dist/components/DocumentStorage/DocumentStorage.d.ts +69 -5
- package/dist/components/DocumentStorage/index.d.ts +1 -0
- package/dist/components/ItemRow.d.ts +38 -0
- package/dist/components/Materializations/MaterializationDetailDialog.d.ts +1 -2
- package/dist/components/Materializations/MaterializationRunsList.d.ts +1 -5
- package/dist/components/Materializations/Materializations.d.ts +7 -3
- package/dist/components/Materializations/ScopeButton.d.ts +18 -0
- package/dist/components/Materializations/SectionLabel.d.ts +7 -4
- package/dist/components/Materializations/TriggerLabel.d.ts +14 -0
- package/dist/components/Materializations/index.d.ts +0 -1
- package/dist/components/Package/ContentTypeIcon.d.ts +3 -5
- package/dist/components/Package/NewDashboardDialog.d.ts +18 -0
- package/dist/components/Package/index.d.ts +0 -1
- package/dist/components/PackageSection.d.ts +23 -0
- package/dist/components/buttons.d.ts +53 -0
- package/dist/components/index.d.ts +5 -0
- package/dist/components/styles.d.ts +49 -40
- package/dist/hooks/useCrudMutation.d.ts +42 -0
- package/dist/index.cjs.js +22 -26
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +17431 -20676
- package/dist/telemetry/consoleEvents.d.ts +60 -0
- package/dist/utils/sha256.d.ts +2 -0
- package/package.json +1 -1
- package/src/components/AppDialog.tsx +115 -0
- package/src/components/BackLink.tsx +83 -0
- package/src/components/Connections/AddConnectionDialog.tsx +50 -70
- package/src/components/Connections/DeleteConnectionDialog.tsx +23 -50
- package/src/components/Connections/EditConnectionDialog.tsx +54 -73
- package/src/components/Dashboard/DashboardBar.tsx +88 -0
- package/src/components/Dashboard/telemetry.ts +24 -5
- package/src/components/DashboardBuilder/AddTileDialog.tsx +141 -143
- package/src/components/DashboardBuilder/BuilderToolbar.tsx +110 -218
- package/src/components/DashboardBuilder/DashboardBuilder.spec.tsx +5 -11
- package/src/components/DashboardBuilder/DashboardBuilder.tsx +202 -171
- package/src/components/DashboardBuilder/DashboardEditor.authoritative.spec.tsx +706 -0
- package/src/components/DashboardBuilder/DashboardEditor.package.spec.tsx +163 -0
- package/src/components/DashboardBuilder/DashboardEditor.spec.tsx +2 -25
- package/src/components/DashboardBuilder/DashboardEditor.tsx +442 -94
- package/src/components/DashboardBuilder/DiffDialog.tsx +75 -82
- package/src/components/DashboardBuilder/DrillDialog.tsx +144 -156
- package/src/components/DashboardBuilder/FilterDialog.tsx +276 -295
- package/src/components/DashboardBuilder/FilterStrip.tsx +11 -10
- package/src/components/DashboardBuilder/newDashboard.spec.ts +40 -0
- package/src/components/DashboardBuilder/newDashboard.ts +48 -0
- package/src/components/DashboardBuilder/spliceDocument.spec.ts +53 -0
- package/src/components/DashboardBuilder/spliceDocument.ts +45 -8
- package/src/components/DashboardBuilder/useDashboardEditor.spec.ts +56 -0
- package/src/components/DashboardBuilder/useDashboardEditor.ts +12 -4
- package/src/components/DocumentStorage/BrowserDocumentStorage.ts +7 -6
- package/src/components/DocumentStorage/DocumentStorage.ts +78 -5
- package/src/components/DocumentStorage/index.ts +1 -0
- package/src/components/Environment/About.tsx +14 -28
- package/src/components/Environment/AddPackageDialog.tsx +85 -154
- package/src/components/Environment/Connections.tsx +125 -205
- package/src/components/Environment/DeletePackageDialog.tsx +32 -77
- package/src/components/Environment/EditPackageDialog.tsx +46 -58
- package/src/components/Environment/Environment.tsx +34 -36
- package/src/components/Environment/Packages.tsx +63 -128
- package/src/components/Home/AddEnvironmentDialog.tsx +47 -70
- package/src/components/Home/DeleteEnvironmentDialog.tsx +32 -77
- package/src/components/Home/EditEnvironmentDialog.tsx +47 -61
- package/src/components/Home/Home.tsx +101 -214
- package/src/components/ItemRow.tsx +165 -0
- package/src/components/Materializations/CreateMaterializationDialog.tsx +34 -51
- package/src/components/Materializations/DeleteMaterializationDialog.tsx +31 -53
- package/src/components/Materializations/MaterializationDetailDialog.tsx +60 -69
- package/src/components/Materializations/MaterializationRunsList.tsx +29 -42
- package/src/components/Materializations/Materializations.tsx +137 -140
- package/src/components/Materializations/ScopeButton.tsx +85 -0
- package/src/components/Materializations/SectionLabel.tsx +7 -4
- package/src/components/Materializations/SetScheduleDialog.tsx +48 -89
- package/src/components/Materializations/TriggerLabel.tsx +36 -0
- package/src/components/Materializations/cron.spec.ts +113 -0
- package/src/components/Materializations/index.ts +0 -1
- package/src/components/Materializations/utils.spec.ts +182 -0
- package/src/components/Package/ContentTypeIcon.spec.ts +22 -37
- package/src/components/Package/ContentTypeIcon.tsx +10 -12
- package/src/components/Package/NewDashboardDialog.spec.tsx +129 -0
- package/src/components/Package/NewDashboardDialog.tsx +265 -0
- package/src/components/Package/Package.tsx +184 -238
- package/src/components/Package/index.ts +0 -1
- package/src/components/PackageSection.tsx +85 -0
- package/src/components/RenderedResult/RenderedResult.lifecycle.spec.tsx +198 -0
- package/src/components/RenderedResult/RenderedResult.tsx +22 -8
- package/src/components/ResultsDialog.tsx +8 -32
- package/src/components/buttons.tsx +114 -0
- package/src/components/designSystem.spec.tsx +316 -0
- package/src/components/given/paramCodec.spec.ts +1 -1
- package/src/components/index.ts +10 -0
- package/src/components/styles.ts +49 -85
- package/src/hooks/useCrudMutation.spec.tsx +119 -0
- package/src/hooks/useCrudMutation.tsx +85 -0
- package/src/index.ts +9 -0
- package/src/telemetry/consoleEvents.spec.ts +130 -0
- package/src/telemetry/consoleEvents.ts +124 -0
- package/src/theme/defaults.ts +34 -23
- package/src/theme/resolveTheme.spec.ts +9 -4
- package/src/theme/resolveTheme.ts +12 -8
- package/src/utils/sha256.ts +13 -0
- package/test/README.md +1 -1
- package/test/serverProvider.tsx +5 -2
- package/dist/DocumentStorageProvider-BeBD0uWc.cjs.js +0 -134
- package/dist/RenderedResult-CPi6uQWq.cjs.js +0 -115
- package/dist/ServerProvider-CH71GsoL.cjs.js +0 -1
- package/dist/components/Materializations/CreateEnvMaterializationDialog.d.ts +0 -14
- package/dist/components/Materializations/EnvironmentMaterializations.d.ts +0 -7
- package/dist/components/Materializations/ScheduleCard.d.ts +0 -20
- package/dist/components/Materializations/TriggerChip.d.ts +0 -10
- package/dist/components/Package/Models.d.ts +0 -6
- package/src/components/Materializations/CreateEnvMaterializationDialog.tsx +0 -179
- package/src/components/Materializations/EnvironmentMaterializations.tsx +0 -267
- package/src/components/Materializations/ScheduleCard.tsx +0 -231
- package/src/components/Materializations/TriggerChip.tsx +0 -44
- package/src/components/Package/Models.tsx +0 -71
|
@@ -3,20 +3,13 @@
|
|
|
3
3
|
|
|
4
4
|
import React, { useState } from "react";
|
|
5
5
|
import Button from "@mui/material/Button";
|
|
6
|
-
import Dialog from "@mui/material/Dialog";
|
|
7
|
-
import DialogTitle from "@mui/material/DialogTitle";
|
|
8
|
-
import DialogContent from "@mui/material/DialogContent";
|
|
9
|
-
import DialogActions from "@mui/material/DialogActions";
|
|
10
|
-
import IconButton from "@mui/material/IconButton";
|
|
11
|
-
import CloseIcon from "@mui/icons-material/Close";
|
|
12
6
|
import Typography from "@mui/material/Typography";
|
|
13
|
-
import { ListItemIcon, ListItemText, MenuItem
|
|
7
|
+
import { ListItemIcon, ListItemText, MenuItem } from "@mui/material";
|
|
14
8
|
import { Delete } from "@mui/icons-material";
|
|
15
9
|
import { Environment } from "../../client";
|
|
16
|
-
import {
|
|
10
|
+
import { useCrudMutation } from "../../hooks/useCrudMutation";
|
|
17
11
|
import { useServer } from "../ServerProvider";
|
|
18
|
-
import {
|
|
19
|
-
import { MALLOY_BRAND } from "../styles";
|
|
12
|
+
import { AppDialog } from "../AppDialog";
|
|
20
13
|
|
|
21
14
|
export default function DeleteEnvironmentDialog({
|
|
22
15
|
environment,
|
|
@@ -27,8 +20,6 @@ export default function DeleteEnvironmentDialog({
|
|
|
27
20
|
}) {
|
|
28
21
|
const [open, setOpen] = useState(false);
|
|
29
22
|
const { apiClients } = useServer();
|
|
30
|
-
const queryClient = useQueryClient();
|
|
31
|
-
const [notificationMessage, setNotificationMessage] = useState("");
|
|
32
23
|
const handleClickOpen = () => {
|
|
33
24
|
setOpen(true);
|
|
34
25
|
};
|
|
@@ -37,21 +28,14 @@ export default function DeleteEnvironmentDialog({
|
|
|
37
28
|
onCloseDialog();
|
|
38
29
|
};
|
|
39
30
|
|
|
40
|
-
const deleteEnvironment =
|
|
31
|
+
const deleteEnvironment = useCrudMutation({
|
|
41
32
|
mutationFn: () =>
|
|
42
33
|
apiClients.environments.deleteEnvironment(environment.name),
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
onError(error) {
|
|
49
|
-
setNotificationMessage(
|
|
50
|
-
error instanceof Error
|
|
51
|
-
? error.message
|
|
52
|
-
: "An unknown error occurred",
|
|
53
|
-
);
|
|
54
|
-
},
|
|
34
|
+
success: "Environment deleted",
|
|
35
|
+
invalidates: [["environments"]],
|
|
36
|
+
closeDialog: handleClose,
|
|
37
|
+
resource: "environment",
|
|
38
|
+
action: "delete",
|
|
55
39
|
});
|
|
56
40
|
|
|
57
41
|
return (
|
|
@@ -62,60 +46,31 @@ export default function DeleteEnvironmentDialog({
|
|
|
62
46
|
</ListItemIcon>
|
|
63
47
|
<ListItemText>Delete</ListItemText>
|
|
64
48
|
</MenuItem>
|
|
65
|
-
<
|
|
66
|
-
onClose={handleClose}
|
|
67
|
-
aria-labelledby="customized-dialog-title"
|
|
49
|
+
<AppDialog
|
|
68
50
|
open={open}
|
|
51
|
+
onClose={handleClose}
|
|
52
|
+
title="Delete environment"
|
|
53
|
+
actions={
|
|
54
|
+
<>
|
|
55
|
+
<Button onClick={handleClose}>Cancel</Button>
|
|
56
|
+
<Button
|
|
57
|
+
variant="contained"
|
|
58
|
+
color="error"
|
|
59
|
+
autoFocus
|
|
60
|
+
onClick={() => deleteEnvironment.mutate()}
|
|
61
|
+
loading={deleteEnvironment.isPending}
|
|
62
|
+
>
|
|
63
|
+
Delete environment
|
|
64
|
+
</Button>
|
|
65
|
+
</>
|
|
66
|
+
}
|
|
69
67
|
>
|
|
70
|
-
<
|
|
71
|
-
Delete
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
sx={(theme) => ({
|
|
77
|
-
position: "absolute",
|
|
78
|
-
right: 8,
|
|
79
|
-
top: 8,
|
|
80
|
-
color: theme.palette.grey[500],
|
|
81
|
-
})}
|
|
82
|
-
>
|
|
83
|
-
<CloseIcon />
|
|
84
|
-
</IconButton>
|
|
85
|
-
<DialogContent dividers>
|
|
86
|
-
<Typography gutterBottom>
|
|
87
|
-
Are you sure you want to delete "{environment.name}
|
|
88
|
-
"? This action cannot be undone.
|
|
89
|
-
</Typography>
|
|
90
|
-
</DialogContent>
|
|
91
|
-
<DialogActions>
|
|
92
|
-
<Button
|
|
93
|
-
variant="outlined"
|
|
94
|
-
onClick={handleClose}
|
|
95
|
-
style={{
|
|
96
|
-
borderColor: MALLOY_BRAND.teal,
|
|
97
|
-
color: MALLOY_BRAND.teal,
|
|
98
|
-
}}
|
|
99
|
-
>
|
|
100
|
-
Cancel
|
|
101
|
-
</Button>
|
|
102
|
-
<Button
|
|
103
|
-
loading={deleteEnvironment.isPending}
|
|
104
|
-
variant="contained"
|
|
105
|
-
autoFocus
|
|
106
|
-
onClick={() => deleteEnvironment.mutate()}
|
|
107
|
-
color="error"
|
|
108
|
-
>
|
|
109
|
-
Delete
|
|
110
|
-
</Button>
|
|
111
|
-
</DialogActions>
|
|
112
|
-
<Snackbar
|
|
113
|
-
open={notificationMessage !== ""}
|
|
114
|
-
autoHideDuration={6000}
|
|
115
|
-
onClose={() => setNotificationMessage("")}
|
|
116
|
-
message={notificationMessage}
|
|
117
|
-
/>
|
|
118
|
-
</Dialog>
|
|
68
|
+
<Typography variant="body2">
|
|
69
|
+
Delete <strong>{environment.name}</strong>? Its packages stop
|
|
70
|
+
being served and this cannot be undone.
|
|
71
|
+
</Typography>
|
|
72
|
+
</AppDialog>
|
|
73
|
+
{deleteEnvironment.notice}
|
|
119
74
|
</React.Fragment>
|
|
120
75
|
);
|
|
121
76
|
}
|
|
@@ -4,22 +4,18 @@
|
|
|
4
4
|
import React from "react";
|
|
5
5
|
import Button from "@mui/material/Button";
|
|
6
6
|
import TextField from "@mui/material/TextField";
|
|
7
|
-
import Dialog from "@mui/material/Dialog";
|
|
8
|
-
import DialogActions from "@mui/material/DialogActions";
|
|
9
|
-
import DialogContent from "@mui/material/DialogContent";
|
|
10
|
-
import DialogContentText from "@mui/material/DialogContentText";
|
|
11
|
-
import DialogTitle from "@mui/material/DialogTitle";
|
|
12
7
|
import { useState } from "react";
|
|
13
8
|
import { Edit } from "@mui/icons-material";
|
|
14
|
-
import { MenuItem, ListItemIcon, ListItemText
|
|
9
|
+
import { MenuItem, ListItemIcon, ListItemText } from "@mui/material";
|
|
15
10
|
import { Environment } from "../../client";
|
|
16
11
|
import {
|
|
17
12
|
generateEnvironmentReadme,
|
|
18
13
|
getEnvironmentDescription,
|
|
19
14
|
} from "../../utils/parsing";
|
|
20
|
-
import {
|
|
21
|
-
import { useMutationWithApiError } from "../../hooks/useQueryWithApiError";
|
|
15
|
+
import { useCrudMutation } from "../../hooks/useCrudMutation";
|
|
22
16
|
import { useServer } from "../ServerProvider";
|
|
17
|
+
import Stack from "@mui/material/Stack";
|
|
18
|
+
import { AppDialog } from "../AppDialog";
|
|
23
19
|
|
|
24
20
|
interface EditEnvironmentModalProps {
|
|
25
21
|
environment: Environment;
|
|
@@ -32,8 +28,6 @@ export default function EditEnvironmentDialog({
|
|
|
32
28
|
}: EditEnvironmentModalProps) {
|
|
33
29
|
const [open, setOpen] = useState(false);
|
|
34
30
|
const { apiClients } = useServer();
|
|
35
|
-
const queryClient = useQueryClient();
|
|
36
|
-
const [notificationMessage, setNotificationMessage] = useState("");
|
|
37
31
|
|
|
38
32
|
const handleClickOpen = () => {
|
|
39
33
|
setOpen(true);
|
|
@@ -44,8 +38,8 @@ export default function EditEnvironmentDialog({
|
|
|
44
38
|
onCloseDialog();
|
|
45
39
|
};
|
|
46
40
|
|
|
47
|
-
const editEnvironment =
|
|
48
|
-
|
|
41
|
+
const editEnvironment = useCrudMutation({
|
|
42
|
+
mutationFn(variables: { description: string }) {
|
|
49
43
|
return apiClients.environments.updateEnvironment(environment.name, {
|
|
50
44
|
name: environment.name,
|
|
51
45
|
readme: generateEnvironmentReadme(
|
|
@@ -57,18 +51,11 @@ export default function EditEnvironmentDialog({
|
|
|
57
51
|
),
|
|
58
52
|
});
|
|
59
53
|
},
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
onError(error) {
|
|
66
|
-
setNotificationMessage(
|
|
67
|
-
error instanceof Error
|
|
68
|
-
? error.message
|
|
69
|
-
: "An unknown error occurred",
|
|
70
|
-
);
|
|
71
|
-
},
|
|
54
|
+
success: "Environment updated",
|
|
55
|
+
invalidates: [["environments"]],
|
|
56
|
+
closeDialog: handleClose,
|
|
57
|
+
resource: "environment",
|
|
58
|
+
action: "update",
|
|
72
59
|
});
|
|
73
60
|
|
|
74
61
|
const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => {
|
|
@@ -87,62 +74,61 @@ export default function EditEnvironmentDialog({
|
|
|
87
74
|
<ListItemText>Edit</ListItemText>
|
|
88
75
|
</MenuItem>
|
|
89
76
|
|
|
90
|
-
<
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
77
|
+
<AppDialog
|
|
78
|
+
open={open}
|
|
79
|
+
onClose={handleClose}
|
|
80
|
+
title="Edit environment"
|
|
81
|
+
description="What this environment is, for the people who open it."
|
|
82
|
+
actions={
|
|
83
|
+
<>
|
|
84
|
+
<Button
|
|
85
|
+
disabled={editEnvironment.isPending}
|
|
86
|
+
onClick={handleClose}
|
|
87
|
+
>
|
|
88
|
+
Cancel
|
|
89
|
+
</Button>
|
|
90
|
+
<Button
|
|
91
|
+
type="submit"
|
|
92
|
+
form="environment-form"
|
|
93
|
+
variant="contained"
|
|
94
|
+
loading={editEnvironment.isPending}
|
|
95
|
+
>
|
|
96
|
+
Save changes
|
|
97
|
+
</Button>
|
|
98
|
+
</>
|
|
99
|
+
}
|
|
100
|
+
>
|
|
101
|
+
<form onSubmit={handleSubmit} id="environment-form">
|
|
102
|
+
<Stack sx={{ gap: 2 }}>
|
|
97
103
|
<TextField
|
|
98
104
|
autoFocus
|
|
99
105
|
required
|
|
100
|
-
margin="dense"
|
|
101
106
|
id="name"
|
|
102
107
|
name="name"
|
|
103
|
-
label="
|
|
108
|
+
label="Name"
|
|
104
109
|
disabled
|
|
105
110
|
type="text"
|
|
106
111
|
fullWidth
|
|
107
|
-
|
|
112
|
+
size="small"
|
|
108
113
|
defaultValue={environment.name}
|
|
114
|
+
InputLabelProps={{ shrink: true }}
|
|
109
115
|
/>
|
|
110
116
|
<TextField
|
|
111
|
-
margin="dense"
|
|
112
117
|
id="description"
|
|
113
118
|
name="description"
|
|
114
|
-
label="
|
|
119
|
+
label="Description"
|
|
115
120
|
type="text"
|
|
116
121
|
fullWidth
|
|
117
|
-
|
|
122
|
+
size="small"
|
|
118
123
|
defaultValue={getEnvironmentDescription(
|
|
119
124
|
environment.readme,
|
|
120
125
|
)}
|
|
126
|
+
InputLabelProps={{ shrink: true }}
|
|
121
127
|
/>
|
|
122
|
-
</
|
|
123
|
-
</
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
disabled={editEnvironment.isPending}
|
|
127
|
-
onClick={handleClose}
|
|
128
|
-
>
|
|
129
|
-
Cancel
|
|
130
|
-
</Button>
|
|
131
|
-
<Button
|
|
132
|
-
type="submit"
|
|
133
|
-
form="environment-form"
|
|
134
|
-
loading={editEnvironment.isPending}
|
|
135
|
-
>
|
|
136
|
-
Save Changes
|
|
137
|
-
</Button>
|
|
138
|
-
</DialogActions>
|
|
139
|
-
</Dialog>
|
|
140
|
-
<Snackbar
|
|
141
|
-
open={notificationMessage !== ""}
|
|
142
|
-
autoHideDuration={6000}
|
|
143
|
-
onClose={() => setNotificationMessage("")}
|
|
144
|
-
message={notificationMessage}
|
|
145
|
-
/>
|
|
128
|
+
</Stack>
|
|
129
|
+
</form>
|
|
130
|
+
</AppDialog>
|
|
131
|
+
{editEnvironment.notice}
|
|
146
132
|
</React.Fragment>
|
|
147
133
|
);
|
|
148
134
|
}
|