1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-19 13:29:41 +02:00
portainer/app/react/edge/components/EdgeCheckInIntervalField.tsx
Ali d38085a560
Some checks are pending
ci / build_images (map[arch:amd64 platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:amd64 platform:windows version:1809]) (push) Waiting to run
ci / build_images (map[arch:amd64 platform:windows version:ltsc2022]) (push) Waiting to run
ci / build_images (map[arch:arm platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:arm64 platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:ppc64le platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:s390x platform:linux version:]) (push) Waiting to run
ci / build_manifests (push) Blocked by required conditions
/ triage (push) Waiting to run
Lint / Run linters (push) Waiting to run
Test / test-client (push) Waiting to run
Test / test-server (map[arch:amd64 platform:linux]) (push) Waiting to run
Test / test-server (map[arch:amd64 platform:windows version:1809]) (push) Waiting to run
Test / test-server (map[arch:amd64 platform:windows version:ltsc2022]) (push) Waiting to run
Test / test-server (map[arch:arm64 platform:linux]) (push) Waiting to run
chore(data-cy): require data-cy attributes [EE-6880] (#11453)
2024-04-11 12:11:38 +12:00

69 lines
1.6 KiB
TypeScript

import { FormControl, Size } from '@@/form-components/FormControl';
import { Select } from '@@/form-components/Input';
import { Options, useIntervalOptions } from './useIntervalOptions';
interface Props {
value: number;
onChange(value: number): void;
isDefaultHidden?: boolean;
label?: string;
tooltip?: string;
readonly?: boolean;
size?: Size;
}
export const checkinIntervalOptions: Options = [
{ label: 'Use default interval', value: 0, isDefault: true },
{
label: '5 seconds',
value: 5,
},
{
label: '10 seconds',
value: 10,
},
{
label: '30 seconds',
value: 30,
},
{ label: '5 minutes', value: 300 },
{ label: '1 hour', value: 3600 },
{ label: '1 day', value: 86400 },
];
export function EdgeCheckinIntervalField({
value,
readonly,
onChange,
isDefaultHidden = false,
label = 'Poll frequency',
tooltip = 'Interval used by this Edge agent to check in with the Portainer instance. Affects Edge environment management and Edge compute features.',
size = 'small',
}: Props) {
const options = useIntervalOptions(
'EdgeAgentCheckinInterval',
checkinIntervalOptions,
isDefaultHidden
);
return (
<FormControl
inputId="edge_checkin"
label={label}
tooltip={tooltip}
size={size}
>
<Select
value={value}
data-cy="edge-checkin-interval-select"
onChange={(e) => {
onChange(parseInt(e.currentTarget.value, 10));
}}
options={options}
disabled={readonly}
id="edge_checkin"
/>
</FormControl>
);
}