/* * Copyright OpenSearch Contributors * SPDX-License-Identifier: Apache-2.0 */ import React, { ChangeEvent } from "react"; import { EuiButton, EuiText, EuiHorizontalRule, EuiFlexGroup, EuiFlexItem, EuiSpacer, EuiLink, EuiIcon, EuiEmptyPrompt, EuiFormRow, EuiSelect, } from "@elastic/eui"; import { ContentPanel } from "../../../../components/ContentPanel"; import "brace/theme/github"; import "brace/mode/json"; import { Policy, State as StateData } from "../../../../../models/interfaces"; import { STATES_DOCUMENTATION_URL } from "../../../../utils/constants"; import State from "./State"; interface StatesProps { onOpenFlyout: () => void; policy: Policy; onClickEditState: (state: StateData) => void; onClickDeleteState: (idx: number) => void; onChangeDefaultState: (event: ChangeEvent) => void; isReadOnly: boolean; } const States = ({ onOpenFlyout, policy, onClickEditState, onClickDeleteState, onChangeDefaultState, isReadOnly = false }: StatesProps) => { return (

You can think of policies as state machines. "Actions" are the operations ISM performs when an index is in a certain state.
"Transitions" define when to move from one state to another.{" "} Learn more

} >
{!isReadOnly && ( <> ({ text: state.name, value: state.name }))} value={policy.default_state} onChange={onChangeDefaultState} /> )} {policy.states.map((state, idx) => ( ))} {!isReadOnly && (!!policy.states.length ? ( <> Add state ) : ( No states} titleSize="s" body={

Your policy currently has no states defined. Add states to manage your index lifecycle.

} actions={ Add state } /> ))}
); }; export default States;