/* * Copyright OpenSearch Contributors * SPDX-License-Identifier: Apache-2.0 */ import React, { useCallback } from 'react'; import { i18n } from '@osd/i18n'; import { EuiButtonGroup, EuiFormRow } from '@elastic/eui'; import produce from 'immer'; import { Draft } from 'immer'; import { ColorModes, ColorRanges, ColorSchemaOptions, colorSchemas, RangeOption, SwitchOption, } from '../../../../../charts/public'; import { useTypedDispatch, useTypedSelector, setStyleState, } from '../../../application/utils/state_management'; import { MetricOptionsDefaults } from '../metric_viz_type'; import { PersistedState } from '../../../../../visualizations/public'; import { Option } from '../../../application/app'; const METRIC_COLOR_MODES = [ { id: ColorModes.NONE, label: i18n.translate('visTypeMetric.colorModes.noneOptionLabel', { defaultMessage: 'None', }), }, { id: ColorModes.LABELS, label: i18n.translate('visTypeMetric.colorModes.labelsOptionLabel', { defaultMessage: 'Labels', }), }, { id: ColorModes.BACKGROUND, label: i18n.translate('visTypeMetric.colorModes.backgroundOptionLabel', { defaultMessage: 'Background', }), }, ]; function MetricVizOptions() { const styleState = useTypedSelector((state) => state.style) as MetricOptionsDefaults; const dispatch = useTypedDispatch(); const { metric } = styleState; const setOption = useCallback( (callback: (draft: Draft) => void) => { const newState = produce(styleState, callback); dispatch(setStyleState(newState)); }, [dispatch, styleState] ); const metricColorModeLabel = i18n.translate('visTypeMetric.params.color.useForLabel', { defaultMessage: 'Use color for', }); return ( <> ); } export { MetricVizOptions };