/* * Copyright OpenSearch Contributors * SPDX-License-Identifier: Apache-2.0 */ import React, { ChangeEvent, Component, Fragment } from "react"; import { EuiSpacer, EuiFormRow, EuiSelect, EuiFlexGroup, EuiFlexItem, EuiFieldNumber, EuiRadioGroup, EuiComboBoxOptionOption, EuiPanel, EuiTitle, EuiFormHelpText, EuiHorizontalRule, EuiText, } from "@elastic/eui"; import moment from "moment-timezone"; import EuiComboBox from "../../../../components/ComboBoxWithoutWarning"; import { RollupService } from "../../../../services"; import { FieldItem } from "../../../../../models/interfaces"; import { CalendarTimeunitOptions, FixedTimeunitOptions } from "../../../../utils/constants"; interface TimeAggregationProps { rollupService: RollupService; intervalValue: number; intervalType: string; selectedTimestamp: EuiComboBoxOptionOption[]; timestampError: string; timeunit: string; timezone: string; fieldsOption: FieldItem[]; onChangeIntervalType: (optionId: string) => void; onChangeIntervalValue: (e: ChangeEvent) => void; onChangeTimestamp: (options: EuiComboBoxOptionOption[]) => void; onChangeTimeunit: (e: ChangeEvent) => void; onChangeTimezone: (e: ChangeEvent) => void; } interface TimeAggregationState {} const radios = [ { id: "fixed", label: "Fixed", }, { id: "calendar", label: "Calendar", }, ]; const timezones = moment.tz.names().map((tz) => ({ label: tz, text: tz })); export default class TimeAggregation extends Component { constructor(props: TimeAggregationProps) { super(props); } render() { const { intervalType, intervalValue, selectedTimestamp, timestampError, timeunit, timezone, onChangeIntervalType, onChangeIntervalValue, onChangeTimestamp, onChangeTimeunit, onChangeTimezone, fieldsOption, } = this.props; // Filter options for date histogram const dateFields = fieldsOption.filter((item) => item.type == "date"); return (

Time aggregation

Your source indices must include a timestamp field. The rollup job creates a date histogram for the field you specify." "
onChangeIntervalType(id)} name="intervalType" /> {intervalType == "fixed" ? ( ) : (
Every 1
{" "}
)}
); } }