diff --git a/plugins/main/public/components/common/hooks/data_grid/data_grid_service.ts b/plugins/main/public/components/common/data_grid/data_grid_service.ts similarity index 94% rename from plugins/main/public/components/common/hooks/data_grid/data_grid_service.ts rename to plugins/main/public/components/common/data_grid/data_grid_service.ts index 610825e598..aa7e55cd19 100644 --- a/plugins/main/public/components/common/hooks/data_grid/data_grid_service.ts +++ b/plugins/main/public/components/common/data_grid/data_grid_service.ts @@ -1,8 +1,8 @@ -import { SearchResponse } from "../../../../../../../src/core/server"; -import * as FileSaver from '../../../../services/file-saver'; -import { beautifyDate } from "../../../agents/vuls/inventory/lib"; +import { SearchResponse } from "../../../../../../src/core/server"; +import * as FileSaver from '../../../services/file-saver'; +import { beautifyDate } from "../../agents/vuls/inventory/lib"; import { SearchParams, search } from "../search_bar/search_bar_service"; -import { IFieldType, IndexPattern } from "../../../../../../../src/plugins/data/common"; +import { IFieldType, IndexPattern } from "../../../../../../src/plugins/data/common"; export const MAX_ENTRIES_PER_QUERY = 10000; import { EuiDataGridColumn } from '@elastic/eui'; diff --git a/plugins/main/public/components/common/hooks/data_grid/index.ts b/plugins/main/public/components/common/data_grid/index.ts similarity index 100% rename from plugins/main/public/components/common/hooks/data_grid/index.ts rename to plugins/main/public/components/common/data_grid/index.ts diff --git a/plugins/main/public/components/common/hooks/data_grid/use_data_grid.ts b/plugins/main/public/components/common/data_grid/use_data_grid.ts similarity index 98% rename from plugins/main/public/components/common/hooks/data_grid/use_data_grid.ts rename to plugins/main/public/components/common/data_grid/use_data_grid.ts index 9e29424c9a..902087ddcf 100644 --- a/plugins/main/public/components/common/hooks/data_grid/use_data_grid.ts +++ b/plugins/main/public/components/common/data_grid/use_data_grid.ts @@ -3,7 +3,7 @@ import React, { useEffect, useMemo, useState, Fragment } from "react"; import { SearchResponse } from "@opensearch-project/opensearch/api/types"; // ToDo: check how create this methods import { parseData, getFieldFormatted, parseColumns } from './data_grid_service'; -import { IndexPattern } from '../../../../../../../src/plugins/data/common'; +import { IndexPattern } from '../../../../../../src/plugins/data/common'; const MAX_ENTRIES_PER_QUERY = 10000; diff --git a/plugins/main/public/components/common/hooks/search_bar/index.ts b/plugins/main/public/components/common/search_bar/index.ts similarity index 100% rename from plugins/main/public/components/common/hooks/search_bar/index.ts rename to plugins/main/public/components/common/search_bar/index.ts diff --git a/plugins/main/public/components/common/hooks/search_bar/search_bar_service.ts b/plugins/main/public/components/common/search_bar/search_bar_service.ts similarity index 90% rename from plugins/main/public/components/common/hooks/search_bar/search_bar_service.ts rename to plugins/main/public/components/common/search_bar/search_bar_service.ts index a12b22694b..d7c546ccff 100644 --- a/plugins/main/public/components/common/hooks/search_bar/search_bar_service.ts +++ b/plugins/main/public/components/common/search_bar/search_bar_service.ts @@ -1,6 +1,6 @@ -import { getPlugins } from '../../../../kibana-services'; -import { IndexPattern, Filter, OpenSearchQuerySortValue } from "../../../../../../../src/plugins/data/public"; -import { SearchResponse } from "../../../../../../../src/core/server"; +import { getPlugins } from '../../../kibana-services'; +import { IndexPattern, Filter, OpenSearchQuerySortValue } from "../../../../../../src/plugins/data/public"; +import { SearchResponse } from "../../../../../../src/core/server"; export interface SearchParams { indexPattern: IndexPattern; diff --git a/plugins/main/public/components/common/hooks/search_bar/use_search_bar.test.ts b/plugins/main/public/components/common/search_bar/use_search_bar.test.ts similarity index 94% rename from plugins/main/public/components/common/hooks/search_bar/use_search_bar.test.ts rename to plugins/main/public/components/common/search_bar/use_search_bar.test.ts index 5cc25e1ccb..fca817f1a1 100644 --- a/plugins/main/public/components/common/hooks/search_bar/use_search_bar.test.ts +++ b/plugins/main/public/components/common/search_bar/use_search_bar.test.ts @@ -1,23 +1,23 @@ import { renderHook } from '@testing-library/react-hooks'; import '@testing-library/jest-dom/extend-expect'; // osd dependencies -import { Start, dataPluginMock } from '../../../../../../../src/plugins/data/public/mocks'; +import { Start, dataPluginMock } from '../../../../../../src/plugins/data/public/mocks'; import { Filter, IndexPattern, Query, TimeRange, -} from '../../../../../../../src/plugins/data/public'; +} from '../../../../../../src/plugins/data/public'; // wazuh plugin dependencies import useSearchBar from './use_search_bar'; -import { getDataPlugin } from '../../../../kibana-services'; -import * as timeFilterHook from '../../hooks/use-time-filter'; -import * as queryManagerHook from '../../hooks/use-query'; +import { getDataPlugin } from '../../../kibana-services'; +import * as timeFilterHook from '../hooks/use-time-filter'; +import * as queryManagerHook from '../hooks/use-query'; /** * Mocking Data Plugin **/ -jest.mock('../../../../kibana-services', () => { +jest.mock('../../../kibana-services', () => { return { getDataPlugin: jest.fn(), }; @@ -73,7 +73,7 @@ describe('[hook] useSearchBarConfiguration', () => { spyUseQueryManager.mockImplementation(() => [mockQueryResult, jest.fn()]); }); - it('should return default app index pattern when not receiving a default index pattern', async () => { + it.only('should return default app index pattern when not receiving a default index pattern', async () => { jest .spyOn(mockDataPlugin.indexPatterns, 'getDefault') .mockResolvedValue(mockedDefaultIndexPatternData); diff --git a/plugins/main/public/components/common/hooks/search_bar/use_search_bar.tsx b/plugins/main/public/components/common/search_bar/use_search_bar.tsx similarity index 95% rename from plugins/main/public/components/common/hooks/search_bar/use_search_bar.tsx rename to plugins/main/public/components/common/search_bar/use_search_bar.tsx index c87e44cf49..22c6a6ff45 100644 --- a/plugins/main/public/components/common/hooks/search_bar/use_search_bar.tsx +++ b/plugins/main/public/components/common/search_bar/use_search_bar.tsx @@ -7,13 +7,12 @@ import { Filter, IIndexPattern, IndexPatternsContract, -} from '../../../../../../../src/plugins/data/public'; -import { getDataPlugin } from '../../../../kibana-services'; +} from '../../../../../../src/plugins/data/public'; +import { getDataPlugin } from '../../../kibana-services'; -import { useFilterManager, useQueryManager, useTimeFilter } from '../../hooks'; -import { AUTHORIZED_AGENTS } from '../../../../../common/constants'; +import { useFilterManager, useQueryManager, useTimeFilter } from '../hooks'; +import { AUTHORIZED_AGENTS } from '../../../../common/constants'; -/// Input - types type tUseSearchBarCustomInputs = { defaultIndexPatternID: IIndexPattern['id']; onFiltersUpdated?: (filters: Filter[]) => void; @@ -88,7 +87,7 @@ const useSearchBar = ( try { return await indexPatternService.get(indexPatternID); } catch (error) { - // when the index pattern id not exists will get the default + // when the index pattern id not exists will get the default defined in the index pattern service console.error(error); return await indexPatternService.getDefault(); } diff --git a/plugins/main/public/components/common/wazuh_discover/wz_discover.tsx b/plugins/main/public/components/common/wazuh_discover/wz_discover.tsx index 991cbc2ea2..da9c7e71d9 100644 --- a/plugins/main/public/components/common/wazuh_discover/wz_discover.tsx +++ b/plugins/main/public/components/common/wazuh_discover/wz_discover.tsx @@ -12,10 +12,8 @@ import { EuiFlyoutHeader, EuiTitle, EuiButtonEmpty, - EuiCallOut, EuiSpacer, EuiPanel, - EuiDataGridColumn } from '@elastic/eui'; import { IntlProvider } from 'react-intl'; import { IndexPattern } from '../../../../../../src/plugins/data/common'; @@ -24,13 +22,13 @@ import { useDocViewer } from '../doc_viewer'; import DocViewer from '../doc_viewer/doc_viewer'; import { DiscoverNoResults } from '../../overview/vulnerabilities/common/components/no_results'; import { LoadingSpinner } from '../../overview/vulnerabilities/common/components/loading_spinner'; -import { useDataGrid, tDataGridColumn, exportSearchToCSV } from '../hooks/data_grid'; +import { useDataGrid, tDataGridColumn, exportSearchToCSV } from '../data_grid'; import { ErrorHandler, ErrorFactory, HttpError } from '../../../react-services/error-management'; import { withErrorBoundary } from '../hocs'; import { HitsCounter } from '../../../kibana-integrations/discover/application/components/hits_counter'; import { formatNumWithCommas } from '../../../kibana-integrations/discover/application/helpers'; -import useSearchBar from '../hooks/search_bar/use_search_bar'; -import { search } from '../hooks/search_bar'; +import useSearchBar from '../search_bar/use_search_bar'; +import { search } from '../search_bar'; import { getPlugins } from '../../../kibana-services'; import { ViewMode } from '../../../../../../src/plugins/embeddable/public'; import { getDiscoverPanels } from './config/chart';