apache-airflow-providers-edge3 1.1.3__py3-none-any.whl → 1.2.0__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.3.dist-info → apache_airflow_providers_edge3-1.2.0.dist-info}/METADATA +7 -8
- apache_airflow_providers_edge3-1.2.0.dist-info/RECORD +103 -0
- apache_airflow_providers_edge3-1.1.3.dist-info/RECORD +0 -41
- {apache_airflow_providers_edge3-1.1.3.dist-info → apache_airflow_providers_edge3-1.2.0.dist-info}/WHEEL +0 -0
- {apache_airflow_providers_edge3-1.1.3.dist-info → apache_airflow_providers_edge3-1.2.0.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,66 @@
|
|
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 { HStack, Text } from "@chakra-ui/react";
|
20
|
+
import type { ApiError } from "openapi-gen/requests/core/ApiError";
|
21
|
+
import type { HTTPExceptionResponse, HTTPValidationError } from "openapi-gen/requests/types.gen";
|
22
|
+
|
23
|
+
import { Alert } from "./ui";
|
24
|
+
|
25
|
+
export type ExpandedApiError = {
|
26
|
+
body: HTTPExceptionResponse | HTTPValidationError | undefined;
|
27
|
+
} & ApiError;
|
28
|
+
|
29
|
+
type Props = {
|
30
|
+
readonly error?: unknown;
|
31
|
+
};
|
32
|
+
|
33
|
+
export const ErrorAlert = ({ error: err }: Props) => {
|
34
|
+
const error = err as ExpandedApiError;
|
35
|
+
|
36
|
+
// eslint-disable-next-line no-extra-boolean-cast
|
37
|
+
if (!Boolean(error)) {
|
38
|
+
return undefined;
|
39
|
+
}
|
40
|
+
|
41
|
+
const details = error.body?.detail;
|
42
|
+
let detailMessage;
|
43
|
+
|
44
|
+
if (details !== undefined) {
|
45
|
+
if (typeof details === "string") {
|
46
|
+
detailMessage = details;
|
47
|
+
} else if (Array.isArray(details)) {
|
48
|
+
detailMessage = details.map((detail) => `${detail.loc.join(".")} ${detail.msg}`);
|
49
|
+
} else {
|
50
|
+
detailMessage = Object.keys(details).map((key) => `${key}: ${details[key] as string}`);
|
51
|
+
}
|
52
|
+
}
|
53
|
+
|
54
|
+
return (
|
55
|
+
<Alert status="error">
|
56
|
+
<HStack align="start" flexDirection="column" gap={2} mt={-1}>
|
57
|
+
{error.status} {error.message}
|
58
|
+
{detailMessage === error.message ? undefined : (
|
59
|
+
<Text whiteSpace="preserve" wordBreak="break-all">
|
60
|
+
{detailMessage}
|
61
|
+
</Text>
|
62
|
+
)}
|
63
|
+
</HStack>
|
64
|
+
</Alert>
|
65
|
+
);
|
66
|
+
};
|
@@ -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 { Badge, type BadgeProps } from "@chakra-ui/react";
|
20
|
+
import type { TaskInstanceState } from "openapi/requests/types.gen";
|
21
|
+
import * as React from "react";
|
22
|
+
|
23
|
+
import { StateIcon } from "./StateIcon";
|
24
|
+
|
25
|
+
export type Props = {
|
26
|
+
readonly state?: TaskInstanceState | null;
|
27
|
+
} & BadgeProps;
|
28
|
+
|
29
|
+
export const StateBadge = React.forwardRef<HTMLDivElement, Props>(({ children, state, ...rest }, ref) => (
|
30
|
+
<Badge
|
31
|
+
borderRadius="full"
|
32
|
+
colorPalette={state === null ? "none" : state}
|
33
|
+
fontSize="sm"
|
34
|
+
px={children === undefined ? 1 : 2}
|
35
|
+
py={1}
|
36
|
+
ref={ref}
|
37
|
+
variant="solid"
|
38
|
+
{...rest}
|
39
|
+
>
|
40
|
+
{state === undefined ? undefined : <StateIcon state={state} />}
|
41
|
+
{children}
|
42
|
+
</Badge>
|
43
|
+
));
|
@@ -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 type { TaskInstanceState } from "openapi/requests/types.gen";
|
20
|
+
import type { IconBaseProps } from "react-icons";
|
21
|
+
import { FiActivity, FiCalendar, FiRepeat, FiSkipForward, FiSlash, FiWatch, FiX } from "react-icons/fi";
|
22
|
+
import { LuCalendarSync, LuCheck, LuCircleDashed, LuCircleFadingArrowUp, LuRedo2 } from "react-icons/lu";
|
23
|
+
import { PiQueue } from "react-icons/pi";
|
24
|
+
|
25
|
+
type Props = {
|
26
|
+
readonly state?: TaskInstanceState | null;
|
27
|
+
} & IconBaseProps;
|
28
|
+
|
29
|
+
export const StateIcon = ({ state, ...rest }: Props) => {
|
30
|
+
switch (state) {
|
31
|
+
case "deferred":
|
32
|
+
return <FiWatch {...rest} />;
|
33
|
+
case "failed":
|
34
|
+
return <FiX {...rest} />;
|
35
|
+
case "queued":
|
36
|
+
return <PiQueue {...rest} />;
|
37
|
+
case "removed":
|
38
|
+
return <FiSlash {...rest} />;
|
39
|
+
case "restarting":
|
40
|
+
return <FiRepeat {...rest} />;
|
41
|
+
case "running":
|
42
|
+
return <FiActivity {...rest} />;
|
43
|
+
case "scheduled":
|
44
|
+
return <FiCalendar {...rest} />;
|
45
|
+
case "skipped":
|
46
|
+
return <FiSkipForward {...rest} />;
|
47
|
+
case "success":
|
48
|
+
return <LuCheck {...rest} />;
|
49
|
+
case "up_for_reschedule":
|
50
|
+
return <LuCalendarSync {...rest} />;
|
51
|
+
case "up_for_retry":
|
52
|
+
return <LuRedo2 {...rest} />;
|
53
|
+
case "upstream_failed":
|
54
|
+
return <LuCircleFadingArrowUp {...rest} />;
|
55
|
+
default:
|
56
|
+
return <LuCircleDashed {...rest} />;
|
57
|
+
}
|
58
|
+
};
|
@@ -0,0 +1,71 @@
|
|
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 { Badge, type BadgeProps } from "@chakra-ui/react";
|
20
|
+
import type { EdgeWorkerState } from "openapi/requests/types.gen";
|
21
|
+
import * as React from "react";
|
22
|
+
|
23
|
+
import { WorkerStateIcon } from "./WorkerStateIcon";
|
24
|
+
|
25
|
+
const state2Color = (state: EdgeWorkerState | null | undefined) => {
|
26
|
+
switch (state) {
|
27
|
+
case "starting":
|
28
|
+
case "maintenance request":
|
29
|
+
case "maintenance exit":
|
30
|
+
return "yellow";
|
31
|
+
case "running":
|
32
|
+
return "green";
|
33
|
+
case "idle":
|
34
|
+
return "teal";
|
35
|
+
case "shutdown request":
|
36
|
+
case "terminating":
|
37
|
+
return "purple";
|
38
|
+
case "offline":
|
39
|
+
case "offline maintenance":
|
40
|
+
return "black";
|
41
|
+
case "unknown":
|
42
|
+
return "red";
|
43
|
+
case "maintenance mode":
|
44
|
+
case "maintenance pending":
|
45
|
+
return "orange";
|
46
|
+
default:
|
47
|
+
return "gray";
|
48
|
+
}
|
49
|
+
};
|
50
|
+
|
51
|
+
export type Props = {
|
52
|
+
readonly state?: EdgeWorkerState | null;
|
53
|
+
} & BadgeProps;
|
54
|
+
|
55
|
+
export const WorkerStateBadge = React.forwardRef<HTMLDivElement, Props>(
|
56
|
+
({ children, state, ...rest }, ref) => (
|
57
|
+
<Badge
|
58
|
+
borderRadius="full"
|
59
|
+
colorPalette={state2Color(state)}
|
60
|
+
fontSize="sm"
|
61
|
+
px={children === undefined ? 1 : 2}
|
62
|
+
py={1}
|
63
|
+
ref={ref}
|
64
|
+
variant="solid"
|
65
|
+
{...rest}
|
66
|
+
>
|
67
|
+
{state === undefined ? undefined : <WorkerStateIcon state={state} />}
|
68
|
+
{children}
|
69
|
+
</Badge>
|
70
|
+
),
|
71
|
+
);
|
@@ -0,0 +1,57 @@
|
|
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 { EdgeWorkerState } from "openapi/requests/types.gen";
|
20
|
+
import type { IconBaseProps } from "react-icons";
|
21
|
+
import { BiSolidLeaf } from "react-icons/bi";
|
22
|
+
import { FiActivity, FiArrowDownRight, FiWatch } from "react-icons/fi";
|
23
|
+
import { HiOutlineWrench, HiOutlineWrenchScrewdriver } from "react-icons/hi2";
|
24
|
+
import { IoCloudOfflineOutline } from "react-icons/io5";
|
25
|
+
import { LuCircleDashed } from "react-icons/lu";
|
26
|
+
import { RiWifiOffLine } from "react-icons/ri";
|
27
|
+
|
28
|
+
type Props = {
|
29
|
+
readonly state?: EdgeWorkerState | null;
|
30
|
+
} & IconBaseProps;
|
31
|
+
|
32
|
+
export const WorkerStateIcon = ({ state, ...rest }: Props) => {
|
33
|
+
switch (state) {
|
34
|
+
case "starting":
|
35
|
+
return <FiWatch {...rest} />;
|
36
|
+
case "running":
|
37
|
+
return <FiActivity {...rest} />;
|
38
|
+
case "idle":
|
39
|
+
return <BiSolidLeaf {...rest} />;
|
40
|
+
case "shutdown request":
|
41
|
+
case "terminating":
|
42
|
+
return <FiArrowDownRight {...rest} />;
|
43
|
+
case "offline":
|
44
|
+
return <IoCloudOfflineOutline {...rest} />;
|
45
|
+
case "unknown":
|
46
|
+
return <RiWifiOffLine {...rest} />;
|
47
|
+
case "maintenance request":
|
48
|
+
case "maintenance pending":
|
49
|
+
case "maintenance exit":
|
50
|
+
return <HiOutlineWrench {...rest} />;
|
51
|
+
case "maintenance mode":
|
52
|
+
case "offline maintenance":
|
53
|
+
return <HiOutlineWrenchScrewdriver {...rest} />;
|
54
|
+
default:
|
55
|
+
return <LuCircleDashed {...rest} />;
|
56
|
+
}
|
57
|
+
};
|
@@ -0,0 +1,62 @@
|
|
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 no-extra-boolean-cast */
|
21
|
+
import { Alert as ChakraAlert } from "@chakra-ui/react";
|
22
|
+
import { forwardRef } from "react";
|
23
|
+
|
24
|
+
import { CloseButton } from "./CloseButton";
|
25
|
+
|
26
|
+
export type AlertProps = {
|
27
|
+
readonly closable?: boolean;
|
28
|
+
readonly endElement?: React.ReactNode;
|
29
|
+
readonly icon?: React.ReactElement;
|
30
|
+
readonly onClose?: () => void;
|
31
|
+
readonly startElement?: React.ReactNode;
|
32
|
+
readonly title?: React.ReactNode;
|
33
|
+
} & Omit<ChakraAlert.RootProps, "title">;
|
34
|
+
|
35
|
+
export const Alert = forwardRef<HTMLDivElement, AlertProps>((props, ref) => {
|
36
|
+
const { children, closable, endElement, icon, onClose, startElement, title, ...rest } = props;
|
37
|
+
|
38
|
+
return (
|
39
|
+
<ChakraAlert.Root ref={ref} {...rest} alignItems="center">
|
40
|
+
{startElement ?? <ChakraAlert.Indicator>{icon}</ChakraAlert.Indicator>}
|
41
|
+
{Boolean(children) ? (
|
42
|
+
<ChakraAlert.Content>
|
43
|
+
<ChakraAlert.Title>{title}</ChakraAlert.Title>
|
44
|
+
<ChakraAlert.Description>{children}</ChakraAlert.Description>
|
45
|
+
</ChakraAlert.Content>
|
46
|
+
) : (
|
47
|
+
<ChakraAlert.Title flex="1">{title}</ChakraAlert.Title>
|
48
|
+
)}
|
49
|
+
{endElement}
|
50
|
+
{Boolean(closable) ? (
|
51
|
+
<CloseButton
|
52
|
+
alignSelf="flex-start"
|
53
|
+
insetEnd="-2"
|
54
|
+
onClick={onClose}
|
55
|
+
pos="relative"
|
56
|
+
size="sm"
|
57
|
+
top="-2"
|
58
|
+
/>
|
59
|
+
) : undefined}
|
60
|
+
</ChakraAlert.Root>
|
61
|
+
);
|
62
|
+
});
|
@@ -0,0 +1,32 @@
|
|
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 { ButtonProps as ChakraCloseButtonProps } from "@chakra-ui/react";
|
20
|
+
import { IconButton as ChakraIconButton } from "@chakra-ui/react";
|
21
|
+
import { forwardRef } from "react";
|
22
|
+
import { LuX } from "react-icons/lu";
|
23
|
+
|
24
|
+
export type CloseButtonProps = {} & ChakraCloseButtonProps;
|
25
|
+
|
26
|
+
export const CloseButton = forwardRef<HTMLButtonElement, CloseButtonProps>((props, ref) => {
|
27
|
+
return (
|
28
|
+
<ChakraIconButton aria-label="Close" ref={ref} variant="ghost" {...props}>
|
29
|
+
{props.children ?? <LuX />}
|
30
|
+
</ChakraIconButton>
|
31
|
+
);
|
32
|
+
});
|
@@ -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
|
+
export * from "./Alert";
|
@@ -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
|
+
import { ThemeProvider } from "next-themes";
|
20
|
+
import type { ThemeProviderProps } from "next-themes/dist/types";
|
21
|
+
|
22
|
+
export const ColorModeProvider = (props: ThemeProviderProps) => (
|
23
|
+
<ThemeProvider attribute="class" disableTransitionOnChange {...props} />
|
24
|
+
);
|
@@ -0,0 +1,21 @@
|
|
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 * from "./ColorModeProvider";
|
21
|
+
export * from "./useColorMode";
|
@@ -0,0 +1,32 @@
|
|
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 { useTheme } from "next-themes";
|
20
|
+
|
21
|
+
export const useColorMode = () => {
|
22
|
+
const { resolvedTheme, setTheme } = useTheme();
|
23
|
+
const toggleColorMode = () => {
|
24
|
+
setTheme(resolvedTheme === "light" ? "dark" : "light");
|
25
|
+
};
|
26
|
+
|
27
|
+
return {
|
28
|
+
colorMode: resolvedTheme as "dark" | "light" | undefined,
|
29
|
+
setColorMode: setTheme,
|
30
|
+
toggleColorMode,
|
31
|
+
};
|
32
|
+
};
|
@@ -0,0 +1,29 @@
|
|
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 { StrictMode } from "react";
|
20
|
+
import { createRoot } from "react-dom/client";
|
21
|
+
|
22
|
+
import PluginComponent from "./main";
|
23
|
+
|
24
|
+
// Development entry point for testing the component
|
25
|
+
createRoot(document.querySelector("#root") as HTMLDivElement).render(
|
26
|
+
<StrictMode>
|
27
|
+
<PluginComponent />
|
28
|
+
</StrictMode>,
|
29
|
+
);
|
@@ -0,0 +1,44 @@
|
|
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 } from "@chakra-ui/react";
|
20
|
+
import { BrowserRouter, Route, Routes } from "react-router-dom";
|
21
|
+
|
22
|
+
import { JobsPage } from "src/pages/JobsPage";
|
23
|
+
import { WorkerPage } from "src/pages/WorkerPage";
|
24
|
+
|
25
|
+
import { NavTabs } from "./NavTabs";
|
26
|
+
|
27
|
+
export const EdgeLayout = () => {
|
28
|
+
const tabs = [
|
29
|
+
{ label: "Edge Worker", value: "plugin/edge_worker" },
|
30
|
+
{ label: "Edge Jobs", value: "plugin/edge_jobs" },
|
31
|
+
];
|
32
|
+
|
33
|
+
return (
|
34
|
+
<Box p={2} /* Compensate for parent padding from ExternalView */>
|
35
|
+
<BrowserRouter>
|
36
|
+
<NavTabs tabs={tabs} />
|
37
|
+
<Routes>
|
38
|
+
<Route path="plugin/edge_worker" element={<WorkerPage />} />
|
39
|
+
<Route path="plugin/edge_jobs" element={<JobsPage />} />
|
40
|
+
</Routes>
|
41
|
+
</BrowserRouter>
|
42
|
+
</Box>
|
43
|
+
);
|
44
|
+
};
|
@@ -0,0 +1,63 @@
|
|
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 { Center, Flex } from "@chakra-ui/react";
|
20
|
+
import { useRef, type ReactNode } from "react";
|
21
|
+
import { NavLink } from "react-router-dom";
|
22
|
+
|
23
|
+
import { useContainerWidth } from "src/utils";
|
24
|
+
|
25
|
+
type Props = {
|
26
|
+
readonly tabs: Array<{ icon?: ReactNode; label: string; value: string }>;
|
27
|
+
};
|
28
|
+
|
29
|
+
export const NavTabs = ({ tabs }: Props) => {
|
30
|
+
const containerRef = useRef<HTMLDivElement>(null);
|
31
|
+
const containerWidth = useContainerWidth(containerRef);
|
32
|
+
|
33
|
+
return (
|
34
|
+
<Flex alignItems="center" borderBottomWidth={1} mb={2} ref={containerRef}>
|
35
|
+
{tabs.map(({ icon, label, value }) => (
|
36
|
+
<NavLink
|
37
|
+
end
|
38
|
+
key={value}
|
39
|
+
title={label}
|
40
|
+
to={{
|
41
|
+
pathname: value,
|
42
|
+
}}
|
43
|
+
>
|
44
|
+
{({ isActive }) => (
|
45
|
+
<Center
|
46
|
+
borderBottomColor="border.info"
|
47
|
+
borderBottomWidth={isActive ? 3 : 0}
|
48
|
+
color={isActive ? "fg" : "fg.muted"}
|
49
|
+
fontWeight="bold"
|
50
|
+
height="40px"
|
51
|
+
mb="-2px" // Show the border on top of its parent's border
|
52
|
+
pb={isActive ? 0 : "3px"}
|
53
|
+
px={4}
|
54
|
+
transition="all 0.2s ease"
|
55
|
+
>
|
56
|
+
{containerWidth > 600 || !icon ? label : icon}
|
57
|
+
</Center>
|
58
|
+
)}
|
59
|
+
</NavLink>
|
60
|
+
))}
|
61
|
+
</Flex>
|
62
|
+
);
|
63
|
+
};
|