apache-airflow-providers-edge3 1.5.0__py3-none-any.whl → 2.0.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 +3 -3
- airflow/providers/edge3/cli/api_client.py +23 -26
- airflow/providers/edge3/cli/worker.py +9 -28
- airflow/providers/edge3/example_dags/integration_test.py +1 -1
- airflow/providers/edge3/example_dags/win_test.py +32 -22
- airflow/providers/edge3/executors/edge_executor.py +7 -63
- airflow/providers/edge3/models/edge_worker.py +7 -3
- airflow/providers/edge3/plugins/edge_executor_plugin.py +26 -205
- airflow/providers/edge3/plugins/www/dist/main.umd.cjs +8 -8
- airflow/providers/edge3/plugins/www/openapi-gen/queries/common.ts +6 -1
- airflow/providers/edge3/plugins/www/openapi-gen/queries/ensureQueryData.ts +6 -1
- airflow/providers/edge3/plugins/www/openapi-gen/queries/prefetch.ts +6 -1
- airflow/providers/edge3/plugins/www/openapi-gen/queries/queries.ts +6 -2
- airflow/providers/edge3/plugins/www/openapi-gen/queries/suspense.ts +6 -1
- airflow/providers/edge3/plugins/www/openapi-gen/requests/schemas.gen.ts +5 -0
- airflow/providers/edge3/plugins/www/openapi-gen/requests/services.gen.ts +18 -3
- airflow/providers/edge3/plugins/www/openapi-gen/requests/types.gen.ts +24 -0
- airflow/providers/edge3/plugins/www/package.json +17 -15
- airflow/providers/edge3/plugins/www/pnpm-lock.yaml +1194 -1244
- airflow/providers/edge3/plugins/www/src/components/SearchBar.tsx +103 -0
- airflow/providers/edge3/plugins/www/src/components/ui/InputGroup.tsx +57 -0
- airflow/providers/edge3/plugins/www/src/components/ui/Select/Content.tsx +37 -0
- airflow/providers/edge3/plugins/www/src/components/ui/Select/Item.tsx +34 -0
- airflow/providers/edge3/plugins/www/src/components/ui/Select/Root.tsx +24 -0
- airflow/providers/edge3/plugins/www/src/components/ui/Select/Trigger.tsx +54 -0
- airflow/providers/edge3/plugins/www/src/components/ui/Select/ValueText.tsx +51 -0
- airflow/providers/edge3/plugins/www/src/components/ui/Select/index.ts +34 -0
- airflow/providers/edge3/plugins/www/src/components/ui/index.ts +3 -0
- airflow/providers/edge3/plugins/www/src/constants.ts +43 -0
- airflow/providers/edge3/plugins/www/src/pages/WorkerPage.tsx +184 -95
- airflow/providers/edge3/version_compat.py +0 -2
- airflow/providers/edge3/worker_api/auth.py +11 -35
- airflow/providers/edge3/worker_api/datamodels.py +3 -2
- airflow/providers/edge3/worker_api/routes/health.py +1 -1
- airflow/providers/edge3/worker_api/routes/jobs.py +10 -11
- airflow/providers/edge3/worker_api/routes/logs.py +5 -8
- airflow/providers/edge3/worker_api/routes/ui.py +14 -3
- airflow/providers/edge3/worker_api/routes/worker.py +19 -12
- airflow/providers/edge3/{openapi → worker_api}/v2-edge-generated.yaml +59 -5
- {apache_airflow_providers_edge3-1.5.0.dist-info → apache_airflow_providers_edge3-2.0.0.dist-info}/METADATA +13 -13
- {apache_airflow_providers_edge3-1.5.0.dist-info → apache_airflow_providers_edge3-2.0.0.dist-info}/RECORD +45 -40
- airflow/providers/edge3/openapi/__init__.py +0 -19
- airflow/providers/edge3/openapi/edge_worker_api_v1.yaml +0 -808
- airflow/providers/edge3/worker_api/routes/_v2_compat.py +0 -136
- airflow/providers/edge3/worker_api/routes/_v2_routes.py +0 -237
- {apache_airflow_providers_edge3-1.5.0.dist-info → apache_airflow_providers_edge3-2.0.0.dist-info}/WHEEL +0 -0
- {apache_airflow_providers_edge3-1.5.0.dist-info → apache_airflow_providers_edge3-2.0.0.dist-info}/entry_points.txt +0 -0
- {apache_airflow_providers_edge3-1.5.0.dist-info → apache_airflow_providers_edge3-2.0.0.dist-info}/licenses/LICENSE +0 -0
- {apache_airflow_providers_edge3-1.5.0.dist-info → apache_airflow_providers_edge3-2.0.0.dist-info}/licenses/NOTICE +0 -0
|
@@ -0,0 +1,103 @@
|
|
|
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 { Button, Input, Kbd, type ButtonProps } from "@chakra-ui/react";
|
|
20
|
+
import { useState, useRef, type ChangeEvent } from "react";
|
|
21
|
+
import { useHotkeys } from "react-hotkeys-hook";
|
|
22
|
+
import { FiSearch } from "react-icons/fi";
|
|
23
|
+
import { useDebouncedCallback } from "use-debounce";
|
|
24
|
+
|
|
25
|
+
import { CloseButton, InputGroup, type InputGroupProps } from "./ui";
|
|
26
|
+
|
|
27
|
+
const debounceDelay = 200;
|
|
28
|
+
|
|
29
|
+
type Props = {
|
|
30
|
+
readonly buttonProps?: ButtonProps;
|
|
31
|
+
readonly defaultValue: string;
|
|
32
|
+
readonly groupProps?: InputGroupProps;
|
|
33
|
+
readonly hideAdvanced?: boolean;
|
|
34
|
+
readonly hotkeyDisabled?: boolean;
|
|
35
|
+
readonly onChange: (value: string) => void;
|
|
36
|
+
readonly placeHolder: string;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const SearchBar = ({
|
|
40
|
+
buttonProps,
|
|
41
|
+
defaultValue,
|
|
42
|
+
groupProps,
|
|
43
|
+
hideAdvanced = false,
|
|
44
|
+
hotkeyDisabled = false,
|
|
45
|
+
onChange,
|
|
46
|
+
placeHolder,
|
|
47
|
+
}: Props) => {
|
|
48
|
+
const handleSearchChange = useDebouncedCallback((val: string) => onChange(val), debounceDelay);
|
|
49
|
+
const searchRef = useRef<HTMLInputElement>(null);
|
|
50
|
+
const [value, setValue] = useState(defaultValue);
|
|
51
|
+
|
|
52
|
+
const onSearchChange = (event: ChangeEvent<HTMLInputElement>) => {
|
|
53
|
+
setValue(event.target.value);
|
|
54
|
+
handleSearchChange(event.target.value);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
useHotkeys(
|
|
58
|
+
"mod+k",
|
|
59
|
+
() => {
|
|
60
|
+
searchRef.current?.focus();
|
|
61
|
+
},
|
|
62
|
+
{ enabled: !hotkeyDisabled, preventDefault: true },
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<InputGroup
|
|
67
|
+
{...groupProps}
|
|
68
|
+
colorPalette="brand"
|
|
69
|
+
endElement={
|
|
70
|
+
<>
|
|
71
|
+
{value ? (
|
|
72
|
+
<CloseButton
|
|
73
|
+
aria-label="Clear search"
|
|
74
|
+
colorPalette="brand"
|
|
75
|
+
data-testid="clear-search"
|
|
76
|
+
onClick={() => {
|
|
77
|
+
setValue("");
|
|
78
|
+
onChange("");
|
|
79
|
+
}}
|
|
80
|
+
size="xs"
|
|
81
|
+
/>
|
|
82
|
+
) : undefined}
|
|
83
|
+
{hideAdvanced ? undefined : (
|
|
84
|
+
<Button fontWeight="normal" height={28} variant="ghost" {...buttonProps}>
|
|
85
|
+
Advanced
|
|
86
|
+
</Button>
|
|
87
|
+
)}
|
|
88
|
+
{!hotkeyDisabled && <Kbd size="sm">⌘K</Kbd>}
|
|
89
|
+
</>
|
|
90
|
+
}
|
|
91
|
+
startElement={<FiSearch />}
|
|
92
|
+
>
|
|
93
|
+
<Input
|
|
94
|
+
data-testid="search-workers"
|
|
95
|
+
onChange={onSearchChange}
|
|
96
|
+
placeholder={placeHolder}
|
|
97
|
+
pr={150}
|
|
98
|
+
ref={searchRef}
|
|
99
|
+
value={value}
|
|
100
|
+
/>
|
|
101
|
+
</InputGroup>
|
|
102
|
+
);
|
|
103
|
+
};
|
|
@@ -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
|
+
|
|
20
|
+
/* eslint-disable @typescript-eslint/strict-boolean-expressions */
|
|
21
|
+
|
|
22
|
+
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
|
23
|
+
import type { BoxProps, InputElementProps } from "@chakra-ui/react";
|
|
24
|
+
import { Group, InputElement } from "@chakra-ui/react";
|
|
25
|
+
import { cloneElement, forwardRef } from "react";
|
|
26
|
+
|
|
27
|
+
export type InputGroupProps = {
|
|
28
|
+
readonly children: React.ReactElement;
|
|
29
|
+
readonly endElement?: React.ReactNode;
|
|
30
|
+
readonly endElementProps?: InputElementProps;
|
|
31
|
+
readonly startElement?: React.ReactNode;
|
|
32
|
+
readonly startElementProps?: InputElementProps;
|
|
33
|
+
} & BoxProps;
|
|
34
|
+
|
|
35
|
+
export const InputGroup = forwardRef<HTMLDivElement, InputGroupProps>((props, ref) => {
|
|
36
|
+
const { children, endElement, endElementProps, startElement, startElementProps, ...rest } = props;
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<Group ref={ref} {...rest}>
|
|
40
|
+
{startElement ? (
|
|
41
|
+
<InputElement pointerEvents="none" {...startElementProps}>
|
|
42
|
+
{startElement}
|
|
43
|
+
</InputElement>
|
|
44
|
+
) : undefined}
|
|
45
|
+
{cloneElement(children, {
|
|
46
|
+
...(startElement && { ps: "calc(var(--input-height) - 6px)" }),
|
|
47
|
+
...(endElement && { pe: "calc(var(--input-height) - 6px)" }),
|
|
48
|
+
...children.props,
|
|
49
|
+
})}
|
|
50
|
+
{endElement ? (
|
|
51
|
+
<InputElement placement="end" {...endElementProps}>
|
|
52
|
+
{endElement}
|
|
53
|
+
</InputElement>
|
|
54
|
+
) : undefined}
|
|
55
|
+
</Group>
|
|
56
|
+
);
|
|
57
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
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 { Select as ChakraSelect, Portal } from "@chakra-ui/react";
|
|
20
|
+
import { forwardRef } from "react";
|
|
21
|
+
|
|
22
|
+
type ContentProps = {
|
|
23
|
+
readonly portalled?: boolean;
|
|
24
|
+
readonly portalRef?: React.RefObject<HTMLElement>;
|
|
25
|
+
} & ChakraSelect.ContentProps;
|
|
26
|
+
|
|
27
|
+
export const Content = forwardRef<HTMLDivElement, ContentProps>((props, ref) => {
|
|
28
|
+
const { portalled = true, portalRef, ...rest } = props;
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<Portal container={portalRef} disabled={!portalled}>
|
|
32
|
+
<ChakraSelect.Positioner>
|
|
33
|
+
<ChakraSelect.Content {...rest} ref={ref} />
|
|
34
|
+
</ChakraSelect.Positioner>
|
|
35
|
+
</Portal>
|
|
36
|
+
);
|
|
37
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
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 @typescript-eslint/no-unsafe-assignment */
|
|
21
|
+
import { Select as ChakraSelect } from "@chakra-ui/react";
|
|
22
|
+
import { forwardRef } from "react";
|
|
23
|
+
|
|
24
|
+
export const Item = forwardRef<HTMLDivElement, ChakraSelect.ItemProps>((props, ref) => {
|
|
25
|
+
const { children, item, ...rest } = props;
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
29
|
+
<ChakraSelect.Item item={item} key={item.value} {...rest} ref={ref}>
|
|
30
|
+
{children}
|
|
31
|
+
<ChakraSelect.ItemIndicator />
|
|
32
|
+
</ChakraSelect.Item>
|
|
33
|
+
);
|
|
34
|
+
});
|
|
@@ -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 { Select as ChakraSelect } from "@chakra-ui/react";
|
|
20
|
+
import { forwardRef } from "react";
|
|
21
|
+
|
|
22
|
+
export const Root = forwardRef<HTMLDivElement, ChakraSelect.RootProps>((props, ref) => (
|
|
23
|
+
<ChakraSelect.Root {...props} positioning={{ sameWidth: true, ...props.positioning }} ref={ref} />
|
|
24
|
+
));
|
|
@@ -0,0 +1,54 @@
|
|
|
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 { Select as ChakraSelect } from "@chakra-ui/react";
|
|
20
|
+
import { forwardRef } from "react";
|
|
21
|
+
|
|
22
|
+
import { CloseButton } from "../CloseButton";
|
|
23
|
+
|
|
24
|
+
type Props = {
|
|
25
|
+
readonly clearable?: boolean;
|
|
26
|
+
readonly isActive?: boolean;
|
|
27
|
+
readonly triggerProps?: ChakraSelect.TriggerProps;
|
|
28
|
+
} & ChakraSelect.ControlProps;
|
|
29
|
+
|
|
30
|
+
export const Trigger = forwardRef<HTMLButtonElement, Props>((props, ref) => {
|
|
31
|
+
const { children, clearable, isActive, triggerProps, ...rest } = props;
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<ChakraSelect.Control {...rest}>
|
|
35
|
+
<ChakraSelect.Trigger ref={ref} {...triggerProps}>
|
|
36
|
+
{children}
|
|
37
|
+
</ChakraSelect.Trigger>
|
|
38
|
+
<ChakraSelect.IndicatorGroup _rtl={{ bottom: 0, left: 0, right: "auto", top: 0 }}>
|
|
39
|
+
{clearable ? (
|
|
40
|
+
<ChakraSelect.ClearTrigger asChild>
|
|
41
|
+
<CloseButton
|
|
42
|
+
focusRingWidth="2px"
|
|
43
|
+
focusVisibleRing="inside"
|
|
44
|
+
pointerEvents="auto"
|
|
45
|
+
size="xs"
|
|
46
|
+
variant="plain"
|
|
47
|
+
/>
|
|
48
|
+
</ChakraSelect.ClearTrigger>
|
|
49
|
+
) : undefined}
|
|
50
|
+
<ChakraSelect.Indicator />
|
|
51
|
+
</ChakraSelect.IndicatorGroup>
|
|
52
|
+
</ChakraSelect.Control>
|
|
53
|
+
);
|
|
54
|
+
});
|
|
@@ -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 { CollectionItem } from "@chakra-ui/react";
|
|
20
|
+
import { Select as ChakraSelect } from "@chakra-ui/react";
|
|
21
|
+
import { forwardRef } from "react";
|
|
22
|
+
|
|
23
|
+
type ValueTextProps = {
|
|
24
|
+
readonly children?: (items: Array<CollectionItem>) => React.ReactNode;
|
|
25
|
+
} & Omit<ChakraSelect.ValueTextProps, "children">;
|
|
26
|
+
|
|
27
|
+
export const ValueText = forwardRef<HTMLSpanElement, ValueTextProps>((props, ref) => {
|
|
28
|
+
const { children, ...rest } = props;
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<ChakraSelect.ValueText {...rest} ref={ref}>
|
|
32
|
+
<ChakraSelect.Context>
|
|
33
|
+
{(select) => {
|
|
34
|
+
const items = select.selectedItems;
|
|
35
|
+
|
|
36
|
+
if (items.length === 0) {
|
|
37
|
+
return props.placeholder;
|
|
38
|
+
}
|
|
39
|
+
if (children) {
|
|
40
|
+
return children(items);
|
|
41
|
+
}
|
|
42
|
+
if (items.length === 1) {
|
|
43
|
+
return select.collection.stringifyItem(items[0]);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return `${items.length} selected`;
|
|
47
|
+
}}
|
|
48
|
+
</ChakraSelect.Context>
|
|
49
|
+
</ChakraSelect.ValueText>
|
|
50
|
+
);
|
|
51
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
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 { Select as ChakraSelect } from "@chakra-ui/react";
|
|
20
|
+
|
|
21
|
+
import { Content } from "./Content";
|
|
22
|
+
import { Item } from "./Item";
|
|
23
|
+
import { Root } from "./Root";
|
|
24
|
+
import { Trigger } from "./Trigger";
|
|
25
|
+
import { ValueText } from "./ValueText";
|
|
26
|
+
|
|
27
|
+
export const Select = {
|
|
28
|
+
...ChakraSelect,
|
|
29
|
+
Content,
|
|
30
|
+
Item,
|
|
31
|
+
Root,
|
|
32
|
+
Trigger,
|
|
33
|
+
ValueText,
|
|
34
|
+
};
|
|
@@ -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
|
+
|
|
20
|
+
import { createListCollection } from "@chakra-ui/react";
|
|
21
|
+
import type { EdgeWorkerState } from "../openapi-gen/requests/types.gen";
|
|
22
|
+
import { $EdgeWorkerState } from "../openapi-gen/requests/schemas.gen";
|
|
23
|
+
|
|
24
|
+
// Helper function to convert snake_case or space-separated strings to Title Case
|
|
25
|
+
const toTitleCase = (str: string): string => {
|
|
26
|
+
return str
|
|
27
|
+
.split(/[\s_]+/)
|
|
28
|
+
.map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
|
|
29
|
+
.join(" ");
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const workerStateOptions = createListCollection<{
|
|
33
|
+
label: string;
|
|
34
|
+
value: EdgeWorkerState | "all";
|
|
35
|
+
}>({
|
|
36
|
+
items: [
|
|
37
|
+
{ label: "All States", value: "all" },
|
|
38
|
+
...$EdgeWorkerState.enum.map((state) => ({
|
|
39
|
+
label: toTitleCase(state),
|
|
40
|
+
value: state as EdgeWorkerState,
|
|
41
|
+
})),
|
|
42
|
+
],
|
|
43
|
+
});
|