mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
fix(slo): remove groupBy on update (#170233)
This commit is contained in:
parent
a1bde01a8a
commit
ce6cb90278
7 changed files with 16 additions and 2 deletions
|
@ -7,6 +7,7 @@
|
|||
|
||||
import { EuiFlexGroup, EuiFlexItem, EuiIconTip } from '@elastic/eui';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { ALL_VALUE } from '@kbn/slo-schema/src/schema/common';
|
||||
import React, { useEffect } from 'react';
|
||||
import { useFormContext } from 'react-hook-form';
|
||||
import { useFetchApmIndex } from '../../../../hooks/slo/use_fetch_apm_indices';
|
||||
|
@ -136,6 +137,7 @@ export function ApmAvailabilityIndicatorTypeForm() {
|
|||
<IndexFieldSelector
|
||||
indexFields={partitionByFields}
|
||||
name="groupBy"
|
||||
defaultValue={ALL_VALUE}
|
||||
label={
|
||||
<span>
|
||||
{i18n.translate('xpack.observability.slo.sloEdit.groupBy.label', {
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
import { EuiFieldNumber, EuiFlexGroup, EuiFlexItem, EuiFormRow, EuiIconTip } from '@elastic/eui';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { ALL_VALUE } from '@kbn/slo-schema/src/schema/common';
|
||||
import React, { useEffect } from 'react';
|
||||
import { Controller, useFormContext } from 'react-hook-form';
|
||||
import { useFetchApmIndex } from '../../../../hooks/slo/use_fetch_apm_indices';
|
||||
|
@ -179,6 +180,7 @@ export function ApmLatencyIndicatorTypeForm() {
|
|||
<IndexFieldSelector
|
||||
indexFields={partitionByFields}
|
||||
name="groupBy"
|
||||
defaultValue={ALL_VALUE}
|
||||
label={
|
||||
<span>
|
||||
{i18n.translate('xpack.observability.slo.sloEdit.groupBy.label', {
|
||||
|
|
|
@ -20,6 +20,7 @@ interface Props {
|
|||
isDisabled: boolean;
|
||||
isLoading: boolean;
|
||||
isRequired?: boolean;
|
||||
defaultValue?: string;
|
||||
}
|
||||
export function IndexFieldSelector({
|
||||
indexFields,
|
||||
|
@ -29,6 +30,7 @@ export function IndexFieldSelector({
|
|||
isDisabled,
|
||||
isLoading,
|
||||
isRequired = false,
|
||||
defaultValue = '',
|
||||
}: Props) {
|
||||
const { control, getFieldState } = useFormContext<CreateSLOForm>();
|
||||
const [options, setOptions] = useState<Option[]>(createOptionsFromFields(indexFields));
|
||||
|
@ -41,7 +43,7 @@ export function IndexFieldSelector({
|
|||
<EuiFlexItem>
|
||||
<EuiFormRow label={label} isInvalid={getFieldState(name).invalid}>
|
||||
<Controller
|
||||
defaultValue=""
|
||||
defaultValue={defaultValue}
|
||||
name={name}
|
||||
control={control}
|
||||
rules={{ required: isRequired }}
|
||||
|
@ -60,7 +62,7 @@ export function IndexFieldSelector({
|
|||
return field.onChange(selected[0].value);
|
||||
}
|
||||
|
||||
field.onChange('');
|
||||
field.onChange(defaultValue);
|
||||
}}
|
||||
options={options}
|
||||
onSearchChange={(searchValue: string) => {
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
import { EuiFlexGroup, EuiFlexItem, EuiIconTip } from '@elastic/eui';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { ALL_VALUE } from '@kbn/slo-schema/src/schema/common';
|
||||
import React from 'react';
|
||||
import { useFormContext } from 'react-hook-form';
|
||||
import { useFetchIndexPatternFields } from '../../../../hooks/slo/use_fetch_index_pattern_fields';
|
||||
|
@ -138,6 +139,7 @@ export function CustomKqlIndicatorTypeForm() {
|
|||
<IndexFieldSelector
|
||||
indexFields={partitionByFields}
|
||||
name="groupBy"
|
||||
defaultValue={ALL_VALUE}
|
||||
label={
|
||||
<span>
|
||||
{i18n.translate('xpack.observability.slo.sloEdit.groupBy.label', {
|
||||
|
|
|
@ -15,6 +15,7 @@ import {
|
|||
} from '@elastic/eui';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { FormattedMessage } from '@kbn/i18n-react';
|
||||
import { ALL_VALUE } from '@kbn/slo-schema/src/schema/common';
|
||||
import React from 'react';
|
||||
import { useFormContext } from 'react-hook-form';
|
||||
import { useFetchIndexPatternFields } from '../../../../hooks/slo/use_fetch_index_pattern_fields';
|
||||
|
@ -153,6 +154,7 @@ export function CustomMetricIndicatorTypeForm() {
|
|||
<IndexFieldSelector
|
||||
indexFields={partitionByFields}
|
||||
name="groupBy"
|
||||
defaultValue={ALL_VALUE}
|
||||
label={
|
||||
<span>
|
||||
{i18n.translate('xpack.observability.slo.sloEdit.groupBy.label', {
|
||||
|
|
|
@ -15,6 +15,7 @@ import {
|
|||
} from '@elastic/eui';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { FormattedMessage } from '@kbn/i18n-react';
|
||||
import { ALL_VALUE } from '@kbn/slo-schema/src/schema/common';
|
||||
import React from 'react';
|
||||
import { useFormContext } from 'react-hook-form';
|
||||
import { useFetchIndexPatternFields } from '../../../../hooks/slo/use_fetch_index_pattern_fields';
|
||||
|
@ -140,6 +141,7 @@ export function HistogramIndicatorTypeForm() {
|
|||
<IndexFieldSelector
|
||||
indexFields={partitionByFields}
|
||||
name="groupBy"
|
||||
defaultValue={ALL_VALUE}
|
||||
label={
|
||||
<span>
|
||||
{i18n.translate('xpack.observability.slo.sloEdit.groupBy.label', {
|
||||
|
|
|
@ -18,6 +18,7 @@ import { i18n } from '@kbn/i18n';
|
|||
import { FormattedMessage } from '@kbn/i18n-react';
|
||||
import React from 'react';
|
||||
import { useFormContext } from 'react-hook-form';
|
||||
import { ALL_VALUE } from '@kbn/slo-schema/src/schema/common';
|
||||
import { useFetchIndexPatternFields } from '../../../../hooks/slo/use_fetch_index_pattern_fields';
|
||||
import { CreateSLOForm } from '../../types';
|
||||
import { DataPreviewChart } from '../common/data_preview_chart';
|
||||
|
@ -130,6 +131,7 @@ export function TimesliceMetricIndicatorTypeForm() {
|
|||
<IndexFieldSelector
|
||||
indexFields={partitionByFields}
|
||||
name="groupBy"
|
||||
defaultValue={ALL_VALUE}
|
||||
label={
|
||||
<span>
|
||||
{i18n.translate('xpack.observability.slo.sloEdit.groupBy.label', {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue