Skip to content

Commit

Permalink
[Investigations] - Timeline tabs file cleanup (#179832)
Browse files Browse the repository at this point in the history
## Summary

This PR cleans up a bit of the code around timeline tabs. It de-dupes
the layout components and some of the shared functionality between the
tabs. I would also like to move the tabs from using the `connector`
pattern to using `useSelector`, but that'll be done in a follow up PR.
The commit history unfortunately pulls in a bit from [this
pr](#176064), but the 2 commits
for the actual files changed in this PR are as follows:

1. (No code changes, just moving files) Moving the tabs into a nested
tabs folder:
89fa2d8

2. (Actual Code Changes) De-duping the shared components:
c6eecdb

3. (No code changes, moving filed and renaming) Removed the `_content`
parts of the folder names, and moved the `tabs_content` files into the
`tabs` folder:
ec3b959

---------

Co-authored-by: Jatin Kathuria <jatin.kathuria@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
3 people authored Apr 8, 2024
1 parent 62ccd7e commit b175633
Show file tree
Hide file tree
Showing 54 changed files with 746 additions and 842 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ import {
import { useDiscoverInTimelineContext } from '../../common/components/discover_in_timeline/use_discover_in_timeline_context';
import { useShowTimeline } from '../../common/utils/timeline/use_show_timeline';
import { useIsExperimentalFeatureEnabled } from '../../common/hooks/use_experimental_features';
import { useDiscoverState } from '../../timelines/components/timeline/esql_tab_content/use_discover_state';
import { useSourcererDataView } from '../../common/containers/sourcerer';
import { useDiscoverState } from '../../timelines/components/timeline/tabs/esql/use_discover_state';

export interface SendToTimelineButtonProps {
asEmptyButton: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ import type { SavedSearch } from '@kbn/saved-search-plugin/common';
import type { DiscoverAppState } from '@kbn/discover-plugin/public/application/main/services/discover_app_state_container';
import type { TimeRange } from '@kbn/es-query';
import { useMutation, useQueryClient } from '@tanstack/react-query';
import { useDiscoverState } from '../../../timelines/components/timeline/esql_tab_content/use_discover_state';
import { useDiscoverState } from '../../../timelines/components/timeline/tabs/esql/use_discover_state';
import { timelineDefaults } from '../../../timelines/store/defaults';
import { TimelineId } from '../../../../common/types';
import { timelineActions, timelineSelectors } from '../../../timelines/store';
import { useAppToasts } from '../../hooks/use_app_toasts';
import { useShallowEqualSelector } from '../../hooks/use_selector';
import { useKibana } from '../../lib/kibana';
import { savedSearchComparator } from '../../../timelines/components/timeline/esql_tab_content/utils';
import { savedSearchComparator } from '../../../timelines/components/timeline/tabs/esql/utils';
import {
DISCOVER_SEARCH_SAVE_ERROR_TITLE,
DISCOVER_SEARCH_SAVE_ERROR_UNKNOWN,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ import { useFieldBrowserOptions } from '../../../timelines/components/fields_bro
import {
useSessionViewNavigation,
useSessionView,
} from '../../../timelines/components/timeline/session_tab_content/use_session_view';
} from '../../../timelines/components/timeline/tabs/session/use_session_view';
import {
EventsContainerLoading,
FullScreenContainer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { GraphOverlay } from '../../../timelines/components/graph_overlay';
import {
useSessionView,
useSessionViewNavigation,
} from '../../../timelines/components/timeline/session_tab_content/use_session_view';
} from '../../../timelines/components/timeline/tabs/session/use_session_view';
import { inputsSelectors } from '../../../common/store';
import { combineQueries } from '../../../common/lib/kuery';
import { useInvalidFilterQuery } from '../../../common/hooks/use_invalid_filter_query';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { sourcererSelectors } from '../../../../common/store';
jest.mock('./api');
jest.mock('../../../../common/hooks/use_app_toasts');
jest.mock('../../../../common/components/user_privileges/endpoint/use_endpoint_privileges');
jest.mock('../../../../timelines/components/timeline/esql_tab_content');
jest.mock('../../../../timelines/components/timeline/tabs/esql');

describe('useSignalIndex', () => {
let appToastsMock: jest.Mocked<ReturnType<typeof useAppToastsMock.create>>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { useDeepEqualSelector } from '../../../../common/hooks/use_selector';
import { SourcererScopeName } from '../../../../common/store/sourcerer/model';
import { useSourcererDataView } from '../../../../common/containers/sourcerer';
import { useDeleteNote } from './hooks/use_delete_note';
import { getTimelineNoteSelector } from '../../timeline/notes_tab_content/selectors';
import { getTimelineNoteSelector } from '../../timeline/tabs/notes/selectors';

export const NotePreviewsContainer = styled.section`
padding-top: ${({ theme }) => `${theme.eui.euiSizeS}`};
Expand Down
Loading

0 comments on commit b175633

Please sign in to comment.