/* * Copyright OpenSearch Contributors * SPDX-License-Identifier: Apache-2.0 */ import React from "react"; import { EuiComboBoxOptionOption, EuiFlexGroup, EuiFlexItem } from "@elastic/eui"; import { useChannels } from "./hooks"; import { AllBuiltInComponents } from "../../components/FormGenerator"; import "./index.scss"; export interface ChannelSelectProps { value?: { id: string }[]; onChange: (val: { id: string }[]) => void; "data-test-subj"?: string; } const ChannelSelect = (props: ChannelSelectProps) => { const { value, onChange } = props; const { channels, loading } = useChannels(); return ( ({ value: channel.config_id, label: channel.name, className: "valid-option" }))} onChange={(val, options: EuiComboBoxOptionOption[]) => { onChange( options.map((item) => ({ id: item.value || "", })) ); }} onCreateOption={undefined} value={loading ? [] : value?.map((item) => item.id)} /> ); }; export default ChannelSelect;