@malloy-publisher/sdk 0.0.34 → 0.0.36
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 +21 -0
- package/dist/{RenderedResult-CKEsEevp.js → RenderedResult-BlNz8j4d.js} +2 -2
- package/dist/{RenderedResult-9A74lwfO.cjs → RenderedResult-DphykkT6.cjs} +1 -1
- package/dist/client/api.d.ts +18 -0
- package/dist/components/ApiErrorDisplay.d.ts +13 -0
- package/dist/components/Model/ModelCell.d.ts +1 -6
- package/dist/components/Package/Config.d.ts +1 -9
- package/dist/components/Package/Connections.d.ts +1 -8
- package/dist/components/Package/Databases.d.ts +1 -9
- package/dist/components/Package/Models.d.ts +1 -6
- package/dist/components/Package/Notebooks.d.ts +2 -7
- package/dist/components/Package/Package.d.ts +1 -6
- package/dist/components/Package/PackageProvider.d.ts +14 -0
- package/dist/components/Package/Schedules.d.ts +1 -9
- package/dist/components/Package/index.d.ts +2 -1
- package/dist/components/Project/About.d.ts +1 -7
- package/dist/components/Project/ConnectionExplorer.d.ts +1 -4
- package/dist/components/Project/Packages.d.ts +2 -5
- package/dist/components/Project/Project.d.ts +11 -3
- package/dist/components/Project/index.d.ts +1 -1
- package/dist/components/QueryResult/QueryResult.d.ts +1 -6
- package/dist/{index-DahUc0AC.js → index-DvGSfdDD.js} +29197 -29339
- package/dist/{index-TNDWxBXR.cjs → index-nKbldp0y.cjs} +598 -598
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +17 -13
- package/dist/{vendor-DfRellEl.js → vendor-C8UD-eyK.js} +5 -5
- package/package.json +1 -1
- package/src/components/ApiErrorDisplay.tsx +40 -0
- package/src/components/Home/Home.tsx +8 -1
- package/src/components/Model/Model.tsx +59 -28
- package/src/components/Model/ModelCell.tsx +26 -63
- package/src/components/Model/NamedQueries.tsx +2 -2
- package/src/components/Model/SourcesExplorer.tsx +14 -15
- package/src/components/MutableNotebook/ModelPicker.tsx +13 -3
- package/src/components/MutableNotebook/MutableCell.tsx +5 -14
- package/src/components/MutableNotebook/MutableNotebook.tsx +2 -2
- package/src/components/Notebook/Notebook.tsx +48 -24
- package/src/components/Package/Config.tsx +10 -18
- package/src/components/Package/Connections.tsx +10 -12
- package/src/components/Package/Databases.tsx +93 -198
- package/src/components/Package/FileTreeView.tsx +21 -4
- package/src/components/Package/Models.tsx +21 -31
- package/src/components/Package/Notebooks.tsx +22 -32
- package/src/components/Package/Package.tsx +31 -89
- package/src/components/Package/PackageProvider.tsx +46 -0
- package/src/components/Package/Schedules.tsx +10 -19
- package/src/components/Package/index.ts +6 -1
- package/src/components/Project/About.tsx +7 -15
- package/src/components/Project/ConnectionExplorer.tsx +131 -52
- package/src/components/Project/Packages.tsx +12 -13
- package/src/components/Project/Project.tsx +35 -16
- package/src/components/Project/index.ts +1 -1
- package/src/components/QueryResult/QueryResult.tsx +12 -15
- package/src/components/RenderedResult/ResultContainer.tsx +0 -1
- package/dist/components/Package/PublisherPackageProvider.d.ts +0 -14
- package/dist/components/Project/TablesInSchema.d.ts +0 -10
- package/src/components/Package/PublisherPackageProvider.tsx +0 -48
- package/src/components/Project/TablesInSchema.tsx +0 -84
|
@@ -293,20 +293,11 @@ export function MutableCell({
|
|
|
293
293
|
/>
|
|
294
294
|
))}
|
|
295
295
|
{!editingMalloy && cell.result && (
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
<Suspense fallback="Loading malloy...">
|
|
302
|
-
<ResultContainer
|
|
303
|
-
result={cell.result}
|
|
304
|
-
minHeight={500}
|
|
305
|
-
maxHeight={500}
|
|
306
|
-
/>
|
|
307
|
-
</Suspense>
|
|
308
|
-
</CardContent>
|
|
309
|
-
</>
|
|
296
|
+
<ResultContainer
|
|
297
|
+
result={cell.result}
|
|
298
|
+
minHeight={300}
|
|
299
|
+
maxHeight={800}
|
|
300
|
+
/>
|
|
310
301
|
)}
|
|
311
302
|
</>
|
|
312
303
|
))}
|
|
@@ -20,7 +20,7 @@ import { useRouterClickHandler } from "../click_helper";
|
|
|
20
20
|
import { Configuration, ModelsApi } from "../../client";
|
|
21
21
|
import { SourceAndPath } from "../Model/SourcesExplorer";
|
|
22
22
|
import { NotebookManager } from "../NotebookManager";
|
|
23
|
-
import {
|
|
23
|
+
import { usePackage } from "../Package";
|
|
24
24
|
import { StyledCard, StyledCardContent, StyledCardMedia } from "../styles";
|
|
25
25
|
import { ModelPicker } from "./ModelPicker";
|
|
26
26
|
import { MutableCell } from "./MutableCell";
|
|
@@ -48,7 +48,7 @@ export default function MutableNotebook({
|
|
|
48
48
|
}: MutableNotebookProps) {
|
|
49
49
|
const navigate = useRouterClickHandler();
|
|
50
50
|
const { server, projectName, packageName, versionId, accessToken } =
|
|
51
|
-
|
|
51
|
+
usePackage();
|
|
52
52
|
if (!projectName || !packageName) {
|
|
53
53
|
throw new Error(
|
|
54
54
|
"Project and package must be provided via PubliserPackageProvider",
|
|
@@ -11,11 +11,13 @@ import {
|
|
|
11
11
|
import Stack from "@mui/material/Stack";
|
|
12
12
|
import { QueryClient, useQuery } from "@tanstack/react-query";
|
|
13
13
|
import React, { useEffect } from "react";
|
|
14
|
-
import { Configuration, NotebooksApi } from "../../client";
|
|
14
|
+
import { Configuration, NotebooksApi, CompiledNotebook } from "../../client";
|
|
15
15
|
import { highlight } from "../highlighter";
|
|
16
|
-
import {
|
|
16
|
+
import { usePackage } from "../Package";
|
|
17
17
|
import { StyledCard, StyledCardContent, StyledCardMedia } from "../styles";
|
|
18
18
|
import { NotebookCell } from "./NotebookCell";
|
|
19
|
+
import { ApiErrorDisplay, ApiError } from "../ApiErrorDisplay";
|
|
20
|
+
import { AxiosError } from "axios";
|
|
19
21
|
|
|
20
22
|
const notebooksApi = new NotebooksApi(new Configuration());
|
|
21
23
|
const queryClient = new QueryClient();
|
|
@@ -27,7 +29,7 @@ interface NotebookProps {
|
|
|
27
29
|
expandEmbeddings?: boolean;
|
|
28
30
|
hideEmbeddingIcons?: boolean;
|
|
29
31
|
}
|
|
30
|
-
// Requires
|
|
32
|
+
// Requires PackageProvider
|
|
31
33
|
export default function Notebook({
|
|
32
34
|
notebookPath,
|
|
33
35
|
expandCodeCells,
|
|
@@ -40,7 +42,7 @@ export default function Notebook({
|
|
|
40
42
|
const [highlightedEmbedCode, setHighlightedEmbedCode] =
|
|
41
43
|
React.useState<string>();
|
|
42
44
|
const { server, projectName, packageName, accessToken, versionId } =
|
|
43
|
-
|
|
45
|
+
usePackage();
|
|
44
46
|
const notebookCodeSnippet = getNotebookCodeSnippet(
|
|
45
47
|
server,
|
|
46
48
|
packageName,
|
|
@@ -59,7 +61,7 @@ export default function Notebook({
|
|
|
59
61
|
isSuccess,
|
|
60
62
|
isError,
|
|
61
63
|
error,
|
|
62
|
-
} = useQuery(
|
|
64
|
+
} = useQuery<CompiledNotebook, ApiError>(
|
|
63
65
|
{
|
|
64
66
|
queryKey: [
|
|
65
67
|
"notebook",
|
|
@@ -69,21 +71,44 @@ export default function Notebook({
|
|
|
69
71
|
notebookPath,
|
|
70
72
|
versionId,
|
|
71
73
|
],
|
|
72
|
-
queryFn: () =>
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
74
|
+
queryFn: async () => {
|
|
75
|
+
try {
|
|
76
|
+
const response = await notebooksApi.getNotebook(
|
|
77
|
+
projectName,
|
|
78
|
+
packageName,
|
|
79
|
+
notebookPath,
|
|
80
|
+
versionId,
|
|
81
|
+
{
|
|
82
|
+
baseURL: server,
|
|
83
|
+
withCredentials: !accessToken,
|
|
84
|
+
headers: {
|
|
85
|
+
Authorization: accessToken && `Bearer ${accessToken}`,
|
|
86
|
+
},
|
|
83
87
|
},
|
|
84
|
-
|
|
85
|
-
|
|
88
|
+
);
|
|
89
|
+
return response.data;
|
|
90
|
+
} catch (err) {
|
|
91
|
+
// If it's an Axios error, it will have response data
|
|
92
|
+
if (err && typeof err === "object" && "response" in err) {
|
|
93
|
+
const axiosError = err as AxiosError<{
|
|
94
|
+
code: string;
|
|
95
|
+
message: string;
|
|
96
|
+
}>;
|
|
97
|
+
if (axiosError.response?.data) {
|
|
98
|
+
const apiError: ApiError = new Error(
|
|
99
|
+
axiosError.response.data.message || axiosError.message,
|
|
100
|
+
);
|
|
101
|
+
apiError.status = axiosError.response.status;
|
|
102
|
+
apiError.data = axiosError.response.data;
|
|
103
|
+
throw apiError;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
// For other errors, throw as is
|
|
107
|
+
throw err;
|
|
108
|
+
}
|
|
109
|
+
},
|
|
86
110
|
retry: false,
|
|
111
|
+
throwOnError: false,
|
|
87
112
|
},
|
|
88
113
|
queryClient,
|
|
89
114
|
);
|
|
@@ -171,7 +196,7 @@ export default function Notebook({
|
|
|
171
196
|
</Typography>
|
|
172
197
|
)}
|
|
173
198
|
{isSuccess &&
|
|
174
|
-
notebook.
|
|
199
|
+
notebook.notebookCells?.map((cell, index) => (
|
|
175
200
|
<NotebookCell
|
|
176
201
|
cell={cell}
|
|
177
202
|
notebookPath={notebookPath}
|
|
@@ -190,11 +215,10 @@ export default function Notebook({
|
|
|
190
215
|
/>
|
|
191
216
|
))}
|
|
192
217
|
{isError && (
|
|
193
|
-
<
|
|
194
|
-
{
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
</Typography>
|
|
218
|
+
<ApiErrorDisplay
|
|
219
|
+
error={error}
|
|
220
|
+
context={`${projectName} > ${packageName} > ${notebookPath}`}
|
|
221
|
+
/>
|
|
198
222
|
)}
|
|
199
223
|
</Stack>
|
|
200
224
|
</StyledCardMedia>
|
|
@@ -11,26 +11,16 @@ import { QueryClient, useQuery } from "@tanstack/react-query";
|
|
|
11
11
|
import axios from "axios";
|
|
12
12
|
import { Configuration, PackagesApi } from "../../client";
|
|
13
13
|
import { StyledCard, StyledCardContent } from "../styles";
|
|
14
|
+
import { usePackage } from "./PackageProvider";
|
|
15
|
+
import { ApiErrorDisplay } from "../ApiErrorDisplay";
|
|
14
16
|
|
|
15
|
-
axios.defaults.baseURL = "http://localhost:4000";
|
|
16
17
|
const packagesApi = new PackagesApi(new Configuration());
|
|
17
18
|
const queryClient = new QueryClient();
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
server
|
|
21
|
-
|
|
22
|
-
packageName: string;
|
|
23
|
-
versionId?: string;
|
|
24
|
-
accessToken?: string;
|
|
25
|
-
}
|
|
20
|
+
export default function Config() {
|
|
21
|
+
const { server, projectName, packageName, versionId, accessToken } =
|
|
22
|
+
usePackage();
|
|
26
23
|
|
|
27
|
-
export default function Package({
|
|
28
|
-
server,
|
|
29
|
-
projectName,
|
|
30
|
-
packageName,
|
|
31
|
-
versionId,
|
|
32
|
-
accessToken,
|
|
33
|
-
}: PackageProps) {
|
|
34
24
|
const { data, isSuccess, isError, error } = useQuery(
|
|
35
25
|
{
|
|
36
26
|
queryKey: ["package", server, projectName, packageName, versionId],
|
|
@@ -43,6 +33,7 @@ export default function Package({
|
|
|
43
33
|
},
|
|
44
34
|
}),
|
|
45
35
|
retry: false,
|
|
36
|
+
throwOnError: false,
|
|
46
37
|
},
|
|
47
38
|
queryClient,
|
|
48
39
|
);
|
|
@@ -94,9 +85,10 @@ export default function Package({
|
|
|
94
85
|
</ListItem>
|
|
95
86
|
))}
|
|
96
87
|
{isError && (
|
|
97
|
-
<
|
|
98
|
-
{
|
|
99
|
-
|
|
88
|
+
<ApiErrorDisplay
|
|
89
|
+
error={error}
|
|
90
|
+
context={`${projectName} > ${packageName} > ${versionId}`}
|
|
91
|
+
/>
|
|
100
92
|
)}
|
|
101
93
|
</List>
|
|
102
94
|
</Box>
|
|
@@ -11,17 +11,12 @@ import { QueryClient, useQuery } from "@tanstack/react-query";
|
|
|
11
11
|
import { Configuration, ConnectionsApi } from "../../client";
|
|
12
12
|
import { Connection as ApiConnection } from "../../client/api";
|
|
13
13
|
import { StyledCard, StyledCardContent } from "../styles";
|
|
14
|
+
import { usePackage } from "./PackageProvider";
|
|
15
|
+
import { ApiErrorDisplay } from "../ApiErrorDisplay";
|
|
14
16
|
|
|
15
17
|
const connectionsApi = new ConnectionsApi(new Configuration());
|
|
16
18
|
const queryClient = new QueryClient();
|
|
17
19
|
|
|
18
|
-
interface ConnectionsProps {
|
|
19
|
-
server?: string;
|
|
20
|
-
projectName: string;
|
|
21
|
-
accessToken: string;
|
|
22
|
-
navigate: (to: string, event?: React.MouseEvent) => void;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
20
|
// TODO(jjs) - Move this UI to the ConnectionExplorer component
|
|
26
21
|
function Connection({ connection }: { connection: ApiConnection }) {
|
|
27
22
|
return (
|
|
@@ -36,8 +31,9 @@ function Connection({ connection }: { connection: ApiConnection }) {
|
|
|
36
31
|
);
|
|
37
32
|
}
|
|
38
33
|
|
|
39
|
-
export default function Connections(
|
|
40
|
-
const { server, projectName, accessToken } =
|
|
34
|
+
export default function Connections() {
|
|
35
|
+
const { server, projectName, accessToken } = usePackage();
|
|
36
|
+
|
|
41
37
|
const { data, isSuccess, isError, error } = useQuery(
|
|
42
38
|
{
|
|
43
39
|
queryKey: ["connections", server, projectName],
|
|
@@ -50,6 +46,7 @@ export default function Connections(connectionProps: ConnectionsProps) {
|
|
|
50
46
|
},
|
|
51
47
|
}),
|
|
52
48
|
retry: false,
|
|
49
|
+
throwOnError: false,
|
|
53
50
|
},
|
|
54
51
|
queryClient,
|
|
55
52
|
);
|
|
@@ -98,9 +95,10 @@ export default function Connections(connectionProps: ConnectionsProps) {
|
|
|
98
95
|
<Typography variant="body2">No Connections</Typography>
|
|
99
96
|
)}
|
|
100
97
|
{isError && (
|
|
101
|
-
<
|
|
102
|
-
{
|
|
103
|
-
|
|
98
|
+
<ApiErrorDisplay
|
|
99
|
+
error={error}
|
|
100
|
+
context={`${projectName} > Connections`}
|
|
101
|
+
/>
|
|
104
102
|
)}
|
|
105
103
|
</Box>
|
|
106
104
|
</StyledCardContent>
|
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
DialogContent,
|
|
5
5
|
DialogTitle,
|
|
6
6
|
Divider,
|
|
7
|
-
IconButton,
|
|
8
7
|
Table,
|
|
9
8
|
TableBody,
|
|
10
9
|
TableCell,
|
|
@@ -17,26 +16,31 @@ import { QueryClient, useQuery } from "@tanstack/react-query";
|
|
|
17
16
|
import React from "react";
|
|
18
17
|
import { Configuration, Database, DatabasesApi } from "../../client";
|
|
19
18
|
import { StyledCard, StyledCardContent } from "../styles";
|
|
19
|
+
import { usePackage } from "./PackageProvider";
|
|
20
|
+
import { ApiErrorDisplay } from "../ApiErrorDisplay";
|
|
20
21
|
|
|
21
22
|
const databasesApi = new DatabasesApi(new Configuration());
|
|
22
23
|
const queryClient = new QueryClient();
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
server
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
export default function Databases() {
|
|
26
|
+
const { server, projectName, packageName, versionId, accessToken } =
|
|
27
|
+
usePackage();
|
|
28
|
+
|
|
29
|
+
const [open, setOpen] = React.useState(false);
|
|
30
|
+
const [selectedDatabase, setSelectedDatabase] =
|
|
31
|
+
React.useState<Database | null>(null);
|
|
32
|
+
|
|
33
|
+
const handleOpen = (database: Database) => {
|
|
34
|
+
setSelectedDatabase(database);
|
|
35
|
+
setOpen(true);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const handleClose = () => {
|
|
39
|
+
setOpen(false);
|
|
40
|
+
setSelectedDatabase(null);
|
|
41
|
+
};
|
|
31
42
|
|
|
32
|
-
|
|
33
|
-
server,
|
|
34
|
-
projectName,
|
|
35
|
-
packageName,
|
|
36
|
-
versionId,
|
|
37
|
-
accessToken,
|
|
38
|
-
}: DatabaseProps) {
|
|
39
|
-
const { data, isSuccess, isError, error } = useQuery(
|
|
43
|
+
const { data, isError, error, isSuccess } = useQuery(
|
|
40
44
|
{
|
|
41
45
|
queryKey: ["databases", server, projectName, packageName, versionId],
|
|
42
46
|
queryFn: () =>
|
|
@@ -48,6 +52,7 @@ export default function DatabaseView({
|
|
|
48
52
|
},
|
|
49
53
|
}),
|
|
50
54
|
retry: false,
|
|
55
|
+
throwOnError: false,
|
|
51
56
|
},
|
|
52
57
|
queryClient,
|
|
53
58
|
);
|
|
@@ -63,203 +68,93 @@ export default function DatabaseView({
|
|
|
63
68
|
}
|
|
64
69
|
};
|
|
65
70
|
return (
|
|
66
|
-
|
|
67
|
-
<
|
|
68
|
-
<
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
71
|
+
<>
|
|
72
|
+
<StyledCard variant="outlined" sx={{ padding: "10px", width: "100%" }}>
|
|
73
|
+
<StyledCardContent>
|
|
74
|
+
<Typography variant="overline" fontWeight="bold">
|
|
75
|
+
Databases
|
|
76
|
+
</Typography>
|
|
77
|
+
<Divider />
|
|
78
|
+
<Box
|
|
79
|
+
sx={{
|
|
80
|
+
mt: "10px",
|
|
81
|
+
maxHeight: "200px",
|
|
82
|
+
overflowY: "auto",
|
|
83
|
+
}}
|
|
84
|
+
>
|
|
85
|
+
{!isSuccess && !isError && (
|
|
86
|
+
<Typography variant="body2" sx={{ p: "10px", m: "auto" }}>
|
|
87
|
+
Fetching Databases...
|
|
88
|
+
</Typography>
|
|
89
|
+
)}
|
|
90
|
+
{isError && (
|
|
91
|
+
<ApiErrorDisplay
|
|
92
|
+
error={error}
|
|
93
|
+
context={`${projectName} > ${packageName} > Databases`}
|
|
94
|
+
/>
|
|
95
|
+
)}
|
|
96
|
+
{isSuccess && data.data.length > 0 && (
|
|
86
97
|
<Table size="small">
|
|
87
98
|
<TableHead>
|
|
88
99
|
<TableRow>
|
|
89
|
-
<TableCell>
|
|
90
|
-
|
|
91
|
-
variant="subtitle2"
|
|
92
|
-
fontWeight="bold"
|
|
93
|
-
>
|
|
94
|
-
Database Name
|
|
95
|
-
</Typography>
|
|
96
|
-
</TableCell>
|
|
97
|
-
<TableCell align="right">
|
|
98
|
-
<Typography
|
|
99
|
-
variant="subtitle2"
|
|
100
|
-
fontWeight="bold"
|
|
101
|
-
>
|
|
102
|
-
Table Rows
|
|
103
|
-
</Typography>
|
|
104
|
-
</TableCell>
|
|
100
|
+
<TableCell>Name</TableCell>
|
|
101
|
+
<TableCell align="right">Rows</TableCell>
|
|
105
102
|
</TableRow>
|
|
106
103
|
</TableHead>
|
|
107
104
|
<TableBody>
|
|
108
105
|
{data.data.map((database) => (
|
|
109
|
-
<TableRow
|
|
110
|
-
|
|
111
|
-
|
|
106
|
+
<TableRow
|
|
107
|
+
key={database.path}
|
|
108
|
+
onClick={() => handleOpen(database)}
|
|
109
|
+
sx={{ cursor: "pointer" }}
|
|
110
|
+
>
|
|
111
|
+
<TableCell component="th" scope="row">
|
|
112
|
+
{database.path}
|
|
112
113
|
</TableCell>
|
|
113
114
|
<TableCell align="right">
|
|
114
|
-
|
|
115
|
-
{formatRowSize(database.info.rowCount)}
|
|
116
|
-
</Typography>
|
|
115
|
+
{formatRowSize(database.info.rowCount)}
|
|
117
116
|
</TableCell>
|
|
118
117
|
</TableRow>
|
|
119
118
|
))}
|
|
120
119
|
</TableBody>
|
|
121
120
|
</Table>
|
|
121
|
+
)}
|
|
122
|
+
{isSuccess && data.data.length === 0 && (
|
|
123
|
+
<Typography variant="body2" sx={{ p: "10px", m: "auto" }}>
|
|
124
|
+
No databases found
|
|
125
|
+
</Typography>
|
|
126
|
+
)}
|
|
127
|
+
</Box>
|
|
128
|
+
</StyledCardContent>
|
|
129
|
+
</StyledCard>
|
|
130
|
+
|
|
131
|
+
<Dialog open={open} onClose={handleClose} maxWidth="sm" fullWidth>
|
|
132
|
+
<DialogTitle>{selectedDatabase?.path}</DialogTitle>
|
|
133
|
+
<DialogContent>
|
|
134
|
+
{selectedDatabase?.info?.columns && (
|
|
135
|
+
<TableContainer>
|
|
136
|
+
<Table size="small">
|
|
137
|
+
<TableHead>
|
|
138
|
+
<TableRow>
|
|
139
|
+
<TableCell>Column</TableCell>
|
|
140
|
+
<TableCell>Type</TableCell>
|
|
141
|
+
</TableRow>
|
|
142
|
+
</TableHead>
|
|
143
|
+
<TableBody>
|
|
144
|
+
{selectedDatabase.info.columns.map((column) => (
|
|
145
|
+
<TableRow key={column.name}>
|
|
146
|
+
<TableCell component="th" scope="row">
|
|
147
|
+
{column.name}
|
|
148
|
+
</TableCell>
|
|
149
|
+
<TableCell>{column.type}</TableCell>
|
|
150
|
+
</TableRow>
|
|
151
|
+
))}
|
|
152
|
+
</TableBody>
|
|
153
|
+
</Table>
|
|
122
154
|
</TableContainer>
|
|
123
155
|
)}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
{isError && (
|
|
128
|
-
<Typography variant="body2" sx={{ p: "10px", m: "auto" }}>
|
|
129
|
-
{`${projectName} > ${packageName} > ${versionId} - ${error.message}`}
|
|
130
|
-
</Typography>
|
|
131
|
-
)}
|
|
132
|
-
</Box>
|
|
133
|
-
</StyledCardContent>
|
|
134
|
-
</StyledCard>
|
|
135
|
-
);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
function NameAndSchema({ database }: { database: Database }) {
|
|
139
|
-
const [open, setOpen] = React.useState(false);
|
|
140
|
-
return (
|
|
141
|
-
<Box
|
|
142
|
-
sx={{ display: "flex", alignItems: "center" }}
|
|
143
|
-
onClick={() => setOpen(!open)}
|
|
144
|
-
style={{ cursor: "pointer" }}
|
|
145
|
-
>
|
|
146
|
-
<Typography
|
|
147
|
-
variant="body2"
|
|
148
|
-
color="primary"
|
|
149
|
-
sx={{
|
|
150
|
-
maxWidth: "200px",
|
|
151
|
-
overflow: "hidden",
|
|
152
|
-
textOverflow: "ellipsis",
|
|
153
|
-
whiteSpace: "nowrap",
|
|
154
|
-
}}
|
|
155
|
-
>
|
|
156
|
-
{database.path}
|
|
157
|
-
</Typography>
|
|
158
|
-
|
|
159
|
-
<Box sx={{ display: "flex", alignItems: "center" }}>
|
|
160
|
-
<Box sx={{ mr: 1, display: "flex", alignItems: "center" }}>
|
|
161
|
-
<svg
|
|
162
|
-
width="16"
|
|
163
|
-
height="16"
|
|
164
|
-
viewBox="0 0 24 24"
|
|
165
|
-
fill="none"
|
|
166
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
167
|
-
>
|
|
168
|
-
<path
|
|
169
|
-
d="M11 7H6C5.46957 7 4.96086 7.21071 4.58579 7.58579C4.21071 7.96086 4 8.46957 4 9V18C4 18.5304 4.21071 19.0391 4.58579 19.4142C4.96086 19.7893 5.46957 20 6 20H15C15.5304 20 16.0391 19.7893 16.4142 19.4142C16.7893 19.0391 17 18.5304 17 18V13"
|
|
170
|
-
stroke="currentColor"
|
|
171
|
-
strokeWidth="2"
|
|
172
|
-
strokeLinecap="round"
|
|
173
|
-
strokeLinejoin="round"
|
|
174
|
-
/>
|
|
175
|
-
<path
|
|
176
|
-
d="M9 15L20 4"
|
|
177
|
-
stroke="currentColor"
|
|
178
|
-
strokeWidth="2"
|
|
179
|
-
strokeLinecap="round"
|
|
180
|
-
strokeLinejoin="round"
|
|
181
|
-
/>
|
|
182
|
-
<path
|
|
183
|
-
d="M15 4H20V9"
|
|
184
|
-
stroke="currentColor"
|
|
185
|
-
strokeWidth="2"
|
|
186
|
-
strokeLinecap="round"
|
|
187
|
-
strokeLinejoin="round"
|
|
188
|
-
/>
|
|
189
|
-
</svg>
|
|
190
|
-
</Box>
|
|
191
|
-
</Box>
|
|
192
|
-
<SchemaButton
|
|
193
|
-
database={database}
|
|
194
|
-
open={open}
|
|
195
|
-
setClose={() => setOpen(false)}
|
|
196
|
-
/>
|
|
197
|
-
</Box>
|
|
198
|
-
);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
function SchemaButton({
|
|
202
|
-
database,
|
|
203
|
-
open,
|
|
204
|
-
setClose,
|
|
205
|
-
}: {
|
|
206
|
-
open: boolean;
|
|
207
|
-
setClose: () => void;
|
|
208
|
-
database: Database;
|
|
209
|
-
}) {
|
|
210
|
-
return (
|
|
211
|
-
<Dialog open={open} onClose={setClose} maxWidth="sm" fullWidth>
|
|
212
|
-
<DialogTitle>
|
|
213
|
-
Schema:{" "}
|
|
214
|
-
<Typography
|
|
215
|
-
fontSize="large"
|
|
216
|
-
variant="body2"
|
|
217
|
-
fontFamily="monospace"
|
|
218
|
-
component="span"
|
|
219
|
-
>
|
|
220
|
-
{database.path}
|
|
221
|
-
</Typography>
|
|
222
|
-
<IconButton
|
|
223
|
-
aria-label="close"
|
|
224
|
-
onClick={setClose}
|
|
225
|
-
sx={{ position: "absolute", right: 8, top: 8 }}
|
|
226
|
-
>
|
|
227
|
-
<Box
|
|
228
|
-
sx={{
|
|
229
|
-
width: 24,
|
|
230
|
-
height: 24,
|
|
231
|
-
display: "flex",
|
|
232
|
-
alignItems: "center",
|
|
233
|
-
justifyContent: "center",
|
|
234
|
-
}}
|
|
235
|
-
>
|
|
236
|
-
X
|
|
237
|
-
</Box>
|
|
238
|
-
</IconButton>
|
|
239
|
-
</DialogTitle>
|
|
240
|
-
<DialogContent>
|
|
241
|
-
<TableContainer>
|
|
242
|
-
<Table
|
|
243
|
-
size="small"
|
|
244
|
-
sx={{ "& .MuiTableCell-root": { padding: "10px" } }}
|
|
245
|
-
>
|
|
246
|
-
<TableHead>
|
|
247
|
-
<TableRow>
|
|
248
|
-
<TableCell>NAME</TableCell>
|
|
249
|
-
<TableCell>TYPE</TableCell>
|
|
250
|
-
</TableRow>
|
|
251
|
-
</TableHead>
|
|
252
|
-
<TableBody>
|
|
253
|
-
{database.info.columns.map((row) => (
|
|
254
|
-
<TableRow key={row.name}>
|
|
255
|
-
<TableCell>{row.name}</TableCell>
|
|
256
|
-
<TableCell>{row.type}</TableCell>
|
|
257
|
-
</TableRow>
|
|
258
|
-
))}
|
|
259
|
-
</TableBody>
|
|
260
|
-
</Table>
|
|
261
|
-
</TableContainer>
|
|
262
|
-
</DialogContent>
|
|
263
|
-
</Dialog>
|
|
156
|
+
</DialogContent>
|
|
157
|
+
</Dialog>
|
|
158
|
+
</>
|
|
264
159
|
);
|
|
265
160
|
}
|