mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 01:13:23 -04:00
[Security Solution] Remove indexFields from security data view type (#188932)
## Summary Remove `indexFields` from `SourcererDataView` as we can pull this info from native DataViewSpec.
This commit is contained in:
parent
477d07f7fc
commit
66130a3cad
10 changed files with 6 additions and 16 deletions
|
@ -13,4 +13,4 @@ export type {
|
|||
IndexFieldsStrategyResponse,
|
||||
BrowserFields,
|
||||
} from '@kbn/timelines-plugin/common';
|
||||
export { EMPTY_BROWSER_FIELDS, EMPTY_INDEX_FIELDS } from '@kbn/timelines-plugin/common';
|
||||
export { EMPTY_BROWSER_FIELDS } from '@kbn/timelines-plugin/common';
|
||||
|
|
|
@ -100,7 +100,6 @@ describe('source/index.tsx', () => {
|
|||
const { type: sourceType, payload } = mockDispatch.mock.calls[1][0];
|
||||
expect(sourceType).toEqual('x-pack/security_solution/local/sourcerer/SET_DATA_VIEW');
|
||||
expect(payload.id).toEqual('neato');
|
||||
expect(payload.indexFields).toHaveLength(mocksSource.indexFields.length);
|
||||
});
|
||||
|
||||
it('should reuse the result for dataView info when cleanCache not passed', async () => {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import { TableId } from '@kbn/securitysolution-data-table';
|
||||
import type { DataViewSpec, FieldSpec } from '@kbn/data-views-plugin/public';
|
||||
import type { DataViewSpec } from '@kbn/data-views-plugin/public';
|
||||
import { ReqStatus } from '../../notes/store/notes.slice';
|
||||
import { HostsFields } from '../../../common/api/search_strategy/hosts/model/sort';
|
||||
import { InputsModelId } from '../store/inputs/constants';
|
||||
|
@ -60,7 +60,6 @@ export const mockSourcererState: SourcererState = {
|
|||
...initialSourcererState.defaultDataView,
|
||||
browserFields: mockBrowserFields,
|
||||
id: DEFAULT_DATA_VIEW_ID,
|
||||
indexFields: mockIndexFields as FieldSpec[],
|
||||
fields: mockFieldMap,
|
||||
loading: false,
|
||||
patternList: [...DEFAULT_INDEX_PATTERN, `${DEFAULT_SIGNALS_INDEX}-spacename`],
|
||||
|
|
|
@ -192,7 +192,7 @@ export const usePickIndexPatterns = ({
|
|||
async (newSelectedDataViewId: string, isAlerts?: boolean) => {
|
||||
if (
|
||||
kibanaDataViews.some(
|
||||
(kdv) => kdv.id === newSelectedDataViewId && kdv.indexFields.length === 0
|
||||
(kdv) => kdv.id === newSelectedDataViewId && Object.keys(kdv?.fields || {}).length === 0
|
||||
)
|
||||
) {
|
||||
try {
|
||||
|
|
|
@ -32,7 +32,6 @@ describe('getSourcererDataView', () => {
|
|||
loading: false,
|
||||
id: 'test-id',
|
||||
title: 'test-pattern',
|
||||
indexFields: {},
|
||||
fields: {},
|
||||
patternList: ['test-pattern'],
|
||||
dataView: {
|
||||
|
|
|
@ -24,7 +24,6 @@ export const getSourcererDataView = async (
|
|||
loading: false,
|
||||
id: dataViewData.id ?? '',
|
||||
title: dataView.getIndexPattern(),
|
||||
indexFields: dataView.fields,
|
||||
fields: dataViewData.fields,
|
||||
patternList,
|
||||
dataView: dataViewData,
|
||||
|
|
|
@ -121,7 +121,7 @@ export const useSourcererDataView = (
|
|||
browserFields: browserFields(),
|
||||
dataViewId: sourcererDataView.id,
|
||||
indexPattern: {
|
||||
fields: sourcererDataView.indexFields,
|
||||
fields: Object.values(sourcererDataView.fields || {}),
|
||||
title: selectedPatterns.join(','),
|
||||
getName: () => selectedPatterns.join(','),
|
||||
},
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import type { BrowserFields } from '@kbn/timelines-plugin/common';
|
||||
import { EMPTY_BROWSER_FIELDS, EMPTY_INDEX_FIELDS } from '@kbn/timelines-plugin/common';
|
||||
import { EMPTY_BROWSER_FIELDS } from '@kbn/timelines-plugin/common';
|
||||
import type { DataViewSpec } from '@kbn/data-views-plugin/public';
|
||||
import type { RuntimeFieldSpec, RuntimePrimitiveTypes } from '@kbn/data-views-plugin/common';
|
||||
import type { SecuritySolutionDataViewBase } from '../../common/types';
|
||||
|
@ -69,10 +69,6 @@ export interface SourcererDataView extends KibanaDataView {
|
|||
* category, description, format
|
||||
* indices the field is included in etc*/
|
||||
browserFields: BrowserFields;
|
||||
/**
|
||||
* @deprecated use sourcererDataView.fields
|
||||
* comes from dataView.fields.toSpec() */
|
||||
indexFields: SecuritySolutionDataViewBase['fields'];
|
||||
fields: DataViewSpec['fields'] | undefined;
|
||||
/** set when data view fields are fetched */
|
||||
loading: boolean;
|
||||
|
@ -166,7 +162,6 @@ export const initSourcererScope: Omit<SourcererScope, 'id'> = {
|
|||
export const initDataView: SourcererDataView & { id: string; error?: unknown } = {
|
||||
browserFields: EMPTY_BROWSER_FIELDS,
|
||||
id: '',
|
||||
indexFields: EMPTY_INDEX_FIELDS,
|
||||
fields: undefined,
|
||||
loading: false,
|
||||
patternList: [],
|
||||
|
|
|
@ -66,4 +66,4 @@ export type {
|
|||
PaginationInputPaginated,
|
||||
} from './search_strategy';
|
||||
|
||||
export { Direction, EntityType, EMPTY_BROWSER_FIELDS, EMPTY_INDEX_FIELDS } from './search_strategy';
|
||||
export { Direction, EntityType, EMPTY_BROWSER_FIELDS } from './search_strategy';
|
||||
|
|
|
@ -81,4 +81,3 @@ export interface FieldCategory {
|
|||
export type BrowserFields = Record<FieldCategoryName, FieldCategory>;
|
||||
|
||||
export const EMPTY_BROWSER_FIELDS = {};
|
||||
export const EMPTY_INDEX_FIELDS: FieldSpec[] = [];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue