@malloy-publisher/sdk 0.0.41 → 0.0.42
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/{RenderedResult-gQPXZIVQ.js → RenderedResult-D4wHWzQL.js} +2 -2
- package/dist/{RenderedResult-BX2zW03q.cjs → RenderedResult-DR4Ejhm0.cjs} +1 -1
- package/dist/components/Notebook/Notebook.d.ts +4 -3
- package/dist/hooks/useQueryWithApiError.d.ts +10 -0
- package/dist/{index-xo1oaGoD.cjs → index-C7HUzsul.cjs} +522 -522
- package/dist/{index-DCLrfHfE.js → index-wBKeSKqo.js} +21302 -21344
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +16 -15
- package/dist/{vendor-BCM56_2K.js → vendor-BKsYdkmG.js} +5456 -5458
- package/dist/{vendor-Bg9-K32d.cjs → vendor-hHfbZ4ZT.cjs} +30 -30
- package/openapitools.json +1 -1
- package/package.json +2 -2
- package/src/components/ApiErrorDisplay.tsx +12 -12
- package/src/components/Home/Home.tsx +9 -14
- package/src/components/Model/Model.tsx +18 -45
- package/src/components/Model/NamedQueries.tsx +38 -42
- package/src/components/Model/SourcesExplorer.tsx +47 -51
- package/src/components/MutableNotebook/ModelPicker.tsx +12 -18
- package/src/components/Notebook/Notebook.tsx +37 -60
- package/src/components/Package/Config.tsx +28 -34
- package/src/components/Package/Connections.tsx +12 -18
- package/src/components/Package/Databases.tsx +12 -18
- package/src/components/Package/Models.tsx +12 -20
- package/src/components/Package/Notebooks.tsx +13 -12
- package/src/components/Package/Schedules.tsx +12 -18
- package/src/components/Project/About.tsx +12 -18
- package/src/components/Project/ConnectionExplorer.tsx +49 -65
- package/src/components/Project/Packages.tsx +12 -18
- package/src/components/QueryResult/QueryResult.tsx +24 -30
- package/src/hooks/useQueryWithApiError.ts +114 -0
- package/src/index.ts +5 -0
|
@@ -7,36 +7,30 @@ import {
|
|
|
7
7
|
ListItemText,
|
|
8
8
|
Typography,
|
|
9
9
|
} from "@mui/material";
|
|
10
|
-
import { QueryClient, useQuery } from "@tanstack/react-query";
|
|
11
10
|
import { Configuration, PackagesApi } from "../../client";
|
|
12
11
|
import { ApiErrorDisplay } from "../ApiErrorDisplay";
|
|
13
12
|
import { Loading } from "../Loading";
|
|
14
13
|
import { StyledCard, StyledCardContent } from "../styles";
|
|
15
14
|
import { usePackage } from "./PackageProvider";
|
|
15
|
+
import { useQueryWithApiError } from "../../hooks/useQueryWithApiError";
|
|
16
16
|
|
|
17
17
|
const packagesApi = new PackagesApi(new Configuration());
|
|
18
|
-
const queryClient = new QueryClient();
|
|
19
18
|
|
|
20
19
|
export default function Config() {
|
|
21
20
|
const { server, projectName, packageName, versionId, accessToken } =
|
|
22
21
|
usePackage();
|
|
23
22
|
|
|
24
|
-
const { data, isSuccess, isError, error } =
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
retry: false,
|
|
36
|
-
throwOnError: false,
|
|
37
|
-
},
|
|
38
|
-
queryClient,
|
|
39
|
-
);
|
|
23
|
+
const { data, isSuccess, isError, error } = useQueryWithApiError({
|
|
24
|
+
queryKey: ["package", server, projectName, packageName, versionId],
|
|
25
|
+
queryFn: () =>
|
|
26
|
+
packagesApi.getPackage(projectName, packageName, versionId, false, {
|
|
27
|
+
baseURL: server,
|
|
28
|
+
withCredentials: !accessToken,
|
|
29
|
+
headers: {
|
|
30
|
+
Authorization: accessToken && `Bearer ${accessToken}`,
|
|
31
|
+
},
|
|
32
|
+
}),
|
|
33
|
+
});
|
|
40
34
|
|
|
41
35
|
return (
|
|
42
36
|
<StyledCard variant="outlined" sx={{ padding: "10px", width: "100%" }}>
|
|
@@ -57,9 +51,9 @@ export default function Config() {
|
|
|
57
51
|
<ListItemText primary="Name" secondary={packageName} />
|
|
58
52
|
</ListItem>
|
|
59
53
|
{!isSuccess && !isError && (
|
|
60
|
-
<
|
|
54
|
+
<ListItem>
|
|
61
55
|
<Loading text="Fetching Package Metadata..." />
|
|
62
|
-
</
|
|
56
|
+
</ListItem>
|
|
63
57
|
)}
|
|
64
58
|
{isSuccess &&
|
|
65
59
|
((data.data && (
|
|
@@ -70,20 +64,20 @@ export default function Config() {
|
|
|
70
64
|
/>
|
|
71
65
|
</ListItem>
|
|
72
66
|
)) || (
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
67
|
+
<ListItem
|
|
68
|
+
disablePadding={true}
|
|
69
|
+
dense={true}
|
|
70
|
+
sx={{ mt: "20px" }}
|
|
71
|
+
>
|
|
72
|
+
<ErrorIcon
|
|
73
|
+
sx={{
|
|
74
|
+
color: "grey.600",
|
|
75
|
+
mr: "10px",
|
|
76
|
+
}}
|
|
77
|
+
/>
|
|
78
|
+
<ListItemText primary={"No package manifest"} />
|
|
79
|
+
</ListItem>
|
|
80
|
+
))}
|
|
87
81
|
{isError && (
|
|
88
82
|
<ApiErrorDisplay
|
|
89
83
|
error={error}
|
|
@@ -7,15 +7,14 @@ import {
|
|
|
7
7
|
TableRow,
|
|
8
8
|
Typography,
|
|
9
9
|
} from "@mui/material";
|
|
10
|
-
import { QueryClient, useQuery } from "@tanstack/react-query";
|
|
11
10
|
import { Configuration, ConnectionsApi } from "../../client";
|
|
12
11
|
import { Connection as ApiConnection } from "../../client/api";
|
|
13
12
|
import { StyledCard, StyledCardContent } from "../styles";
|
|
14
13
|
import { usePackage } from "./PackageProvider";
|
|
15
14
|
import { ApiErrorDisplay } from "../ApiErrorDisplay";
|
|
15
|
+
import { useQueryWithApiError } from "../../hooks/useQueryWithApiError";
|
|
16
16
|
|
|
17
17
|
const connectionsApi = new ConnectionsApi(new Configuration());
|
|
18
|
-
const queryClient = new QueryClient();
|
|
19
18
|
|
|
20
19
|
// TODO(jjs) - Move this UI to the ConnectionExplorer component
|
|
21
20
|
function Connection({ connection }: { connection: ApiConnection }) {
|
|
@@ -34,22 +33,17 @@ function Connection({ connection }: { connection: ApiConnection }) {
|
|
|
34
33
|
export default function Connections() {
|
|
35
34
|
const { server, projectName, accessToken } = usePackage();
|
|
36
35
|
|
|
37
|
-
const { data, isSuccess, isError, error } =
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
retry: false,
|
|
49
|
-
throwOnError: false,
|
|
50
|
-
},
|
|
51
|
-
queryClient,
|
|
52
|
-
);
|
|
36
|
+
const { data, isSuccess, isError, error } = useQueryWithApiError({
|
|
37
|
+
queryKey: ["connections", server, projectName],
|
|
38
|
+
queryFn: () =>
|
|
39
|
+
connectionsApi.listConnections(projectName, {
|
|
40
|
+
baseURL: server,
|
|
41
|
+
withCredentials: !accessToken,
|
|
42
|
+
headers: {
|
|
43
|
+
Authorization: accessToken && `Bearer ${accessToken}`,
|
|
44
|
+
},
|
|
45
|
+
}),
|
|
46
|
+
});
|
|
53
47
|
|
|
54
48
|
return (
|
|
55
49
|
<StyledCard variant="outlined" sx={{ padding: "10px", width: "100%" }}>
|
|
@@ -12,16 +12,15 @@ import {
|
|
|
12
12
|
TableRow,
|
|
13
13
|
Typography,
|
|
14
14
|
} from "@mui/material";
|
|
15
|
-
import { QueryClient, useQuery } from "@tanstack/react-query";
|
|
16
15
|
import React from "react";
|
|
17
16
|
import { Configuration, Database, DatabasesApi } from "../../client";
|
|
18
17
|
import { StyledCard, StyledCardContent } from "../styles";
|
|
19
18
|
import { usePackage } from "./PackageProvider";
|
|
20
19
|
import { ApiErrorDisplay } from "../ApiErrorDisplay";
|
|
21
20
|
import { Loading } from "../Loading";
|
|
21
|
+
import { useQueryWithApiError } from "../../hooks/useQueryWithApiError";
|
|
22
22
|
|
|
23
23
|
const databasesApi = new DatabasesApi(new Configuration());
|
|
24
|
-
const queryClient = new QueryClient();
|
|
25
24
|
|
|
26
25
|
export default function Databases() {
|
|
27
26
|
const { server, projectName, packageName, versionId, accessToken } =
|
|
@@ -41,22 +40,17 @@ export default function Databases() {
|
|
|
41
40
|
setSelectedDatabase(null);
|
|
42
41
|
};
|
|
43
42
|
|
|
44
|
-
const { data, isError, error, isSuccess } =
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
retry: false,
|
|
56
|
-
throwOnError: false,
|
|
57
|
-
},
|
|
58
|
-
queryClient,
|
|
59
|
-
);
|
|
43
|
+
const { data, isError, error, isSuccess } = useQueryWithApiError({
|
|
44
|
+
queryKey: ["databases", server, projectName, packageName, versionId],
|
|
45
|
+
queryFn: () =>
|
|
46
|
+
databasesApi.listDatabases(projectName, packageName, versionId, {
|
|
47
|
+
baseURL: server,
|
|
48
|
+
withCredentials: !accessToken,
|
|
49
|
+
headers: {
|
|
50
|
+
Authorization: accessToken && `Bearer ${accessToken}`,
|
|
51
|
+
},
|
|
52
|
+
}),
|
|
53
|
+
});
|
|
60
54
|
const formatRowSize = (size: number) => {
|
|
61
55
|
if (size >= 1024 * 1024 * 1024 * 1024) {
|
|
62
56
|
return `${(size / (1024 * 1024 * 1024)).toFixed(2)} T`;
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { Box, Divider, Typography } from "@mui/material";
|
|
2
|
-
import { QueryClient, useQuery } from "@tanstack/react-query";
|
|
3
|
-
import axios from "axios";
|
|
4
2
|
import { Configuration, ModelsApi } from "../../client";
|
|
5
3
|
import { ApiErrorDisplay } from "../ApiErrorDisplay";
|
|
6
4
|
import { Loading } from "../Loading";
|
|
7
5
|
import { StyledCard, StyledCardContent } from "../styles";
|
|
8
6
|
import { FileTreeView } from "./FileTreeView";
|
|
9
7
|
import { usePackage } from "./PackageProvider";
|
|
8
|
+
import { useQueryWithApiError } from "../../hooks/useQueryWithApiError";
|
|
10
9
|
|
|
11
|
-
axios.defaults.baseURL = "http://localhost:4000";
|
|
12
10
|
const modelsApi = new ModelsApi(new Configuration());
|
|
13
|
-
const queryClient = new QueryClient();
|
|
14
11
|
|
|
15
12
|
const DEFAULT_EXPANDED_FOLDERS = ["notebooks/", "models/"];
|
|
16
13
|
|
|
@@ -22,22 +19,17 @@ export default function Models({ navigate }: ModelsProps) {
|
|
|
22
19
|
const { server, projectName, packageName, versionId, accessToken } =
|
|
23
20
|
usePackage();
|
|
24
21
|
|
|
25
|
-
const { data, isError, error, isSuccess } =
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
throwOnError: false,
|
|
37
|
-
retry: false,
|
|
38
|
-
},
|
|
39
|
-
queryClient,
|
|
40
|
-
);
|
|
22
|
+
const { data, isError, error, isSuccess } = useQueryWithApiError({
|
|
23
|
+
queryKey: ["models", server, projectName, packageName, versionId],
|
|
24
|
+
queryFn: () =>
|
|
25
|
+
modelsApi.listModels(projectName, packageName, versionId, {
|
|
26
|
+
baseURL: server,
|
|
27
|
+
withCredentials: !accessToken,
|
|
28
|
+
headers: {
|
|
29
|
+
Authorization: accessToken && `Bearer ${accessToken}`,
|
|
30
|
+
},
|
|
31
|
+
}),
|
|
32
|
+
});
|
|
41
33
|
|
|
42
34
|
return (
|
|
43
35
|
<StyledCard variant="outlined" sx={{ padding: "10px", width: "100%" }}>
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { Box, Divider, Typography } from "@mui/material";
|
|
2
|
-
import { QueryClient, useQuery } from "@tanstack/react-query";
|
|
3
2
|
import { Configuration, NotebooksApi } from "../../client";
|
|
4
3
|
import { ApiErrorDisplay } from "../ApiErrorDisplay";
|
|
5
4
|
import { Loading } from "../Loading";
|
|
6
5
|
import { StyledCard, StyledCardContent } from "../styles";
|
|
7
6
|
import { FileTreeView } from "./FileTreeView";
|
|
8
7
|
import { usePackage } from "./PackageProvider";
|
|
8
|
+
import { useQueryWithApiError } from "../../hooks/useQueryWithApiError";
|
|
9
9
|
|
|
10
10
|
const notebooksApi = new NotebooksApi(new Configuration());
|
|
11
|
-
const queryClient = new QueryClient();
|
|
12
11
|
|
|
13
12
|
const DEFAULT_EXPANDED_FOLDERS = ["notebooks/"];
|
|
14
13
|
|
|
@@ -20,22 +19,24 @@ export default function Notebooks({ navigate }: NotebooksProps) {
|
|
|
20
19
|
const { server, projectName, packageName, versionId, accessToken } =
|
|
21
20
|
usePackage();
|
|
22
21
|
|
|
23
|
-
const { data, isError, error, isSuccess } =
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
const { data, isError, error, isSuccess } = useQueryWithApiError({
|
|
23
|
+
queryKey: ["notebooks", server, projectName, packageName, versionId],
|
|
24
|
+
queryFn: async () => {
|
|
25
|
+
const response = await notebooksApi.listNotebooks(
|
|
26
|
+
projectName,
|
|
27
|
+
packageName,
|
|
28
|
+
versionId,
|
|
29
|
+
{
|
|
28
30
|
baseURL: server,
|
|
29
31
|
withCredentials: !accessToken,
|
|
30
32
|
headers: {
|
|
31
33
|
Authorization: accessToken && `Bearer ${accessToken}`,
|
|
32
34
|
},
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
},
|
|
36
|
+
);
|
|
37
|
+
return response;
|
|
36
38
|
},
|
|
37
|
-
|
|
38
|
-
);
|
|
39
|
+
});
|
|
39
40
|
|
|
40
41
|
return (
|
|
41
42
|
<StyledCard variant="outlined" sx={{ padding: "10px", width: "100%" }}>
|
|
@@ -10,36 +10,30 @@ import {
|
|
|
10
10
|
TableRow,
|
|
11
11
|
Typography,
|
|
12
12
|
} from "@mui/material";
|
|
13
|
-
import { QueryClient, useQuery } from "@tanstack/react-query";
|
|
14
13
|
import { Configuration, SchedulesApi } from "../../client";
|
|
15
14
|
import { StyledCard, StyledCardContent } from "../styles";
|
|
16
15
|
import { usePackage } from "./PackageProvider";
|
|
17
16
|
import { ApiErrorDisplay } from "../ApiErrorDisplay";
|
|
18
17
|
import { Loading } from "../Loading";
|
|
18
|
+
import { useQueryWithApiError } from "../../hooks/useQueryWithApiError";
|
|
19
19
|
|
|
20
20
|
const schedulesApi = new SchedulesApi(new Configuration());
|
|
21
|
-
const queryClient = new QueryClient();
|
|
22
21
|
|
|
23
22
|
export default function Schedules() {
|
|
24
23
|
const { server, projectName, packageName, versionId, accessToken } =
|
|
25
24
|
usePackage();
|
|
26
25
|
|
|
27
|
-
const { data, isError, isLoading, error } =
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
retry: false,
|
|
39
|
-
throwOnError: false,
|
|
40
|
-
},
|
|
41
|
-
queryClient,
|
|
42
|
-
);
|
|
26
|
+
const { data, isError, isLoading, error } = useQueryWithApiError({
|
|
27
|
+
queryKey: ["schedules", server, projectName, packageName, versionId],
|
|
28
|
+
queryFn: () =>
|
|
29
|
+
schedulesApi.listSchedules(projectName, packageName, versionId, {
|
|
30
|
+
baseURL: server,
|
|
31
|
+
withCredentials: !accessToken,
|
|
32
|
+
headers: {
|
|
33
|
+
Authorization: accessToken && `Bearer ${accessToken}`,
|
|
34
|
+
},
|
|
35
|
+
}),
|
|
36
|
+
});
|
|
43
37
|
|
|
44
38
|
if (isLoading) {
|
|
45
39
|
return <Loading text="Fetching Schedules..." />;
|
|
@@ -2,33 +2,27 @@ import { Divider, Typography } from "@mui/material";
|
|
|
2
2
|
import { Configuration, ProjectsApi } from "../../client";
|
|
3
3
|
import Markdown from "markdown-to-jsx";
|
|
4
4
|
import { StyledCard, StyledCardContent, StyledCardMedia } from "../styles";
|
|
5
|
-
import { QueryClient, useQuery } from "@tanstack/react-query";
|
|
6
5
|
import { useProject } from "./Project";
|
|
7
6
|
import { ApiErrorDisplay } from "../ApiErrorDisplay";
|
|
8
7
|
import { Loading } from "../Loading";
|
|
8
|
+
import { useQueryWithApiError } from "../../hooks/useQueryWithApiError";
|
|
9
9
|
|
|
10
10
|
const projectsApi = new ProjectsApi(new Configuration());
|
|
11
|
-
const queryClient = new QueryClient();
|
|
12
11
|
|
|
13
12
|
export default function About() {
|
|
14
13
|
const { server, projectName, accessToken } = useProject();
|
|
15
14
|
|
|
16
|
-
const { data, isSuccess, isError, error } =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
retry: false,
|
|
28
|
-
throwOnError: false,
|
|
29
|
-
},
|
|
30
|
-
queryClient,
|
|
31
|
-
);
|
|
15
|
+
const { data, isSuccess, isError, error } = useQueryWithApiError({
|
|
16
|
+
queryKey: ["about", server, projectName],
|
|
17
|
+
queryFn: () =>
|
|
18
|
+
projectsApi.getProject(projectName, false, {
|
|
19
|
+
baseURL: server,
|
|
20
|
+
withCredentials: true,
|
|
21
|
+
headers: {
|
|
22
|
+
Authorization: accessToken && `Bearer ${accessToken}`,
|
|
23
|
+
},
|
|
24
|
+
}),
|
|
25
|
+
});
|
|
32
26
|
|
|
33
27
|
return (
|
|
34
28
|
<>
|
|
@@ -21,15 +21,14 @@ import {
|
|
|
21
21
|
TableHead,
|
|
22
22
|
TableRow,
|
|
23
23
|
} from "@mui/material";
|
|
24
|
-
import { QueryClient, useQuery } from "@tanstack/react-query";
|
|
25
24
|
import { ConnectionsApi } from "../../client/api";
|
|
26
25
|
import { Configuration } from "../../client/configuration";
|
|
27
26
|
import { useProject } from "./Project";
|
|
28
27
|
import { ApiErrorDisplay } from "../ApiErrorDisplay";
|
|
29
28
|
import { Loading } from "../Loading";
|
|
29
|
+
import { useQueryWithApiError } from "../../hooks/useQueryWithApiError";
|
|
30
30
|
|
|
31
31
|
const connectionsApi = new ConnectionsApi(new Configuration());
|
|
32
|
-
const queryClient = new QueryClient();
|
|
33
32
|
|
|
34
33
|
interface ConnectionExplorerProps {
|
|
35
34
|
connectionName: string;
|
|
@@ -47,22 +46,17 @@ export default function ConnectionExplorer({
|
|
|
47
46
|
null,
|
|
48
47
|
);
|
|
49
48
|
const [showHiddenSchemas, setShowHiddenSchemas] = React.useState(false);
|
|
50
|
-
const { data, isSuccess, isError, error, isLoading } =
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
retry: false,
|
|
62
|
-
throwOnError: false,
|
|
63
|
-
},
|
|
64
|
-
queryClient,
|
|
65
|
-
);
|
|
49
|
+
const { data, isSuccess, isError, error, isLoading } = useQueryWithApiError({
|
|
50
|
+
queryKey: ["tablePath", server, projectName, connectionName],
|
|
51
|
+
queryFn: () =>
|
|
52
|
+
connectionsApi.listSchemas(projectName, connectionName, {
|
|
53
|
+
baseURL: server,
|
|
54
|
+
withCredentials: !accessToken,
|
|
55
|
+
headers: {
|
|
56
|
+
Authorization: accessToken && `Bearer ${accessToken}`,
|
|
57
|
+
},
|
|
58
|
+
}),
|
|
59
|
+
});
|
|
66
60
|
|
|
67
61
|
return (
|
|
68
62
|
<Grid container spacing={2}>
|
|
@@ -174,35 +168,30 @@ function TableViewer({
|
|
|
174
168
|
}: TableViewerProps) {
|
|
175
169
|
const { server, projectName, accessToken } = useProject();
|
|
176
170
|
|
|
177
|
-
const { data, isSuccess, isError, error, isLoading } =
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
171
|
+
const { data, isSuccess, isError, error, isLoading } = useQueryWithApiError({
|
|
172
|
+
queryKey: [
|
|
173
|
+
"tablePathSchema",
|
|
174
|
+
server,
|
|
175
|
+
projectName,
|
|
176
|
+
connectionName,
|
|
177
|
+
schemaName,
|
|
178
|
+
tableName,
|
|
179
|
+
],
|
|
180
|
+
queryFn: () =>
|
|
181
|
+
connectionsApi.getTablesource(
|
|
182
182
|
projectName,
|
|
183
183
|
connectionName,
|
|
184
|
-
schemaName,
|
|
185
184
|
tableName,
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
`${schemaName}.${tableName}`,
|
|
193
|
-
{
|
|
194
|
-
baseURL: server,
|
|
195
|
-
withCredentials: !accessToken,
|
|
196
|
-
headers: {
|
|
197
|
-
Authorization: accessToken && `Bearer ${accessToken}`,
|
|
198
|
-
},
|
|
185
|
+
`${schemaName}.${tableName}`,
|
|
186
|
+
{
|
|
187
|
+
baseURL: server,
|
|
188
|
+
withCredentials: !accessToken,
|
|
189
|
+
headers: {
|
|
190
|
+
Authorization: accessToken && `Bearer ${accessToken}`,
|
|
199
191
|
},
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
},
|
|
204
|
-
queryClient,
|
|
205
|
-
);
|
|
192
|
+
},
|
|
193
|
+
),
|
|
194
|
+
});
|
|
206
195
|
|
|
207
196
|
if (isSuccess && data) {
|
|
208
197
|
console.log(data);
|
|
@@ -289,28 +278,23 @@ function TablesInSchema({
|
|
|
289
278
|
}: TablesInSchemaProps) {
|
|
290
279
|
const { server, projectName, accessToken } = useProject();
|
|
291
280
|
|
|
292
|
-
const { data, isSuccess, isError, error, isLoading } =
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
retry: false,
|
|
310
|
-
throwOnError: false,
|
|
311
|
-
},
|
|
312
|
-
queryClient,
|
|
313
|
-
);
|
|
281
|
+
const { data, isSuccess, isError, error, isLoading } = useQueryWithApiError({
|
|
282
|
+
queryKey: [
|
|
283
|
+
"tablesInSchema",
|
|
284
|
+
server,
|
|
285
|
+
projectName,
|
|
286
|
+
connectionName,
|
|
287
|
+
schemaName,
|
|
288
|
+
],
|
|
289
|
+
queryFn: () =>
|
|
290
|
+
connectionsApi.listTables(projectName, connectionName, schemaName, {
|
|
291
|
+
baseURL: server,
|
|
292
|
+
withCredentials: !accessToken,
|
|
293
|
+
headers: {
|
|
294
|
+
Authorization: accessToken && `Bearer ${accessToken}`,
|
|
295
|
+
},
|
|
296
|
+
}),
|
|
297
|
+
});
|
|
314
298
|
|
|
315
299
|
return (
|
|
316
300
|
<>
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { Box, Divider, Grid, Typography } from "@mui/material";
|
|
2
2
|
import { Configuration, PackagesApi } from "../../client";
|
|
3
3
|
import { StyledCard, StyledCardContent, StyledCardMedia } from "../styles";
|
|
4
|
-
import { QueryClient, useQuery } from "@tanstack/react-query";
|
|
5
4
|
import { useProject } from "./Project";
|
|
6
5
|
import { ApiErrorDisplay } from "../ApiErrorDisplay";
|
|
7
6
|
import { Loading } from "../Loading";
|
|
7
|
+
import { useQueryWithApiError } from "../../hooks/useQueryWithApiError";
|
|
8
8
|
|
|
9
9
|
const packagesApi = new PackagesApi(new Configuration());
|
|
10
|
-
const queryClient = new QueryClient();
|
|
11
10
|
|
|
12
11
|
interface PackagesProps {
|
|
13
12
|
navigate: (to: string, event?: React.MouseEvent) => void;
|
|
@@ -16,22 +15,17 @@ interface PackagesProps {
|
|
|
16
15
|
export default function Packages({ navigate }: PackagesProps) {
|
|
17
16
|
const { server, projectName, accessToken } = useProject();
|
|
18
17
|
|
|
19
|
-
const { data, isSuccess, isError, error } =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
retry: false,
|
|
31
|
-
throwOnError: false,
|
|
32
|
-
},
|
|
33
|
-
queryClient,
|
|
34
|
-
);
|
|
18
|
+
const { data, isSuccess, isError, error } = useQueryWithApiError({
|
|
19
|
+
queryKey: ["packages", server, projectName],
|
|
20
|
+
queryFn: () =>
|
|
21
|
+
packagesApi.listPackages(projectName, {
|
|
22
|
+
baseURL: server,
|
|
23
|
+
withCredentials: !accessToken,
|
|
24
|
+
headers: {
|
|
25
|
+
Authorization: accessToken && `Bearer ${accessToken}`,
|
|
26
|
+
},
|
|
27
|
+
}),
|
|
28
|
+
});
|
|
35
29
|
|
|
36
30
|
return (
|
|
37
31
|
<>
|