@malloy-publisher/sdk 0.0.196-dev → 0.0.197-dev
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 +77 -77
- package/TREE_SHAKING.md +11 -11
- package/dist/{ServerProvider-CvZTC0sJ.es.js → ServerProvider-DDScRRDc.es.js} +1393 -1393
- package/dist/ServerProvider-IhQ4aYBm.cjs.js +1 -0
- package/dist/client/api.d.ts +674 -674
- 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 +53 -53
- 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/ServerProvider.d.ts +4 -4
- package/dist/components/index.d.ts +1 -1
- package/dist/{core-mP4paWtU.cjs.js → core-7-3Jcsb0.cjs.js} +1 -1
- package/dist/{core-BrfQApxh.es.js → core-w79IMXAG.es.js} +1 -1
- 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/{index-ClRkROAM.es.js → index-CN0_kZSF.es.js} +13067 -13033
- package/dist/{index-CW09s4Xx.cjs.js → index-Xo_ADux9.cjs.js} +34 -34
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.es.js +21 -21
- package/dist/utils/formatting.d.ts +1 -1
- package/dist/utils/parsing.d.ts +2 -2
- package/package.json +1 -1
- package/src/components/Connections/DeleteConnectionDialog.tsx +1 -0
- package/src/components/Connections/EditConnectionDialog.tsx +2 -0
- package/src/components/{Project → Environment}/About.tsx +8 -4
- package/src/components/{Project → Environment}/AddPackageDialog.tsx +5 -3
- package/src/components/{Project → Environment}/ConnectionExplorer.tsx +14 -14
- package/src/components/{Project → Environment}/DeletePackageDialog.tsx +2 -2
- package/src/components/{Project → Environment}/EditPackageDialog.tsx +18 -13
- package/src/components/{Project/Project.tsx → Environment/Environment.tsx} +6 -6
- package/src/components/{Project → Environment}/Packages.tsx +6 -5
- package/src/components/Environment/index.ts +2 -0
- package/src/components/Home/{AddProjectDialog.tsx → AddEnvironmentDialog.tsx} +21 -18
- package/src/components/Home/{DeleteProjectDialog.tsx → DeleteEnvironmentDialog.tsx} +14 -13
- package/src/components/Home/{EditProjectDialog.tsx → EditEnvironmentDialog.tsx} +32 -28
- package/src/components/Home/Home.tsx +39 -38
- package/src/components/Model/ModelCell.tsx +2 -2
- package/src/components/Model/SourcesExplorer.tsx +2 -2
- package/src/components/Model/useModelData.ts +3 -3
- package/src/components/Notebook/Notebook.tsx +7 -7
- package/src/components/Package/Config.tsx +4 -4
- package/src/components/Package/Connections.tsx +15 -15
- package/src/components/Package/Databases.tsx +4 -4
- package/src/components/Package/Models.tsx +4 -4
- package/src/components/Package/Notebooks.tsx +4 -4
- package/src/components/QueryResult/QueryResult.tsx +6 -6
- package/src/components/ServerProvider.tsx +5 -5
- package/src/components/Workbook/ModelPicker.tsx +4 -4
- package/src/components/Workbook/Workbook.tsx +4 -4
- package/src/components/index.ts +1 -1
- package/src/hooks/useDimensionFiltersFromSpec.ts +5 -5
- package/src/hooks/useDimensionFiltersQuery.ts +6 -6
- package/src/hooks/useDimensionalFilterRangeData.ts +7 -7
- package/src/hooks/useRawQueryData.ts +3 -3
- package/src/index.ts +1 -1
- package/src/utils/formatting.spec.ts +22 -21
- package/src/utils/formatting.ts +8 -7
- package/src/utils/parsing.spec.ts +23 -19
- package/src/utils/parsing.ts +8 -6
- package/dist/ServerProvider-BMsmCksc.cjs.js +0 -1
- 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/Project/Project.d.ts +0 -6
- package/dist/components/Project/index.d.ts +0 -2
- 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/{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
package/dist/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-Xo_ADux9.cjs.js"),o=require("./ServerProvider-IhQ4aYBm.cjs.js");exports.AnalyzePackageButton=e.AnalyzePackageButton;exports.BrowserWorkbookStorage=e.BrowserWorkbookStorage;exports.ConnectionExplorer=e.ConnectionExplorer;exports.DimensionFilter=e.DimensionFilter;exports.EmbeddedQueryResult=e.EmbeddedQueryResult;exports.Environment=e.Environment;exports.Home=e.Home;exports.Loading=e.Loading;exports.Model=e.Model;exports.ModelExplorer=e.ModelExplorer;exports.ModelExplorerDialog=e.ModelExplorerDialog;exports.Models=e.Models;exports.Notebook=e.Notebook;exports.Package=e.Package;exports.Packages=e.Packages;exports.QueryResult=e.QueryResult;exports.RenderedResult=e.RenderedResult;exports.ResultContainer=e.ResultContainer;exports.SourceExplorerComponent=e.SourceExplorerComponent;exports.SourcesExplorer=e.SourcesExplorer;exports.Workbook=e.Workbook;exports.WorkbookList=e.WorkbookList;exports.WorkbookManager=e.WorkbookManager;exports.WorkbookStorageProvider=e.WorkbookStorageProvider;exports.createEmbeddedQueryResult=e.createEmbeddedQueryResult;exports.encodeResourceUri=e.encodeResourceUri;exports.extractDimensionSpecs=e.extractDimensionSpecs;exports.extractSourceFromQuery=e.extractSourceFromQuery;exports.generateFilterClause=e.generateFilterClause;exports.getDimensionKey=e.getDimensionKey;exports.getJoinedSources=e.getJoinedSources;exports.injectWhereClause=e.injectWhereClause;exports.makeDimensionKey=e.makeDimensionKey;exports.parseAllSourceInfos=e.parseAllSourceInfos;exports.parseDimensionFilterAnnotation=e.parseDimensionFilterAnnotation;exports.parseNotebookFilterAnnotation=e.parseNotebookFilterAnnotation;exports.parseResourceUri=e.parseResourceUri;exports.useDimensionFilters=e.useDimensionFilters;exports.useDimensionFiltersFromSpec=e.useDimensionFiltersFromSpec;exports.useDimensionFiltersQuery=e.useDimensionFiltersQuery;exports.useDimensionalFilterRangeData=e.useDimensionalFilterRangeData;exports.useModelData=e.useModelData;exports.useRawQueryData=e.useRawQueryData;exports.useRouterClickHandler=e.useRouterClickHandler;exports.ServerProvider=o.ServerProvider;exports.useServer=o.useServer;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from './components';
|
|
2
|
-
export { default as ConnectionExplorer } from './components/
|
|
2
|
+
export { default as ConnectionExplorer } from './components/Environment/ConnectionExplorer';
|
|
3
3
|
export { useServer } from './components/ServerProvider';
|
|
4
4
|
export * from './hooks';
|
|
5
5
|
export { useRawQueryData } from './hooks/useRawQueryData';
|
package/dist/index.es.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { A as a, J as o, C as r, D as n,
|
|
2
|
-
import { S as T, u as V } from "./ServerProvider-
|
|
1
|
+
import { A as a, J as o, C as r, D as n, y as t, E as i, H as l, L as u, M as m, o as c, q as d, x as k, N as p, v as D, P as g, Q as S, R, F, r as x, S as y, W as b, G as E, K as C, I as M, B as Q, _ as W, g as v, i as P, j as A, X as f, k as B, l as H, Y as K, p as L, m as N, n as U, Z as j, O as w, T as I, U as J, V as h, t as q, u as z, e as G } from "./index-CN0_kZSF.es.js";
|
|
2
|
+
import { S as T, u as V } from "./ServerProvider-DDScRRDc.es.js";
|
|
3
3
|
export {
|
|
4
4
|
a as AnalyzePackageButton,
|
|
5
5
|
o as BrowserWorkbookStorage,
|
|
6
6
|
r as ConnectionExplorer,
|
|
7
7
|
n as DimensionFilter,
|
|
8
8
|
t as EmbeddedQueryResult,
|
|
9
|
-
i as
|
|
10
|
-
l as
|
|
11
|
-
u as
|
|
9
|
+
i as Environment,
|
|
10
|
+
l as Home,
|
|
11
|
+
u as Loading,
|
|
12
|
+
m as Model,
|
|
12
13
|
c as ModelExplorer,
|
|
13
14
|
d as ModelExplorerDialog,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
g as Project,
|
|
15
|
+
k as Models,
|
|
16
|
+
p as Notebook,
|
|
17
|
+
D as Package,
|
|
18
|
+
g as Packages,
|
|
19
19
|
S as QueryResult,
|
|
20
20
|
R as RenderedResult,
|
|
21
21
|
F as ResultContainer,
|
|
@@ -26,19 +26,19 @@ export {
|
|
|
26
26
|
E as WorkbookList,
|
|
27
27
|
C as WorkbookManager,
|
|
28
28
|
M as WorkbookStorageProvider,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
Q as createEmbeddedQueryResult,
|
|
30
|
+
W as encodeResourceUri,
|
|
31
|
+
v as extractDimensionSpecs,
|
|
32
|
+
P as extractSourceFromQuery,
|
|
33
33
|
A as generateFilterClause,
|
|
34
34
|
f as getDimensionKey,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
B as getJoinedSources,
|
|
36
|
+
H as injectWhereClause,
|
|
37
|
+
K as makeDimensionKey,
|
|
38
|
+
L as parseAllSourceInfos,
|
|
39
|
+
N as parseDimensionFilterAnnotation,
|
|
40
|
+
U as parseNotebookFilterAnnotation,
|
|
41
|
+
j as parseResourceUri,
|
|
42
42
|
w as useDimensionFilters,
|
|
43
43
|
I as useDimensionFiltersFromSpec,
|
|
44
44
|
J as useDimensionFiltersQuery,
|
package/dist/utils/parsing.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
export declare const
|
|
1
|
+
export declare const getEnvironmentDescription: (readme: string | undefined) => string;
|
|
2
|
+
export declare const generateEnvironmentReadme: (environment: {
|
|
3
3
|
name: string;
|
|
4
4
|
readme?: string;
|
|
5
5
|
}, description?: string) => string;
|
package/package.json
CHANGED
|
@@ -447,6 +447,7 @@ export default function EditConnectionDialog({
|
|
|
447
447
|
return (
|
|
448
448
|
<React.Fragment>
|
|
449
449
|
<IconButton
|
|
450
|
+
aria-label={`Edit connection ${connection?.name ?? ""}`.trim()}
|
|
450
451
|
onClick={(event) => {
|
|
451
452
|
event.preventDefault();
|
|
452
453
|
event.stopPropagation();
|
|
@@ -737,6 +738,7 @@ export default function EditConnectionDialog({
|
|
|
737
738
|
Database {index + 1}
|
|
738
739
|
</Typography>
|
|
739
740
|
<IconButton
|
|
741
|
+
aria-label={`Remove attached database ${index + 1}`}
|
|
740
742
|
onClick={() =>
|
|
741
743
|
removeAttachedDatabase(index)
|
|
742
744
|
}
|
|
@@ -16,14 +16,15 @@ interface AboutProps {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export default function About({ resourceUri }: AboutProps) {
|
|
19
|
-
const {
|
|
19
|
+
const { environmentName } = parseResourceUri(resourceUri);
|
|
20
20
|
const { apiClients } = useServer();
|
|
21
21
|
const [expanded, setExpanded] = useState(false);
|
|
22
22
|
const wordLimit = 90;
|
|
23
23
|
|
|
24
24
|
const { data, isSuccess, isError, error } = useQueryWithApiError({
|
|
25
|
-
queryKey: ["about",
|
|
26
|
-
queryFn: () =>
|
|
25
|
+
queryKey: ["about", environmentName],
|
|
26
|
+
queryFn: () =>
|
|
27
|
+
apiClients.environments.getEnvironment(environmentName, false),
|
|
27
28
|
});
|
|
28
29
|
|
|
29
30
|
const readmeContent = data?.data?.readme || "";
|
|
@@ -93,7 +94,10 @@ export default function About({ resourceUri }: AboutProps) {
|
|
|
93
94
|
</PackageCard>
|
|
94
95
|
)}
|
|
95
96
|
{isError && (
|
|
96
|
-
<ApiErrorDisplay
|
|
97
|
+
<ApiErrorDisplay
|
|
98
|
+
error={error}
|
|
99
|
+
context={`${environmentName} > About`}
|
|
100
|
+
/>
|
|
97
101
|
)}
|
|
98
102
|
</>
|
|
99
103
|
);
|
|
@@ -35,10 +35,10 @@ export default function AddPackageDialog({
|
|
|
35
35
|
setOpen(false);
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
-
const {
|
|
38
|
+
const { environmentName } = parseResourceUri(resourceUri);
|
|
39
39
|
const addPackage = useMutationWithApiError({
|
|
40
40
|
async mutationFn(variables: Package) {
|
|
41
|
-
return apiClients.packages.createPackage(
|
|
41
|
+
return apiClients.packages.createPackage(environmentName, {
|
|
42
42
|
name: variables.name,
|
|
43
43
|
description: variables.description,
|
|
44
44
|
location: variables.location,
|
|
@@ -47,7 +47,9 @@ export default function AddPackageDialog({
|
|
|
47
47
|
onSuccess() {
|
|
48
48
|
handleClose();
|
|
49
49
|
setNotificationMessage("Package created successfully");
|
|
50
|
-
queryClient.invalidateQueries({
|
|
50
|
+
queryClient.invalidateQueries({
|
|
51
|
+
queryKey: ["packages", environmentName],
|
|
52
|
+
});
|
|
51
53
|
},
|
|
52
54
|
onError(error) {
|
|
53
55
|
setNotificationMessage(
|
|
@@ -62,7 +62,7 @@ export default function ConnectionExplorer({
|
|
|
62
62
|
connection,
|
|
63
63
|
}: ConnectionExplorerProps) {
|
|
64
64
|
const { apiClients } = useServer();
|
|
65
|
-
const {
|
|
65
|
+
const { environmentName: environmentName } = parseResourceUri(resourceUri);
|
|
66
66
|
const [selectedTableResource, setSelectedTableResource] = React.useState<
|
|
67
67
|
string | null
|
|
68
68
|
>(null);
|
|
@@ -76,9 +76,9 @@ export default function ConnectionExplorer({
|
|
|
76
76
|
isLoading: schemasLoading,
|
|
77
77
|
error: schemasErrorObj,
|
|
78
78
|
} = useQueryWithApiError({
|
|
79
|
-
queryKey: ["schemas",
|
|
79
|
+
queryKey: ["schemas", environmentName, connectionName],
|
|
80
80
|
queryFn: () =>
|
|
81
|
-
apiClients.connections.listSchemas(
|
|
81
|
+
apiClients.connections.listSchemas(environmentName, connectionName),
|
|
82
82
|
});
|
|
83
83
|
|
|
84
84
|
const availableSchemas = schemasData?.data || [];
|
|
@@ -119,7 +119,7 @@ export default function ConnectionExplorer({
|
|
|
119
119
|
{schemasError && (
|
|
120
120
|
<ApiErrorDisplay
|
|
121
121
|
error={schemasErrorObj}
|
|
122
|
-
context={`${
|
|
122
|
+
context={`${environmentName} > ${connectionName} > Schemas`}
|
|
123
123
|
/>
|
|
124
124
|
)}
|
|
125
125
|
{!schemasLoading &&
|
|
@@ -181,7 +181,7 @@ export default function ConnectionExplorer({
|
|
|
181
181
|
<Grid size={{ xs: 12, md: schema ? 6 : 4 }}>
|
|
182
182
|
{selectedSchema && selectedTableResource && (
|
|
183
183
|
<SelectedTableDetailPanel
|
|
184
|
-
|
|
184
|
+
environmentName={environmentName}
|
|
185
185
|
connectionName={connectionName}
|
|
186
186
|
schemaName={selectedSchema}
|
|
187
187
|
tableResource={selectedTableResource}
|
|
@@ -198,12 +198,12 @@ type TableSchemaViewerProps = {
|
|
|
198
198
|
};
|
|
199
199
|
|
|
200
200
|
function SelectedTableDetailPanel({
|
|
201
|
-
|
|
201
|
+
environmentName,
|
|
202
202
|
connectionName,
|
|
203
203
|
schemaName,
|
|
204
204
|
tableResource,
|
|
205
205
|
}: {
|
|
206
|
-
|
|
206
|
+
environmentName: string;
|
|
207
207
|
connectionName: string;
|
|
208
208
|
schemaName: string;
|
|
209
209
|
tableResource: string;
|
|
@@ -217,14 +217,14 @@ function SelectedTableDetailPanel({
|
|
|
217
217
|
} = useQueryWithApiError({
|
|
218
218
|
queryKey: [
|
|
219
219
|
"connectionTableDetail",
|
|
220
|
-
|
|
220
|
+
environmentName,
|
|
221
221
|
connectionName,
|
|
222
222
|
schemaName,
|
|
223
223
|
tableResource,
|
|
224
224
|
],
|
|
225
225
|
queryFn: () =>
|
|
226
226
|
apiClients.connections.getTable(
|
|
227
|
-
|
|
227
|
+
environmentName,
|
|
228
228
|
connectionName,
|
|
229
229
|
schemaName,
|
|
230
230
|
tableResource,
|
|
@@ -242,7 +242,7 @@ function SelectedTableDetailPanel({
|
|
|
242
242
|
{tableDetailError && (
|
|
243
243
|
<ApiErrorDisplay
|
|
244
244
|
error={tableDetailErrorObj}
|
|
245
|
-
context={`${
|
|
245
|
+
context={`${environmentName} > ${connectionName} > ${schemaName} > ${tableResource}`}
|
|
246
246
|
/>
|
|
247
247
|
)}
|
|
248
248
|
{!tableDetailError && (
|
|
@@ -319,14 +319,14 @@ function TablesInSchema({
|
|
|
319
319
|
resourceUri,
|
|
320
320
|
connection,
|
|
321
321
|
}: TablesInSchemaProps) {
|
|
322
|
-
const {
|
|
322
|
+
const { environmentName: environmentName } = parseResourceUri(resourceUri);
|
|
323
323
|
const { apiClients } = useServer();
|
|
324
324
|
const [searchTerm, setSearchTerm] = useState("");
|
|
325
325
|
const { data, isSuccess, isError, error, isLoading } = useQueryWithApiError({
|
|
326
|
-
queryKey: ["tablesInSchema",
|
|
326
|
+
queryKey: ["tablesInSchema", environmentName, connectionName, schemaName],
|
|
327
327
|
queryFn: () =>
|
|
328
328
|
apiClients.connections.listTables(
|
|
329
|
-
|
|
329
|
+
environmentName,
|
|
330
330
|
connectionName,
|
|
331
331
|
schemaName,
|
|
332
332
|
),
|
|
@@ -376,7 +376,7 @@ function TablesInSchema({
|
|
|
376
376
|
{isError && (
|
|
377
377
|
<ApiErrorDisplay
|
|
378
378
|
error={error}
|
|
379
|
-
context={`${
|
|
379
|
+
context={`${environmentName} > ${connectionName} > ${schemaName}`}
|
|
380
380
|
/>
|
|
381
381
|
)}
|
|
382
382
|
{isSuccess && filteredTables.length === 0 && (
|
|
@@ -32,11 +32,11 @@ export default function DeletePackageDialog({
|
|
|
32
32
|
setOpen(false);
|
|
33
33
|
onCloseDialog();
|
|
34
34
|
};
|
|
35
|
-
const {
|
|
35
|
+
const { environmentName, packageName } = parseResourceUri(resourceUri);
|
|
36
36
|
|
|
37
37
|
const deletePackage = useMutationWithApiError({
|
|
38
38
|
mutationFn: () =>
|
|
39
|
-
apiClients.packages.deletePackage(
|
|
39
|
+
apiClients.packages.deletePackage(environmentName, packageName),
|
|
40
40
|
onSuccess() {
|
|
41
41
|
handleClose();
|
|
42
42
|
queryClient.invalidateQueries({ queryKey: ["packages"] });
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Edit } from "@mui/icons-material";
|
|
2
|
+
import { ListItemIcon, ListItemText, MenuItem, Snackbar } from "@mui/material";
|
|
2
3
|
import Button from "@mui/material/Button";
|
|
3
|
-
import TextField from "@mui/material/TextField";
|
|
4
4
|
import Dialog from "@mui/material/Dialog";
|
|
5
5
|
import DialogActions from "@mui/material/DialogActions";
|
|
6
6
|
import DialogContent from "@mui/material/DialogContent";
|
|
7
7
|
import DialogContentText from "@mui/material/DialogContentText";
|
|
8
8
|
import DialogTitle from "@mui/material/DialogTitle";
|
|
9
|
-
import
|
|
10
|
-
import { Edit } from "@mui/icons-material";
|
|
11
|
-
import { MenuItem, ListItemIcon, ListItemText, Snackbar } from "@mui/material";
|
|
12
|
-
import { Package } from "../../client";
|
|
9
|
+
import TextField from "@mui/material/TextField";
|
|
13
10
|
import { useQueryClient } from "@tanstack/react-query";
|
|
11
|
+
import React, { useState } from "react";
|
|
12
|
+
import { Package } from "../../client";
|
|
14
13
|
import { useMutationWithApiError } from "../../hooks/useQueryWithApiError";
|
|
15
|
-
import { useServer } from "../ServerProvider";
|
|
16
14
|
import { parseResourceUri } from "../../utils/formatting";
|
|
15
|
+
import { useServer } from "../ServerProvider";
|
|
17
16
|
|
|
18
17
|
interface EditPackageDialogProps {
|
|
19
18
|
package: Package;
|
|
@@ -40,18 +39,24 @@ export default function EditPackageDialog({
|
|
|
40
39
|
onCloseDialog();
|
|
41
40
|
};
|
|
42
41
|
|
|
43
|
-
const { packageName,
|
|
42
|
+
const { packageName, environmentName } = parseResourceUri(resourceUri);
|
|
44
43
|
const editPackage = useMutationWithApiError({
|
|
45
44
|
async mutationFn(variables: { description: string }) {
|
|
46
|
-
return apiClients.packages.updatePackage(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
return apiClients.packages.updatePackage(
|
|
46
|
+
environmentName,
|
|
47
|
+
packageName,
|
|
48
|
+
{
|
|
49
|
+
name: packageName,
|
|
50
|
+
description: variables.description,
|
|
51
|
+
},
|
|
52
|
+
);
|
|
50
53
|
},
|
|
51
54
|
onSuccess() {
|
|
52
55
|
handleClose();
|
|
53
56
|
setNotificationMessage("Package updated successfully");
|
|
54
|
-
queryClient.invalidateQueries({
|
|
57
|
+
queryClient.invalidateQueries({
|
|
58
|
+
queryKey: ["packages", environmentName],
|
|
59
|
+
});
|
|
55
60
|
},
|
|
56
61
|
onError(error) {
|
|
57
62
|
setNotificationMessage(
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { Box, Grid, Typography } from "@mui/material";
|
|
2
|
+
import { useEffect } from "react";
|
|
2
3
|
import { parseResourceUri } from "../../utils/formatting";
|
|
3
4
|
import { useServer } from "../ServerProvider";
|
|
4
5
|
import { PackageContainer } from "../styles";
|
|
5
6
|
import About from "./About";
|
|
6
7
|
import AddPackageDialog from "./AddPackageDialog";
|
|
7
8
|
import Packages from "./Packages";
|
|
8
|
-
import { useEffect } from "react";
|
|
9
9
|
|
|
10
|
-
interface
|
|
10
|
+
interface EnvironmentProps {
|
|
11
11
|
onSelectPackage: (to: string, event?: React.MouseEvent) => void;
|
|
12
12
|
resourceUri: string;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export default function
|
|
15
|
+
export default function Environment({
|
|
16
16
|
onSelectPackage,
|
|
17
17
|
resourceUri,
|
|
18
|
-
}:
|
|
18
|
+
}: EnvironmentProps) {
|
|
19
19
|
const { mutable } = useServer();
|
|
20
|
-
const {
|
|
20
|
+
const { environmentName } = parseResourceUri(resourceUri);
|
|
21
21
|
|
|
22
22
|
useEffect(() => {
|
|
23
23
|
window.scrollTo({ top: 0, behavior: "auto" });
|
|
@@ -32,7 +32,7 @@ export default function Project({
|
|
|
32
32
|
alignItems="center"
|
|
33
33
|
mb={2}
|
|
34
34
|
>
|
|
35
|
-
<Typography variant="h6">{
|
|
35
|
+
<Typography variant="h6">{environmentName} packages</Typography>
|
|
36
36
|
{mutable && <AddPackageDialog resourceUri={resourceUri} />}
|
|
37
37
|
</Box>
|
|
38
38
|
<Grid container spacing={3} columns={12}>
|
|
@@ -45,6 +45,7 @@ const PackageMenu = ({
|
|
|
45
45
|
{mutable && (
|
|
46
46
|
<>
|
|
47
47
|
<IconButton
|
|
48
|
+
aria-label={`Package actions for ${p.name}`}
|
|
48
49
|
onClick={(event) => {
|
|
49
50
|
event.stopPropagation();
|
|
50
51
|
openMenu(event);
|
|
@@ -96,10 +97,10 @@ export default function Packages({
|
|
|
96
97
|
resourceUri,
|
|
97
98
|
}: PackagesProps) {
|
|
98
99
|
const { apiClients } = useServer();
|
|
99
|
-
const {
|
|
100
|
+
const { environmentName: environmentName } = parseResourceUri(resourceUri);
|
|
100
101
|
const { data, isSuccess, isError, error } = useQueryWithApiError({
|
|
101
|
-
queryKey: ["packages",
|
|
102
|
-
queryFn: () => apiClients.packages.listPackages(
|
|
102
|
+
queryKey: ["packages", environmentName],
|
|
103
|
+
queryFn: () => apiClients.packages.listPackages(environmentName),
|
|
103
104
|
});
|
|
104
105
|
|
|
105
106
|
return (
|
|
@@ -113,7 +114,7 @@ export default function Packages({
|
|
|
113
114
|
})
|
|
114
115
|
.map((p) => {
|
|
115
116
|
const packageResourceUri = encodeResourceUri({
|
|
116
|
-
|
|
117
|
+
environmentName,
|
|
117
118
|
packageName: p.name,
|
|
118
119
|
});
|
|
119
120
|
return (
|
|
@@ -183,7 +184,7 @@ export default function Packages({
|
|
|
183
184
|
{isError && (
|
|
184
185
|
<ApiErrorDisplay
|
|
185
186
|
error={error}
|
|
186
|
-
context={`${
|
|
187
|
+
context={`${environmentName} > Packages`}
|
|
187
188
|
/>
|
|
188
189
|
)}
|
|
189
190
|
</>
|
|
@@ -10,10 +10,10 @@ import TextField from "@mui/material/TextField";
|
|
|
10
10
|
import { useQueryClient } from "@tanstack/react-query";
|
|
11
11
|
import React, { useState } from "react";
|
|
12
12
|
import { useMutationWithApiError } from "../../hooks/useQueryWithApiError";
|
|
13
|
-
import {
|
|
13
|
+
import { generateEnvironmentReadme } from "../../utils/parsing";
|
|
14
14
|
import { useServer } from "../ServerProvider";
|
|
15
15
|
|
|
16
|
-
export default function
|
|
16
|
+
export default function AddEnvironmentDialog() {
|
|
17
17
|
const [open, setOpen] = useState(false);
|
|
18
18
|
const { apiClients } = useServer();
|
|
19
19
|
const [notificationMessage, setNotificationMessage] = useState("");
|
|
@@ -25,11 +25,11 @@ export default function AddProjectDialog() {
|
|
|
25
25
|
setOpen(false);
|
|
26
26
|
};
|
|
27
27
|
const queryClient = useQueryClient();
|
|
28
|
-
const
|
|
28
|
+
const addEnvironment = useMutationWithApiError({
|
|
29
29
|
async mutationFn(variables: { name: string; description: string }) {
|
|
30
|
-
return apiClients.
|
|
30
|
+
return apiClients.environments.createEnvironment({
|
|
31
31
|
name: variables.name,
|
|
32
|
-
readme:
|
|
32
|
+
readme: generateEnvironmentReadme(
|
|
33
33
|
{
|
|
34
34
|
name: variables.name,
|
|
35
35
|
readme: "",
|
|
@@ -40,8 +40,8 @@ export default function AddProjectDialog() {
|
|
|
40
40
|
},
|
|
41
41
|
onSuccess() {
|
|
42
42
|
handleClose();
|
|
43
|
-
queryClient.invalidateQueries({ queryKey: ["
|
|
44
|
-
setNotificationMessage("
|
|
43
|
+
queryClient.invalidateQueries({ queryKey: ["environments"] });
|
|
44
|
+
setNotificationMessage("Environment created successfully");
|
|
45
45
|
},
|
|
46
46
|
onError(error) {
|
|
47
47
|
setNotificationMessage(
|
|
@@ -61,7 +61,7 @@ export default function AddProjectDialog() {
|
|
|
61
61
|
if (!name) {
|
|
62
62
|
throw new Error("Name is required");
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
addEnvironment.mutate({ name, description });
|
|
65
65
|
};
|
|
66
66
|
|
|
67
67
|
return (
|
|
@@ -72,23 +72,23 @@ export default function AddProjectDialog() {
|
|
|
72
72
|
startIcon={<AddCircleRounded />}
|
|
73
73
|
sx={{ mt: 2, color: "white" }}
|
|
74
74
|
>
|
|
75
|
-
Create New
|
|
75
|
+
Create New Environment
|
|
76
76
|
</Button>
|
|
77
77
|
<Dialog open={open} onClose={handleClose}>
|
|
78
|
-
<DialogTitle>Create New
|
|
78
|
+
<DialogTitle>Create New Environment</DialogTitle>
|
|
79
79
|
<DialogContent>
|
|
80
80
|
<DialogContentText>
|
|
81
|
-
Add a new
|
|
81
|
+
Add a new environment to start exploring semantic models and
|
|
82
82
|
analyzing data.
|
|
83
83
|
</DialogContentText>
|
|
84
|
-
<form onSubmit={handleSubmit} id="
|
|
84
|
+
<form onSubmit={handleSubmit} id="environment-form">
|
|
85
85
|
<TextField
|
|
86
86
|
autoFocus
|
|
87
87
|
required
|
|
88
88
|
margin="dense"
|
|
89
89
|
id="name"
|
|
90
90
|
name="name"
|
|
91
|
-
label="
|
|
91
|
+
label="Environment Name"
|
|
92
92
|
type="text"
|
|
93
93
|
fullWidth
|
|
94
94
|
variant="standard"
|
|
@@ -97,7 +97,7 @@ export default function AddProjectDialog() {
|
|
|
97
97
|
margin="dense"
|
|
98
98
|
id="description"
|
|
99
99
|
name="description"
|
|
100
|
-
label="
|
|
100
|
+
label="Environment Description"
|
|
101
101
|
placeholder="Explore semantic models, run queries, and build dashboards"
|
|
102
102
|
type="text"
|
|
103
103
|
fullWidth
|
|
@@ -106,15 +106,18 @@ export default function AddProjectDialog() {
|
|
|
106
106
|
</form>
|
|
107
107
|
</DialogContent>
|
|
108
108
|
<DialogActions>
|
|
109
|
-
<Button
|
|
109
|
+
<Button
|
|
110
|
+
disabled={addEnvironment.isPending}
|
|
111
|
+
onClick={handleClose}
|
|
112
|
+
>
|
|
110
113
|
Cancel
|
|
111
114
|
</Button>
|
|
112
115
|
<Button
|
|
113
116
|
type="submit"
|
|
114
|
-
form="
|
|
115
|
-
loading={
|
|
117
|
+
form="environment-form"
|
|
118
|
+
loading={addEnvironment.isPending}
|
|
116
119
|
>
|
|
117
|
-
Create
|
|
120
|
+
Create Environment
|
|
118
121
|
</Button>
|
|
119
122
|
</DialogActions>
|
|
120
123
|
</Dialog>
|
|
@@ -9,16 +9,16 @@ import CloseIcon from "@mui/icons-material/Close";
|
|
|
9
9
|
import Typography from "@mui/material/Typography";
|
|
10
10
|
import { ListItemIcon, ListItemText, MenuItem, Snackbar } from "@mui/material";
|
|
11
11
|
import { Delete } from "@mui/icons-material";
|
|
12
|
-
import {
|
|
12
|
+
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
16
|
|
|
17
|
-
export default function
|
|
18
|
-
|
|
17
|
+
export default function DeleteEnvironmentDialog({
|
|
18
|
+
environment,
|
|
19
19
|
onCloseDialog,
|
|
20
20
|
}: {
|
|
21
|
-
|
|
21
|
+
environment: Environment;
|
|
22
22
|
onCloseDialog: () => void;
|
|
23
23
|
}) {
|
|
24
24
|
const [open, setOpen] = useState(false);
|
|
@@ -33,12 +33,13 @@ export default function DeleteProjectDialog({
|
|
|
33
33
|
onCloseDialog();
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
const
|
|
37
|
-
mutationFn: () =>
|
|
36
|
+
const deleteEnvironment = useMutationWithApiError({
|
|
37
|
+
mutationFn: () =>
|
|
38
|
+
apiClients.environments.deleteEnvironment(environment.name),
|
|
38
39
|
onSuccess() {
|
|
39
40
|
handleClose();
|
|
40
|
-
queryClient.invalidateQueries({ queryKey: ["
|
|
41
|
-
setNotificationMessage("
|
|
41
|
+
queryClient.invalidateQueries({ queryKey: ["environments"] });
|
|
42
|
+
setNotificationMessage("Environment deleted successfully");
|
|
42
43
|
},
|
|
43
44
|
onError(error) {
|
|
44
45
|
setNotificationMessage(
|
|
@@ -63,7 +64,7 @@ export default function DeleteProjectDialog({
|
|
|
63
64
|
open={open}
|
|
64
65
|
>
|
|
65
66
|
<DialogTitle sx={{ m: 0, p: 2 }} id="customized-dialog-title">
|
|
66
|
-
Delete
|
|
67
|
+
Delete Environment
|
|
67
68
|
</DialogTitle>
|
|
68
69
|
<IconButton
|
|
69
70
|
aria-label="close"
|
|
@@ -79,8 +80,8 @@ export default function DeleteProjectDialog({
|
|
|
79
80
|
</IconButton>
|
|
80
81
|
<DialogContent dividers>
|
|
81
82
|
<Typography gutterBottom>
|
|
82
|
-
Are you sure you want to delete "{
|
|
83
|
-
This action cannot be undone.
|
|
83
|
+
Are you sure you want to delete "{environment.name}
|
|
84
|
+
"? This action cannot be undone.
|
|
84
85
|
</Typography>
|
|
85
86
|
</DialogContent>
|
|
86
87
|
<DialogActions>
|
|
@@ -95,10 +96,10 @@ export default function DeleteProjectDialog({
|
|
|
95
96
|
Cancel
|
|
96
97
|
</Button>
|
|
97
98
|
<Button
|
|
98
|
-
loading={
|
|
99
|
+
loading={deleteEnvironment.isPending}
|
|
99
100
|
variant="contained"
|
|
100
101
|
autoFocus
|
|
101
|
-
onClick={() =>
|
|
102
|
+
onClick={() => deleteEnvironment.mutate()}
|
|
102
103
|
color="error"
|
|
103
104
|
>
|
|
104
105
|
Delete
|