/* * Copyright OpenSearch Contributors * SPDX-License-Identifier: Apache-2.0 */ import React, { Component } from "react"; import { ArgsWithQuery, ArgsWithError, EuiFlexGroup, EuiFlexItem, EuiPagination, EuiSearchBar, EuiSwitch } from "@elastic/eui"; import { DataStream } from "../../../../../server/models/interfaces"; interface ManagedIndexControlsProps { search: string; showDataStreams: boolean; onSearchChange: (args: ArgsWithQuery | ArgsWithError) => void; onRefresh: () => void; getDataStreams: () => Promise; toggleShowDataStreams: () => void; } export default class ManagedIndexControls extends Component { state = { refreshInterval: 0, isPaused: true, }; onRefreshChange = ({ refreshInterval, isPaused }: { refreshInterval: number; isPaused: boolean }) => { this.setState({ isPaused, refreshInterval }); }; getDataStreams = async () => { return (await this.props.getDataStreams()).map((ds) => ({ value: ds.name })); }; render() { const { search, onSearchChange, showDataStreams, toggleShowDataStreams } = this.props; const schema = { strict: true, fields: { indices: { type: "string", }, data_streams: { type: "string", }, }, }; const filters = showDataStreams ? [ { type: "field_value_selection", field: "data_streams", name: "Data streams", noOptionsMessage: "No data streams found", multiSelect: false, cache: 60000, options: () => this.getDataStreams(), }, ] : undefined; return ( ); } }