diff --git a/x-pack/platform/plugins/private/translations/translations/fr-FR.json b/x-pack/platform/plugins/private/translations/translations/fr-FR.json index b1237cff24aed..c1d3a21eae6a3 100644 --- a/x-pack/platform/plugins/private/translations/translations/fr-FR.json +++ b/x-pack/platform/plugins/private/translations/translations/fr-FR.json @@ -7675,7 +7675,6 @@ "securitySolutionPackages.ecsDataQualityDashboard.checkAllErrorCheckingIndexMessage": "Une erreur s'est produite lors de la vérification de l'index {indexName}", "securitySolutionPackages.ecsDataQualityDashboard.checkingLabel": "Vérification de {index}", "securitySolutionPackages.ecsDataQualityDashboard.checkNow": "Vérifier maintenant", - "securitySolutionPackages.ecsDataQualityDashboard.close": "Fermer", "securitySolutionPackages.ecsDataQualityDashboard.coldDescription": "L'index n'est plus mis à jour et il est interrogé peu fréquemment. Les informations doivent toujours être interrogeables, mais il est acceptable que ces requêtes soient plus lentes.", "securitySolutionPackages.ecsDataQualityDashboard.coldPatternTooltip": "{indices} {indices, plural, =1 {L'index correspondant} other {Les index correspondants}} au modèle {pattern} {indices, plural, =1 {est} other {sont}} \"cold\". Les index \"cold\" ne sont plus mis à jour et ne sont pas interrogés fréquemment. Les informations doivent toujours être interrogeables, mais il est acceptable que ces requêtes soient plus lentes.", "securitySolutionPackages.ecsDataQualityDashboard.compareFieldsTable.searchFieldsPlaceholder": "Rechercher dans les champs", @@ -7803,7 +7802,6 @@ "securitySolutionPackages.ecsDataQualityDashboard.indexSizeTooltip": "Taille de l'index (sans les répliques)", "securitySolutionPackages.ecsDataQualityDashboard.indices": "Index", "securitySolutionPackages.ecsDataQualityDashboard.indicesChecked": "Index vérifiés", - "securitySolutionPackages.ecsDataQualityDashboard.introducingDataQualityHistory": "Présentation de l'historique de la qualité des données", "securitySolutionPackages.ecsDataQualityDashboard.lastCheckedLabel": "Dernière vérification", "securitySolutionPackages.ecsDataQualityDashboard.loadingHistoricalResults": "Chargement des résultats antérieurs", "securitySolutionPackages.ecsDataQualityDashboard.mappingThatConflictWithEcsMessage": "❌ Les mappings ou valeurs de champs qui ne sont pas conformes à ECS ne sont pas pris en charge", @@ -7862,11 +7860,9 @@ "securitySolutionPackages.ecsDataQualityDashboard.toasts.copiedResultsToastTitle": "Résultats copiés dans le presse-papiers", "securitySolutionPackages.ecsDataQualityDashboard.toggleHistoricalResultCheckedAt": "Bascule de résultat historique vérifié à {checkedAt}", "securitySolutionPackages.ecsDataQualityDashboard.totalChecks": "{formattedCount} {count, plural, one {vérification} other {vérifications}}", - "securitySolutionPackages.ecsDataQualityDashboard.tryIt": "Essayer", "securitySolutionPackages.ecsDataQualityDashboard.unmanagedDescription": "L'index n'est pas géré par la Gestion du cycle de vie des index (ILM)", "securitySolutionPackages.ecsDataQualityDashboard.unmanagedPatternTooltip": "{indices} {indices, plural, =1 {L'index correspondant} other {Les index correspondants}} au modèle {pattern} {indices, plural, =1 {n'est pas géré} other {ne sont pas gérés}} par la gestion du cycle de vie des index (ILM)", "securitySolutionPackages.ecsDataQualityDashboard.viewHistory": "Afficher l'historique", - "securitySolutionPackages.ecsDataQualityDashboard.viewPastResults": "Voir les résultats antérieurs", "securitySolutionPackages.ecsDataQualityDashboard.warmDescription": "L'index n'est plus mis à jour mais il est toujours interrogé", "securitySolutionPackages.ecsDataQualityDashboard.warmPatternTooltip": "{indices} {indices, plural, =1 {L'index correspondant} other {Les index correspondants}} au modèle {pattern} {indices, plural, =1 {est} other {sont}} \"warm\". Les index \"warm\" ne sont plus mis à jour, mais ils sont toujours interrogés.", "securitySolutionPackages.entityAnalytics.navigation": "Analyse des entités", diff --git a/x-pack/platform/plugins/private/translations/translations/ja-JP.json b/x-pack/platform/plugins/private/translations/translations/ja-JP.json index 6b04d22971992..d8e73c9713942 100644 --- a/x-pack/platform/plugins/private/translations/translations/ja-JP.json +++ b/x-pack/platform/plugins/private/translations/translations/ja-JP.json @@ -7669,7 +7669,6 @@ "securitySolutionPackages.ecsDataQualityDashboard.checkAllErrorCheckingIndexMessage": "インデックス{indexName}の確認中にエラーが発生しました", "securitySolutionPackages.ecsDataQualityDashboard.checkingLabel": "{index}を確認中", "securitySolutionPackages.ecsDataQualityDashboard.checkNow": "今すぐ確認", - "securitySolutionPackages.ecsDataQualityDashboard.close": "閉じる", "securitySolutionPackages.ecsDataQualityDashboard.coldDescription": "インデックスは更新されず、頻繁に照会されません。情報はまだ検索可能でなければなりませんが、クエリーが低速でも問題ありません。", "securitySolutionPackages.ecsDataQualityDashboard.coldPatternTooltip": "{pattern}パターンと一致する{indices} {indices, plural, other {インデックス}}{indices, plural, other {は}}コールドです。コールドインデックスは更新されず、ほとんど照会されません。情報はまだ検索可能でなければなりませんが、クエリーが低速でも問題ありません。", "securitySolutionPackages.ecsDataQualityDashboard.compareFieldsTable.searchFieldsPlaceholder": "検索フィールド", @@ -7797,7 +7796,6 @@ "securitySolutionPackages.ecsDataQualityDashboard.indexSizeTooltip": "インデックスのサイズ(レプリカを除く)", "securitySolutionPackages.ecsDataQualityDashboard.indices": "インデックス", "securitySolutionPackages.ecsDataQualityDashboard.indicesChecked": "確認されたインデックス", - "securitySolutionPackages.ecsDataQualityDashboard.introducingDataQualityHistory": "データ品質履歴の概要", "securitySolutionPackages.ecsDataQualityDashboard.lastCheckedLabel": "前回確認日時", "securitySolutionPackages.ecsDataQualityDashboard.loadingHistoricalResults": "履歴結果を読み込み中", "securitySolutionPackages.ecsDataQualityDashboard.mappingThatConflictWithEcsMessage": "❌ ECSと互換性がないマッピングまたはフィールド値はサポートされません", @@ -7856,11 +7854,9 @@ "securitySolutionPackages.ecsDataQualityDashboard.toasts.copiedResultsToastTitle": "結果をクリップボードにコピーしました", "securitySolutionPackages.ecsDataQualityDashboard.toggleHistoricalResultCheckedAt": "{checkedAt}に確認された履歴結果を切り替える", "securitySolutionPackages.ecsDataQualityDashboard.totalChecks": "{formattedCount} {count, plural, other {確認}}", - "securitySolutionPackages.ecsDataQualityDashboard.tryIt": "お試しください", "securitySolutionPackages.ecsDataQualityDashboard.unmanagedDescription": "インデックスはインデックスライフサイクル管理(ILM)で管理されていません", "securitySolutionPackages.ecsDataQualityDashboard.unmanagedPatternTooltip": "{pattern}パターンと一致する{indices} {indices, plural, other {インデックス}}{indices, plural, other {は}}インデックスライフサイクル管理(ILM)によって管理されていません", "securitySolutionPackages.ecsDataQualityDashboard.viewHistory": "履歴を表示", - "securitySolutionPackages.ecsDataQualityDashboard.viewPastResults": "過去の結果を表示", "securitySolutionPackages.ecsDataQualityDashboard.warmDescription": "インデックスは更新されませんが、まだ照会されています", "securitySolutionPackages.ecsDataQualityDashboard.warmPatternTooltip": "{pattern}パターンと一致する{indices} {indices, plural, other {インデックス}}{indices, plural, other {は}}ウォームです。ウォームインデックスは更新されませんが、まだ照会されています。", "securitySolutionPackages.entityAnalytics.navigation": "エンティティ分析", diff --git a/x-pack/platform/plugins/private/translations/translations/zh-CN.json b/x-pack/platform/plugins/private/translations/translations/zh-CN.json index 7887d369098a2..91c2f1638d46c 100644 --- a/x-pack/platform/plugins/private/translations/translations/zh-CN.json +++ b/x-pack/platform/plugins/private/translations/translations/zh-CN.json @@ -7681,7 +7681,6 @@ "securitySolutionPackages.ecsDataQualityDashboard.checkAllErrorCheckingIndexMessage": "检查索引 {indexName} 时发生错误", "securitySolutionPackages.ecsDataQualityDashboard.checkingLabel": "正在检查 {index}", "securitySolutionPackages.ecsDataQualityDashboard.checkNow": "立即检查", - "securitySolutionPackages.ecsDataQualityDashboard.close": "关闭", "securitySolutionPackages.ecsDataQualityDashboard.coldDescription": "该索引不再进行更新,且不被经常查询。这些信息仍需能够搜索,但查询速度快慢并不重要。", "securitySolutionPackages.ecsDataQualityDashboard.coldPatternTooltip": "{indices} 个匹配 {pattern} 模式的{indices, plural, other {索引}}{indices, plural, other {为}}冷索引。冷索引不再进行更新,且不被经常查询。这些信息仍需能够搜索,但查询速度快慢并不重要。", "securitySolutionPackages.ecsDataQualityDashboard.compareFieldsTable.searchFieldsPlaceholder": "搜索字段", @@ -7809,7 +7808,6 @@ "securitySolutionPackages.ecsDataQualityDashboard.indexSizeTooltip": "索引的大小(不包括副本分片)", "securitySolutionPackages.ecsDataQualityDashboard.indices": "索引", "securitySolutionPackages.ecsDataQualityDashboard.indicesChecked": "已检查索引", - "securitySolutionPackages.ecsDataQualityDashboard.introducingDataQualityHistory": "正在引入数据质量历史记录", "securitySolutionPackages.ecsDataQualityDashboard.lastCheckedLabel": "上次检查时间", "securitySolutionPackages.ecsDataQualityDashboard.loadingHistoricalResults": "正在加载历史结果", "securitySolutionPackages.ecsDataQualityDashboard.mappingThatConflictWithEcsMessage": "❌ 不支持不符合 ECS 规范的映射或字段值", @@ -7868,11 +7866,9 @@ "securitySolutionPackages.ecsDataQualityDashboard.toasts.copiedResultsToastTitle": "已将结果复制到剪贴板", "securitySolutionPackages.ecsDataQualityDashboard.toggleHistoricalResultCheckedAt": "切换已于 {checkedAt} 检查的历史结果", "securitySolutionPackages.ecsDataQualityDashboard.totalChecks": "{formattedCount} 个{count, plural, other {检查}}", - "securitySolutionPackages.ecsDataQualityDashboard.tryIt": "试用", "securitySolutionPackages.ecsDataQualityDashboard.unmanagedDescription": "此索引不由索引生命周期管理 (ILM) 进行管理", "securitySolutionPackages.ecsDataQualityDashboard.unmanagedPatternTooltip": "与 {pattern} 模式匹配的 {indices} 个{indices, plural, other {索引}}{indices, plural, other {}}不通过索引生命周期管理 (ILM) 进行管理", "securitySolutionPackages.ecsDataQualityDashboard.viewHistory": "查看历史记录", - "securitySolutionPackages.ecsDataQualityDashboard.viewPastResults": "查看过去的结果", "securitySolutionPackages.ecsDataQualityDashboard.warmDescription": "不再更新但仍会查询此索引", "securitySolutionPackages.ecsDataQualityDashboard.warmPatternTooltip": "{indices} 个匹配 {pattern} 模式的{indices, plural, other {索引}}{indices, plural, other {为}}温索引。不再更新但仍会查询温索引。", "securitySolutionPackages.entityAnalytics.navigation": "实体分析", diff --git a/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/constants.ts b/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/constants.ts deleted file mode 100644 index 68c373217a4b4..0000000000000 --- a/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/constants.ts +++ /dev/null @@ -1,9 +0,0 @@ -/* - * 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. - */ - -export const HISTORICAL_RESULTS_TOUR_IS_DISMISSED_STORAGE_KEY = - 'securitySolution.dataQualityDashboard.historicalResultsTour.v8.16.isDismissed'; diff --git a/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/hooks/use_is_historical_results_tour_active/index.tsx b/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/hooks/use_is_historical_results_tour_active/index.tsx deleted file mode 100644 index 572bf7023dada..0000000000000 --- a/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/hooks/use_is_historical_results_tour_active/index.tsx +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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 { useCallback } from 'react'; -import useLocalStorage from 'react-use/lib/useLocalStorage'; - -import { HISTORICAL_RESULTS_TOUR_IS_DISMISSED_STORAGE_KEY } from '../../constants'; - -export const useIsHistoricalResultsTourActive = () => { - const [isTourDismissed, setIsTourDismissed] = useLocalStorage( - HISTORICAL_RESULTS_TOUR_IS_DISMISSED_STORAGE_KEY, - false - ); - - const isTourActive = !isTourDismissed; - const setIsTourActive = useCallback( - (active: boolean) => { - setIsTourDismissed(!active); - }, - [setIsTourDismissed] - ); - - return [isTourActive, setIsTourActive] as const; -}; diff --git a/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/index.test.tsx b/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/index.test.tsx index 44f51a50cc027..7b23a10b15719 100644 --- a/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/index.test.tsx +++ b/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/index.test.tsx @@ -6,7 +6,7 @@ */ import numeral from '@elastic/numeral'; -import { render, screen, waitFor, within } from '@testing-library/react'; +import { render, screen, waitFor } from '@testing-library/react'; import React from 'react'; import { EMPTY_STAT } from '../../constants'; @@ -22,8 +22,6 @@ import { } from '../../mock/test_providers/test_providers'; import { PatternRollup } from '../../types'; import { Props, IndicesDetails } from '.'; -import userEvent from '@testing-library/user-event'; -import { HISTORICAL_RESULTS_TOUR_IS_DISMISSED_STORAGE_KEY } from './constants'; const defaultBytesFormat = '0,0.[0]b'; const formatBytes = (value: number | undefined) => @@ -70,7 +68,6 @@ const defaultProps: Props = { describe('IndicesDetails', () => { beforeEach(async () => { jest.clearAllMocks(); - localStorage.removeItem(HISTORICAL_RESULTS_TOUR_IS_DISMISSED_STORAGE_KEY); render( @@ -91,55 +88,4 @@ describe('IndicesDetails', () => { expect(screen.getByTestId(`${pattern}PatternPanel`)).toBeInTheDocument(); }); }); - - describe('tour', () => { - test('it renders the tour wrapping view history button of first row of first non-empty pattern', async () => { - const wrapper = await screen.findByTestId('historicalResultsTour'); - const button = within(wrapper).getByTestId( - 'viewHistoryAction-.internal.alerts-security.alerts-default-000001' - ); - expect(button).toHaveAttribute('data-tour-element', patterns[1]); - - expect(screen.getByTestId('historicalResultsTourPanel')).toHaveTextContent( - 'Introducing data quality history' - ); - }); - - describe('when the tour is dismissed', () => { - test('it hides the tour and persists in localStorage', async () => { - const wrapper = screen.getByTestId('historicalResultsTourPanel'); - const button = within(wrapper).getByText('Close'); - await userEvent.click(button); - - await waitFor(() => expect(screen.queryByTestId('historicalResultsTour')).toBeNull()); - - expect(localStorage.getItem(HISTORICAL_RESULTS_TOUR_IS_DISMISSED_STORAGE_KEY)).toEqual( - 'true' - ); - }); - }); - - describe('when the first pattern is toggled', () => { - test('it renders the tour wrapping view history button of first row of second non-empty pattern', async () => { - const firstNonEmptyPatternAccordionWrapper = await screen.findByTestId( - `${patterns[1]}PatternPanel` - ); - const accordionToggle = within(firstNonEmptyPatternAccordionWrapper).getByTestId( - 'indexResultBadge' - ); - await userEvent.click(accordionToggle); - - const secondPatternAccordionWrapper = screen.getByTestId(`${patterns[2]}PatternPanel`); - const historicalResultsWrapper = await within(secondPatternAccordionWrapper).findByTestId( - 'historicalResultsTour' - ); - const button = within(historicalResultsWrapper).getByTestId( - `viewHistoryAction-${patternIndexNames[patterns[2]][0]}` - ); - expect(button).toHaveAttribute('data-tour-element', patterns[2]); - - expect(screen.getByTestId('historicalResultsTourPanel')).toBeInTheDocument(); - }); - }); - }); }); diff --git a/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/index.tsx b/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/index.tsx index 5a6f8dffea3c2..81ccbee3b71f1 100644 --- a/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/index.tsx +++ b/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/index.tsx @@ -6,14 +6,13 @@ */ import { EuiFlexItem, useEuiTheme } from '@elastic/eui'; -import React, { useState, useCallback, useEffect } from 'react'; +import React from 'react'; import { css } from '@emotion/react'; import { useResultsRollupContext } from '../../contexts/results_rollup_context'; import { Pattern } from './pattern'; import { SelectedIndex } from '../../types'; import { useDataQualityContext } from '../../data_quality_context'; -import { useIsHistoricalResultsTourActive } from './hooks/use_is_historical_results_tour_active'; const useStyles = () => { const { euiTheme } = useEuiTheme(); @@ -41,41 +40,6 @@ const IndicesDetailsComponent: React.FC = ({ const { patternRollups, patternIndexNames } = useResultsRollupContext(); const { patterns } = useDataQualityContext(); - const [isTourActive, setIsTourActive] = useIsHistoricalResultsTourActive(); - - const handleDismissTour = useCallback(() => { - setIsTourActive(false); - }, [setIsTourActive]); - - const [openPatterns, setOpenPatterns] = useState< - Array<{ name: string; isOpen: boolean; isEmpty: boolean }> - >(() => { - return patterns.map((pattern) => ({ name: pattern, isOpen: true, isEmpty: false })); - }); - - const handleAccordionToggle = useCallback( - (patternName: string, isOpen: boolean, isEmpty: boolean) => { - setOpenPatterns((prevOpenPatterns) => { - return prevOpenPatterns.map((p) => - p.name === patternName ? { ...p, isOpen, isEmpty } : p - ); - }); - }, - [] - ); - - const firstOpenNonEmptyPattern = openPatterns.find((pattern) => { - return pattern.isOpen && !pattern.isEmpty; - })?.name; - - const [openPatternsUpdatedAt, setOpenPatternsUpdatedAt] = useState(Date.now()); - - useEffect(() => { - if (firstOpenNonEmptyPattern) { - setOpenPatternsUpdatedAt(Date.now()); - } - }, [openPatterns, firstOpenNonEmptyPattern]); - return (
{patterns.map((pattern) => ( @@ -86,16 +50,6 @@ const IndicesDetailsComponent: React.FC = ({ patternRollup={patternRollups[pattern]} chartSelectedIndex={chartSelectedIndex} setChartSelectedIndex={setChartSelectedIndex} - isTourActive={isTourActive} - isFirstOpenNonEmptyPattern={pattern === firstOpenNonEmptyPattern} - onAccordionToggle={handleAccordionToggle} - onDismissTour={handleDismissTour} - // TODO: remove this hack when EUI popover is fixed - // https://github.com/elastic/eui/issues/5226 - // - // this information is used to force the tour guide popover to reposition - // when surrounding accordions get toggled and affect the layout - {...(pattern === firstOpenNonEmptyPattern && { openPatternsUpdatedAt })} /> ))} diff --git a/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/pattern/constants.ts b/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/pattern/constants.ts index a02eccb3e81a4..4bab5938cf98b 100644 --- a/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/pattern/constants.ts +++ b/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/pattern/constants.ts @@ -9,5 +9,3 @@ export const MIN_PAGE_SIZE = 10; export const HISTORY_TAB_ID = 'history'; export const LATEST_CHECK_TAB_ID = 'latest_check'; - -export const HISTORICAL_RESULTS_TOUR_SELECTOR_KEY = 'data-tour-element'; diff --git a/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/pattern/historical_results_tour/index.test.tsx b/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/pattern/historical_results_tour/index.test.tsx deleted file mode 100644 index 53f2e059072c8..0000000000000 --- a/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/pattern/historical_results_tour/index.test.tsx +++ /dev/null @@ -1,105 +0,0 @@ -/* - * 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 React from 'react'; -import { render, screen, waitFor } from '@testing-library/react'; -import userEvent from '@testing-library/user-event'; - -import { HISTORICAL_RESULTS_TOUR_SELECTOR_KEY } from '../constants'; -import { HistoricalResultsTour } from '.'; -import { INTRODUCING_DATA_QUALITY_HISTORY, VIEW_PAST_RESULTS } from './translations'; - -const anchorSelectorValue = 'test-anchor'; - -describe('HistoricalResultsTour', () => { - beforeEach(() => { - jest.clearAllMocks(); - }); - - describe('given no anchor element', () => { - it('does not render the tour step', () => { - render( - - ); - - expect(screen.queryByText(INTRODUCING_DATA_QUALITY_HISTORY)).not.toBeInTheDocument(); - }); - }); - - describe('given an anchor element', () => { - beforeEach(() => { - // eslint-disable-next-line no-unsanitized/property - document.body.innerHTML = `
`; - }); - - describe('when isOpen is true', () => { - const onTryIt = jest.fn(); - const onDismissTour = jest.fn(); - beforeEach(() => { - render( - - ); - }); - it('renders the tour step', async () => { - expect( - await screen.findByRole('dialog', { name: INTRODUCING_DATA_QUALITY_HISTORY }) - ).toBeInTheDocument(); - expect(screen.getByText(INTRODUCING_DATA_QUALITY_HISTORY)).toBeInTheDocument(); - expect(screen.getByText(VIEW_PAST_RESULTS)).toBeInTheDocument(); - expect(screen.getByRole('button', { name: /Close/i })).toBeInTheDocument(); - expect(screen.getByRole('button', { name: /Try It/i })).toBeInTheDocument(); - - const historicalResultsTour = screen.getByTestId('historicalResultsTour'); - expect(historicalResultsTour.querySelector('[data-tour-element]')).toHaveAttribute( - 'data-tour-element', - anchorSelectorValue - ); - }); - - describe('when the close button is clicked', () => { - it('calls dismissTour', async () => { - await userEvent.click(await screen.findByRole('button', { name: /Close/i })); - expect(onDismissTour).toHaveBeenCalledTimes(1); - }); - }); - - describe('when the try it button is clicked', () => { - it('calls onTryIt', async () => { - await userEvent.click(await screen.findByRole('button', { name: /Try It/i })); - expect(onTryIt).toHaveBeenCalledTimes(1); - }); - }); - }); - - describe('when isOpen is false', () => { - it('does not render the tour step', async () => { - render( - - ); - - await waitFor(() => - expect(screen.queryByText(INTRODUCING_DATA_QUALITY_HISTORY)).not.toBeInTheDocument() - ); - }); - }); - }); -}); diff --git a/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/pattern/historical_results_tour/index.tsx b/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/pattern/historical_results_tour/index.tsx deleted file mode 100644 index 6b78be1d0d0e1..0000000000000 --- a/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/pattern/historical_results_tour/index.tsx +++ /dev/null @@ -1,85 +0,0 @@ -/* - * 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 React, { FC, useEffect, useState } from 'react'; -import { EuiButton, EuiButtonEmpty, EuiText, EuiTourStep } from '@elastic/eui'; -import { css } from '@emotion/react'; - -import { HISTORICAL_RESULTS_TOUR_SELECTOR_KEY } from '../constants'; -import { CLOSE, INTRODUCING_DATA_QUALITY_HISTORY, TRY_IT, VIEW_PAST_RESULTS } from './translations'; - -export interface Props { - anchorSelectorValue: string; - isOpen: boolean; - onTryIt: () => void; - onDismissTour: () => void; - zIndex?: number; -} - -const styles = { - text: css({ - marginBlockStart: '-10px', - }), -}; - -export const HistoricalResultsTour: FC = ({ - anchorSelectorValue, - onTryIt, - isOpen, - onDismissTour, - zIndex, -}) => { - const [anchorElement, setAnchorElement] = useState(); - - useEffect(() => { - const element = document.querySelector( - `[${HISTORICAL_RESULTS_TOUR_SELECTOR_KEY}="${anchorSelectorValue}"]` - ); - - if (!element) { - return; - } - - setAnchorElement(element); - }, [anchorSelectorValue]); - - if (!isOpen || !anchorElement) { - return null; - } - - return ( - -

{VIEW_PAST_RESULTS}

- - } - data-test-subj="historicalResultsTour" - isStepOpen={isOpen} - minWidth={283} - onFinish={onDismissTour} - step={1} - stepsTotal={1} - title={INTRODUCING_DATA_QUALITY_HISTORY} - anchorPosition="rightUp" - repositionOnScroll - anchor={anchorElement} - zIndex={zIndex} - panelProps={{ - 'data-test-subj': 'historicalResultsTourPanel', - }} - footerAction={[ - - {CLOSE} - , - - {TRY_IT} - , - ]} - /> - ); -}; diff --git a/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/pattern/historical_results_tour/translations.ts b/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/pattern/historical_results_tour/translations.ts deleted file mode 100644 index d8f81aa288baa..0000000000000 --- a/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/pattern/historical_results_tour/translations.ts +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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 { i18n } from '@kbn/i18n'; - -export const CLOSE = i18n.translate('securitySolutionPackages.ecsDataQualityDashboard.close', { - defaultMessage: 'Close', -}); - -export const TRY_IT = i18n.translate('securitySolutionPackages.ecsDataQualityDashboard.tryIt', { - defaultMessage: 'Try it', -}); - -export const INTRODUCING_DATA_QUALITY_HISTORY = i18n.translate( - 'securitySolutionPackages.ecsDataQualityDashboard.introducingDataQualityHistory', - { - defaultMessage: 'Introducing data quality history', - } -); - -export const VIEW_PAST_RESULTS = i18n.translate( - 'securitySolutionPackages.ecsDataQualityDashboard.viewPastResults', - { - defaultMessage: 'View past results', - } -); diff --git a/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/pattern/index.test.tsx b/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/pattern/index.test.tsx index 8f8ed7d702d2f..4c7d7a0e314d9 100644 --- a/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/pattern/index.test.tsx +++ b/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/pattern/index.test.tsx @@ -6,17 +6,14 @@ */ import React from 'react'; -import { render, screen, waitFor, within } from '@testing-library/react'; +import { render, screen } from '@testing-library/react'; import { TestDataQualityProviders, TestExternalProviders, } from '../../../mock/test_providers/test_providers'; import { Pattern } from '.'; -import { - auditbeatWithAllResults, - emptyAuditbeatPatternRollup, -} from '../../../mock/pattern_rollup/mock_auditbeat_pattern_rollup'; +import { auditbeatWithAllResults } from '../../../mock/pattern_rollup/mock_auditbeat_pattern_rollup'; import { useIlmExplain } from './hooks/use_ilm_explain'; import { useStats } from './hooks/use_stats'; import { ERROR_LOADING_METADATA_TITLE, LOADING_STATS } from './translations'; @@ -86,10 +83,6 @@ describe('pattern', () => { setChartSelectedIndex={jest.fn()} indexNames={Object.keys(auditbeatWithAllResults.stats!)} pattern={pattern} - isTourActive={false} - onDismissTour={jest.fn()} - isFirstOpenNonEmptyPattern={false} - onAccordionToggle={jest.fn()} /> @@ -103,153 +96,6 @@ describe('pattern', () => { expect(screen.getByTestId('summaryTable')).toBeInTheDocument(); }); - describe('onAccordionToggle', () => { - describe('by default', () => { - describe('when no summary table items are available', () => { - it('invokes the onAccordionToggle function with the pattern name, isOpen as true and isEmpty as true', async () => { - const onAccordionToggle = jest.fn(); - - (useIlmExplain as jest.Mock).mockReturnValue({ - error: null, - ilmExplain: null, - loading: false, - }); - - (useStats as jest.Mock).mockReturnValue({ - stats: null, - error: null, - loading: false, - }); - - render( - - - - - - ); - - const accordionToggle = screen.getByTestId('patternAccordionButton-auditbeat-*'); - expect(accordionToggle).toHaveTextContent( - 'auditbeat-*Incompatible fields0Indices checked0Indices0Size0BDocs0' - ); - - expect(onAccordionToggle).toHaveBeenCalledTimes(1); - - await userEvent.click(accordionToggle); - - expect(onAccordionToggle).toHaveBeenCalledTimes(2); - expect(onAccordionToggle).toHaveBeenCalledWith(pattern, true, true); - }); - }); - - describe('when summary table items are available', () => { - it('invokes the onAccordionToggle function with the pattern name, isOpen as true and isEmpty as false', async () => { - const onAccordionToggle = jest.fn(); - - (useIlmExplain as jest.Mock).mockReturnValue({ - error: null, - ilmExplain: auditbeatWithAllResults.ilmExplain, - loading: false, - }); - - (useStats as jest.Mock).mockReturnValue({ - stats: auditbeatWithAllResults.stats, - error: null, - loading: false, - }); - - render( - - - - - - ); - - const accordionToggle = screen.getByTestId('patternAccordionButton-auditbeat-*'); - expect(onAccordionToggle).toHaveBeenCalledTimes(1); - - await userEvent.click(accordionToggle); - - expect(onAccordionToggle).toHaveBeenCalledTimes(2); - expect(onAccordionToggle).toHaveBeenCalledWith(pattern, true, false); - }); - }); - }); - - describe('when the accordion is toggled', () => { - it('calls the onAccordionToggle function with current open state and current empty state', async () => { - const onAccordionToggle = jest.fn(); - - (useIlmExplain as jest.Mock).mockReturnValue({ - error: null, - ilmExplain: auditbeatWithAllResults.ilmExplain, - loading: false, - }); - - (useStats as jest.Mock).mockReturnValue({ - stats: auditbeatWithAllResults.stats, - error: null, - loading: false, - }); - - render( - - - - - - ); - - const accordionToggle = screen.getByTestId('patternAccordionButton-auditbeat-*'); - - expect(onAccordionToggle).toHaveBeenCalledTimes(1); - expect(onAccordionToggle).toHaveBeenCalledWith(pattern, true, false); - - await userEvent.click(accordionToggle); - - expect(onAccordionToggle).toHaveBeenCalledTimes(2); - expect(onAccordionToggle).toHaveBeenLastCalledWith(pattern, false, false); - - await userEvent.click(accordionToggle); - - expect(onAccordionToggle).toHaveBeenCalledTimes(3); - expect(onAccordionToggle).toHaveBeenCalledWith(pattern, true, false); - }); - }); - }); - describe('remote clusters callout', () => { describe('when the pattern includes a colon', () => { it('it renders the remote clusters callout', () => { @@ -262,10 +108,6 @@ describe('pattern', () => { setChartSelectedIndex={jest.fn()} indexNames={undefined} pattern={'remote:*'} - isTourActive={false} - onDismissTour={jest.fn()} - isFirstOpenNonEmptyPattern={false} - onAccordionToggle={jest.fn()} /> @@ -286,10 +128,6 @@ describe('pattern', () => { setChartSelectedIndex={jest.fn()} indexNames={undefined} pattern={pattern} - isTourActive={false} - onDismissTour={jest.fn()} - isFirstOpenNonEmptyPattern={false} - onAccordionToggle={jest.fn()} /> @@ -318,10 +156,6 @@ describe('pattern', () => { setChartSelectedIndex={jest.fn()} indexNames={Object.keys(auditbeatWithAllResults.stats!)} pattern={pattern} - isTourActive={false} - onDismissTour={jest.fn()} - isFirstOpenNonEmptyPattern={false} - onAccordionToggle={jest.fn()} /> @@ -349,10 +183,6 @@ describe('pattern', () => { setChartSelectedIndex={jest.fn()} indexNames={Object.keys(auditbeatWithAllResults.stats!)} pattern={pattern} - isTourActive={false} - onDismissTour={jest.fn()} - isFirstOpenNonEmptyPattern={false} - onAccordionToggle={jest.fn()} /> @@ -386,10 +216,6 @@ describe('pattern', () => { setChartSelectedIndex={jest.fn()} indexNames={Object.keys(auditbeatWithAllResults.stats!)} pattern={pattern} - isTourActive={false} - onDismissTour={jest.fn()} - isFirstOpenNonEmptyPattern={false} - onAccordionToggle={jest.fn()} /> @@ -423,10 +249,6 @@ describe('pattern', () => { setChartSelectedIndex={jest.fn()} indexNames={Object.keys(auditbeatWithAllResults.stats!)} pattern={pattern} - isTourActive={false} - onDismissTour={jest.fn()} - isFirstOpenNonEmptyPattern={false} - onAccordionToggle={jest.fn()} /> @@ -471,10 +293,6 @@ describe('pattern', () => { setChartSelectedIndex={jest.fn()} indexNames={Object.keys(auditbeatWithAllResults.stats!)} pattern={pattern} - isTourActive={false} - onDismissTour={jest.fn()} - isFirstOpenNonEmptyPattern={false} - onAccordionToggle={jest.fn()} /> @@ -549,10 +367,6 @@ describe('pattern', () => { setChartSelectedIndex={jest.fn()} indexNames={Object.keys(auditbeatWithAllResults.stats!)} pattern={pattern} - isTourActive={false} - onDismissTour={jest.fn()} - isFirstOpenNonEmptyPattern={false} - onAccordionToggle={jest.fn()} /> @@ -622,10 +436,6 @@ describe('pattern', () => { setChartSelectedIndex={jest.fn()} indexNames={Object.keys(auditbeatWithAllResults.stats!)} pattern={pattern} - isTourActive={false} - onDismissTour={jest.fn()} - isFirstOpenNonEmptyPattern={false} - onAccordionToggle={jest.fn()} /> @@ -683,10 +493,6 @@ describe('pattern', () => { setChartSelectedIndex={jest.fn()} indexNames={Object.keys(auditbeatWithAllResults.stats!)} pattern={pattern} - isTourActive={false} - onDismissTour={jest.fn()} - isFirstOpenNonEmptyPattern={false} - onAccordionToggle={jest.fn()} /> @@ -716,326 +522,4 @@ describe('pattern', () => { }); }); }); - - describe('Tour', () => { - describe('when isTourActive and isFirstOpenNonEmptyPattern', () => { - it('renders the tour near the first row history view button', async () => { - (useIlmExplain as jest.Mock).mockReturnValue({ - error: null, - ilmExplain: auditbeatWithAllResults.ilmExplain, - loading: false, - }); - - (useStats as jest.Mock).mockReturnValue({ - stats: auditbeatWithAllResults.stats, - error: null, - loading: false, - }); - - render( - - - - - - ); - - const tourWrapper = await screen.findByTestId('historicalResultsTour'); - - expect( - within(tourWrapper).getByTestId('viewHistoryAction-.ds-auditbeat-8.6.1-2023.02.07-000001') - ).toBeInTheDocument(); - - expect(screen.getByTestId('historicalResultsTourPanel')).toBeInTheDocument(); - }); - - describe('when accordion is collapsed', () => { - it('hides the tour', async () => { - (useIlmExplain as jest.Mock).mockReturnValue({ - error: null, - ilmExplain: auditbeatWithAllResults.ilmExplain, - loading: false, - }); - - (useStats as jest.Mock).mockReturnValue({ - stats: auditbeatWithAllResults.stats, - error: null, - loading: false, - }); - - render( - - - - - - ); - - expect(await screen.findByTestId('historicalResultsTour')).toBeInTheDocument(); - - const accordionToggle = screen.getByTestId('patternAccordionButton-auditbeat-*'); - await userEvent.click(accordionToggle); - - expect(screen.queryByTestId('historicalResultsTour')).not.toBeInTheDocument(); - }); - }); - - describe('when the tour close button is clicked', () => { - it('invokes onDismissTour', async () => { - (useIlmExplain as jest.Mock).mockReturnValue({ - error: null, - ilmExplain: auditbeatWithAllResults.ilmExplain, - loading: false, - }); - - (useStats as jest.Mock).mockReturnValue({ - stats: auditbeatWithAllResults.stats, - error: null, - loading: false, - }); - - const onDismissTour = jest.fn(); - - render( - - - - - - ); - - const tourDialog = await screen.findByTestId('historicalResultsTourPanel'); - const closeButton = within(tourDialog).getByText('Close'); - - await userEvent.click(closeButton); - - expect(onDismissTour).toHaveBeenCalledTimes(1); - }); - }); - - describe('when the tour tryIt action is clicked', () => { - it('opens the flyout with history tab and invokes onDismissTour', async () => { - (useIlmExplain as jest.Mock).mockReturnValue({ - error: null, - ilmExplain: auditbeatWithAllResults.ilmExplain, - loading: false, - }); - - (useStats as jest.Mock).mockReturnValue({ - stats: auditbeatWithAllResults.stats, - error: null, - loading: false, - }); - - const onDismissTour = jest.fn(); - - render( - - - - - - ); - - const tourDialog = await screen.findByTestId('historicalResultsTourPanel'); - const tryItButton = within(tourDialog).getByText('Try it'); - - await userEvent.click(tryItButton); - - expect(onDismissTour).toHaveBeenCalledTimes(1); - expect(screen.getByTestId(`indexCheckFlyoutTab-${LATEST_CHECK_TAB_ID}`)).toHaveAttribute( - 'aria-selected', - 'false' - ); - expect(screen.getByTestId(`indexCheckFlyoutTab-${HISTORY_TAB_ID}`)).toHaveAttribute( - 'aria-selected', - 'true' - ); - }); - }); - - describe('when latest check flyout tab is opened', () => { - it('hides the tour in listview and shows in flyout', async () => { - (useIlmExplain as jest.Mock).mockReturnValue({ - error: null, - ilmExplain: auditbeatWithAllResults.ilmExplain, - loading: false, - }); - - (useStats as jest.Mock).mockReturnValue({ - stats: auditbeatWithAllResults.stats, - error: null, - loading: false, - }); - - const onDismissTour = jest.fn(); - - render( - - - - - - ); - - const summaryTableWrapper = within(screen.getByTestId('summaryTable')); - - expect( - await summaryTableWrapper.findByTestId('historicalResultsTour') - ).toBeInTheDocument(); - expect(screen.queryByTestId('historicalResultsTourPanel')).toBeInTheDocument(); - - const checkNowButton = summaryTableWrapper.getByTestId( - 'checkNowAction-.ds-auditbeat-8.6.1-2023.02.07-000001' - ); - await userEvent.click(checkNowButton); - - expect(screen.getByTestId(`indexCheckFlyoutTab-${LATEST_CHECK_TAB_ID}`)).toHaveAttribute( - 'aria-selected', - 'true' - ); - expect(screen.getByTestId(`indexCheckFlyoutTab-${HISTORY_TAB_ID}`)).toHaveAttribute( - 'aria-selected', - 'false' - ); - - expect( - summaryTableWrapper.queryByTestId('historicalResultsTour') - ).not.toBeInTheDocument(); - - const tabWrapper = await screen.findByTestId(`indexCheckFlyoutTab-${HISTORY_TAB_ID}`); - await waitFor(() => { - expect( - tabWrapper.closest('[data-test-subj="historicalResultsTour"]') - ).toBeInTheDocument(); - expect(screen.queryByTestId('historicalResultsTourPanel')).toBeInTheDocument(); - }); - - expect(onDismissTour).not.toHaveBeenCalled(); - }); - }); - }); - - describe('when not isFirstOpenNonEmptyPattern', () => { - it('does not render the tour', async () => { - (useIlmExplain as jest.Mock).mockReturnValue({ - error: null, - ilmExplain: auditbeatWithAllResults.ilmExplain, - loading: false, - }); - - (useStats as jest.Mock).mockReturnValue({ - stats: auditbeatWithAllResults.stats, - error: null, - loading: false, - }); - - render( - - - - - - ); - - expect(screen.queryByTestId('historicalResultsTour')).not.toBeInTheDocument(); - }); - }); - - describe('when not isTourActive', () => { - it('does not render the tour', async () => { - (useIlmExplain as jest.Mock).mockReturnValue({ - error: null, - ilmExplain: auditbeatWithAllResults.ilmExplain, - loading: false, - }); - - (useStats as jest.Mock).mockReturnValue({ - stats: auditbeatWithAllResults.stats, - error: null, - loading: false, - }); - - render( - - - - - - ); - - expect(screen.queryByTestId('historicalResultsTour')).not.toBeInTheDocument(); - }); - }); - }); }); diff --git a/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/pattern/index.tsx b/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/pattern/index.tsx index e19e9a77a6369..0cd3893b27f97 100644 --- a/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/pattern/index.tsx +++ b/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/pattern/index.tsx @@ -35,7 +35,6 @@ import { getPageIndex } from './utils/get_page_index'; import { useAbortControllerRef } from '../../../hooks/use_abort_controller_ref'; import { useHistoricalResults } from './hooks/use_historical_results'; import { HistoricalResultsContext } from './contexts/historical_results_context'; -import { HistoricalResultsTour } from './historical_results_tour'; const EMPTY_INDEX_NAMES: string[] = []; @@ -45,11 +44,6 @@ interface Props { patternRollup: PatternRollup | undefined; chartSelectedIndex: SelectedIndex | null; setChartSelectedIndex: (selectedIndex: SelectedIndex | null) => void; - isTourActive: boolean; - isFirstOpenNonEmptyPattern: boolean; - onAccordionToggle: (patternName: string, isOpen: boolean, isEmpty: boolean) => void; - onDismissTour: () => void; - openPatternsUpdatedAt?: number; } const PatternComponent: React.FC = ({ @@ -58,11 +52,6 @@ const PatternComponent: React.FC = ({ patternRollup, chartSelectedIndex, setChartSelectedIndex, - isTourActive, - isFirstOpenNonEmptyPattern, - onAccordionToggle, - onDismissTour, - openPatternsUpdatedAt, }) => { const { historicalResultsState, fetchHistoricalResults } = useHistoricalResults(); const historicalResultsContextValue = useMemo( @@ -142,27 +131,9 @@ const PatternComponent: React.FC = ({ isAccordionOpenRef.current = isAccordionOpen; }, [isAccordionOpen]); - useEffect(() => { - // this use effect syncs isEmpty state with the parent component - // - // we do not add isAccordionOpen to the dependency array because - // it is already handled by handleAccordionToggle - // so we don't want to additionally trigger this useEffect when isAccordionOpen changes - // because it's confusing and unnecessary - // that's why we use ref here to keep separation of concerns - onAccordionToggle(pattern, isAccordionOpenRef.current, items.length === 0); - }, [items.length, onAccordionToggle, pattern]); - - const handleAccordionToggle = useCallback( - (isOpen: boolean) => { - const isEmpty = items.length === 0; - setIsAccordionOpen(isOpen); - onAccordionToggle(pattern, isOpen, isEmpty); - }, - [items.length, onAccordionToggle, pattern] - ); - - const firstRow = items[0]; + const handleAccordionToggle = useCallback((isOpen: boolean) => { + setIsAccordionOpen(isOpen); + }, []); const handleFlyoutClose = useCallback(() => { setExpandedIndexName(null); @@ -193,9 +164,6 @@ const PatternComponent: React.FC = ({ const handleFlyoutViewCheckHistoryAction = useCallback( (indexName: string) => { - if (isTourActive) { - onDismissTour(); - } fetchHistoricalResults({ abortController: flyoutViewCheckHistoryAbortControllerRef.current, indexName, @@ -203,16 +171,9 @@ const PatternComponent: React.FC = ({ setExpandedIndexName(indexName); setInitialFlyoutTabId(HISTORY_TAB_ID); }, - [fetchHistoricalResults, flyoutViewCheckHistoryAbortControllerRef, isTourActive, onDismissTour] + [fetchHistoricalResults, flyoutViewCheckHistoryAbortControllerRef] ); - const handleOpenFlyoutHistoryTab = useCallback(() => { - const firstItemIndexName = firstRow?.indexName; - if (firstItemIndexName) { - handleFlyoutViewCheckHistoryAction(firstItemIndexName); - } - }, [firstRow?.indexName, handleFlyoutViewCheckHistoryAction]); - useEffect(() => { const newIndexNames = getIndexNames({ stats, ilmExplain, ilmPhases, isILMAvailable }); const newDocsCount = getPatternDocsCount({ indexNames: newIndexNames, stats }); @@ -362,34 +323,6 @@ const PatternComponent: React.FC = ({ {!loading && error == null && (
- = ({ ilmExplain={ilmExplain} stats={stats} onClose={handleFlyoutClose} - onDismissTour={onDismissTour} - isTourActive={isTourActive} /> ) : null} diff --git a/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/pattern/index_check_flyout/index.test.tsx b/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/pattern/index_check_flyout/index.test.tsx index a41e7d67e7682..a329ae0e3bcdd 100644 --- a/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/pattern/index_check_flyout/index.test.tsx +++ b/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/pattern/index_check_flyout/index.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { render, screen, waitFor, within } from '@testing-library/react'; +import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { IndexCheckFlyout } from '.'; @@ -42,8 +42,6 @@ describe('IndexCheckFlyout', () => { pattern="auditbeat-*" patternRollup={auditbeatWithAllResults} stats={mockStats} - onDismissTour={jest.fn()} - isTourActive={false} /> @@ -100,8 +98,6 @@ describe('IndexCheckFlyout', () => { patternRollup={auditbeatWithAllResults} stats={mockStats} initialSelectedTabId="latest_check" - isTourActive={false} - onDismissTour={jest.fn()} /> @@ -134,8 +130,6 @@ describe('IndexCheckFlyout', () => { patternRollup={auditbeatWithAllResults} stats={mockStats} initialSelectedTabId="latest_check" - isTourActive={false} - onDismissTour={jest.fn()} /> @@ -182,8 +176,6 @@ describe('IndexCheckFlyout', () => { patternRollup={auditbeatWithAllResults} stats={mockStats} initialSelectedTabId="latest_check" - onDismissTour={jest.fn()} - isTourActive={false} /> @@ -209,170 +201,4 @@ describe('IndexCheckFlyout', () => { expect(screen.getByTestId('historicalResults')).toBeInTheDocument(); }); }); - - describe('Tour guide', () => { - describe('when in Latest Check tab and isTourActive', () => { - it('should render the tour guide near history tab with proper data-tour-element attribute', async () => { - const pattern = 'auditbeat-*'; - render( - - - - - - - - ); - - const historyTab = screen.getByTestId(`indexCheckFlyoutTab-${HISTORY_TAB_ID}`); - const latestCheckTab = screen.getByTestId(`indexCheckFlyoutTab-${LATEST_CHECK_TAB_ID}`); - - expect(historyTab).toHaveAttribute('data-tour-element', `${pattern}-history-tab`); - expect(latestCheckTab).not.toHaveAttribute('data-tour-element', `${pattern}-history-tab`); - await waitFor(() => - expect(historyTab.closest('[data-test-subj="historicalResultsTour"]')).toBeInTheDocument() - ); - expect(screen.getByTestId('historicalResultsTourPanel')).toBeInTheDocument(); - }); - - describe('when the tour close button is clicked', () => { - it('should invoke the dismiss tour callback', async () => { - const onDismissTour = jest.fn(); - render( - - - - - - - - ); - - const dialogWrapper = await screen.findByTestId('historicalResultsTourPanel'); - const closeButton = within(dialogWrapper).getByText('Close'); - await userEvent.click(closeButton); - - expect(onDismissTour).toHaveBeenCalled(); - }); - }); - - describe('when the tour TryIt button is clicked', () => { - it('should switch to history tab and invoke onDismissTour', async () => { - const onDismissTour = jest.fn(); - render( - - - - - - - - ); - - const dialogWrapper = await screen.findByTestId('historicalResultsTourPanel'); - - const tryItButton = within(dialogWrapper).getByText('Try it'); - await userEvent.click(tryItButton); - - expect(onDismissTour).toHaveBeenCalled(); - expect(screen.getByTestId(`indexCheckFlyoutTab-${HISTORY_TAB_ID}`)).toHaveAttribute( - 'aria-selected', - 'true' - ); - - expect(onDismissTour).toHaveBeenCalled(); - }); - }); - - describe('when manually switching to history tab', () => { - it('should invoke onDismissTour', async () => { - const onDismissTour = jest.fn(); - render( - - - - - - - - ); - - const historyTab = screen.getByTestId(`indexCheckFlyoutTab-${HISTORY_TAB_ID}`); - await userEvent.click(historyTab); - - expect(onDismissTour).toHaveBeenCalled(); - }); - }); - }); - - describe('when not isTourActive', () => { - it('should not render the tour guide', async () => { - render( - - - - - - - - ); - - await waitFor(() => - expect(screen.queryByTestId('historicalResultsTour')).not.toBeInTheDocument() - ); - - expect(screen.queryByTestId('historicalResultsTourPanel')).not.toBeInTheDocument(); - }); - }); - }); }); diff --git a/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/pattern/index_check_flyout/index.tsx b/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/pattern/index_check_flyout/index.tsx index 3bb20323ca1c4..a664620d81f67 100644 --- a/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/pattern/index_check_flyout/index.tsx +++ b/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/pattern/index_check_flyout/index.tsx @@ -36,13 +36,8 @@ import { HistoricalResults } from './historical_results'; import { useHistoricalResultsContext } from '../contexts/historical_results_context'; import { getFormattedCheckTime } from './utils/get_formatted_check_time'; import { CHECK_NOW } from '../translations'; -import { - HISTORICAL_RESULTS_TOUR_SELECTOR_KEY, - HISTORY_TAB_ID, - LATEST_CHECK_TAB_ID, -} from '../constants'; +import { HISTORY_TAB_ID, LATEST_CHECK_TAB_ID } from '../constants'; import { IndexCheckFlyoutTabId } from './types'; -import { HistoricalResultsTour } from '../historical_results_tour'; export interface Props { ilmExplain: Record | null; @@ -52,8 +47,6 @@ export interface Props { stats: Record | null; onClose: () => void; initialSelectedTabId: IndexCheckFlyoutTabId; - onDismissTour: () => void; - isTourActive: boolean; } const tabs = [ @@ -75,8 +68,6 @@ export const IndexCheckFlyoutComponent: React.FC = ({ patternRollup, stats, onClose, - onDismissTour, - isTourActive, }) => { const didSwitchToLatestTabOnceRef = useRef(false); const { fetchHistoricalResults } = useHistoricalResultsContext(); @@ -101,9 +92,6 @@ export const IndexCheckFlyoutComponent: React.FC = ({ (tabId: IndexCheckFlyoutTabId) => { setSelectedTabId(tabId); if (tabId === HISTORY_TAB_ID) { - if (isTourActive) { - onDismissTour(); - } fetchHistoricalResults({ abortController: fetchHistoricalResultsAbortControllerRef.current, indexName, @@ -133,8 +121,6 @@ export const IndexCheckFlyoutComponent: React.FC = ({ formatNumber, httpFetch, indexName, - isTourActive, - onDismissTour, pattern, ] ); @@ -162,10 +148,6 @@ export const IndexCheckFlyoutComponent: React.FC = ({ selectedTabId, ]); - const handleSelectHistoryTab = useCallback(() => { - handleTabClick(HISTORY_TAB_ID); - }, [handleTabClick]); - const renderTabs = useMemo( () => tabs.map((tab, index) => { @@ -175,15 +157,12 @@ export const IndexCheckFlyoutComponent: React.FC = ({ onClick={() => handleTabClick(tab.id)} isSelected={tab.id === selectedTabId} key={index} - {...(tab.id === HISTORY_TAB_ID && { - [HISTORICAL_RESULTS_TOUR_SELECTOR_KEY]: `${pattern}-history-tab`, - })} > {tab.name} ); }), - [handleTabClick, pattern, selectedTabId] + [handleTabClick, selectedTabId] ); return ( @@ -214,24 +193,16 @@ export const IndexCheckFlyoutComponent: React.FC = ({ )} - {renderTabs} + {renderTabs} {selectedTabId === LATEST_CHECK_TAB_ID ? ( - <> - - - + ) : ( )} diff --git a/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/pattern/summary_table/utils/columns.test.tsx b/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/pattern/summary_table/utils/columns.test.tsx index 7701803c36e59..032faac4d9845 100644 --- a/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/pattern/summary_table/utils/columns.test.tsx +++ b/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/pattern/summary_table/utils/columns.test.tsx @@ -203,62 +203,6 @@ describe('helpers', () => { expect(onViewHistoryAction).toBeCalledWith(indexSummaryTableItem.indexName); }); - - test('adds data-tour-element attribute to the first view history button', () => { - const pattern = 'auditbeat-*'; - const columns = getSummaryTableColumns({ - formatBytes, - formatNumber, - isILMAvailable, - pattern, - onCheckNowAction: jest.fn(), - onViewHistoryAction: jest.fn(), - firstIndexName: indexName, - dangerColor: testColor, - }); - - const expandActionRender = ( - (columns[0] as EuiTableActionsColumnType) - .actions[1] as CustomItemAction - ).render; - - render( - - {expandActionRender != null && expandActionRender(indexSummaryTableItem, true)} - - ); - - const button = screen.getByLabelText(VIEW_HISTORY); - expect(button).toHaveAttribute('data-tour-element', pattern); - }); - - test('doesn`t add data-tour-element attribute to non-first view history buttons', () => { - const pattern = 'auditbeat-*'; - const columns = getSummaryTableColumns({ - formatBytes, - formatNumber, - isILMAvailable, - pattern, - onCheckNowAction: jest.fn(), - onViewHistoryAction: jest.fn(), - firstIndexName: 'another-index', - dangerColor: testColor, - }); - - const expandActionRender = ( - (columns[0] as EuiTableActionsColumnType) - .actions[1] as CustomItemAction - ).render; - - render( - - {expandActionRender != null && expandActionRender(indexSummaryTableItem, true)} - - ); - - const button = screen.getByLabelText(VIEW_HISTORY); - expect(button).not.toHaveAttribute('data-tour-element'); - }); }); describe('incompatible render()', () => { diff --git a/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/pattern/summary_table/utils/columns.tsx b/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/pattern/summary_table/utils/columns.tsx index 48cacfb3c96f7..094063a304e30 100644 --- a/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/pattern/summary_table/utils/columns.tsx +++ b/x-pack/solutions/security/packages/ecs-data-quality-dashboard/impl/data_quality_panel/data_quality_details/indices_details/pattern/summary_table/utils/columns.tsx @@ -36,7 +36,6 @@ import { IndexResultBadge } from '../../index_result_badge'; import { Stat } from '../../../../../stat'; import { getIndexResultToolTip } from '../../utils/get_index_result_tooltip'; import { CHECK_NOW } from '../../translations'; -import { HISTORICAL_RESULTS_TOUR_SELECTOR_KEY } from '../../constants'; const styles = { progressContainer: css({ @@ -106,7 +105,6 @@ export const getSummaryTableColumns = ({ pattern, onCheckNowAction, onViewHistoryAction, - firstIndexName, dangerColor, }: { formatBytes: (value: number | undefined) => string; @@ -115,7 +113,6 @@ export const getSummaryTableColumns = ({ pattern: string; onCheckNowAction: (indexName: string) => void; onViewHistoryAction: (indexName: string) => void; - firstIndexName?: string; dangerColor: string; }): Array> => [ { @@ -142,7 +139,6 @@ export const getSummaryTableColumns = ({ { name: i18n.VIEW_HISTORY, render: (item) => { - const isFirstIndexName = firstIndexName === item.indexName; return ( onViewHistoryAction(item.indexName)} - {...(isFirstIndexName && { - [HISTORICAL_RESULTS_TOUR_SELECTOR_KEY]: pattern, - })} /> );