Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
fd1bf0f
hosts => explore
stephmilovic Dec 8, 2022
581e357
fix types
stephmilovic Dec 8, 2022
166f7fa
network > explore
stephmilovic Dec 8, 2022
90d80e7
users > explore
stephmilovic Dec 8, 2022
f843058
authentications & paginated table > explore
stephmilovic Dec 8, 2022
0d0439c
move stat item
stephmilovic Dec 8, 2022
110d87d
risk score > explore
stephmilovic Dec 8, 2022
2e0ff7d
fix whoops
stephmilovic Dec 8, 2022
855af61
fix
stephmilovic Dec 8, 2022
9ffcfd9
severity > explore
stephmilovic Dec 8, 2022
9417e9d
Update CODEOWNERS
stephmilovic Dec 8, 2022
244875d
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Dec 8, 2022
8a94a1d
start plugin work
stephmilovic Dec 9, 2022
bba035e
fix jest
stephmilovic Dec 12, 2022
cac6d42
merge main
stephmilovic Dec 12, 2022
505c9db
Merge branch 'explore' into explore_sub_plugin
stephmilovic Dec 12, 2022
024978c
consolidate jest
stephmilovic Dec 12, 2022
7843cc8
wip
stephmilovic Dec 12, 2022
9a25f82
Fix jest
stephmilovic Dec 12, 2022
29f66c1
fix more imports
stephmilovic Dec 12, 2022
2a0d8f5
Merge branch 'explore' into explore_sub_plugin
stephmilovic Dec 12, 2022
a753286
fix types
stephmilovic Dec 12, 2022
5147b90
Merge branch 'main' into explore_sub_plugin
stephmilovic Dec 13, 2022
a799e71
better disable
stephmilovic Dec 13, 2022
8310b4e
Merge branch 'main' into explore_sub_plugin
kibanamachine Dec 14, 2022
8e647b4
nit
stephmilovic Dec 14, 2022
5119d6d
Merge branch 'explore_sub_plugin' of github.com:stephmilovic/kibana i…
stephmilovic Dec 14, 2022
7b20fbc
Merge branch 'main' into explore_sub_plugin
stephmilovic Dec 14, 2022
74c0ecd
storarge for users page
stephmilovic Dec 14, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions x-pack/plugins/security_solution/public/app/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import type {
import type { RouteProps } from 'react-router-dom';
import type { AppMountParameters } from '@kbn/core/public';
import type { UsageCollectionSetup } from '@kbn/usage-collection-plugin/public';
import type { ExploreReducer, ExploreState } from '../explore';
import type { StartServices } from '../types';

/**
Expand All @@ -38,8 +39,8 @@ import type { TableState } from '../common/store/data_table/types';
export { SecurityPageName } from '../../common/constants';

export interface SecuritySubPluginStore<K extends SecuritySubPluginKeyStore, T> {
initialState: Record<K, T>;
reducer: Record<K, Reducer<T, AnyAction>>;
initialState: K extends 'explore' ? ExploreState : Record<K, T>;
reducer: K extends 'explore' ? ExploreReducer : Record<K, Reducer<T, AnyAction>>;
middleware?: Array<Middleware<{}, State, Dispatch<AppAction | Immutable<AppAction>>>>;
}

Expand All @@ -48,12 +49,15 @@ export type SecuritySubPluginRoutes = RouteProps[];
export interface SecuritySubPlugin {
routes: SecuritySubPluginRoutes;
storageDataTables?: Pick<TableState, 'tableById'>;
exploreDataTables?: {
network: Pick<TableState, 'tableById'>;
hosts: Pick<TableState, 'tableById'>;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why, but users never actually utilized this storage.

users: Pick<TableState, 'tableById'>;
};
}

export type SecuritySubPluginKeyStore =
| 'hosts'
| 'users'
| 'network'
| 'explore'
| 'timeline'
| 'hostList'
| 'alertList'
Expand Down
20 changes: 7 additions & 13 deletions x-pack/plugins/security_solution/public/common/store/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,14 @@ export const createStoreFactory = async (
const dataTableInitialState = {
dataTable: {
tableById: {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
/* eslint-disable @typescript-eslint/no-non-null-assertion */
...subPlugins.alerts.storageDataTables!.tableById,
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
...subPlugins.rules.storageDataTables!.tableById,
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
...subPlugins.exceptions.storageDataTables!.tableById,
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
...subPlugins.hosts.storageDataTables!.tableById,
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
...subPlugins.network.storageDataTables!.tableById,
...subPlugins.explore.exploreDataTables!.hosts.tableById,
...subPlugins.explore.exploreDataTables!.network.tableById,
...subPlugins.explore.exploreDataTables!.users.tableById,
/* eslint-enable @typescript-eslint/no-non-null-assertion */
},
},
};
Expand All @@ -132,9 +130,7 @@ export const createStoreFactory = async (

const initialState = createInitialState(
{
...subPlugins.hosts.store.initialState,
...subPlugins.users.store.initialState,
...subPlugins.network.store.initialState,
...subPlugins.explore.store.initialState,
...timelineInitialState,
...subPlugins.management.store.initialState,
},
Expand All @@ -148,9 +144,7 @@ export const createStoreFactory = async (
);

const rootReducer = {
...subPlugins.hosts.store.reducer,
...subPlugins.users.store.reducer,
...subPlugins.network.store.reducer,
...subPlugins.explore.store.reducer,
timeline: timelineReducer,
...subPlugins.management.store.reducer,
};
Expand Down
34 changes: 0 additions & 34 deletions x-pack/plugins/security_solution/public/explore/hosts/index.ts

This file was deleted.

66 changes: 0 additions & 66 deletions x-pack/plugins/security_solution/public/explore/hosts/links.ts

This file was deleted.

29 changes: 0 additions & 29 deletions x-pack/plugins/security_solution/public/explore/hosts/routes.tsx

This file was deleted.

61 changes: 61 additions & 0 deletions x-pack/plugins/security_solution/public/explore/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* 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 type { Storage } from '@kbn/kibana-utils-plugin/public';
import type { AnyAction, Reducer } from 'redux';
import type { HostsState } from './hosts/store';
import type { UsersState } from './users/store';
import { TableId } from '../../common/types';
import type { SecuritySubPluginWithStore } from '../app/types';
import { routes } from './routes';
import type { NetworkState } from './network/store';
import { initialNetworkState, networkReducer } from './network/store';
import { getDataTablesInStorageByIds } from '../timelines/containers/local_storage';
import { initialUsersState, usersReducer } from './users/store';
import { hostsReducer, initialHostsState } from './hosts/store';

export interface ExploreState {
network: NetworkState;
hosts: HostsState;
users: UsersState;
}

export interface ExploreReducer {
network: Reducer<NetworkState, AnyAction>;
hosts: Reducer<HostsState, AnyAction>;
users: Reducer<UsersState, AnyAction>;
}

export class Explore {
Copy link
Copy Markdown
Contributor Author

@stephmilovic stephmilovic Dec 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@YulNaumenko @elastic/security-threat-hunting-explore this is the part that needs some opinion. I added exploreDataTables to make typing this easier. Note that users never utilized the local storage table feature, should it be there? Not sure I totally understand/remember this feature

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we have the local storage cleanup or utilize functionality, but we have a migration logic:

.map(migrateColumnWidthToInitialWidth)
.map(migrateColumnLabelToDisplayAsText),

Do you think this is something you can use for your case?

public setup() {}

public start(storage: Storage): SecuritySubPluginWithStore<'explore', ExploreState> {
return {
routes,
exploreDataTables: {
network: { tableById: getDataTablesInStorageByIds(storage, [TableId.networkPageEvents]) },
hosts: {
tableById: getDataTablesInStorageByIds(storage, [
TableId.hostsPageEvents,
TableId.hostsPageSessions,
]),
},
users: {
tableById: getDataTablesInStorageByIds(storage, [TableId.usersPageEvents]),
},
},
store: {
initialState: {
network: initialNetworkState,
users: initialUsersState,
hosts: initialHostsState,
},
reducer: { network: networkReducer, users: usersReducer, hosts: hostsReducer },
},
};
}
}
Loading