/* * Copyright OpenSearch Contributors * SPDX-License-Identifier: Apache-2.0 */ import React, { ChangeEvent } from "react"; import { EuiAccordion, EuiText, EuiFlexGroup, EuiFlexItem, EuiFormRow, EuiFieldNumber, EuiFieldText, EuiSelect } from "@elastic/eui"; import "brace/theme/github"; import "brace/mode/json"; import { Action, UIAction } from "../../../../../models/interfaces"; import EuiFormCustomLabel from "../EuiFormCustomLabel"; interface TimeoutRetrySettingsProps { action: UIAction; editAction: boolean; onChangeAction: (action: UIAction) => void; } const options = [ { value: "exponential", text: "Exponential" }, { value: "constant", text: "Constant" }, { value: "linear", text: "Linear" }, ]; const TimeoutRetrySettings = ({ action, editAction, onChangeAction }: TimeoutRetrySettingsProps) => (

Timeout and retry settings are supported to handle an action failure. You can specify parameters based on your need.

) => { const timeout = e.target.value; onChangeAction(action.clone({ ...action.action, timeout })); }} /> ) => { const count = e.target.valueAsNumber; const retry = { ...action.action.retry, count }; if (isNaN(count)) delete retry.count; onChangeAction(action.clone({ ...action.action, retry })); }} /> ) => { const backoff = e.target.value; onChangeAction(action.clone({ ...action.action, retry: { ...action.action.retry, backoff } })); }} /> ) => { const delay = e.target.value; onChangeAction(action.clone({ ...action.action, retry: { ...action.action.retry, delay } })); }} />
); export default TimeoutRetrySettings;