Skip to content

Commit

Permalink
Merge branch 'main' into endpoint-isolate-e2e-coverage
Browse files Browse the repository at this point in the history
# Conflicts:
#	x-pack/test/security_solution_endpoint/apps/endpoint/endpoint_list.ts
  • Loading branch information
szwarckonrad committed Apr 18, 2023
2 parents c54509b + dfbb97f commit d2fbb5d
Show file tree
Hide file tree
Showing 69 changed files with 852 additions and 812 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import React, { Component } from 'react';
import PropTypes from 'prop-types';

import { css } from '@emotion/react';
import {
EuiButtonIcon,
EuiFlexGroup,
Expand Down Expand Up @@ -192,12 +192,25 @@ export class DataTableFormat extends Component<DataTableFormatProps, DataTableFo

return (
<EuiInMemoryTable
className="insDataTableFormat__table"
tableLayout="auto"
className="insDataTableFormat__table eui-xScroll"
data-test-subj="inspectorTable"
columns={columns}
items={rows}
sorting={true}
pagination={pagination}
css={css`
// Set a min width on each column - you can use [data-test-subj] to target specific columns
.euiTableHeaderCell {
min-width: 100px;
}
// Make sure the pagination follows the scroll
> div:last-child {
position: sticky;
left: 0;
}
`}
/>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ const currentDocumentSelector = (state: PreviewState) => state.documents[state.c
const currentDocumentIsLoadingSelector = (state: PreviewState) => state.isLoadingDocuments;

const ScriptFieldComponent = ({ existingConcreteFields, links, placeholder }: Props) => {
const {
validation: { setScriptEditorValidation },
} = useFieldPreviewContext();
const monacoEditor = useRef<monaco.editor.IStandaloneCodeEditor | null>(null);
const editorValidationSubscription = useRef<Subscription>();
const fieldCurrentValue = useRef<string>('');
Expand Down Expand Up @@ -143,15 +146,15 @@ const ScriptFieldComponent = ({ existingConcreteFields, links, placeholder }: Pr

editorValidationSubscription.current = PainlessLang.validation$().subscribe(
({ isValid, isValidating, errors }) => {
controller.setScriptEditorValidation({
setScriptEditorValidation({
isValid,
isValidating,
message: errors[0]?.message ?? null,
});
}
);
},
[controller]
[setScriptEditorValidation]
);

const updateMonacoMarkers = useCallback((markers: monaco.editor.IMarkerData[]) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ const documentsSelector = (state: PreviewState) => {
};
};

const scriptEditorValidationSelector = (state: PreviewState) => state.scriptEditorValidation;

export const FieldPreviewProvider: FunctionComponent<{ controller: PreviewController }> = ({
controller,
children,
Expand Down Expand Up @@ -121,6 +119,12 @@ export const FieldPreviewProvider: FunctionComponent<{ controller: PreviewContro
/** The parameters required for the Painless _execute API */
const [params, setParams] = useState<Params>(defaultParams);

const [scriptEditorValidation, setScriptEditorValidation] = useState<{
isValidating: boolean;
isValid: boolean;
message: string | null;
}>({ isValidating: false, isValid: true, message: null });

/** Flag to show/hide the preview panel */
const [isPanelVisible, setIsPanelVisible] = useState(true);
/** Flag to indicate if we are loading document from cluster */
Expand All @@ -133,10 +137,6 @@ export const FieldPreviewProvider: FunctionComponent<{ controller: PreviewContro

const { currentDocument, currentDocIndex, currentDocId, totalDocs, currentIdx } =
useStateSelector(controller.state$, documentsSelector);
const scriptEditorValidation = useStateSelector(
controller.state$,
scriptEditorValidationSelector
);

let isPreviewAvailable = true;

Expand Down Expand Up @@ -513,6 +513,9 @@ export const FieldPreviewProvider: FunctionComponent<{ controller: PreviewContro
isVisible: isPanelVisible,
setIsVisible: setIsPanelVisible,
},
validation: {
setScriptEditorValidation,
},
reset,
}),
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,11 @@ export class PreviewController {
}
};

/* disabled while investigating issues with painless script editor
setScriptEditorValidation = (scriptEditorValidation: PreviewState['scriptEditorValidation']) => {
this.updateState({ scriptEditorValidation });
};
*/

setCustomId = (customId?: string) => {
this.updateState({ customId });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ export interface Context {
isLastDoc: boolean;
};
reset: () => void;
validation: {
setScriptEditorValidation: React.Dispatch<
React.SetStateAction<{ isValid: boolean; isValidating: boolean; message: string | null }>
>;
};
}

export type PainlessExecuteContext =
Expand Down
6 changes: 6 additions & 0 deletions x-pack/plugins/maps/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ export const APP_ICON_SOLUTION = 'logoKibana';
export const APP_NAME = i18n.translate('xpack.maps.visTypeAlias.title', {
defaultMessage: 'Maps',
});
export const MAP_EMBEDDABLE_NAME = i18n.translate('xpack.maps.embeddableDisplayName', {
defaultMessage: 'map',
});

export const INITIAL_LAYERS_KEY = 'initialLayers';

export const MAPS_APP_PATH = `app/${APP_ID}`;
Expand All @@ -36,6 +40,8 @@ export const OPEN_LAYER_WIZARD = 'openLayerWizard';
// Centroids are a single point for representing lines, multiLines, polygons, and multiPolygons
export const KBN_IS_CENTROID_FEATURE = '__kbn_is_centroid_feature__';

export const GEOJSON_FEATURE_ID_PROPERTY_NAME = '__kbn__feature_id__';

export function getNewMapPath() {
return `/${MAPS_APP_PATH}/${MAP_PATH}`;
}
Expand Down
12 changes: 0 additions & 12 deletions x-pack/plugins/maps/common/i18n_getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,6 @@ import { i18n } from '@kbn/i18n';

import { ES_SPATIAL_RELATIONS } from './constants';

export function getAppTitle() {
return i18n.translate('xpack.maps.appTitle', {
defaultMessage: 'Maps',
});
}

export function getMapEmbeddableDisplayName() {
return i18n.translate('xpack.maps.embeddableDisplayName', {
defaultMessage: 'map',
});
}

export function getDataSourceLabel() {
return i18n.translate('xpack.maps.source.dataSourceLabel', {
defaultMessage: 'Data source',
Expand Down
19 changes: 11 additions & 8 deletions x-pack/plugins/maps/public/api/create_layer_descriptors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,29 @@
* 2.0.
*/

import { LayerDescriptor } from '../../common/descriptor_types';
import { lazyLoadMapModules } from '../lazy_load_bundle';
import type { LayerDescriptor } from '../../common/descriptor_types';
import type { CreateLayerDescriptorParams } from '../classes/sources/es_search_source';

export const createLayerDescriptors = {
async createSecurityLayerDescriptors(
indexPatternId: string,
indexPatternTitle: string
): Promise<LayerDescriptor[]> {
const mapModules = await lazyLoadMapModules();
return mapModules.createSecurityLayerDescriptors(indexPatternId, indexPatternTitle);
const { createSecurityLayerDescriptors } = await import(
'../classes/layers/wizards/solution_layers/security'
);
return createSecurityLayerDescriptors(indexPatternId, indexPatternTitle);
},
async createBasemapLayerDescriptor(): Promise<LayerDescriptor | null> {
const mapModules = await lazyLoadMapModules();
return mapModules.createBasemapLayerDescriptor();
const { createBasemapLayerDescriptor } = await import(
'../classes/layers/create_basemap_layer_descriptor'
);
return createBasemapLayerDescriptor();
},
async createESSearchSourceLayerDescriptor(
params: CreateLayerDescriptorParams
): Promise<LayerDescriptor> {
const mapModules = await lazyLoadMapModules();
return mapModules.createESSearchSourceLayerDescriptor(params);
const { createLayerDescriptor } = await import('../classes/sources/es_search_source');
return createLayerDescriptor(params);
},
};
7 changes: 3 additions & 4 deletions x-pack/plugins/maps/public/api/ems.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
* 2.0.
*/

import { EMSTermJoinConfig, SampleValuesConfig } from '../ems_autosuggest';
import { lazyLoadMapModules } from '../lazy_load_bundle';
import type { EMSTermJoinConfig, SampleValuesConfig } from '../ems_autosuggest';

export async function suggestEMSTermJoinConfig(
sampleValuesConfig: SampleValuesConfig
): Promise<EMSTermJoinConfig | null> {
const mapModules = await lazyLoadMapModules();
return await mapModules.suggestEMSTermJoinConfig(sampleValuesConfig);
const { suggestEMSTermJoinConfig: suggestEms } = await import('../ems_autosuggest');
return await suggestEms(sampleValuesConfig);
}
2 changes: 1 addition & 1 deletion x-pack/plugins/maps/public/classes/layers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
*/

export type { LayerWizard, LayerWizardWithMeta, RenderWizardArguments } from './wizards';
export { getLayerWizards, registerLayerWizardExternal } from './wizards';
export { getLayerWizards } from './wizards';
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
* 2.0.
*/

import { assignFeatureIds, GEOJSON_FEATURE_ID_PROPERTY_NAME } from './assign_feature_ids';
import { GEOJSON_FEATURE_ID_PROPERTY_NAME } from '../../../../../common/constants';
import { assignFeatureIds } from './assign_feature_ids';
import { FeatureCollection, Feature, Point } from 'geojson';

const featureId = 'myFeature1';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
*/

import _ from 'lodash';
import { FeatureCollection, Feature } from 'geojson';

export const GEOJSON_FEATURE_ID_PROPERTY_NAME = '__kbn__feature_id__';
import type { FeatureCollection, Feature } from 'geojson';
import { GEOJSON_FEATURE_ID_PROPERTY_NAME } from '../../../../../common/constants';

let idCounter = 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import type { FilterSpecification, Map as MbMap, GeoJSONSource } from '@kbn/mapb
import {
EMPTY_FEATURE_COLLECTION,
FEATURE_VISIBLE_PROPERTY_NAME,
GEOJSON_FEATURE_ID_PROPERTY_NAME,
LAYER_TYPE,
SOURCE_BOUNDS_DATA_REQUEST_ID,
} from '../../../../../common/constants';
Expand All @@ -35,7 +36,6 @@ import {
} from '../vector_layer';
import { DataRequestAbortError } from '../../../util/data_request';
import { getFeatureCollectionBounds } from '../../../util/get_feature_collection_bounds';
import { GEOJSON_FEATURE_ID_PROPERTY_NAME } from './assign_feature_ids';
import { syncGeojsonSourceData } from './geojson_source_data';
import { performInnerJoins } from './perform_inner_joins';
import { pluckStyleMetaFromFeatures } from './pluck_style_meta_from_features';
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/maps/public/classes/layers/wizards/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ export type {
LayerWizardWithMeta,
RenderWizardArguments,
} from './layer_wizard_registry';
export { getLayerWizards, registerLayerWizardExternal } from './layer_wizard_registry';
export { getLayerWizards } from './layer_wizard_registry';
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* 2.0.
*/

import '../../_index.scss';
import React, { Component } from 'react';
import classNames from 'classnames';
import { EuiFlexGroup, EuiFlexItem, EuiCallOut } from '@elastic/eui';
Expand Down
Loading

0 comments on commit d2fbb5d

Please sign in to comment.