apache-airflow-providers-edge3 1.1.3rc1__py3-none-any.whl → 1.2.0rc1__py3-none-any.whl
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.
- airflow/providers/edge3/__init__.py +1 -1
- airflow/providers/edge3/cli/worker.py +6 -2
- airflow/providers/edge3/example_dags/integration_test.py +6 -2
- airflow/providers/edge3/example_dags/win_test.py +6 -1
- airflow/providers/edge3/openapi/v2-edge-generated.yaml +1138 -0
- airflow/providers/edge3/plugins/edge_executor_plugin.py +43 -3
- airflow/providers/edge3/plugins/www/.gitignore +27 -0
- airflow/providers/edge3/plugins/www/.prettierignore +6 -0
- airflow/providers/edge3/plugins/www/.prettierrc +13 -0
- airflow/providers/edge3/plugins/www/README.md +141 -0
- airflow/providers/edge3/plugins/www/dist/main.d.ts +1 -0
- airflow/providers/edge3/plugins/www/dist/main.umd.cjs +124 -0
- airflow/providers/edge3/plugins/www/eslint.config.js +54 -0
- airflow/providers/edge3/plugins/www/index.html +13 -0
- airflow/providers/edge3/plugins/www/openapi-gen/queries/common.ts +33 -0
- airflow/providers/edge3/plugins/www/openapi-gen/queries/ensureQueryData.ts +16 -0
- airflow/providers/edge3/plugins/www/openapi-gen/queries/index.ts +4 -0
- airflow/providers/edge3/plugins/www/openapi-gen/queries/infiniteQueries.ts +2 -0
- airflow/providers/edge3/plugins/www/openapi-gen/queries/prefetch.ts +16 -0
- airflow/providers/edge3/plugins/www/openapi-gen/queries/queries.ts +87 -0
- airflow/providers/edge3/plugins/www/openapi-gen/queries/suspense.ts +16 -0
- airflow/providers/edge3/plugins/www/openapi-gen/requests/core/ApiError.ts +21 -0
- airflow/providers/edge3/plugins/www/openapi-gen/requests/core/ApiRequestOptions.ts +21 -0
- airflow/providers/edge3/plugins/www/openapi-gen/requests/core/ApiResult.ts +7 -0
- airflow/providers/edge3/plugins/www/openapi-gen/requests/core/CancelablePromise.ts +126 -0
- airflow/providers/edge3/plugins/www/openapi-gen/requests/core/OpenAPI.ts +57 -0
- airflow/providers/edge3/plugins/www/openapi-gen/requests/core/request.ts +347 -0
- airflow/providers/edge3/plugins/www/openapi-gen/requests/index.ts +7 -0
- airflow/providers/edge3/plugins/www/openapi-gen/requests/schemas.gen.ts +700 -0
- airflow/providers/edge3/plugins/www/openapi-gen/requests/services.gen.ts +289 -0
- airflow/providers/edge3/plugins/www/openapi-gen/requests/types.gen.ts +655 -0
- airflow/providers/edge3/plugins/www/package.json +80 -0
- airflow/providers/edge3/plugins/www/pnpm-lock.yaml +6653 -0
- airflow/providers/edge3/plugins/www/src/components/ErrorAlert.tsx +66 -0
- airflow/providers/edge3/plugins/www/src/components/StateBadge.tsx +43 -0
- airflow/providers/edge3/plugins/www/src/components/StateIcon.tsx +58 -0
- airflow/providers/edge3/plugins/www/src/components/WorkerStateBadge.tsx +71 -0
- airflow/providers/edge3/plugins/www/src/components/WorkerStateIcon.tsx +57 -0
- airflow/providers/edge3/plugins/www/src/components/ui/Alert.tsx +62 -0
- airflow/providers/edge3/plugins/www/src/components/ui/CloseButton.tsx +32 -0
- airflow/providers/edge3/plugins/www/src/components/ui/index.ts +20 -0
- airflow/providers/edge3/plugins/www/src/context/colorMode/ColorModeProvider.tsx +24 -0
- airflow/providers/edge3/plugins/www/src/context/colorMode/index.ts +21 -0
- airflow/providers/edge3/plugins/www/src/context/colorMode/useColorMode.tsx +32 -0
- airflow/providers/edge3/plugins/www/src/dev.tsx +29 -0
- airflow/providers/edge3/plugins/www/src/layouts/EdgeLayout.tsx +44 -0
- airflow/providers/edge3/plugins/www/src/layouts/NavTabs.tsx +63 -0
- airflow/providers/edge3/plugins/www/src/main.tsx +58 -0
- airflow/providers/edge3/plugins/www/src/pages/JobsPage.tsx +88 -0
- airflow/providers/edge3/plugins/www/src/pages/WorkerPage.tsx +105 -0
- airflow/providers/edge3/plugins/www/src/res/README.md +24 -0
- airflow/providers/edge3/plugins/www/src/res/cloud-computer-dark.svg +3 -0
- airflow/providers/edge3/plugins/www/src/res/cloud-computer.svg +3 -0
- airflow/providers/edge3/plugins/www/src/theme.ts +176 -0
- airflow/providers/edge3/plugins/www/src/utils/config.ts +23 -0
- airflow/providers/edge3/plugins/www/src/utils/index.ts +22 -0
- airflow/providers/edge3/plugins/www/src/utils/tokenHandler.ts +51 -0
- airflow/providers/edge3/plugins/www/src/utils/useContainerWidth.ts +43 -0
- airflow/providers/edge3/plugins/www/src/vite-env.d.ts +20 -0
- airflow/providers/edge3/plugins/www/testsSetup.ts +19 -0
- airflow/providers/edge3/plugins/www/tsconfig.app.json +31 -0
- airflow/providers/edge3/plugins/www/tsconfig.json +8 -0
- airflow/providers/edge3/plugins/www/tsconfig.lib.json +15 -0
- airflow/providers/edge3/plugins/www/tsconfig.node.json +29 -0
- airflow/providers/edge3/plugins/www/vite.config.ts +95 -0
- airflow/providers/edge3/version_compat.py +1 -0
- airflow/providers/edge3/worker_api/app.py +34 -8
- airflow/providers/edge3/worker_api/datamodels_ui.py +67 -0
- airflow/providers/edge3/worker_api/routes/health.py +1 -1
- airflow/providers/edge3/worker_api/routes/ui.py +102 -0
- {apache_airflow_providers_edge3-1.1.3rc1.dist-info → apache_airflow_providers_edge3-1.2.0rc1.dist-info}/METADATA +7 -8
- apache_airflow_providers_edge3-1.2.0rc1.dist-info/RECORD +103 -0
- apache_airflow_providers_edge3-1.1.3rc1.dist-info/RECORD +0 -41
- {apache_airflow_providers_edge3-1.1.3rc1.dist-info → apache_airflow_providers_edge3-1.2.0rc1.dist-info}/WHEEL +0 -0
- {apache_airflow_providers_edge3-1.1.3rc1.dist-info → apache_airflow_providers_edge3-1.2.0rc1.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,58 @@
|
|
1
|
+
/*!
|
2
|
+
* Licensed to the Apache Software Foundation (ASF) under one
|
3
|
+
* or more contributor license agreements. See the NOTICE file
|
4
|
+
* distributed with this work for additional information
|
5
|
+
* regarding copyright ownership. The ASF licenses this file
|
6
|
+
* to you under the Apache License, Version 2.0 (the
|
7
|
+
* "License"); you may not use this file except in compliance
|
8
|
+
* with the License. You may obtain a copy of the License at
|
9
|
+
*
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
*
|
12
|
+
* Unless required by applicable law or agreed to in writing,
|
13
|
+
* software distributed under the License is distributed on an
|
14
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
15
|
+
* KIND, either express or implied. See the License for the
|
16
|
+
* specific language governing permissions and limitations
|
17
|
+
* under the License.
|
18
|
+
*/
|
19
|
+
import { ChakraProvider } from "@chakra-ui/react";
|
20
|
+
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
21
|
+
import axios from "axios";
|
22
|
+
import { FC } from "react";
|
23
|
+
|
24
|
+
import { ColorModeProvider } from "src/context/colorMode";
|
25
|
+
import { EdgeLayout } from "src/layouts/EdgeLayout";
|
26
|
+
import { tokenHandler } from "src/utils";
|
27
|
+
|
28
|
+
import { system } from "./theme";
|
29
|
+
|
30
|
+
export type PluginComponentProps = object;
|
31
|
+
|
32
|
+
/**
|
33
|
+
* Main plugin component
|
34
|
+
*/
|
35
|
+
const PluginComponent: FC<PluginComponentProps> = () => {
|
36
|
+
// ensure HTTP API calls are authenticated with current session token
|
37
|
+
axios.interceptors.request.use(tokenHandler);
|
38
|
+
|
39
|
+
const queryClient = new QueryClient({
|
40
|
+
defaultOptions: {
|
41
|
+
queries: {
|
42
|
+
staleTime: Infinity,
|
43
|
+
},
|
44
|
+
},
|
45
|
+
});
|
46
|
+
|
47
|
+
return (
|
48
|
+
<ChakraProvider value={system}>
|
49
|
+
<QueryClientProvider client={queryClient}>
|
50
|
+
<ColorModeProvider>
|
51
|
+
<EdgeLayout />
|
52
|
+
</ColorModeProvider>
|
53
|
+
</QueryClientProvider>
|
54
|
+
</ChakraProvider>
|
55
|
+
);
|
56
|
+
};
|
57
|
+
|
58
|
+
export default PluginComponent;
|
@@ -0,0 +1,88 @@
|
|
1
|
+
/*!
|
2
|
+
* Licensed to the Apache Software Foundation (ASF) under one
|
3
|
+
* or more contributor license agreements. See the NOTICE file
|
4
|
+
* distributed with this work for additional information
|
5
|
+
* regarding copyright ownership. The ASF licenses this file
|
6
|
+
* to you under the Apache License, Version 2.0 (the
|
7
|
+
* "License"); you may not use this file except in compliance
|
8
|
+
* with the License. You may obtain a copy of the License at
|
9
|
+
*
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
*
|
12
|
+
* Unless required by applicable law or agreed to in writing,
|
13
|
+
* software distributed under the License is distributed on an
|
14
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
15
|
+
* KIND, either express or implied. See the License for the
|
16
|
+
* specific language governing permissions and limitations
|
17
|
+
* under the License.
|
18
|
+
*/
|
19
|
+
import { Box, Table } from "@chakra-ui/react";
|
20
|
+
import { useUiServiceJobs } from "openapi/queries";
|
21
|
+
|
22
|
+
import { ErrorAlert } from "src/components/ErrorAlert";
|
23
|
+
import { StateBadge } from "src/components/StateBadge";
|
24
|
+
import { autoRefreshInterval } from "src/utils";
|
25
|
+
|
26
|
+
export const JobsPage = () => {
|
27
|
+
const { data, error } = useUiServiceJobs(undefined, {
|
28
|
+
enabled: true,
|
29
|
+
refetchInterval: autoRefreshInterval,
|
30
|
+
});
|
31
|
+
|
32
|
+
// TODO to make it proper
|
33
|
+
// Use DataTable as component from Airflow-Core UI
|
34
|
+
// Add sorting
|
35
|
+
// Add filtering
|
36
|
+
// Add links to see job details / jobs list
|
37
|
+
// Translation
|
38
|
+
if (data)
|
39
|
+
return (
|
40
|
+
<Box p={2}>
|
41
|
+
<Table.Root size="sm" interactive stickyHeader striped>
|
42
|
+
<Table.Header>
|
43
|
+
<Table.Row>
|
44
|
+
<Table.ColumnHeader>Dag ID</Table.ColumnHeader>
|
45
|
+
<Table.ColumnHeader>Run ID</Table.ColumnHeader>
|
46
|
+
<Table.ColumnHeader>Task ID</Table.ColumnHeader>
|
47
|
+
<Table.ColumnHeader>Map Index</Table.ColumnHeader>
|
48
|
+
<Table.ColumnHeader>Try Number</Table.ColumnHeader>
|
49
|
+
<Table.ColumnHeader>State</Table.ColumnHeader>
|
50
|
+
<Table.ColumnHeader>Queue</Table.ColumnHeader>
|
51
|
+
<Table.ColumnHeader>Queued DTTM</Table.ColumnHeader>
|
52
|
+
<Table.ColumnHeader>Edge Worker</Table.ColumnHeader>
|
53
|
+
<Table.ColumnHeader>Last Update</Table.ColumnHeader>
|
54
|
+
</Table.Row>
|
55
|
+
</Table.Header>
|
56
|
+
<Table.Body>
|
57
|
+
{data.jobs.map((job) => (
|
58
|
+
<Table.Row
|
59
|
+
key={`${job.dag_id}.${job.run_id}.${job.task_id}.${job.map_index}.${job.try_number}`}
|
60
|
+
>
|
61
|
+
<Table.Cell>{job.dag_id}</Table.Cell>
|
62
|
+
<Table.Cell>{job.run_id}</Table.Cell>
|
63
|
+
<Table.Cell>{job.task_id}</Table.Cell>
|
64
|
+
<Table.Cell>{job.map_index}</Table.Cell>
|
65
|
+
<Table.Cell>{job.try_number}</Table.Cell>
|
66
|
+
<Table.Cell>
|
67
|
+
<StateBadge state={job.state}>{job.state}</StateBadge>
|
68
|
+
</Table.Cell>
|
69
|
+
<Table.Cell>{job.queue}</Table.Cell>
|
70
|
+
<Table.Cell>{job.queued_dttm}</Table.Cell>
|
71
|
+
<Table.Cell>{job.edge_worker}</Table.Cell>
|
72
|
+
<Table.Cell>{job.last_update}</Table.Cell>
|
73
|
+
</Table.Row>
|
74
|
+
))}
|
75
|
+
</Table.Body>
|
76
|
+
</Table.Root>
|
77
|
+
</Box>
|
78
|
+
);
|
79
|
+
if (error) {
|
80
|
+
return (
|
81
|
+
<Box p={2}>
|
82
|
+
<p>Unable to load data:</p>
|
83
|
+
<ErrorAlert error={error} />
|
84
|
+
</Box>
|
85
|
+
);
|
86
|
+
}
|
87
|
+
return <Box p={2}>Loading...</Box>;
|
88
|
+
};
|
@@ -0,0 +1,105 @@
|
|
1
|
+
/*!
|
2
|
+
* Licensed to the Apache Software Foundation (ASF) under one
|
3
|
+
* or more contributor license agreements. See the NOTICE file
|
4
|
+
* distributed with this work for additional information
|
5
|
+
* regarding copyright ownership. The ASF licenses this file
|
6
|
+
* to you under the Apache License, Version 2.0 (the
|
7
|
+
* "License"); you may not use this file except in compliance
|
8
|
+
* with the License. You may obtain a copy of the License at
|
9
|
+
*
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
*
|
12
|
+
* Unless required by applicable law or agreed to in writing,
|
13
|
+
* software distributed under the License is distributed on an
|
14
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
15
|
+
* KIND, either express or implied. See the License for the
|
16
|
+
* specific language governing permissions and limitations
|
17
|
+
* under the License.
|
18
|
+
*/
|
19
|
+
import { Box, Table } from "@chakra-ui/react";
|
20
|
+
import { useUiServiceWorker } from "openapi/queries";
|
21
|
+
|
22
|
+
import { ErrorAlert } from "src/components/ErrorAlert";
|
23
|
+
import { WorkerStateBadge } from "src/components/WorkerStateBadge";
|
24
|
+
import { autoRefreshInterval } from "src/utils";
|
25
|
+
|
26
|
+
export const WorkerPage = () => {
|
27
|
+
const { data, error } = useUiServiceWorker(undefined, {
|
28
|
+
enabled: true,
|
29
|
+
refetchInterval: autoRefreshInterval,
|
30
|
+
});
|
31
|
+
|
32
|
+
// TODO to make it proper
|
33
|
+
// Use DataTable as component from Airflow-Core UI
|
34
|
+
// Add actions for maintenance / delete of orphan worker
|
35
|
+
// Add sorting
|
36
|
+
// Add filtering
|
37
|
+
// Add links to see jobs on worker
|
38
|
+
// Translation
|
39
|
+
if (data)
|
40
|
+
return (
|
41
|
+
<Box p={2}>
|
42
|
+
<Table.Root size="sm" interactive stickyHeader striped>
|
43
|
+
<Table.Header>
|
44
|
+
<Table.Row>
|
45
|
+
<Table.ColumnHeader>Worker Name</Table.ColumnHeader>
|
46
|
+
<Table.ColumnHeader>State</Table.ColumnHeader>
|
47
|
+
<Table.ColumnHeader>Queues</Table.ColumnHeader>
|
48
|
+
<Table.ColumnHeader>First Online</Table.ColumnHeader>
|
49
|
+
<Table.ColumnHeader>Last Heartbeat</Table.ColumnHeader>
|
50
|
+
<Table.ColumnHeader>Active Jobs</Table.ColumnHeader>
|
51
|
+
<Table.ColumnHeader>System Information</Table.ColumnHeader>
|
52
|
+
<Table.ColumnHeader>Operations</Table.ColumnHeader>
|
53
|
+
</Table.Row>
|
54
|
+
</Table.Header>
|
55
|
+
<Table.Body>
|
56
|
+
{data.workers.map((worker) => (
|
57
|
+
<Table.Row key={worker.worker_name}>
|
58
|
+
<Table.Cell>{worker.worker_name}</Table.Cell>
|
59
|
+
<Table.Cell>
|
60
|
+
<WorkerStateBadge state={worker.state}>{worker.state}</WorkerStateBadge>
|
61
|
+
</Table.Cell>
|
62
|
+
<Table.Cell>
|
63
|
+
{worker.queues ? (
|
64
|
+
<ul>
|
65
|
+
{worker.queues.map((queue) => (
|
66
|
+
<li key={queue}>{queue}</li>
|
67
|
+
))}
|
68
|
+
</ul>
|
69
|
+
) : (
|
70
|
+
"(default)"
|
71
|
+
)}
|
72
|
+
</Table.Cell>
|
73
|
+
<Table.Cell>{worker.first_online}</Table.Cell>
|
74
|
+
<Table.Cell>{worker.last_heartbeat}</Table.Cell>
|
75
|
+
<Table.Cell>{worker.jobs_active}</Table.Cell>
|
76
|
+
<Table.Cell>
|
77
|
+
{worker.sysinfo ? (
|
78
|
+
<ul>
|
79
|
+
{Object.entries(worker.sysinfo).map(([key, value]) => (
|
80
|
+
<li key={key}>
|
81
|
+
{key}: {value}
|
82
|
+
</li>
|
83
|
+
))}
|
84
|
+
</ul>
|
85
|
+
) : (
|
86
|
+
"N/A"
|
87
|
+
)}
|
88
|
+
</Table.Cell>
|
89
|
+
<Table.Cell>{worker.maintenance_comments}</Table.Cell>
|
90
|
+
</Table.Row>
|
91
|
+
))}
|
92
|
+
</Table.Body>
|
93
|
+
</Table.Root>
|
94
|
+
</Box>
|
95
|
+
);
|
96
|
+
if (error) {
|
97
|
+
return (
|
98
|
+
<Box p={2}>
|
99
|
+
<p>Unable to load data:</p>
|
100
|
+
<ErrorAlert error={error} />
|
101
|
+
</Box>
|
102
|
+
);
|
103
|
+
}
|
104
|
+
return <Box p={2}>Loading...</Box>;
|
105
|
+
};
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<!--
|
2
|
+
Licensed to the Apache Software Foundation (ASF) under one
|
3
|
+
or more contributor license agreements. See the NOTICE file
|
4
|
+
distributed with this work for additional information
|
5
|
+
regarding copyright ownership. The ASF licenses this file
|
6
|
+
to you under the Apache License, Version 2.0 (the
|
7
|
+
"License"); you may not use this file except in compliance
|
8
|
+
with the License. You may obtain a copy of the License at
|
9
|
+
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
|
12
|
+
Unless required by applicable law or agreed to in writing,
|
13
|
+
software distributed under the License is distributed on an
|
14
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
15
|
+
KIND, either express or implied. See the License for the
|
16
|
+
specific language governing permissions and limitations
|
17
|
+
under the License.
|
18
|
+
-->
|
19
|
+
|
20
|
+
# Edge Icon Resources
|
21
|
+
|
22
|
+
The icons were sourced from https://github.com/grommet/grommet-icons/blob/e9bcdfd0ee7cd96f6f065dc223611743bcd1ed58/public/img/cloud-computer.svg
|
23
|
+
|
24
|
+
All credits to @alansouzati - https://github.com/alansouzati
|
@@ -0,0 +1,3 @@
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
|
2
|
+
<path fill="none" stroke="#FFFFFF" stroke-width="2" d="M6,6 L6,5 C6,2 7.5,1 10,1 L14,1 C16.5,1 18,2.5 18,5 L18,6 C21,6 23,8 23,11 C23,14 21,16 18,16 M14,6 L6,6 C3,6 1,7.5 1,11 C1,14.5 3,16 6,16 M8,19 L16,19 L16,12 L8,12 L8,19 Z M12,19 L12,23 L12,19 Z M9,23 L15,23 L9,23 Z"/>
|
3
|
+
</svg>
|
@@ -0,0 +1,3 @@
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
|
2
|
+
<path fill="none" stroke="#000" stroke-width="2" d="M6,6 L6,5 C6,2 7.5,1 10,1 L14,1 C16.5,1 18,2.5 18,5 L18,6 C21,6 23,8 23,11 C23,14 21,16 18,16 M14,6 L6,6 C3,6 1,7.5 1,11 C1,14.5 3,16 6,16 M8,19 L16,19 L16,12 L8,12 L8,19 Z M12,19 L12,23 L12,19 Z M9,23 L15,23 L9,23 Z"/>
|
3
|
+
</svg>
|
@@ -0,0 +1,176 @@
|
|
1
|
+
/*!
|
2
|
+
* Licensed to the Apache Software Foundation (ASF) under one
|
3
|
+
* or more contributor license agreements. See the NOTICE file
|
4
|
+
* distributed with this work for additional information
|
5
|
+
* regarding copyright ownership. The ASF licenses this file
|
6
|
+
* to you under the Apache License, Version 2.0 (the
|
7
|
+
* "License"); you may not use this file except in compliance
|
8
|
+
* with the License. You may obtain a copy of the License at
|
9
|
+
*
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
*
|
12
|
+
* Unless required by applicable law or agreed to in writing,
|
13
|
+
* software distributed under the License is distributed on an
|
14
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
15
|
+
* KIND, either express or implied. See the License for the
|
16
|
+
* specific language governing permissions and limitations
|
17
|
+
* under the License.
|
18
|
+
*/
|
19
|
+
|
20
|
+
/* eslint-disable perfectionist/sort-objects */
|
21
|
+
import { createSystem, defaultConfig, defineConfig } from "@chakra-ui/react";
|
22
|
+
|
23
|
+
const generateSemanticTokens = (color: string, darkContrast: string = "white") => ({
|
24
|
+
solid: { value: `{colors.${color}.600}` },
|
25
|
+
contrast: { value: { _light: "white", _dark: darkContrast } },
|
26
|
+
fg: { value: { _light: `{colors.${color}.800}`, _dark: `{colors.${color}.200}` } },
|
27
|
+
muted: { value: { _light: `{colors.${color}.200}`, _dark: `{colors.${color}.800}` } },
|
28
|
+
subtle: { value: { _light: `{colors.${color}.100}`, _dark: `{colors.${color}.900}` } },
|
29
|
+
emphasized: { value: { _light: `{colors.${color}.300}`, _dark: `{colors.${color}.700}` } },
|
30
|
+
focusRing: { value: { _light: `{colors.${color}.800}`, _dark: `{colors.${color}.200}` } },
|
31
|
+
});
|
32
|
+
|
33
|
+
const customConfig = defineConfig({
|
34
|
+
theme: {
|
35
|
+
tokens: {
|
36
|
+
colors: {
|
37
|
+
// Default green was too light
|
38
|
+
success: {
|
39
|
+
"50": { value: "#E0FFE0" },
|
40
|
+
"100": { value: "#C2FFC2" },
|
41
|
+
"200": { value: "#80FF80" },
|
42
|
+
"300": { value: "#42FF42" },
|
43
|
+
"400": { value: "#00FF00" },
|
44
|
+
"500": { value: "#00C200" },
|
45
|
+
"600": { value: "#008000" },
|
46
|
+
"700": { value: "#006100" },
|
47
|
+
"800": { value: "#004200" },
|
48
|
+
"900": { value: "#001F00" },
|
49
|
+
"950": { value: "#000F00" },
|
50
|
+
},
|
51
|
+
failed: defaultConfig.theme?.tokens?.colors?.red ?? {},
|
52
|
+
// Default gray was too dark
|
53
|
+
queued: {
|
54
|
+
"50": { value: "#F5F5F5" },
|
55
|
+
"100": { value: "#EBEBEB" },
|
56
|
+
"200": { value: "#D4D4D4" },
|
57
|
+
"300": { value: "#BFBFBF" },
|
58
|
+
"400": { value: "#ABABAB" },
|
59
|
+
"500": { value: "#969696" },
|
60
|
+
"600": { value: "#808080" },
|
61
|
+
"700": { value: "#616161" },
|
62
|
+
"800": { value: "#404040" },
|
63
|
+
"900": { value: "#212121" },
|
64
|
+
"950": { value: "#0F0F0F" },
|
65
|
+
},
|
66
|
+
skipped: defaultConfig.theme?.tokens?.colors?.pink ?? {},
|
67
|
+
up_for_reschedule: defaultConfig.theme?.tokens?.colors?.cyan ?? {},
|
68
|
+
up_for_retry: defaultConfig.theme?.tokens?.colors?.yellow ?? {},
|
69
|
+
upstream_failed: defaultConfig.theme?.tokens?.colors?.orange ?? {},
|
70
|
+
// lime
|
71
|
+
running: {
|
72
|
+
"50": { value: "#EFFBEF" },
|
73
|
+
"100": { value: "#DEF7DE" },
|
74
|
+
"200": { value: "#B9EEB9" },
|
75
|
+
"300": { value: "#98E698" },
|
76
|
+
"400": { value: "#78DE78" },
|
77
|
+
"500": { value: "#53D553" },
|
78
|
+
"600": { value: "#32CD32" },
|
79
|
+
"700": { value: "#269C26" },
|
80
|
+
"800": { value: "#196719" },
|
81
|
+
"900": { value: "#0D350D" },
|
82
|
+
"950": { value: "#061906" },
|
83
|
+
},
|
84
|
+
// violet
|
85
|
+
restarting: {
|
86
|
+
"50": { value: "#F6EBFF" },
|
87
|
+
"100": { value: "#EDD6FF" },
|
88
|
+
"200": { value: "#D9A8FF" },
|
89
|
+
"300": { value: "#C880FF" },
|
90
|
+
"400": { value: "#B657FF" },
|
91
|
+
"500": { value: "#A229FF" },
|
92
|
+
"600": { value: "#8F00FF" },
|
93
|
+
"700": { value: "#6E00C2" },
|
94
|
+
"800": { value: "#480080" },
|
95
|
+
"900": { value: "#260042" },
|
96
|
+
"950": { value: "#11001F" },
|
97
|
+
},
|
98
|
+
// mediumpurple
|
99
|
+
deferred: {
|
100
|
+
"50": { value: "#F6F3FC" },
|
101
|
+
"100": { value: "#EDE7F9" },
|
102
|
+
"200": { value: "#DACEF3" },
|
103
|
+
"300": { value: "#C8B6ED" },
|
104
|
+
"400": { value: "#B9A1E7" },
|
105
|
+
"500": { value: "#A689E1" },
|
106
|
+
"600": { value: "#9370DB" },
|
107
|
+
"700": { value: "#6432C8" },
|
108
|
+
"800": { value: "#412182" },
|
109
|
+
"900": { value: "#211041" },
|
110
|
+
"950": { value: "#100821" },
|
111
|
+
},
|
112
|
+
// tan
|
113
|
+
scheduled: {
|
114
|
+
"50": { value: "#FBF8F4" },
|
115
|
+
"100": { value: "#F8F3ED" },
|
116
|
+
"200": { value: "#F1E7DA" },
|
117
|
+
"300": { value: "#E8D9C4" },
|
118
|
+
"400": { value: "#E1CDB2" },
|
119
|
+
"500": { value: "#DAC1A0" },
|
120
|
+
"600": { value: "#D2B48C" },
|
121
|
+
"700": { value: "#B9894B" },
|
122
|
+
"800": { value: "#7D5C31" },
|
123
|
+
"900": { value: "#3E2E18" },
|
124
|
+
"950": { value: "#21180D" },
|
125
|
+
},
|
126
|
+
// lightblue
|
127
|
+
none: {
|
128
|
+
"50": { value: "#F7FBFD" },
|
129
|
+
"100": { value: "#F3F9FB" },
|
130
|
+
"200": { value: "#E4F2F7" },
|
131
|
+
"300": { value: "#D8ECF3" },
|
132
|
+
"400": { value: "#C8E5EE" },
|
133
|
+
"500": { value: "#BDDFEB" },
|
134
|
+
"600": { value: "#ADD8E6" },
|
135
|
+
"700": { value: "#5FB2CE" },
|
136
|
+
"800": { value: "#30819C" },
|
137
|
+
"900": { value: "#18414E" },
|
138
|
+
"950": { value: "#0C2027" },
|
139
|
+
},
|
140
|
+
// lightgrey
|
141
|
+
removed: {
|
142
|
+
"50": { value: "#FCFCFC" },
|
143
|
+
"100": { value: "#F7F7F7" },
|
144
|
+
"200": { value: "#F0F0F0" },
|
145
|
+
"300": { value: "#E8E8E8" },
|
146
|
+
"400": { value: "#E0E0E0" },
|
147
|
+
"500": { value: "#DBDBDB" },
|
148
|
+
"600": { value: "#D3D3D3" },
|
149
|
+
"700": { value: "#9E9E9E" },
|
150
|
+
"800": { value: "#696969" },
|
151
|
+
"900": { value: "#363636" },
|
152
|
+
"950": { value: "#1A1A1A" },
|
153
|
+
},
|
154
|
+
},
|
155
|
+
},
|
156
|
+
semanticTokens: {
|
157
|
+
colors: {
|
158
|
+
success: generateSemanticTokens("success"),
|
159
|
+
failed: defaultConfig.theme?.semanticTokens?.colors?.red ?? {},
|
160
|
+
queued: generateSemanticTokens("queued"),
|
161
|
+
skipped: defaultConfig.theme?.semanticTokens?.colors?.pink ?? {},
|
162
|
+
up_for_reschedule: defaultConfig.theme?.semanticTokens?.colors?.cyan ?? {},
|
163
|
+
up_for_retry: defaultConfig.theme?.semanticTokens?.colors?.yellow ?? {},
|
164
|
+
upstream_failed: defaultConfig.theme?.semanticTokens?.colors?.orange ?? {},
|
165
|
+
running: generateSemanticTokens("running"),
|
166
|
+
restarting: generateSemanticTokens("restarting"),
|
167
|
+
deferred: generateSemanticTokens("deferred"),
|
168
|
+
scheduled: generateSemanticTokens("scheduled"),
|
169
|
+
none: generateSemanticTokens("none", "black"),
|
170
|
+
removed: generateSemanticTokens("removed", "black"),
|
171
|
+
},
|
172
|
+
},
|
173
|
+
},
|
174
|
+
});
|
175
|
+
|
176
|
+
export const system = createSystem(defaultConfig, customConfig);
|
@@ -0,0 +1,23 @@
|
|
1
|
+
/*!
|
2
|
+
* Licensed to the Apache Software Foundation (ASF) under one
|
3
|
+
* or more contributor license agreements. See the NOTICE file
|
4
|
+
* distributed with this work for additional information
|
5
|
+
* regarding copyright ownership. The ASF licenses this file
|
6
|
+
* to you under the Apache License, Version 2.0 (the
|
7
|
+
* "License"); you may not use this file except in compliance
|
8
|
+
* with the License. You may obtain a copy of the License at
|
9
|
+
*
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
*
|
12
|
+
* Unless required by applicable law or agreed to in writing,
|
13
|
+
* software distributed under the License is distributed on an
|
14
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
15
|
+
* KIND, either express or implied. See the License for the
|
16
|
+
* specific language governing permissions and limitations
|
17
|
+
* under the License.
|
18
|
+
*/
|
19
|
+
|
20
|
+
// TODO / Note: might use this in future but core-ui-API is not yet bound:
|
21
|
+
// const autoRefreshInterval = useConfig("auto_refresh_interval") as number | undefined;
|
22
|
+
// Either we need the UI API as a "common component" or we need to bin services via axios here (again)
|
23
|
+
export const autoRefreshInterval = 5000;
|
@@ -0,0 +1,22 @@
|
|
1
|
+
/*!
|
2
|
+
* Licensed to the Apache Software Foundation (ASF) under one
|
3
|
+
* or more contributor license agreements. See the NOTICE file
|
4
|
+
* distributed with this work for additional information
|
5
|
+
* regarding copyright ownership. The ASF licenses this file
|
6
|
+
* to you under the Apache License, Version 2.0 (the
|
7
|
+
* "License"); you may not use this file except in compliance
|
8
|
+
* with the License. You may obtain a copy of the License at
|
9
|
+
*
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
*
|
12
|
+
* Unless required by applicable law or agreed to in writing,
|
13
|
+
* software distributed under the License is distributed on an
|
14
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
15
|
+
* KIND, either express or implied. See the License for the
|
16
|
+
* specific language governing permissions and limitations
|
17
|
+
* under the License.
|
18
|
+
*/
|
19
|
+
|
20
|
+
export { autoRefreshInterval } from "./config";
|
21
|
+
export { useContainerWidth } from "./useContainerWidth";
|
22
|
+
export { tokenHandler } from "./tokenHandler";
|
@@ -0,0 +1,51 @@
|
|
1
|
+
/*!
|
2
|
+
* Licensed to the Apache Software Foundation (ASF) under one
|
3
|
+
* or more contributor license agreements. See the NOTICE file
|
4
|
+
* distributed with this work for additional information
|
5
|
+
* regarding copyright ownership. The ASF licenses this file
|
6
|
+
* to you under the Apache License, Version 2.0 (the
|
7
|
+
* "License"); you may not use this file except in compliance
|
8
|
+
* with the License. You may obtain a copy of the License at
|
9
|
+
*
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
*
|
12
|
+
* Unless required by applicable law or agreed to in writing,
|
13
|
+
* software distributed under the License is distributed on an
|
14
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
15
|
+
* KIND, either express or implied. See the License for the
|
16
|
+
* specific language governing permissions and limitations
|
17
|
+
* under the License.
|
18
|
+
*/
|
19
|
+
import type { InternalAxiosRequestConfig } from "axios";
|
20
|
+
|
21
|
+
export const TOKEN_STORAGE_KEY = "token";
|
22
|
+
const getTokenFromCookies = (): string | undefined => {
|
23
|
+
const cookies = document.cookie.split(";");
|
24
|
+
|
25
|
+
for (const cookie of cookies) {
|
26
|
+
const [name, token] = cookie.split("=");
|
27
|
+
|
28
|
+
if (name?.trim() === "_token" && token !== undefined) {
|
29
|
+
localStorage.setItem(TOKEN_STORAGE_KEY, token);
|
30
|
+
document.cookie = "_token=; expires=Sat, 01 Jan 2000 00:00:00 UTC; path=/;";
|
31
|
+
|
32
|
+
return token;
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
return undefined;
|
37
|
+
};
|
38
|
+
|
39
|
+
export const tokenHandler = (config: InternalAxiosRequestConfig) => {
|
40
|
+
const token = localStorage.getItem(TOKEN_STORAGE_KEY) ?? getTokenFromCookies();
|
41
|
+
|
42
|
+
if (token !== undefined) {
|
43
|
+
config.headers.Authorization = `Bearer ${token}`;
|
44
|
+
}
|
45
|
+
|
46
|
+
return config;
|
47
|
+
};
|
48
|
+
|
49
|
+
export const clearToken = () => {
|
50
|
+
localStorage.removeItem(TOKEN_STORAGE_KEY);
|
51
|
+
};
|
@@ -0,0 +1,43 @@
|
|
1
|
+
/*!
|
2
|
+
* Licensed to the Apache Software Foundation (ASF) under one
|
3
|
+
* or more contributor license agreements. See the NOTICE file
|
4
|
+
* distributed with this work for additional information
|
5
|
+
* regarding copyright ownership. The ASF licenses this file
|
6
|
+
* to you under the Apache License, Version 2.0 (the
|
7
|
+
* "License"); you may not use this file except in compliance
|
8
|
+
* with the License. You may obtain a copy of the License at
|
9
|
+
*
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
*
|
12
|
+
* Unless required by applicable law or agreed to in writing,
|
13
|
+
* software distributed under the License is distributed on an
|
14
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
15
|
+
* KIND, either express or implied. See the License for the
|
16
|
+
* specific language governing permissions and limitations
|
17
|
+
* under the License.
|
18
|
+
*/
|
19
|
+
import { type MutableRefObject, useEffect, useState } from "react";
|
20
|
+
|
21
|
+
export const useContainerWidth = (ref: MutableRefObject<HTMLDivElement | null | undefined>) => {
|
22
|
+
const [width, setWidth] = useState(0);
|
23
|
+
|
24
|
+
useEffect(() => {
|
25
|
+
if (!ref.current) {
|
26
|
+
return undefined;
|
27
|
+
}
|
28
|
+
|
29
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
30
|
+
for (const entry of entries) {
|
31
|
+
setWidth(entry.contentRect.width);
|
32
|
+
}
|
33
|
+
});
|
34
|
+
|
35
|
+
resizeObserver.observe(ref.current);
|
36
|
+
|
37
|
+
return () => {
|
38
|
+
resizeObserver.disconnect();
|
39
|
+
};
|
40
|
+
}, [ref]);
|
41
|
+
|
42
|
+
return width;
|
43
|
+
};
|
@@ -0,0 +1,20 @@
|
|
1
|
+
/*!
|
2
|
+
* Licensed to the Apache Software Foundation (ASF) under one
|
3
|
+
* or more contributor license agreements. See the NOTICE file
|
4
|
+
* distributed with this work for additional information
|
5
|
+
* regarding copyright ownership. The ASF licenses this file
|
6
|
+
* to you under the Apache License, Version 2.0 (the
|
7
|
+
* "License"); you may not use this file except in compliance
|
8
|
+
* with the License. You may obtain a copy of the License at
|
9
|
+
*
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
*
|
12
|
+
* Unless required by applicable law or agreed to in writing,
|
13
|
+
* software distributed under the License is distributed on an
|
14
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
15
|
+
* KIND, either express or implied. See the License for the
|
16
|
+
* specific language governing permissions and limitations
|
17
|
+
* under the License.
|
18
|
+
*/
|
19
|
+
|
20
|
+
/// <reference types="vite/client" />
|
@@ -0,0 +1,19 @@
|
|
1
|
+
/*!
|
2
|
+
* Licensed to the Apache Software Foundation (ASF) under one
|
3
|
+
* or more contributor license agreements. See the NOTICE file
|
4
|
+
* distributed with this work for additional information
|
5
|
+
* regarding copyright ownership. The ASF licenses this file
|
6
|
+
* to you under the Apache License, Version 2.0 (the
|
7
|
+
* "License"); you may not use this file except in compliance
|
8
|
+
* with the License. You may obtain a copy of the License at
|
9
|
+
*
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
*
|
12
|
+
* Unless required by applicable law or agreed to in writing,
|
13
|
+
* software distributed under the License is distributed on an
|
14
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
15
|
+
* KIND, either express or implied. See the License for the
|
16
|
+
* specific language governing permissions and limitations
|
17
|
+
* under the License.
|
18
|
+
*/
|
19
|
+
import "@testing-library/jest-dom/vitest";
|