forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Dataset quality] Warning for datasets not supporting _ignored aggreg…
…ation (elastic#183183) Closes elastic#179227. ## 📝 Summary This PR adds a warning to main page and flyout whenever a dataStream has indices that doesn't support `_ignored` aggregation ## 🎥 Demo https://github.com/elastic/kibana/assets/1313018/c6d5fd81-d9a9-4fcc-92d0-8e65b996df9c #### Flyout https://github.com/elastic/kibana/assets/1313018/2972e104-8b10-413a-a430-3efc5252b757
- Loading branch information
Showing
19 changed files
with
503 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97 changes: 97 additions & 0 deletions
97
...vability_solution/dataset_quality/public/components/dataset_quality/warnings/warnings.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { EuiAccordion, EuiCallOut, EuiFlexGroup, EuiFlexItem, EuiLink } from '@elastic/eui'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { FormattedMessage } from '@kbn/i18n-react'; | ||
import React from 'react'; | ||
import { useDatasetQualityWarnings } from '../../../hooks/use_dataset_quality_warnings'; | ||
|
||
const nonAggregatableWarningTitle = i18n.translate('xpack.datasetQuality.nonAggregatable.title', { | ||
defaultMessage: 'Your request may take longer to complete', | ||
}); | ||
|
||
const nonAggregatableWarningDescription = (nonAggregatableDatasets: string[]) => ( | ||
<FormattedMessage | ||
id="xpack.datasetQuality.nonAggregatable.description" | ||
defaultMessage="{description}" | ||
values={{ | ||
description: ( | ||
<FormattedMessage | ||
id="xpack.datasetQuality.nonAggregatable.warning" | ||
defaultMessage="Some of your datasets do not support _ignored aggregation and may cause delays when querying data. {howToFixIt} {showDatasets}" | ||
values={{ | ||
showDatasets: ( | ||
<FormattedMessage | ||
id="xpack.datasetQuality.nonAggregatable.warning.description." | ||
defaultMessage="{accordion}" | ||
values={{ | ||
accordion: ( | ||
<EuiAccordion | ||
style={{ marginTop: '12px ' }} | ||
buttonContent={i18n.translate( | ||
'xpack.datasetQuality.nonAggregatable.showAffectedDatasets', | ||
{ | ||
defaultMessage: 'Show affected datasets', | ||
} | ||
)} | ||
id={''} | ||
> | ||
<ul> | ||
{nonAggregatableDatasets.map((dataset) => ( | ||
<li key={dataset}>{dataset}</li> | ||
))} | ||
</ul> | ||
</EuiAccordion> | ||
), | ||
}} | ||
/> | ||
), | ||
howToFixIt: ( | ||
<FormattedMessage | ||
id="xpack.datasetQuality.nonAggregatable.howToFixIt" | ||
defaultMessage="Manually {rolloverLink} these datasets to prevent future delays." | ||
values={{ | ||
rolloverLink: ( | ||
<EuiLink | ||
external | ||
target="_blank" | ||
data-test-subj="datasetQualityNonAggregatableHowToFixItLink" | ||
href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-rollover-index.html" | ||
> | ||
{i18n.translate('xpack.datasetQuality.nonAggregatableDatasets.link.title', { | ||
defaultMessage: 'rollover', | ||
})} | ||
</EuiLink> | ||
), | ||
}} | ||
/> | ||
), | ||
}} | ||
/> | ||
), | ||
}} | ||
/> | ||
); | ||
|
||
// Allow for lazy loading | ||
// eslint-disable-next-line import/no-default-export | ||
export default function Warnings() { | ||
const { loading, nonAggregatableDatasets } = useDatasetQualityWarnings(); | ||
|
||
return ( | ||
<EuiFlexGroup data-test-subj="datasetQualityWarningsContainer" gutterSize="s" wrap> | ||
{!loading && nonAggregatableDatasets.length > 0 && ( | ||
<EuiFlexItem> | ||
<EuiCallOut title={nonAggregatableWarningTitle} color="warning" iconType="warning"> | ||
<p>{nonAggregatableWarningDescription(nonAggregatableDatasets)}</p> | ||
</EuiCallOut> | ||
</EuiFlexItem> | ||
)} | ||
</EuiFlexGroup> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
...ugins/observability_solution/dataset_quality/public/hooks/use_dataset_quality_warnings.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
import { useSelector } from '@xstate/react'; | ||
import { useDatasetQualityContext } from '../components/dataset_quality/context'; | ||
|
||
export function useDatasetQualityWarnings() { | ||
const { service } = useDatasetQualityContext(); | ||
|
||
const nonAggregatableDatasets = useSelector( | ||
service, | ||
(state) => state.context.nonAggregatableDatasets | ||
); | ||
|
||
const isNonAggregatableDatasetsLoading = useSelector(service, (state) => | ||
state.matches('nonAggregatableDatasets.fetching') | ||
); | ||
|
||
return { loading: isNonAggregatableDatasetsLoading, nonAggregatableDatasets }; | ||
} |
Oops, something went wrong.