-
- }
- color="warning"
- iconType="alert"
- >
-
-
-
+ }
+
+ const id = getCloudDeploymentId();
+ return (
+
+
+ }
+ color="warning"
+ iconType="alert"
+ >
+
+
+
+
+
+
+ {isCloud && id !== null && (
+
+
+
+ ),
+ }}
/>
- {isCloud && id !== null && (
-
-
-
-
-
- ),
- }}
- />
-
- )}
-
-
-
-
- );
- }
+
+ )}
+
+
+
+ );
};
diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/validate_job.js b/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/validate_job.js
index 05f9ec9d943f9..71e16188db948 100644
--- a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/validate_job.js
+++ b/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/validate_job.js
@@ -5,7 +5,7 @@
*/
-import { newJobLimits } from '../../new_job_new/utils/new_job_defaults';
+import { getNewJobLimits } from '../../../services/ml_server_info';
import { populateValidationMessages } from '../../new_job_new/common/job_validator/util';
import {
@@ -16,7 +16,7 @@ import {
import { isValidLabel, isValidTimeRange } from '../../../util/custom_url_utils';
export function validateModelMemoryLimit(mml) {
- const limits = newJobLimits();
+ const limits = getNewJobLimits();
const tempJob = {
analysis_limits: {
model_memory_limit: mml
diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/directive.js b/x-pack/legacy/plugins/ml/public/jobs/jobs_list/directive.js
index 3267c78deecc1..4b6f3f485d49d 100644
--- a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/directive.js
+++ b/x-pack/legacy/plugins/ml/public/jobs/jobs_list/directive.js
@@ -16,7 +16,7 @@ import { checkFullLicense } from 'plugins/ml/license/check_license';
import { checkGetJobsPrivilege } from 'plugins/ml/privilege/check_privilege';
import { getMlNodeCount } from 'plugins/ml/ml_nodes_check/check_ml_nodes';
import { getJobManagementBreadcrumbs } from 'plugins/ml/jobs/breadcrumbs';
-import { loadNewJobDefaults } from 'plugins/ml/jobs/new_job_new/utils/new_job_defaults';
+import { loadMlServerInfo } from 'plugins/ml/services/ml_server_info';
import uiRoutes from 'ui/routes';
@@ -31,7 +31,7 @@ uiRoutes
indexPatterns: loadIndexPatterns,
privileges: checkGetJobsPrivilege,
mlNodeCount: getMlNodeCount,
- loadNewJobDefaults,
+ loadMlServerInfo,
}
});
diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job_new/common/job_validator/job_validator.ts b/x-pack/legacy/plugins/ml/public/jobs/new_job_new/common/job_validator/job_validator.ts
index 358bbf67bee48..82b1684b7b72f 100644
--- a/x-pack/legacy/plugins/ml/public/jobs/new_job_new/common/job_validator/job_validator.ts
+++ b/x-pack/legacy/plugins/ml/public/jobs/new_job_new/common/job_validator/job_validator.ts
@@ -6,7 +6,7 @@
import { ReactElement } from 'react';
import { basicJobValidation, basicDatafeedValidation } from '../../../../../common/util/job_utils';
-import { newJobLimits } from '../../../new_job_new/utils/new_job_defaults';
+import { getNewJobLimits } from '../../../../services/ml_server_info';
import { JobCreatorType } from '../job_creator';
import { populateValidationMessages, checkForExistingJobAndGroupIds } from './util';
import { ExistingJobsAndGroups } from '../../../../services/job_service';
@@ -111,7 +111,7 @@ export class JobValidator {
const jobConfig = this._jobCreator.jobConfig;
const datafeedConfig = this._jobCreator.datafeedConfig;
- const limits = newJobLimits();
+ const limits = getNewJobLimits();
// run standard basic validation
const basicJobResults = basicJobValidation(jobConfig, undefined, limits);
diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job_new/common/job_validator/util.ts b/x-pack/legacy/plugins/ml/public/jobs/new_job_new/common/job_validator/util.ts
index 224d9ebf55823..b1bd352db387b 100644
--- a/x-pack/legacy/plugins/ml/public/jobs/new_job_new/common/job_validator/util.ts
+++ b/x-pack/legacy/plugins/ml/public/jobs/new_job_new/common/job_validator/util.ts
@@ -8,7 +8,7 @@ import { i18n } from '@kbn/i18n';
import { BasicValidations } from './job_validator';
import { Job, Datafeed } from '../job_creator/configs';
import { ALLOWED_DATA_UNITS, JOB_ID_MAX_LENGTH } from '../../../../../common/constants/validation';
-import { newJobLimits } from '../../../new_job_new/utils/new_job_defaults';
+import { getNewJobLimits } from '../../../../services/ml_server_info';
import { ValidationResults, ValidationMessage } from '../../../../../common/util/job_utils';
import { ExistingJobsAndGroups } from '../../../../services/job_service';
@@ -18,7 +18,7 @@ export function populateValidationMessages(
jobConfig: Job,
datafeedConfig: Datafeed
) {
- const limits = newJobLimits();
+ const limits = getNewJobLimits();
if (validationResults.contains('job_id_empty')) {
basicValidations.jobId.valid = false;
diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/components/common/model_memory_limit/model_memory_limit_input.tsx b/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/components/common/model_memory_limit/model_memory_limit_input.tsx
index 3a3bd0c5a13a4..54fb19d868cdc 100644
--- a/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/components/common/model_memory_limit/model_memory_limit_input.tsx
+++ b/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/components/common/model_memory_limit/model_memory_limit_input.tsx
@@ -6,7 +6,7 @@
import React, { FC, useState, useContext, useEffect } from 'react';
import { EuiFieldText } from '@elastic/eui';
-import { newJobDefaults } from '../../../../../new_job_new/utils/new_job_defaults';
+import { getNewJobDefaults } from '../../../../../../services/ml_server_info';
import { JobCreatorContext } from '../../job_creator_context';
import { Description } from './description';
@@ -23,7 +23,7 @@ export const ModelMemoryLimitInput: FC = () => {
jobCreator.modelMemoryLimit === null ? '' : jobCreator.modelMemoryLimit
);
- const { anomaly_detectors: anomalyDetectors } = newJobDefaults();
+ const { anomaly_detectors: anomalyDetectors } = getNewJobDefaults();
const { model_memory_limit: modelMemoryLimitDefault } = anomalyDetectors;
useEffect(() => {
diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/components/datafeed_step/components/scroll_size/scroll_size_input.tsx b/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/components/datafeed_step/components/scroll_size/scroll_size_input.tsx
index da6a19434135c..ea03d16fcccca 100644
--- a/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/components/datafeed_step/components/scroll_size/scroll_size_input.tsx
+++ b/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/components/datafeed_step/components/scroll_size/scroll_size_input.tsx
@@ -6,7 +6,7 @@
import React, { FC, useState, useContext, useEffect } from 'react';
import { EuiFieldNumber } from '@elastic/eui';
-import { newJobDefaults } from '../../../../../utils/new_job_defaults';
+import { getNewJobDefaults } from '../../../../../../../services/ml_server_info';
import { JobCreatorContext } from '../../../job_creator_context';
import { Description } from './description';
@@ -19,7 +19,7 @@ export const ScrollSizeInput: FC = () => {
jobCreator.scrollSize === null ? '' : `${jobCreator.scrollSize}`
);
- const { datafeeds } = newJobDefaults();
+ const { datafeeds } = getNewJobDefaults();
const scrollSizeDefault = datafeeds.scroll_size !== undefined ? `${datafeeds.scroll_size}` : '';
useEffect(() => {
diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/components/summary_step/components/datafeed_details/datafeed_details.tsx b/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/components/summary_step/components/datafeed_details/datafeed_details.tsx
index 1927fc430abcb..5e1bf9f1ec889 100644
--- a/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/components/summary_step/components/datafeed_details/datafeed_details.tsx
+++ b/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/components/summary_step/components/datafeed_details/datafeed_details.tsx
@@ -11,14 +11,14 @@ import { JobCreatorContext } from '../../../job_creator_context';
import { MLJobEditor } from '../../../../../../jobs_list/components/ml_job_editor';
import { calculateDatafeedFrequencyDefaultSeconds } from '../../../../../../../../common/util/job_utils';
import { DEFAULT_QUERY_DELAY } from '../../../../../common/job_creator/util/constants';
-import { newJobDefaults } from '../../../../../utils/new_job_defaults';
+import { getNewJobDefaults } from '../../../../../../../services/ml_server_info';
import { ListItems, defaultLabel, Italic } from '../common';
const EDITOR_HEIGHT = '200px';
export const DatafeedDetails: FC = () => {
const { jobCreator } = useContext(JobCreatorContext);
- const { datafeeds } = newJobDefaults();
+ const { datafeeds } = getNewJobDefaults();
const queryString = JSON.stringify(jobCreator.query, null, 2);
const defaultFrequency = calculateDatafeedFrequencyDefaultSeconds(jobCreator.bucketSpanMs / 1000);
diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/components/summary_step/components/job_details/job_details.tsx b/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/components/summary_step/components/job_details/job_details.tsx
index dc0311e552bda..ebe113a1f8bef 100644
--- a/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/components/summary_step/components/job_details/job_details.tsx
+++ b/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/components/summary_step/components/job_details/job_details.tsx
@@ -15,7 +15,7 @@ import {
isPopulationJobCreator,
isAdvancedJobCreator,
} from '../../../../../common/job_creator';
-import { newJobDefaults } from '../../../../../utils/new_job_defaults';
+import { getNewJobDefaults } from '../../../../../../../services/ml_server_info';
import { ListItems, falseLabel, trueLabel, defaultLabel, Italic } from '../common';
import { useKibanaContext } from '../../../../../../../contexts/kibana';
@@ -23,7 +23,7 @@ export const JobDetails: FC = () => {
const { jobCreator } = useContext(JobCreatorContext);
const kibanaContext = useKibanaContext();
const dateFormat: string = kibanaContext.kibanaConfig.get('dateFormat');
- const { anomaly_detectors: anomalyDetectors } = newJobDefaults();
+ const { anomaly_detectors: anomalyDetectors } = getNewJobDefaults();
const isAdvanced = isAdvancedJobCreator(jobCreator);
diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/new_job/route.ts b/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/new_job/route.ts
index 964dc1eee5140..09f14c971418d 100644
--- a/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/new_job/route.ts
+++ b/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/new_job/route.ts
@@ -22,7 +22,7 @@ import { Route } from '../../../../../common/types/kibana';
import { loadNewJobCapabilities } from '../../../../services/new_job_capabilities_service';
-import { loadNewJobDefaults } from '../../utils/new_job_defaults';
+import { loadMlServerInfo } from '../../../../services/ml_server_info';
import { mlJobService } from '../../../../services/job_service';
import { JOB_TYPE } from '../../common/job_creator/util/constants';
@@ -58,7 +58,7 @@ routes.forEach((route: Route) => {
indexPattern: loadCurrentIndexPattern,
savedSearch: loadCurrentSavedSearch,
loadNewJobCapabilities,
- loadNewJobDefaults,
+ loadMlServerInfo,
existingJobsAndGroups: mlJobService.getJobAndGroupIds,
jobType: () => route.id,
},
diff --git a/x-pack/legacy/plugins/ml/public/services/__mocks__/ml_info_response.json b/x-pack/legacy/plugins/ml/public/services/__mocks__/ml_info_response.json
new file mode 100644
index 0000000000000..ab6dcf8a5b5f6
--- /dev/null
+++ b/x-pack/legacy/plugins/ml/public/services/__mocks__/ml_info_response.json
@@ -0,0 +1,21 @@
+{
+ "defaults": {
+ "anomaly_detectors": {
+ "model_memory_limit": "128mb",
+ "categorization_examples_limit": 4,
+ "model_snapshot_retention_days": 1
+ },
+ "datafeeds": {
+ "scroll_size": 1000
+ }
+ },
+ "upgrade_mode": false,
+ "native_code": {
+ "version": "8.0.0-SNAPSHOT",
+ "build_hash": "4cde1d7c50fc28"
+ },
+ "limits": {
+ "max_model_memory_limit": "128mb"
+ },
+ "cloudId": "cloud_message_test:ZXUtd2VzdC0yLmF3cy5jbG91ZC5lcy5pbyQ4NWQ2NjZmMzM1MGM0NjllOGMzMjQyZDc2YTdmNDU5YyQxNmI1ZDM2ZGE1Mzk0YjlkYjIyZWJlNDk1OWY1OGQzMg=="
+}
diff --git a/x-pack/legacy/plugins/ml/public/services/cloud_service.js b/x-pack/legacy/plugins/ml/public/services/cloud_service.js
deleted file mode 100644
index b9777e34737ae..0000000000000
--- a/x-pack/legacy/plugins/ml/public/services/cloud_service.js
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-
-
-export function cloudServiceProvider(config) {
- function isRunningOnCloud() {
- try {
- return config.get('cloud.enabled');
- } catch (error) {
- return false;
- }
- }
-
- function getCloudId() {
- try {
- return config.get('cloud.id');
- } catch (error) {
- return undefined;
- }
- }
-
- return {
- isRunningOnCloud,
- getCloudId
- };
-}
diff --git a/x-pack/legacy/plugins/ml/public/services/ml_api_service/index.d.ts b/x-pack/legacy/plugins/ml/public/services/ml_api_service/index.d.ts
index 4f042c638471d..38a71d994c601 100644
--- a/x-pack/legacy/plugins/ml/public/services/ml_api_service/index.d.ts
+++ b/x-pack/legacy/plugins/ml/public/services/ml_api_service/index.d.ts
@@ -9,7 +9,7 @@ import { AggFieldNamePair } from '../../../common/types/fields';
import { ExistingJobsAndGroups } from '../job_service';
import { PrivilegesResponse } from '../../../common/types/privileges';
import { MlSummaryJobs } from '../../../common/types/jobs';
-import { MlServerDefaults, MlServerLimits } from '../../jobs/new_job_new/utils/new_job_defaults';
+import { MlServerDefaults, MlServerLimits } from '../../services/ml_server_info';
import { ES_AGGREGATION } from '../../../common/constants/aggregation_types';
import { DataFrameAnalyticsStats } from '../../data_frame_analytics/pages/analytics_management/components/analytics_list/common';
diff --git a/x-pack/legacy/plugins/ml/public/services/ml_server_info.test.ts b/x-pack/legacy/plugins/ml/public/services/ml_server_info.test.ts
new file mode 100644
index 0000000000000..2b6fb50538020
--- /dev/null
+++ b/x-pack/legacy/plugins/ml/public/services/ml_server_info.test.ts
@@ -0,0 +1,62 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License;
+ * you may not use this file except in compliance with the Elastic License.
+ */
+
+import {
+ loadMlServerInfo,
+ getCloudDeploymentId,
+ isCloud,
+ getNewJobDefaults,
+ getNewJobLimits,
+} from './ml_server_info';
+import mockMlInfoResponse from './__mocks__/ml_info_response.json';
+
+jest.mock('./ml_api_service', () => ({
+ ml: {
+ mlInfo: jest.fn(() => Promise.resolve(mockMlInfoResponse)),
+ },
+}));
+
+describe('ml_server_info initial state', () => {
+ it('server info not loaded ', () => {
+ expect(isCloud()).toBe(false);
+ expect(getCloudDeploymentId()).toBe(null);
+ });
+});
+
+describe('ml_server_info', () => {
+ beforeEach(async done => {
+ await loadMlServerInfo();
+ done();
+ });
+
+ describe('cloud information', () => {
+ it('can get could deployment id', () => {
+ expect(isCloud()).toBe(true);
+ expect(getCloudDeploymentId()).toBe('85d666f3350c469e8c3242d76a7f459c');
+ });
+ });
+
+ describe('defaults', () => {
+ it('can get defaults', async done => {
+ const defaults = getNewJobDefaults();
+
+ expect(defaults.anomaly_detectors.model_memory_limit).toBe('128mb');
+ expect(defaults.anomaly_detectors.categorization_examples_limit).toBe(4);
+ expect(defaults.anomaly_detectors.model_snapshot_retention_days).toBe(1);
+ expect(defaults.datafeeds.scroll_size).toBe(1000);
+ done();
+ });
+ });
+
+ describe('limits', () => {
+ it('can get limits', async done => {
+ const limits = getNewJobLimits();
+
+ expect(limits.max_model_memory_limit).toBe('128mb');
+ done();
+ });
+ });
+});
diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job_new/utils/new_job_defaults.ts b/x-pack/legacy/plugins/ml/public/services/ml_server_info.ts
similarity index 84%
rename from x-pack/legacy/plugins/ml/public/jobs/new_job_new/utils/new_job_defaults.ts
rename to x-pack/legacy/plugins/ml/public/services/ml_server_info.ts
index e3c4bc8a4a28c..95d670eda8a4f 100644
--- a/x-pack/legacy/plugins/ml/public/jobs/new_job_new/utils/new_job_defaults.ts
+++ b/x-pack/legacy/plugins/ml/public/services/ml_server_info.ts
@@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { ml } from '../../../services/ml_api_service';
+import { ml } from './ml_api_service';
export interface MlServerDefaults {
anomaly_detectors: {
@@ -35,7 +35,7 @@ const cloudInfo: CloudInfo = {
isCloud: false,
};
-export async function loadNewJobDefaults() {
+export async function loadMlServerInfo() {
try {
const resp = await ml.mlInfo();
defaults = resp.defaults;
@@ -48,15 +48,15 @@ export async function loadNewJobDefaults() {
}
}
-export function newJobDefaults(): MlServerDefaults {
+export function getNewJobDefaults(): MlServerDefaults {
return defaults;
}
-export function newJobLimits(): MlServerLimits {
+export function getNewJobLimits(): MlServerLimits {
return limits;
}
-export function cloudId(): string | null {
+export function getCloudId(): string | null {
return cloudInfo.cloudId;
}
@@ -64,7 +64,7 @@ export function isCloud(): boolean {
return cloudInfo.isCloud;
}
-export function cloudDeploymentId(): string | null {
+export function getCloudDeploymentId(): string | null {
if (cloudInfo.cloudId === null) {
return null;
}
diff --git a/x-pack/legacy/plugins/ml/server/models/job_service/new_job/line_chart.ts b/x-pack/legacy/plugins/ml/server/models/job_service/new_job/line_chart.ts
index 59a33db1da2e9..eb2f50b8e9250 100644
--- a/x-pack/legacy/plugins/ml/server/models/job_service/new_job/line_chart.ts
+++ b/x-pack/legacy/plugins/ml/server/models/job_service/new_job/line_chart.ts
@@ -49,7 +49,10 @@ export function newJobLineChartProvider(callWithRequest: callWithRequestType) {
);
const results = await callWithRequest('search', json);
- return processSearchResults(results, aggFieldNamePairs.map(af => af.field));
+ return processSearchResults(
+ results,
+ aggFieldNamePairs.map(af => af.field)
+ );
}
return {
diff --git a/x-pack/legacy/plugins/ml/server/models/job_service/new_job/population_chart.ts b/x-pack/legacy/plugins/ml/server/models/job_service/new_job/population_chart.ts
index 69a0472800bf6..812a135f6cf08 100644
--- a/x-pack/legacy/plugins/ml/server/models/job_service/new_job/population_chart.ts
+++ b/x-pack/legacy/plugins/ml/server/models/job_service/new_job/population_chart.ts
@@ -54,7 +54,10 @@ export function newJobPopulationChartProvider(callWithRequest: callWithRequestTy
try {
const results = await callWithRequest('search', json);
- return processSearchResults(results, aggFieldNamePairs.map(af => af.field));
+ return processSearchResults(
+ results,
+ aggFieldNamePairs.map(af => af.field)
+ );
} catch (error) {
return { error };
}
diff --git a/x-pack/legacy/plugins/monitoring/server/telemetry_collection/__tests__/get_all_stats.js b/x-pack/legacy/plugins/monitoring/server/telemetry_collection/__tests__/get_all_stats.js
index 0d147b747f2d0..c1425de20d146 100644
--- a/x-pack/legacy/plugins/monitoring/server/telemetry_collection/__tests__/get_all_stats.js
+++ b/x-pack/legacy/plugins/monitoring/server/telemetry_collection/__tests__/get_all_stats.js
@@ -12,8 +12,7 @@ describe('get_all_stats', () => {
const size = 123;
const start = 0;
const end = 1;
- const callWithRequest = sinon.stub();
- const callWithInternalUser = sinon.stub();
+ const callCluster = sinon.stub();
const server = {
config: sinon.stub().returns({
get: sinon.stub().withArgs('xpack.monitoring.elasticsearch.index_pattern').returns('.monitoring-es-N-*')
@@ -21,16 +20,8 @@ describe('get_all_stats', () => {
.withArgs('xpack.monitoring.logstash.index_pattern').returns('.monitoring-logstash-N-*')
.withArgs('xpack.monitoring.max_bucket_size').returns(size)
}),
- plugins: {
- elasticsearch: {
- getCluster: sinon.stub().withArgs('monitoring').returns({
- callWithInternalUser,
- callWithRequest
- })
- }
- }
};
- const req = { server };
+
const esClusters = [
{ cluster_uuid: 'a' },
{ cluster_uuid: 'b', random_setting_not_removed: false },
@@ -188,19 +179,13 @@ describe('get_all_stats', () => {
}
];
- callWithRequest.withArgs(req, 'search')
- .onCall(0).returns(Promise.resolve(clusterUuidsResponse))
- .onCall(1).returns(Promise.resolve(esStatsResponse))
- .onCall(2).returns(Promise.resolve(kibanaStatsResponse))
- .onCall(3).returns(Promise.resolve(logstashStatsResponse));
-
- callWithInternalUser.withArgs('search')
+ callCluster.withArgs('search')
.onCall(0).returns(Promise.resolve(clusterUuidsResponse))
.onCall(1).returns(Promise.resolve(esStatsResponse))
.onCall(2).returns(Promise.resolve(kibanaStatsResponse))
.onCall(3).returns(Promise.resolve(logstashStatsResponse));
- expect(await getAllStats(req, start, end)).to.eql(allClusters);
+ expect(await getAllStats({ callCluster, server, start, end })).to.eql(allClusters);
});
it('returns empty clusters', async () => {
@@ -208,10 +193,9 @@ describe('get_all_stats', () => {
aggregations: { cluster_uuids: { buckets: [ ] } }
};
- callWithRequest.withArgs(req, 'search').returns(Promise.resolve(clusterUuidsResponse));
- callWithInternalUser.withArgs('search').returns(Promise.resolve(clusterUuidsResponse));
+ callCluster.withArgs('search').returns(Promise.resolve(clusterUuidsResponse));
- expect(await getAllStats(req, start, end)).to.eql([]);
+ expect(await getAllStats({ callCluster, server, start, end })).to.eql([]);
});
});
diff --git a/x-pack/legacy/plugins/monitoring/server/telemetry_collection/get_all_stats.js b/x-pack/legacy/plugins/monitoring/server/telemetry_collection/get_all_stats.js
index b1e8db1b96005..ce33068725d9c 100644
--- a/x-pack/legacy/plugins/monitoring/server/telemetry_collection/get_all_stats.js
+++ b/x-pack/legacy/plugins/monitoring/server/telemetry_collection/get_all_stats.js
@@ -17,23 +17,6 @@ import { getKibanaStats } from './get_kibana_stats';
import { getBeatsStats } from './get_beats_stats';
import { getHighLevelStats } from './get_high_level_stats';
-
-/**
- * Get statistics for all products joined by Elasticsearch cluster.
- *
- * @param {Object} req The incoming request
- * @param {Date} start The starting range to request data
- * @param {Date} end The ending range to request data
- * @return {Promise} The array of clusters joined with the Kibana and Logstash instances.
- */
-export function getAllStats(req, start, end, { useInternalUser = false } = {}) {
- const server = req.server;
- const { callWithRequest, callWithInternalUser } = server.plugins.elasticsearch.getCluster('monitoring');
- const callCluster = useInternalUser ? callWithInternalUser : (...args) => callWithRequest(req, ...args);
-
- return getAllStatsWithCaller(server, callCluster, start, end);
-}
-
/**
* Get statistics for all products joined by Elasticsearch cluster.
*
@@ -43,7 +26,7 @@ export function getAllStats(req, start, end, { useInternalUser = false } = {}) {
* @param {Date} end The ending range to request data
* @return {Promise} The array of clusters joined with the Kibana and Logstash instances.
*/
-function getAllStatsWithCaller(server, callCluster, start, end) {
+export function getAllStats({ server, callCluster, start, end } = {}) {
return getClusterUuids(server, callCluster, start, end)
.then(clusterUuids => {
// don't bother doing a further lookup
diff --git a/x-pack/legacy/plugins/monitoring/server/telemetry_collection/get_stats_with_monitoring.ts b/x-pack/legacy/plugins/monitoring/server/telemetry_collection/get_stats_with_monitoring.ts
index fdf46122f13b7..f784457b46bc3 100644
--- a/x-pack/legacy/plugins/monitoring/server/telemetry_collection/get_stats_with_monitoring.ts
+++ b/x-pack/legacy/plugins/monitoring/server/telemetry_collection/get_stats_with_monitoring.ts
@@ -7,37 +7,24 @@
// @ts-ignore
import { getAllStats } from './get_all_stats';
import { getStatsWithXpack } from '../../../xpack_main/server/telemetry_collection';
+import {
+ StatsGetter,
+ getStatsCollectionConfig,
+} from '../../../../../../src/legacy/core_plugins/telemetry/server/collection_manager';
-/**
- * Get the telemetry data.
- *
- * @param {Object} req The incoming request.
- * @param {Object} config Kibana config.
- * @param {String} start The start time of the request (likely 20m ago).
- * @param {String} end The end time of the request.
- * @param {Boolean} unencrypted Is the request payload going to be unencrypted.
- * @return {Promise} An array of telemetry objects.
- */
-export async function getStatsWithMonitoring(
- req: any,
- config: any,
- start: string,
- end: string,
- unencrypted: boolean
-) {
+export const getStatsWithMonitoring: StatsGetter = async function(config) {
let response = [];
- const useInternalUser = !unencrypted;
try {
- // attempt to collect stats from multiple clusters in monitoring data
- response = await getAllStats(req, start, end, { useInternalUser });
+ const { start, end, server, callCluster } = getStatsCollectionConfig(config, 'monitoring');
+ response = await getAllStats({ server, callCluster, start, end });
} catch (err) {
// no-op
}
if (!Array.isArray(response) || response.length === 0) {
- response = await getStatsWithXpack(req, config, start, end, unencrypted);
+ response = await getStatsWithXpack(config);
}
return response;
-}
+};
diff --git a/x-pack/legacy/plugins/reporting/export_types/csv/server/create_job.ts b/x-pack/legacy/plugins/reporting/export_types/csv/server/create_job.ts
index b1713e1753eea..f9542279f52d9 100644
--- a/x-pack/legacy/plugins/reporting/export_types/csv/server/create_job.ts
+++ b/x-pack/legacy/plugins/reporting/export_types/csv/server/create_job.ts
@@ -34,6 +34,6 @@ function createJobFn(server: ServerFacade) {
};
}
-export const createJobFactory: CreateJobFactory = oncePerServer(createJobFn as (
- server: ServerFacade
-) => ESQueueCreateJobFnDiscoverCsv);
+export const createJobFactory: CreateJobFactory = oncePerServer(
+ createJobFn as (server: ServerFacade) => ESQueueCreateJobFnDiscoverCsv
+);
diff --git a/x-pack/legacy/plugins/reporting/export_types/png/server/create_job/index.ts b/x-pack/legacy/plugins/reporting/export_types/png/server/create_job/index.ts
index 4176a1351d654..f1008a4866fd7 100644
--- a/x-pack/legacy/plugins/reporting/export_types/png/server/create_job/index.ts
+++ b/x-pack/legacy/plugins/reporting/export_types/png/server/create_job/index.ts
@@ -40,6 +40,6 @@ function createJobFn(server: ServerFacade) {
};
}
-export const createJobFactory: CreateJobFactory = oncePerServer(createJobFn as (
- server: ServerFacade
-) => ESQueueCreateJobFnPNG);
+export const createJobFactory: CreateJobFactory = oncePerServer(
+ createJobFn as (server: ServerFacade) => ESQueueCreateJobFnPNG
+);
diff --git a/x-pack/legacy/plugins/reporting/server/browsers/safe_child_process.ts b/x-pack/legacy/plugins/reporting/server/browsers/safe_child_process.ts
index 72bd3c47ead35..e22d3662a33b4 100644
--- a/x-pack/legacy/plugins/reporting/server/browsers/safe_child_process.ts
+++ b/x-pack/legacy/plugins/reporting/server/browsers/safe_child_process.ts
@@ -22,10 +22,7 @@ export function safeChildProcess(
Rx.fromEvent(process as NodeJS.EventEmitter, 'SIGTERM').pipe(mapTo('SIGTERM')),
Rx.fromEvent(process as NodeJS.EventEmitter, 'SIGINT').pipe(mapTo('SIGINT')),
Rx.fromEvent(process as NodeJS.EventEmitter, 'SIGBREAK').pipe(mapTo('SIGBREAK'))
- ).pipe(
- take(1),
- share()
- );
+ ).pipe(take(1), share());
const ownTerminateMapToKill$ = ownTerminateSignal$.pipe(
tap(signal => {
diff --git a/x-pack/legacy/plugins/searchprofiler/public/np_ready/application/components/profile_tree/init_data.ts b/x-pack/legacy/plugins/searchprofiler/public/np_ready/application/components/profile_tree/init_data.ts
index d7990b1204b21..642b2b741abf0 100644
--- a/x-pack/legacy/plugins/searchprofiler/public/np_ready/application/components/profile_tree/init_data.ts
+++ b/x-pack/legacy/plugins/searchprofiler/public/np_ready/application/components/profile_tree/init_data.ts
@@ -105,10 +105,4 @@ export const normalize = (target: Targets) => (data: IndexMap) =>
});
export const initDataFor = (target: Targets) =>
- flow(
- initShards,
- calculateShardValues(target),
- initIndices,
- normalize(target),
- sortIndices
- );
+ flow(initShards, calculateShardValues(target), initIndices, normalize(target), sortIndices);
diff --git a/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_section/privilege_space_table.test.tsx b/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_section/privilege_space_table.test.tsx
index 1025a340b2d86..37ee43c5473b0 100644
--- a/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_section/privilege_space_table.test.tsx
+++ b/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_section/privilege_space_table.test.tsx
@@ -61,26 +61,23 @@ const getTableFromComponent = (
const table = component.find(EuiInMemoryTable);
const rows = table.find('tr');
const dataRows = rows.slice(1);
- return dataRows.reduce(
- (acc, row) => {
- const cells = row.find('td');
- const spacesCell = cells.at(0);
- const spacesBadge = spacesCell.find(EuiBadge);
- const privilegesCell = cells.at(1);
- const privilegesDisplay = privilegesCell.find(PrivilegeDisplay);
- return [
- ...acc,
- {
- spaces: spacesBadge.map(badge => badge.text().trim()),
- privileges: {
- summary: privilegesDisplay.text().trim(),
- overridden: privilegesDisplay.find(EuiIconTip).exists('[type="lock"]'),
- },
+ return dataRows.reduce((acc, row) => {
+ const cells = row.find('td');
+ const spacesCell = cells.at(0);
+ const spacesBadge = spacesCell.find(EuiBadge);
+ const privilegesCell = cells.at(1);
+ const privilegesDisplay = privilegesCell.find(PrivilegeDisplay);
+ return [
+ ...acc,
+ {
+ spaces: spacesBadge.map(badge => badge.text().trim()),
+ privileges: {
+ summary: privilegesDisplay.text().trim(),
+ overridden: privilegesDisplay.find(EuiIconTip).exists('[type="lock"]'),
},
- ];
- },
- [] as TableRow[]
- );
+ },
+ ];
+ }, [] as TableRow[]);
};
describe('only global', () => {
diff --git a/x-pack/legacy/plugins/siem/common/utility_types.ts b/x-pack/legacy/plugins/siem/common/utility_types.ts
index 619ccc7e408fc..c7bbdbfccf082 100644
--- a/x-pack/legacy/plugins/siem/common/utility_types.ts
+++ b/x-pack/legacy/plugins/siem/common/utility_types.ts
@@ -7,7 +7,7 @@
import { ReactNode } from 'react';
export type Pick3 = {
- [P1 in K1]: { [P2 in K2]: { [P3 in K3]: ((T[K1])[K2])[P3] } };
+ [P1 in K1]: { [P2 in K2]: { [P3 in K3]: T[K1][K2][P3] } };
};
export type Omit = Pick>;
diff --git a/x-pack/legacy/plugins/siem/public/components/autocomplete_field/index.tsx b/x-pack/legacy/plugins/siem/public/components/autocomplete_field/index.tsx
index 8770048b5b0e8..408743d261797 100644
--- a/x-pack/legacy/plugins/siem/public/components/autocomplete_field/index.tsx
+++ b/x-pack/legacy/plugins/siem/public/components/autocomplete_field/index.tsx
@@ -307,14 +307,11 @@ const withUnfocused = (state: AutocompleteFieldState) => ({
isFocused: false,
});
-export const FixedEuiFieldSearch: React.SFC<
- React.InputHTMLAttributes &
- EuiFieldSearchProps & {
- inputRef?: (element: HTMLInputElement | null) => void;
- onSearch: (value: string) => void;
- }
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
-> = EuiFieldSearch as any;
+export const FixedEuiFieldSearch: React.SFC &
+ EuiFieldSearchProps & {
+ inputRef?: (element: HTMLInputElement | null) => void;
+ onSearch: (value: string) => void;
+ }> = EuiFieldSearch as any; // eslint-disable-line @typescript-eslint/no-explicit-any
const AutocompleteContainer = euiStyled.div`
position: relative;
diff --git a/x-pack/legacy/plugins/siem/public/components/charts/chart_place_holder.test.tsx b/x-pack/legacy/plugins/siem/public/components/charts/chart_place_holder.test.tsx
index 7674fd09739f5..4050b4f9d70a8 100644
--- a/x-pack/legacy/plugins/siem/public/components/charts/chart_place_holder.test.tsx
+++ b/x-pack/legacy/plugins/siem/public/components/charts/chart_place_holder.test.tsx
@@ -15,24 +15,36 @@ describe('ChartPlaceHolder', () => {
{
key: 'mockKeyA',
color: 'mockColor',
- value: [{ x: 'a', y: 0 }, { x: 'b', y: 0 }],
+ value: [
+ { x: 'a', y: 0 },
+ { x: 'b', y: 0 },
+ ],
},
{
key: 'mockKeyB',
color: 'mockColor',
- value: [{ x: 'a', y: 0 }, { x: 'b', y: 0 }],
+ value: [
+ { x: 'a', y: 0 },
+ { x: 'b', y: 0 },
+ ],
},
];
const mockDataUnexpectedValue = [
{
key: 'mockKeyA',
color: 'mockColor',
- value: [{ x: 'a', y: '' }, { x: 'b', y: 0 }],
+ value: [
+ { x: 'a', y: '' },
+ { x: 'b', y: 0 },
+ ],
},
{
key: 'mockKeyB',
color: 'mockColor',
- value: [{ x: 'a', y: {} }, { x: 'b', y: 0 }],
+ value: [
+ { x: 'a', y: {} },
+ { x: 'b', y: 0 },
+ ],
},
];
diff --git a/x-pack/legacy/plugins/siem/public/components/charts/common.test.tsx b/x-pack/legacy/plugins/siem/public/components/charts/common.test.tsx
index 0fc7bc6afc216..e069c1a8b8be7 100644
--- a/x-pack/legacy/plugins/siem/public/components/charts/common.test.tsx
+++ b/x-pack/legacy/plugins/siem/public/components/charts/common.test.tsx
@@ -109,20 +109,70 @@ describe('getChartWidth', () => {
describe('checkIfAllValuesAreZero', () => {
const mockInvalidDataSets: Array<[ChartSeriesData[]]> = [
- [[{ key: 'mockKey', color: 'mockColor', value: [{ x: 1, y: 0 }, { x: 1, y: 1 }] }]],
[
[
- { key: 'mockKeyA', color: 'mockColor', value: [{ x: 1, y: 0 }, { x: 1, y: 1 }] },
- { key: 'mockKeyB', color: 'mockColor', value: [{ x: 1, y: 0 }, { x: 1, y: 0 }] },
+ {
+ key: 'mockKey',
+ color: 'mockColor',
+ value: [
+ { x: 1, y: 0 },
+ { x: 1, y: 1 },
+ ],
+ },
+ ],
+ ],
+ [
+ [
+ {
+ key: 'mockKeyA',
+ color: 'mockColor',
+ value: [
+ { x: 1, y: 0 },
+ { x: 1, y: 1 },
+ ],
+ },
+ {
+ key: 'mockKeyB',
+ color: 'mockColor',
+ value: [
+ { x: 1, y: 0 },
+ { x: 1, y: 0 },
+ ],
+ },
],
],
];
const mockValidDataSets: Array<[ChartSeriesData[]]> = [
- [[{ key: 'mockKey', color: 'mockColor', value: [{ x: 0, y: 0 }, { x: 1, y: 0 }] }]],
[
[
- { key: 'mockKeyA', color: 'mockColor', value: [{ x: 1, y: 0 }, { x: 3, y: 0 }] },
- { key: 'mockKeyB', color: 'mockColor', value: [{ x: 2, y: 0 }, { x: 4, y: 0 }] },
+ {
+ key: 'mockKey',
+ color: 'mockColor',
+ value: [
+ { x: 0, y: 0 },
+ { x: 1, y: 0 },
+ ],
+ },
+ ],
+ ],
+ [
+ [
+ {
+ key: 'mockKeyA',
+ color: 'mockColor',
+ value: [
+ { x: 1, y: 0 },
+ { x: 3, y: 0 },
+ ],
+ },
+ {
+ key: 'mockKeyB',
+ color: 'mockColor',
+ value: [
+ { x: 2, y: 0 },
+ { x: 4, y: 0 },
+ ],
+ },
],
],
];
diff --git a/x-pack/legacy/plugins/siem/public/components/drag_and_drop/draggable_wrapper.tsx b/x-pack/legacy/plugins/siem/public/components/drag_and_drop/draggable_wrapper.tsx
index b9e32ee897910..35d54414944f4 100644
--- a/x-pack/legacy/plugins/siem/public/components/drag_and_drop/draggable_wrapper.tsx
+++ b/x-pack/legacy/plugins/siem/public/components/drag_and_drop/draggable_wrapper.tsx
@@ -230,13 +230,10 @@ const DraggableWrapperComponent = React.memo(
DraggableWrapperComponent.displayName = 'DraggableWrapperComponent';
-export const DraggableWrapper = connect(
- null,
- {
- registerProvider: dragAndDropActions.registerProvider,
- unRegisterProvider: dragAndDropActions.unRegisterProvider,
- }
-)(DraggableWrapperComponent);
+export const DraggableWrapper = connect(null, {
+ registerProvider: dragAndDropActions.registerProvider,
+ unRegisterProvider: dragAndDropActions.unRegisterProvider,
+})(DraggableWrapperComponent);
/**
* Conditionally wraps children in an EuiPortal to ensure drag offsets are correct when dragging
diff --git a/x-pack/legacy/plugins/siem/public/components/error_toast_dispatcher/index.tsx b/x-pack/legacy/plugins/siem/public/components/error_toast_dispatcher/index.tsx
index 998b90d11a4d8..3628330fbd459 100644
--- a/x-pack/legacy/plugins/siem/public/components/error_toast_dispatcher/index.tsx
+++ b/x-pack/legacy/plugins/siem/public/components/error_toast_dispatcher/index.tsx
@@ -58,9 +58,6 @@ const makeMapStateToProps = () => {
return (state: State) => getErrorSelector(state);
};
-export const ErrorToastDispatcher = connect(
- makeMapStateToProps,
- {
- removeError: appActions.removeError,
- }
-)(ErrorToastDispatcherComponent);
+export const ErrorToastDispatcher = connect(makeMapStateToProps, {
+ removeError: appActions.removeError,
+})(ErrorToastDispatcherComponent);
diff --git a/x-pack/legacy/plugins/siem/public/components/events_viewer/index.tsx b/x-pack/legacy/plugins/siem/public/components/events_viewer/index.tsx
index 5681588cb44b7..68ad6c4e79623 100644
--- a/x-pack/legacy/plugins/siem/public/components/events_viewer/index.tsx
+++ b/x-pack/legacy/plugins/siem/public/components/events_viewer/index.tsx
@@ -205,14 +205,11 @@ const makeMapStateToProps = () => {
return mapStateToProps;
};
-export const StatefulEventsViewer = connect(
- makeMapStateToProps,
- {
- createTimeline: timelineActions.createTimeline,
- deleteEventQuery: inputsActions.deleteOneQuery,
- updateItemsPerPage: timelineActions.updateItemsPerPage,
- updateSort: timelineActions.updateSort,
- removeColumn: timelineActions.removeColumn,
- upsertColumn: timelineActions.upsertColumn,
- }
-)(StatefulEventsViewerComponent);
+export const StatefulEventsViewer = connect(makeMapStateToProps, {
+ createTimeline: timelineActions.createTimeline,
+ deleteEventQuery: inputsActions.deleteOneQuery,
+ updateItemsPerPage: timelineActions.updateItemsPerPage,
+ updateSort: timelineActions.updateSort,
+ removeColumn: timelineActions.removeColumn,
+ upsertColumn: timelineActions.upsertColumn,
+})(StatefulEventsViewerComponent);
diff --git a/x-pack/legacy/plugins/siem/public/components/fields_browser/index.tsx b/x-pack/legacy/plugins/siem/public/components/fields_browser/index.tsx
index 2c8092a3295ad..3958cd463d56e 100644
--- a/x-pack/legacy/plugins/siem/public/components/fields_browser/index.tsx
+++ b/x-pack/legacy/plugins/siem/public/components/fields_browser/index.tsx
@@ -214,10 +214,7 @@ export const StatefulFieldsBrowserComponent = React.memo ({
},
});
-export const FlyoutHeader = connect(
- makeMapStateToProps,
- mapDispatchToProps
-)(StatefulFlyoutHeader);
+export const FlyoutHeader = connect(makeMapStateToProps, mapDispatchToProps)(StatefulFlyoutHeader);
diff --git a/x-pack/legacy/plugins/siem/public/components/flyout/index.tsx b/x-pack/legacy/plugins/siem/public/components/flyout/index.tsx
index d96d161fc0e80..aae8f67997156 100644
--- a/x-pack/legacy/plugins/siem/public/components/flyout/index.tsx
+++ b/x-pack/legacy/plugins/siem/public/components/flyout/index.tsx
@@ -121,9 +121,6 @@ const mapStateToProps = (state: State, { timelineId }: OwnProps) => {
return { dataProviders, show, width };
};
-export const Flyout = connect(
- mapStateToProps,
- {
- showTimeline: timelineActions.showTimeline,
- }
-)(FlyoutComponent);
+export const Flyout = connect(mapStateToProps, {
+ showTimeline: timelineActions.showTimeline,
+})(FlyoutComponent);
diff --git a/x-pack/legacy/plugins/siem/public/components/flyout/pane/index.tsx b/x-pack/legacy/plugins/siem/public/components/flyout/pane/index.tsx
index ba5275ed79aef..4b5ceb25befa4 100644
--- a/x-pack/legacy/plugins/siem/public/components/flyout/pane/index.tsx
+++ b/x-pack/legacy/plugins/siem/public/components/flyout/pane/index.tsx
@@ -179,9 +179,6 @@ const FlyoutPaneComponent = React.memo(
FlyoutPaneComponent.displayName = 'FlyoutPaneComponent';
-export const Pane = connect(
- null,
- {
- applyDeltaToWidth: timelineActions.applyDeltaToWidth,
- }
-)(FlyoutPaneComponent);
+export const Pane = connect(null, {
+ applyDeltaToWidth: timelineActions.applyDeltaToWidth,
+})(FlyoutPaneComponent);
diff --git a/x-pack/legacy/plugins/siem/public/components/inspect/index.tsx b/x-pack/legacy/plugins/siem/public/components/inspect/index.tsx
index 7f835e0e937e6..56bd86310acad 100644
--- a/x-pack/legacy/plugins/siem/public/components/inspect/index.tsx
+++ b/x-pack/legacy/plugins/siem/public/components/inspect/index.tsx
@@ -152,9 +152,6 @@ const makeMapStateToProps = () => {
return mapStateToProps;
};
-export const InspectButton = connect(
- makeMapStateToProps,
- {
- setIsInspected: inputsActions.setInspectionParameter,
- }
-)(InspectButtonComponent);
+export const InspectButton = connect(makeMapStateToProps, {
+ setIsInspected: inputsActions.setInspectionParameter,
+})(InspectButtonComponent);
diff --git a/x-pack/legacy/plugins/siem/public/components/ml/conditional_links/replace_kql_parts.ts b/x-pack/legacy/plugins/siem/public/components/ml/conditional_links/replace_kql_parts.ts
index b2b21129f188c..5907d16e68f57 100644
--- a/x-pack/legacy/plugins/siem/public/components/ml/conditional_links/replace_kql_parts.ts
+++ b/x-pack/legacy/plugins/siem/public/components/ml/conditional_links/replace_kql_parts.ts
@@ -9,8 +9,5 @@ import { replaceKqlCommasWithOr } from './replace_kql_commas_with_or';
import { removeKqlVariables } from './remove_kql_variables';
export const replaceKQLParts = (kqlQuery: string): string => {
- return flow(
- replaceKqlCommasWithOr,
- removeKqlVariables
- )(kqlQuery);
+ return flow(replaceKqlCommasWithOr, removeKqlVariables)(kqlQuery);
};
diff --git a/x-pack/legacy/plugins/siem/public/components/ml_popover/hooks/use_siem_jobs_helpers.tsx b/x-pack/legacy/plugins/siem/public/components/ml_popover/hooks/use_siem_jobs_helpers.tsx
index 81b7914b81742..c53407a9f2f03 100644
--- a/x-pack/legacy/plugins/siem/public/components/ml_popover/hooks/use_siem_jobs_helpers.tsx
+++ b/x-pack/legacy/plugins/siem/public/components/ml_popover/hooks/use_siem_jobs_helpers.tsx
@@ -123,9 +123,10 @@ export const composeModuleAndInstalledJobs = (
): SiemJob[] => {
const installedJobsIds = installedJobs.map(installedJob => installedJob.id);
- return [...installedJobs, ...moduleSiemJobs.filter(mj => !installedJobsIds.includes(mj.id))].sort(
- (a, b) => a.id.localeCompare(b.id)
- );
+ return [
+ ...installedJobs,
+ ...moduleSiemJobs.filter(mj => !installedJobsIds.includes(mj.id)),
+ ].sort((a, b) => a.id.localeCompare(b.id));
};
/**
* Creates a list of SiemJobs by composing JobSummary jobs (installed jobs) and Module
diff --git a/x-pack/legacy/plugins/siem/public/components/navigation/helpers.ts b/x-pack/legacy/plugins/siem/public/components/navigation/helpers.ts
index 0c44b8d44c317..23cd855cc028a 100644
--- a/x-pack/legacy/plugins/siem/public/components/navigation/helpers.ts
+++ b/x-pack/legacy/plugins/siem/public/components/navigation/helpers.ts
@@ -51,9 +51,10 @@ export const getSearch = (tab: SearchNavTab, urlState: TabNavigationProps): stri
}
return replaceQueryStringInLocation(
myLocation,
- replaceStateKeyInQueryString(urlKey, urlStateToReplace)(
- getQueryStringFromLocation(myLocation)
- )
+ replaceStateKeyInQueryString(
+ urlKey,
+ urlStateToReplace
+ )(getQueryStringFromLocation(myLocation))
);
},
{
diff --git a/x-pack/legacy/plugins/siem/public/components/page/hosts/authentications_table/index.tsx b/x-pack/legacy/plugins/siem/public/components/page/hosts/authentications_table/index.tsx
index b9b132b4f50a4..c0d11deec94ed 100644
--- a/x-pack/legacy/plugins/siem/public/components/page/hosts/authentications_table/index.tsx
+++ b/x-pack/legacy/plugins/siem/public/components/page/hosts/authentications_table/index.tsx
@@ -143,13 +143,10 @@ const makeMapStateToProps = () => {
};
};
-export const AuthenticationTable = connect(
- makeMapStateToProps,
- {
- updateTableActivePage: hostsActions.updateTableActivePage,
- updateTableLimit: hostsActions.updateTableLimit,
- }
-)(AuthenticationTableComponent);
+export const AuthenticationTable = connect(makeMapStateToProps, {
+ updateTableActivePage: hostsActions.updateTableActivePage,
+ updateTableLimit: hostsActions.updateTableLimit,
+})(AuthenticationTableComponent);
const getAuthenticationColumns = (): AuthTableColumns => [
{
@@ -339,7 +336,10 @@ export const getAuthenticationColumnsCurated = (
// Columns to exclude from host details pages
if (pageType === hostsModel.HostsType.details) {
return [i18n.LAST_FAILED_DESTINATION, i18n.LAST_SUCCESSFUL_DESTINATION].reduce((acc, name) => {
- acc.splice(acc.findIndex(column => column.name === name), 1);
+ acc.splice(
+ acc.findIndex(column => column.name === name),
+ 1
+ );
return acc;
}, columns);
}
diff --git a/x-pack/legacy/plugins/siem/public/components/page/hosts/hosts_table/index.tsx b/x-pack/legacy/plugins/siem/public/components/page/hosts/hosts_table/index.tsx
index cdc84c513737d..502fa0583536a 100644
--- a/x-pack/legacy/plugins/siem/public/components/page/hosts/hosts_table/index.tsx
+++ b/x-pack/legacy/plugins/siem/public/components/page/hosts/hosts_table/index.tsx
@@ -209,11 +209,8 @@ const makeMapStateToProps = () => {
return mapStateToProps;
};
-export const HostsTable = connect(
- makeMapStateToProps,
- {
- updateHostsSort: hostsActions.updateHostsSort,
- updateTableActivePage: hostsActions.updateTableActivePage,
- updateTableLimit: hostsActions.updateTableLimit,
- }
-)(HostsTableComponent);
+export const HostsTable = connect(makeMapStateToProps, {
+ updateHostsSort: hostsActions.updateHostsSort,
+ updateTableActivePage: hostsActions.updateTableActivePage,
+ updateTableLimit: hostsActions.updateTableLimit,
+})(HostsTableComponent);
diff --git a/x-pack/legacy/plugins/siem/public/components/page/hosts/uncommon_process_table/index.tsx b/x-pack/legacy/plugins/siem/public/components/page/hosts/uncommon_process_table/index.tsx
index 2f2d84306e25e..00eec3fe3a754 100644
--- a/x-pack/legacy/plugins/siem/public/components/page/hosts/uncommon_process_table/index.tsx
+++ b/x-pack/legacy/plugins/siem/public/components/page/hosts/uncommon_process_table/index.tsx
@@ -139,13 +139,10 @@ const makeMapStateToProps = () => {
return (state: State, { type }: OwnProps) => getUncommonProcessesSelector(state, type);
};
-export const UncommonProcessTable = connect(
- makeMapStateToProps,
- {
- updateTableActivePage: hostsActions.updateTableActivePage,
- updateTableLimit: hostsActions.updateTableLimit,
- }
-)(UncommonProcessTableComponent);
+export const UncommonProcessTable = connect(makeMapStateToProps, {
+ updateTableActivePage: hostsActions.updateTableActivePage,
+ updateTableLimit: hostsActions.updateTableLimit,
+})(UncommonProcessTableComponent);
const getUncommonColumns = (): UncommonProcessTableColumns => [
{
@@ -229,7 +226,10 @@ export const getUncommonColumnsCurated = (pageType: HostsType): UncommonProcessT
const columns: UncommonProcessTableColumns = getUncommonColumns();
if (pageType === HostsType.details) {
return [i18n.HOSTS, i18n.NUMBER_OF_HOSTS].reduce((acc, name) => {
- acc.splice(acc.findIndex(column => column.name === name), 1);
+ acc.splice(
+ acc.findIndex(column => column.name === name),
+ 1
+ );
return acc;
}, columns);
} else {
diff --git a/x-pack/legacy/plugins/siem/public/components/page/network/flow_target_select_connected/index.tsx b/x-pack/legacy/plugins/siem/public/components/page/network/flow_target_select_connected/index.tsx
index a5e0977ab9eef..b5e07809f2e12 100644
--- a/x-pack/legacy/plugins/siem/public/components/page/network/flow_target_select_connected/index.tsx
+++ b/x-pack/legacy/plugins/siem/public/components/page/network/flow_target_select_connected/index.tsx
@@ -63,9 +63,6 @@ const makeMapStateToProps = () => {
};
};
-export const FlowTargetSelectConnected = connect(
- makeMapStateToProps,
- {
- updateIpDetailsFlowTarget: networkActions.updateIpDetailsFlowTarget,
- }
-)(FlowTargetSelectComponent);
+export const FlowTargetSelectConnected = connect(makeMapStateToProps, {
+ updateIpDetailsFlowTarget: networkActions.updateIpDetailsFlowTarget,
+})(FlowTargetSelectComponent);
diff --git a/x-pack/legacy/plugins/siem/public/components/page/network/network_dns_table/index.tsx b/x-pack/legacy/plugins/siem/public/components/page/network/network_dns_table/index.tsx
index ac5470ee4f236..cc7a895623303 100644
--- a/x-pack/legacy/plugins/siem/public/components/page/network/network_dns_table/index.tsx
+++ b/x-pack/legacy/plugins/siem/public/components/page/network/network_dns_table/index.tsx
@@ -159,9 +159,6 @@ const makeMapStateToProps = () => {
return mapStateToProps;
};
-export const NetworkDnsTable = connect(
- makeMapStateToProps,
- {
- updateNetworkTable: networkActions.updateNetworkTable,
- }
-)(NetworkDnsTableComponent);
+export const NetworkDnsTable = connect(makeMapStateToProps, {
+ updateNetworkTable: networkActions.updateNetworkTable,
+})(NetworkDnsTableComponent);
diff --git a/x-pack/legacy/plugins/siem/public/components/page/network/network_http_table/index.tsx b/x-pack/legacy/plugins/siem/public/components/page/network/network_http_table/index.tsx
index 71807280ebcb4..e5ad39b814caa 100644
--- a/x-pack/legacy/plugins/siem/public/components/page/network/network_http_table/index.tsx
+++ b/x-pack/legacy/plugins/siem/public/components/page/network/network_http_table/index.tsx
@@ -140,10 +140,7 @@ const makeMapStateToProps = () => {
};
export const NetworkHttpTable = compose>(
- connect(
- makeMapStateToProps,
- {
- updateNetworkTable: networkActions.updateNetworkTable,
- }
- )
+ connect(makeMapStateToProps, {
+ updateNetworkTable: networkActions.updateNetworkTable,
+ })
)(NetworkHttpTableComponent);
diff --git a/x-pack/legacy/plugins/siem/public/components/page/network/network_top_countries_table/index.tsx b/x-pack/legacy/plugins/siem/public/components/page/network/network_top_countries_table/index.tsx
index 107863e6067df..15c48ddf32cd6 100644
--- a/x-pack/legacy/plugins/siem/public/components/page/network/network_top_countries_table/index.tsx
+++ b/x-pack/legacy/plugins/siem/public/components/page/network/network_top_countries_table/index.tsx
@@ -185,10 +185,7 @@ const makeMapStateToProps = () => {
};
export const NetworkTopCountriesTable = compose>(
- connect(
- makeMapStateToProps,
- {
- updateNetworkTable: networkActions.updateNetworkTable,
- }
- )
+ connect(makeMapStateToProps, {
+ updateNetworkTable: networkActions.updateNetworkTable,
+ })
)(NetworkTopCountriesTableComponent);
diff --git a/x-pack/legacy/plugins/siem/public/components/page/network/network_top_n_flow_table/index.tsx b/x-pack/legacy/plugins/siem/public/components/page/network/network_top_n_flow_table/index.tsx
index a41b59b3c6528..b37a3dce808bd 100644
--- a/x-pack/legacy/plugins/siem/public/components/page/network/network_top_n_flow_table/index.tsx
+++ b/x-pack/legacy/plugins/siem/public/components/page/network/network_top_n_flow_table/index.tsx
@@ -176,10 +176,7 @@ const makeMapStateToProps = () => {
};
export const NetworkTopNFlowTable = compose>(
- connect(
- makeMapStateToProps,
- {
- updateNetworkTable: networkActions.updateNetworkTable,
- }
- )
+ connect(makeMapStateToProps, {
+ updateNetworkTable: networkActions.updateNetworkTable,
+ })
)(NetworkTopNFlowTableComponent);
diff --git a/x-pack/legacy/plugins/siem/public/components/page/network/tls_table/index.tsx b/x-pack/legacy/plugins/siem/public/components/page/network/tls_table/index.tsx
index 6adb335839982..7dd9ca0273c5b 100644
--- a/x-pack/legacy/plugins/siem/public/components/page/network/tls_table/index.tsx
+++ b/x-pack/legacy/plugins/siem/public/components/page/network/tls_table/index.tsx
@@ -144,12 +144,9 @@ const makeMapStateToProps = () => {
};
export const TlsTable = compose>(
- connect(
- makeMapStateToProps,
- {
- updateNetworkTable: networkActions.updateNetworkTable,
- }
- )
+ connect(makeMapStateToProps, {
+ updateNetworkTable: networkActions.updateNetworkTable,
+ })
)(TlsTableComponent);
const getSortField = (sortField: TlsSortField): SortingBasicTable => ({
diff --git a/x-pack/legacy/plugins/siem/public/components/page/network/users_table/index.tsx b/x-pack/legacy/plugins/siem/public/components/page/network/users_table/index.tsx
index ce1376d753f70..8da41fca8f384 100644
--- a/x-pack/legacy/plugins/siem/public/components/page/network/users_table/index.tsx
+++ b/x-pack/legacy/plugins/siem/public/components/page/network/users_table/index.tsx
@@ -145,12 +145,9 @@ const makeMapStateToProps = () => {
});
};
-export const UsersTable = connect(
- makeMapStateToProps,
- {
- updateNetworkTable: networkActions.updateNetworkTable,
- }
-)(UsersTableComponent);
+export const UsersTable = connect(makeMapStateToProps, {
+ updateNetworkTable: networkActions.updateNetworkTable,
+})(UsersTableComponent);
const getSortField = (sortField: UsersSortField): SortingBasicTable => {
switch (sortField.field) {
diff --git a/x-pack/legacy/plugins/siem/public/components/search_bar/index.tsx b/x-pack/legacy/plugins/siem/public/components/search_bar/index.tsx
index 5b60b62521293..f5a99c631131f 100644
--- a/x-pack/legacy/plugins/siem/public/components/search_bar/index.tsx
+++ b/x-pack/legacy/plugins/siem/public/components/search_bar/index.tsx
@@ -401,7 +401,4 @@ const mapDispatchToProps = (dispatch: Dispatch) => ({
dispatch(inputsActions.setSearchBarFilter({ id, filters })),
});
-export const SiemSearchBar = connect(
- makeMapStateToProps,
- mapDispatchToProps
-)(SearchBarComponent);
+export const SiemSearchBar = connect(makeMapStateToProps, mapDispatchToProps)(SearchBarComponent);
diff --git a/x-pack/legacy/plugins/siem/public/components/search_bar/selectors.ts b/x-pack/legacy/plugins/siem/public/components/search_bar/selectors.ts
index cfd7cd840dac8..acf91067c4291 100644
--- a/x-pack/legacy/plugins/siem/public/components/search_bar/selectors.ts
+++ b/x-pack/legacy/plugins/siem/public/components/search_bar/selectors.ts
@@ -24,14 +24,6 @@ export const getFilterQuery = (inputState: InputsRange): Query => inputState.que
export const getSavedQuery = (inputState: InputsRange): SavedQuery | undefined =>
inputState.savedQuery;
-export const filterQuerySelector = () =>
- createSelector(
- getFilterQuery,
- filterQuery => filterQuery
- );
+export const filterQuerySelector = () => createSelector(getFilterQuery, filterQuery => filterQuery);
-export const savedQuerySelector = () =>
- createSelector(
- getSavedQuery,
- savedQuery => savedQuery
- );
+export const savedQuerySelector = () => createSelector(getSavedQuery, savedQuery => savedQuery);
diff --git a/x-pack/legacy/plugins/siem/public/components/super_date_picker/selectors.ts b/x-pack/legacy/plugins/siem/public/components/super_date_picker/selectors.ts
index 59f55f33842fe..2e1a3f1a7f3a1 100644
--- a/x-pack/legacy/plugins/siem/public/components/super_date_picker/selectors.ts
+++ b/x-pack/legacy/plugins/siem/public/components/super_date_picker/selectors.ts
@@ -13,62 +13,25 @@ export const getTimerange = (inputState: InputsRange): TimeRange => inputState.t
export const getQueries = (inputState: InputsRange): GlobalQuery[] => inputState.queries;
-export const policySelector = () =>
- createSelector(
- getPolicy,
- policy => policy.kind
- );
+export const policySelector = () => createSelector(getPolicy, policy => policy.kind);
-export const durationSelector = () =>
- createSelector(
- getPolicy,
- policy => policy.duration
- );
+export const durationSelector = () => createSelector(getPolicy, policy => policy.duration);
-export const kindSelector = () =>
- createSelector(
- getTimerange,
- timerange => timerange.kind
- );
+export const kindSelector = () => createSelector(getTimerange, timerange => timerange.kind);
-export const startSelector = () =>
- createSelector(
- getTimerange,
- timerange => timerange.from
- );
+export const startSelector = () => createSelector(getTimerange, timerange => timerange.from);
-export const endSelector = () =>
- createSelector(
- getTimerange,
- timerange => timerange.to
- );
+export const endSelector = () => createSelector(getTimerange, timerange => timerange.to);
-export const fromStrSelector = () =>
- createSelector(
- getTimerange,
- timerange => timerange.fromStr
- );
+export const fromStrSelector = () => createSelector(getTimerange, timerange => timerange.fromStr);
-export const toStrSelector = () =>
- createSelector(
- getTimerange,
- timerange => timerange.toStr
- );
+export const toStrSelector = () => createSelector(getTimerange, timerange => timerange.toStr);
export const isLoadingSelector = () =>
- createSelector(
- getQueries,
- queries => queries.some(i => i.loading === true)
- );
+ createSelector(getQueries, queries => queries.some(i => i.loading === true));
export const queriesSelector = () =>
- createSelector(
- getQueries,
- queries => queries.filter(q => q.id !== 'kql')
- );
+ createSelector(getQueries, queries => queries.filter(q => q.id !== 'kql'));
export const kqlQuerySelector = () =>
- createSelector(
- getQueries,
- queries => queries.find(q => q.id === 'kql')
- );
+ createSelector(getQueries, queries => queries.find(q => q.id === 'kql'));
diff --git a/x-pack/legacy/plugins/siem/public/components/timeline/auto_save_warning/index.tsx b/x-pack/legacy/plugins/siem/public/components/timeline/auto_save_warning/index.tsx
index 2cba2a4b39f1b..d16e446a879a6 100644
--- a/x-pack/legacy/plugins/siem/public/components/timeline/auto_save_warning/index.tsx
+++ b/x-pack/legacy/plugins/siem/public/components/timeline/auto_save_warning/index.tsx
@@ -107,11 +107,8 @@ const mapStateToProps = (state: State) => {
};
};
-export const AutoSaveWarningMsg = connect(
- mapStateToProps,
- {
- setTimelineRangeDatePicker: dispatchSetTimelineRangeDatePicker,
- updateAutoSaveMsg: timelineActions.updateAutoSaveMsg,
- updateTimeline: timelineActions.updateTimeline,
- }
-)(AutoSaveWarningMsgComponent);
+export const AutoSaveWarningMsg = connect(mapStateToProps, {
+ setTimelineRangeDatePicker: dispatchSetTimelineRangeDatePicker,
+ updateAutoSaveMsg: timelineActions.updateAutoSaveMsg,
+ updateTimeline: timelineActions.updateTimeline,
+})(AutoSaveWarningMsgComponent);
diff --git a/x-pack/legacy/plugins/siem/public/components/timeline/body/stateful_body.tsx b/x-pack/legacy/plugins/siem/public/components/timeline/body/stateful_body.tsx
index 531e61dd7dc60..e5656455623b5 100644
--- a/x-pack/legacy/plugins/siem/public/components/timeline/body/stateful_body.tsx
+++ b/x-pack/legacy/plugins/siem/public/components/timeline/body/stateful_body.tsx
@@ -216,17 +216,14 @@ const makeMapStateToProps = () => {
return mapStateToProps;
};
-export const StatefulBody = connect(
- makeMapStateToProps,
- {
- addNoteToEvent: timelineActions.addNoteToEvent,
- applyDeltaToColumnWidth: timelineActions.applyDeltaToColumnWidth,
- pinEvent: timelineActions.pinEvent,
- removeColumn: timelineActions.removeColumn,
- removeProvider: timelineActions.removeProvider,
- unPinEvent: timelineActions.unPinEvent,
- updateColumns: timelineActions.updateColumns,
- updateNote: appActions.updateNote,
- updateSort: timelineActions.updateSort,
- }
-)(StatefulBodyComponent);
+export const StatefulBody = connect(makeMapStateToProps, {
+ addNoteToEvent: timelineActions.addNoteToEvent,
+ applyDeltaToColumnWidth: timelineActions.applyDeltaToColumnWidth,
+ pinEvent: timelineActions.pinEvent,
+ removeColumn: timelineActions.removeColumn,
+ removeProvider: timelineActions.removeProvider,
+ unPinEvent: timelineActions.unPinEvent,
+ updateColumns: timelineActions.updateColumns,
+ updateNote: appActions.updateNote,
+ updateSort: timelineActions.updateSort,
+})(StatefulBodyComponent);
diff --git a/x-pack/legacy/plugins/siem/public/components/timeline/fetch_kql_timeline.tsx b/x-pack/legacy/plugins/siem/public/components/timeline/fetch_kql_timeline.tsx
index e5f50c332a7c2..e97a8c0860d36 100644
--- a/x-pack/legacy/plugins/siem/public/components/timeline/fetch_kql_timeline.tsx
+++ b/x-pack/legacy/plugins/siem/public/components/timeline/fetch_kql_timeline.tsx
@@ -71,9 +71,6 @@ const makeMapStateToProps = () => {
return mapStateToProps;
};
-export const TimelineKqlFetch = connect(
- makeMapStateToProps,
- {
- setTimelineQuery: inputsActions.setQuery,
- }
-)(TimelineKqlFetchComponent);
+export const TimelineKqlFetch = connect(makeMapStateToProps, {
+ setTimelineQuery: inputsActions.setQuery,
+})(TimelineKqlFetchComponent);
diff --git a/x-pack/legacy/plugins/siem/public/components/timeline/index.tsx b/x-pack/legacy/plugins/siem/public/components/timeline/index.tsx
index 78a9488b2fdbb..e4afef9a351e8 100644
--- a/x-pack/legacy/plugins/siem/public/components/timeline/index.tsx
+++ b/x-pack/legacy/plugins/siem/public/components/timeline/index.tsx
@@ -341,22 +341,19 @@ const makeMapStateToProps = () => {
return mapStateToProps;
};
-export const StatefulTimeline = connect(
- makeMapStateToProps,
- {
- addProvider: timelineActions.addProvider,
- createTimeline: timelineActions.createTimeline,
- onDataProviderEdited: timelineActions.dataProviderEdited,
- removeColumn: timelineActions.removeColumn,
- removeProvider: timelineActions.removeProvider,
- updateColumns: timelineActions.updateColumns,
- updateDataProviderEnabled: timelineActions.updateDataProviderEnabled,
- updateDataProviderExcluded: timelineActions.updateDataProviderExcluded,
- updateDataProviderKqlQuery: timelineActions.updateDataProviderKqlQuery,
- updateHighlightedDropAndProviderId: timelineActions.updateHighlightedDropAndProviderId,
- updateItemsPerPage: timelineActions.updateItemsPerPage,
- updateItemsPerPageOptions: timelineActions.updateItemsPerPageOptions,
- updateSort: timelineActions.updateSort,
- upsertColumn: timelineActions.upsertColumn,
- }
-)(StatefulTimelineComponent);
+export const StatefulTimeline = connect(makeMapStateToProps, {
+ addProvider: timelineActions.addProvider,
+ createTimeline: timelineActions.createTimeline,
+ onDataProviderEdited: timelineActions.dataProviderEdited,
+ removeColumn: timelineActions.removeColumn,
+ removeProvider: timelineActions.removeProvider,
+ updateColumns: timelineActions.updateColumns,
+ updateDataProviderEnabled: timelineActions.updateDataProviderEnabled,
+ updateDataProviderExcluded: timelineActions.updateDataProviderExcluded,
+ updateDataProviderKqlQuery: timelineActions.updateDataProviderKqlQuery,
+ updateHighlightedDropAndProviderId: timelineActions.updateHighlightedDropAndProviderId,
+ updateItemsPerPage: timelineActions.updateItemsPerPage,
+ updateItemsPerPageOptions: timelineActions.updateItemsPerPageOptions,
+ updateSort: timelineActions.updateSort,
+ upsertColumn: timelineActions.upsertColumn,
+})(StatefulTimelineComponent);
diff --git a/x-pack/legacy/plugins/siem/public/components/timeline/refetch_timeline.tsx b/x-pack/legacy/plugins/siem/public/components/timeline/refetch_timeline.tsx
index 7e549a08f9511..8a78d04c88311 100644
--- a/x-pack/legacy/plugins/siem/public/components/timeline/refetch_timeline.tsx
+++ b/x-pack/legacy/plugins/siem/public/components/timeline/refetch_timeline.tsx
@@ -44,10 +44,7 @@ const TimelineRefetchComponent = memo(
);
export const TimelineRefetch = compose>(
- connect(
- null,
- {
- setTimelineQuery: inputsActions.setQuery,
- }
- )
+ connect(null, {
+ setTimelineQuery: inputsActions.setQuery,
+ })
)(TimelineRefetchComponent);
diff --git a/x-pack/legacy/plugins/siem/public/components/timeline/search_or_filter/index.tsx b/x-pack/legacy/plugins/siem/public/components/timeline/search_or_filter/index.tsx
index 0ebceccfa90c5..ec491fe50407a 100644
--- a/x-pack/legacy/plugins/siem/public/components/timeline/search_or_filter/index.tsx
+++ b/x-pack/legacy/plugins/siem/public/components/timeline/search_or_filter/index.tsx
@@ -114,11 +114,8 @@ const makeMapStateToProps = () => {
return mapStateToProps;
};
-export const StatefulSearchOrFilter = connect(
- makeMapStateToProps,
- {
- applyKqlFilterQuery: timelineActions.applyKqlFilterQuery,
- setKqlFilterQueryDraft: timelineActions.setKqlFilterQueryDraft,
- updateKqlMode: timelineActions.updateKqlMode,
- }
-)(StatefulSearchOrFilterComponent);
+export const StatefulSearchOrFilter = connect(makeMapStateToProps, {
+ applyKqlFilterQuery: timelineActions.applyKqlFilterQuery,
+ setKqlFilterQueryDraft: timelineActions.setKqlFilterQueryDraft,
+ updateKqlMode: timelineActions.updateKqlMode,
+})(StatefulSearchOrFilterComponent);
diff --git a/x-pack/legacy/plugins/siem/public/components/url_state/index.tsx b/x-pack/legacy/plugins/siem/public/components/url_state/index.tsx
index b58b60587c863..8164348620b50 100644
--- a/x-pack/legacy/plugins/siem/public/components/url_state/index.tsx
+++ b/x-pack/legacy/plugins/siem/public/components/url_state/index.tsx
@@ -38,10 +38,7 @@ const mapDispatchToProps = (dispatch: Dispatch) => ({
});
export const UrlStateRedux = compose>(
- connect(
- makeMapStateToProps,
- mapDispatchToProps
- )
+ connect(makeMapStateToProps, mapDispatchToProps)
)(UrlStateContainer);
export const UseUrlState = React.memo(props => {
diff --git a/x-pack/legacy/plugins/siem/public/components/url_state/test_dependencies.ts b/x-pack/legacy/plugins/siem/public/components/url_state/test_dependencies.ts
index f548fe9ee8d48..39c540b3bd355 100644
--- a/x-pack/legacy/plugins/siem/public/components/url_state/test_dependencies.ts
+++ b/x-pack/legacy/plugins/siem/public/components/url_state/test_dependencies.ts
@@ -265,9 +265,15 @@ export const getMockPropsObj = ({
// silly that this needs to be an array and not an object
// https://jestjs.io/docs/en/api#testeachtable-name-fn-timeout
-export const testCases: Array<
- [LocationTypes, string, string, string, string | null, string, undefined | string]
-> = [
+export const testCases: Array<[
+ LocationTypes,
+ string,
+ string,
+ string,
+ string | null,
+ string,
+ undefined | string
+]> = [
[
/* page */ CONSTANTS.networkPage,
/* namespaceLower */ 'network',
diff --git a/x-pack/legacy/plugins/siem/public/components/url_state/use_url_state.tsx b/x-pack/legacy/plugins/siem/public/components/url_state/use_url_state.tsx
index f1eeb4e6fbec4..d7fece5731972 100644
--- a/x-pack/legacy/plugins/siem/public/components/url_state/use_url_state.tsx
+++ b/x-pack/legacy/plugins/siem/public/components/url_state/use_url_state.tsx
@@ -75,9 +75,10 @@ export const useUrlStateHooks = ({
search,
state: '',
},
- replaceStateKeyInQueryString(urlStateKey, urlStateToReplace)(
- getQueryStringFromLocation(latestLocation)
- )
+ replaceStateKeyInQueryString(
+ urlStateKey,
+ urlStateToReplace
+ )(getQueryStringFromLocation(latestLocation))
);
if (history) {
history.replace(newLocation);
diff --git a/x-pack/legacy/plugins/siem/public/containers/global_time/index.tsx b/x-pack/legacy/plugins/siem/public/containers/global_time/index.tsx
index 78e03a36f40cb..665148b7ad650 100644
--- a/x-pack/legacy/plugins/siem/public/containers/global_time/index.tsx
+++ b/x-pack/legacy/plugins/siem/public/containers/global_time/index.tsx
@@ -83,11 +83,8 @@ const mapStateToProps = (state: State) => {
};
};
-export const GlobalTime = connect(
- mapStateToProps,
- {
- deleteAllQuery: inputsActions.deleteAllQuery,
- deleteOneQuery: inputsActions.deleteOneQuery,
- setGlobalQuery: inputsActions.setQuery,
- }
-)(GlobalTimeComponent);
+export const GlobalTime = connect(mapStateToProps, {
+ deleteAllQuery: inputsActions.deleteAllQuery,
+ deleteOneQuery: inputsActions.deleteOneQuery,
+ setGlobalQuery: inputsActions.setQuery,
+})(GlobalTimeComponent);
diff --git a/x-pack/legacy/plugins/siem/public/lib/keury/index.ts b/x-pack/legacy/plugins/siem/public/lib/keury/index.ts
index bf8726d5ed377..e9f4c95a80b74 100644
--- a/x-pack/legacy/plugins/siem/public/lib/keury/index.ts
+++ b/x-pack/legacy/plugins/siem/public/lib/keury/index.ts
@@ -61,12 +61,7 @@ const escapeAndOr = (val: string) => val.replace(/(\s+)(and|or)(\s+)/gi, '$1\\$2
const escapeNot = (val: string) => val.replace(/not(\s+)/gi, '\\$&');
-export const escapeKuery = flow(
- escapeSpecialCharacters,
- escapeAndOr,
- escapeNot,
- escapeWhitespace
-);
+export const escapeKuery = flow(escapeSpecialCharacters, escapeAndOr, escapeNot, escapeWhitespace);
export interface EsQueryConfig {
allowLeadingWildcards: boolean;
@@ -88,10 +83,15 @@ export const convertToBuildEsQuery = ({
}) => {
try {
return JSON.stringify(
- buildEsQuery(indexPattern, queries, filters.filter(f => f.meta.disabled === false), {
- ...config,
- dateFormatTZ: null,
- })
+ buildEsQuery(
+ indexPattern,
+ queries,
+ filters.filter(f => f.meta.disabled === false),
+ {
+ ...config,
+ dateFormatTZ: null,
+ }
+ )
);
} catch (exp) {
return '';
diff --git a/x-pack/legacy/plugins/siem/public/pages/hosts/details/index.tsx b/x-pack/legacy/plugins/siem/public/pages/hosts/details/index.tsx
index 2cb193fb47c6b..453f26240a87f 100644
--- a/x-pack/legacy/plugins/siem/public/pages/hosts/details/index.tsx
+++ b/x-pack/legacy/plugins/siem/public/pages/hosts/details/index.tsx
@@ -232,11 +232,8 @@ export const makeMapStateToProps = () => {
};
export const HostDetails = compose>(
- connect(
- makeMapStateToProps,
- {
- setAbsoluteRangeDatePicker: dispatchAbsoluteRangeDatePicker,
- setHostDetailsTablesActivePageToZero: dispatchHostDetailsTablesActivePageToZero,
- }
- )
+ connect(makeMapStateToProps, {
+ setAbsoluteRangeDatePicker: dispatchAbsoluteRangeDatePicker,
+ setHostDetailsTablesActivePageToZero: dispatchHostDetailsTablesActivePageToZero,
+ })
)(HostDetailsComponent);
diff --git a/x-pack/legacy/plugins/siem/public/pages/hosts/hosts.tsx b/x-pack/legacy/plugins/siem/public/pages/hosts/hosts.tsx
index 1dc21c9d0284f..f616abbac5745 100644
--- a/x-pack/legacy/plugins/siem/public/pages/hosts/hosts.tsx
+++ b/x-pack/legacy/plugins/siem/public/pages/hosts/hosts.tsx
@@ -154,10 +154,7 @@ interface HostsProps extends GlobalTimeArgs {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const Hosts = compose>(
- connect(
- makeMapStateToProps,
- {
- setAbsoluteRangeDatePicker: dispatchSetAbsoluteRangeDatePicker,
- }
- )
+ connect(makeMapStateToProps, {
+ setAbsoluteRangeDatePicker: dispatchSetAbsoluteRangeDatePicker,
+ })
)(HostsComponent);
diff --git a/x-pack/legacy/plugins/siem/public/pages/network/ip_details/index.tsx b/x-pack/legacy/plugins/siem/public/pages/network/ip_details/index.tsx
index b1751cca0b3d0..d160e4f57be6b 100644
--- a/x-pack/legacy/plugins/siem/public/pages/network/ip_details/index.tsx
+++ b/x-pack/legacy/plugins/siem/public/pages/network/ip_details/index.tsx
@@ -290,10 +290,7 @@ const makeMapStateToProps = () => {
});
};
-export const IPDetails = connect(
- makeMapStateToProps,
- {
- setAbsoluteRangeDatePicker: dispatchAbsoluteRangeDatePicker,
- setIpDetailsTablesActivePageToZero: dispatchIpDetailsTablesActivePageToZero,
- }
-)(IPDetailsComponent);
+export const IPDetails = connect(makeMapStateToProps, {
+ setAbsoluteRangeDatePicker: dispatchAbsoluteRangeDatePicker,
+ setIpDetailsTablesActivePageToZero: dispatchIpDetailsTablesActivePageToZero,
+})(IPDetailsComponent);
diff --git a/x-pack/legacy/plugins/siem/public/pages/network/network.tsx b/x-pack/legacy/plugins/siem/public/pages/network/network.tsx
index 6b4c54737eb10..b919985fecb04 100644
--- a/x-pack/legacy/plugins/siem/public/pages/network/network.tsx
+++ b/x-pack/legacy/plugins/siem/public/pages/network/network.tsx
@@ -161,9 +161,6 @@ const makeMapStateToProps = () => {
return mapStateToProps;
};
-export const Network = connect(
- makeMapStateToProps,
- {
- setAbsoluteRangeDatePicker: dispatchSetAbsoluteRangeDatePicker,
- }
-)(NetworkComponent);
+export const Network = connect(makeMapStateToProps, {
+ setAbsoluteRangeDatePicker: dispatchSetAbsoluteRangeDatePicker,
+})(NetworkComponent);
diff --git a/x-pack/legacy/plugins/siem/public/store/app/selectors.ts b/x-pack/legacy/plugins/siem/public/store/app/selectors.ts
index 9037583d278a7..16f02fd85cbc2 100644
--- a/x-pack/legacy/plugins/siem/public/store/app/selectors.ts
+++ b/x-pack/legacy/plugins/siem/public/store/app/selectors.ts
@@ -33,13 +33,6 @@ export const selectNotesByIdSelector = createSelector(
);
export const notesByIdsSelector = () =>
- createSelector(
- selectNotesById,
- (notesById: NotesById) => notesById
- );
-
-export const errorsSelector = () =>
- createSelector(
- getErrors,
- errors => ({ errors })
- );
+ createSelector(selectNotesById, (notesById: NotesById) => notesById);
+
+export const errorsSelector = () => createSelector(getErrors, errors => ({ errors }));
diff --git a/x-pack/legacy/plugins/siem/public/store/hosts/selectors.ts b/x-pack/legacy/plugins/siem/public/store/hosts/selectors.ts
index 7d00569f9a0ea..8ebeae4bba392 100644
--- a/x-pack/legacy/plugins/siem/public/store/hosts/selectors.ts
+++ b/x-pack/legacy/plugins/siem/public/store/hosts/selectors.ts
@@ -15,25 +15,12 @@ const selectHosts = (state: State, hostsType: HostsType): GenericHostsModel =>
get(hostsType, state.hosts);
export const authenticationsSelector = () =>
- createSelector(
- selectHosts,
- hosts => hosts.queries.authentications
- );
+ createSelector(selectHosts, hosts => hosts.queries.authentications);
export const hostsSelector = () =>
- createSelector(
- selectHosts,
- hosts => hosts.queries[HostsTableType.hosts]
- );
+ createSelector(selectHosts, hosts => hosts.queries[HostsTableType.hosts]);
-export const eventsSelector = () =>
- createSelector(
- selectHosts,
- hosts => hosts.queries.events
- );
+export const eventsSelector = () => createSelector(selectHosts, hosts => hosts.queries.events);
export const uncommonProcessesSelector = () =>
- createSelector(
- selectHosts,
- hosts => hosts.queries.uncommonProcesses
- );
+ createSelector(selectHosts, hosts => hosts.queries.uncommonProcesses);
diff --git a/x-pack/legacy/plugins/siem/public/store/inputs/selectors.ts b/x-pack/legacy/plugins/siem/public/store/inputs/selectors.ts
index 7c33c0f787694..cb2d357b74007 100644
--- a/x-pack/legacy/plugins/siem/public/store/inputs/selectors.ts
+++ b/x-pack/legacy/plugins/siem/public/store/inputs/selectors.ts
@@ -37,49 +37,24 @@ const selectTimelineQuery = (state: State, id: string): GlobalQuery =>
selectedInspectIndex: 0,
};
-export const inputsSelector = () =>
- createSelector(
- selectInputs,
- inputs => inputs
- );
+export const inputsSelector = () => createSelector(selectInputs, inputs => inputs);
export const timelineTimeRangeSelector = createSelector(
selectTimeline,
timeline => timeline.timerange
);
-export const globalTimeRangeSelector = createSelector(
- selectGlobal,
- global => global.timerange
-);
+export const globalTimeRangeSelector = createSelector(selectGlobal, global => global.timerange);
-export const globalPolicySelector = createSelector(
- selectGlobal,
- global => global.policy
-);
+export const globalPolicySelector = createSelector(selectGlobal, global => global.policy);
-export const globalQuery = createSelector(
- selectGlobal,
- global => global.queries
-);
+export const globalQuery = createSelector(selectGlobal, global => global.queries);
-export const globalQueryByIdSelector = () =>
- createSelector(
- selectGlobalQuery,
- query => query
- );
+export const globalQueryByIdSelector = () => createSelector(selectGlobalQuery, query => query);
-export const timelineQueryByIdSelector = () =>
- createSelector(
- selectTimelineQuery,
- query => query
- );
+export const timelineQueryByIdSelector = () => createSelector(selectTimelineQuery, query => query);
-export const globalSelector = () =>
- createSelector(
- selectGlobal,
- global => global
- );
+export const globalSelector = () => createSelector(selectGlobal, global => global);
export const globalQuerySelector = () =>
createSelector(
@@ -92,19 +67,9 @@ export const globalQuerySelector = () =>
);
export const globalSavedQuerySelector = () =>
- createSelector(
- selectGlobal,
- global => global.savedQuery || null
- );
+ createSelector(selectGlobal, global => global.savedQuery || null);
export const globalFiltersQuerySelector = () =>
- createSelector(
- selectGlobal,
- global => global.filters || []
- );
+ createSelector(selectGlobal, global => global.filters || []);
-export const getTimelineSelector = () =>
- createSelector(
- selectTimeline,
- timeline => timeline
- );
+export const getTimelineSelector = () => createSelector(selectTimeline, timeline => timeline);
diff --git a/x-pack/legacy/plugins/siem/public/store/network/selectors.ts b/x-pack/legacy/plugins/siem/public/store/network/selectors.ts
index cf57c0d07c43e..a33684472b279 100644
--- a/x-pack/legacy/plugins/siem/public/store/network/selectors.ts
+++ b/x-pack/legacy/plugins/siem/public/store/network/selectors.ts
@@ -23,11 +23,7 @@ const selectNetworkPage = (state: State): NetworkPageModel => state.network.page
const selectNetworkDetails = (state: State): NetworkDetailsModel => state.network.details;
// Network Page Selectors
-export const dnsSelector = () =>
- createSelector(
- selectNetworkPage,
- network => network.queries.dns
- );
+export const dnsSelector = () => createSelector(selectNetworkPage, network => network.queries.dns);
const selectTopNFlowByType = (
state: State,
@@ -44,10 +40,7 @@ const selectTopNFlowByType = (
};
export const topNFlowSelector = () =>
- createSelector(
- selectTopNFlowByType,
- topNFlowQueries => topNFlowQueries
- );
+ createSelector(selectTopNFlowByType, topNFlowQueries => topNFlowQueries);
const selectTlsByType = (state: State, networkType: NetworkType) => {
const tlsType = networkType === NetworkType.page ? NetworkTableType.tls : IpDetailsTableType.tls;
return (
@@ -56,11 +49,7 @@ const selectTlsByType = (state: State, networkType: NetworkType) => {
);
};
-export const tlsSelector = () =>
- createSelector(
- selectTlsByType,
- tlsQueries => tlsQueries
- );
+export const tlsSelector = () => createSelector(selectTlsByType, tlsQueries => tlsQueries);
const selectTopCountriesByType = (
state: State,
@@ -79,10 +68,7 @@ const selectTopCountriesByType = (
};
export const topCountriesSelector = () =>
- createSelector(
- selectTopCountriesByType,
- topCountriesQueries => topCountriesQueries
- );
+ createSelector(selectTopCountriesByType, topCountriesQueries => topCountriesQueries);
const selectHttpByType = (state: State, networkType: NetworkType) => {
const httpType =
@@ -93,21 +79,11 @@ const selectHttpByType = (state: State, networkType: NetworkType) => {
);
};
-export const httpSelector = () =>
- createSelector(
- selectHttpByType,
- httpQueries => httpQueries
- );
+export const httpSelector = () => createSelector(selectHttpByType, httpQueries => httpQueries);
// IP Details Selectors
export const ipDetailsFlowTargetSelector = () =>
- createSelector(
- selectNetworkDetails,
- network => network.flowTarget
- );
+ createSelector(selectNetworkDetails, network => network.flowTarget);
export const usersSelector = () =>
- createSelector(
- selectNetworkDetails,
- network => network.queries.users
- );
+ createSelector(selectNetworkDetails, network => network.queries.users);
diff --git a/x-pack/legacy/plugins/siem/public/store/timeline/epic.ts b/x-pack/legacy/plugins/siem/public/store/timeline/epic.ts
index 8d4a93ca97eb3..6957db5578af5 100644
--- a/x-pack/legacy/plugins/siem/public/store/timeline/epic.ts
+++ b/x-pack/legacy/plugins/siem/public/store/timeline/epic.ts
@@ -107,20 +107,11 @@ export const createTimelineEpic = (): Epic<
state$,
{ selectNotesByIdSelector, timelineByIdSelector, timelineTimeRangeSelector, apolloClient$ }
) => {
- const timeline$ = state$.pipe(
- map(timelineByIdSelector),
- filter(isNotNull)
- );
+ const timeline$ = state$.pipe(map(timelineByIdSelector), filter(isNotNull));
- const notes$ = state$.pipe(
- map(selectNotesByIdSelector),
- filter(isNotNull)
- );
+ const notes$ = state$.pipe(map(selectNotesByIdSelector), filter(isNotNull));
- const timelineTimeRange$ = state$.pipe(
- map(timelineTimeRangeSelector),
- filter(isNotNull)
- );
+ const timelineTimeRange$ = state$.pipe(map(timelineTimeRangeSelector), filter(isNotNull));
return merge(
action$.pipe(
diff --git a/x-pack/legacy/plugins/siem/public/store/timeline/model.ts b/x-pack/legacy/plugins/siem/public/store/timeline/model.ts
index 50cfd89fd057a..3b10314f72531 100644
--- a/x-pack/legacy/plugins/siem/public/store/timeline/model.ts
+++ b/x-pack/legacy/plugins/siem/public/store/timeline/model.ts
@@ -71,35 +71,33 @@ export interface TimelineModel {
version: string | null;
}
-export const timelineDefaults: Readonly<
- Pick<
- TimelineModel,
- | 'columns'
- | 'dataProviders'
- | 'description'
- | 'eventIdToNoteIds'
- | 'highlightedDropAndProviderId'
- | 'historyIds'
- | 'isFavorite'
- | 'isLive'
- | 'itemsPerPage'
- | 'itemsPerPageOptions'
- | 'kqlMode'
- | 'kqlQuery'
- | 'title'
- | 'noteIds'
- | 'pinnedEventIds'
- | 'pinnedEventsSaveObject'
- | 'dateRange'
- | 'show'
- | 'sort'
- | 'width'
- | 'isSaving'
- | 'isLoading'
- | 'savedObjectId'
- | 'version'
- >
-> = {
+export const timelineDefaults: Readonly> = {
columns: defaultHeaders,
dataProviders: [],
description: '',
@@ -135,32 +133,30 @@ export const timelineDefaults: Readonly<
version: null,
};
-export const eventsDefaults: Readonly<
- Pick<
- TimelineModel,
- | 'columns'
- | 'dataProviders'
- | 'description'
- | 'eventIdToNoteIds'
- | 'highlightedDropAndProviderId'
- | 'historyIds'
- | 'isFavorite'
- | 'isLive'
- | 'itemsPerPage'
- | 'itemsPerPageOptions'
- | 'kqlMode'
- | 'kqlQuery'
- | 'title'
- | 'noteIds'
- | 'pinnedEventIds'
- | 'pinnedEventsSaveObject'
- | 'dateRange'
- | 'show'
- | 'sort'
- | 'width'
- | 'isSaving'
- | 'isLoading'
- | 'savedObjectId'
- | 'version'
- >
-> = { ...timelineDefaults, columns: eventsDefaultHeaders };
+export const eventsDefaults: Readonly> = { ...timelineDefaults, columns: eventsDefaultHeaders };
diff --git a/x-pack/legacy/plugins/siem/public/store/timeline/selectors.ts b/x-pack/legacy/plugins/siem/public/store/timeline/selectors.ts
index 14f51a601fa7f..c248387e6b3fd 100644
--- a/x-pack/legacy/plugins/siem/public/store/timeline/selectors.ts
+++ b/x-pack/legacy/plugins/siem/public/store/timeline/selectors.ts
@@ -22,10 +22,7 @@ const selectCallOutUnauthorizedMsg = (state: State): boolean =>
export const selectTimeline = (state: State, timelineId: string): TimelineModel =>
state.timeline.timelineById[timelineId];
-export const autoSaveMsgSelector = createSelector(
- selectAutoSaveMsg,
- autoSaveMsg => autoSaveMsg
-);
+export const autoSaveMsgSelector = createSelector(selectAutoSaveMsg, autoSaveMsg => autoSaveMsg);
export const timelineByIdSelector = createSelector(
selectTimelineById,
@@ -41,45 +38,34 @@ export const getShowCallOutUnauthorizedMsg = () =>
export const getTimelines = () => timelineByIdSelector;
export const getTimelineByIdSelector = () =>
- createSelector(
- selectTimeline,
- timeline => timeline || timelineDefaults
- );
+ createSelector(selectTimeline, timeline => timeline || timelineDefaults);
export const getEventsByIdSelector = () =>
- createSelector(
- selectTimeline,
- timeline => timeline || eventsDefaults
- );
+ createSelector(selectTimeline, timeline => timeline || eventsDefaults);
export const getKqlFilterQuerySelector = () =>
- createSelector(
- selectTimeline,
- timeline =>
- timeline &&
- timeline.kqlQuery &&
- timeline.kqlQuery.filterQuery &&
- timeline.kqlQuery.filterQuery.kuery
- ? timeline.kqlQuery.filterQuery.kuery.expression
- : null
+ createSelector(selectTimeline, timeline =>
+ timeline &&
+ timeline.kqlQuery &&
+ timeline.kqlQuery.filterQuery &&
+ timeline.kqlQuery.filterQuery.kuery
+ ? timeline.kqlQuery.filterQuery.kuery.expression
+ : null
);
export const getKqlFilterQueryDraftSelector = () =>
- createSelector(
- selectTimeline,
- timeline => (timeline && timeline.kqlQuery ? timeline.kqlQuery.filterQueryDraft : null)
+ createSelector(selectTimeline, timeline =>
+ timeline && timeline.kqlQuery ? timeline.kqlQuery.filterQueryDraft : null
);
export const getKqlFilterKuerySelector = () =>
- createSelector(
- selectTimeline,
- timeline =>
- timeline &&
- timeline.kqlQuery &&
- timeline.kqlQuery.filterQuery &&
- timeline.kqlQuery.filterQuery.kuery
- ? timeline.kqlQuery.filterQuery.kuery
- : null
+ createSelector(selectTimeline, timeline =>
+ timeline &&
+ timeline.kqlQuery &&
+ timeline.kqlQuery.filterQuery &&
+ timeline.kqlQuery.filterQuery.kuery
+ ? timeline.kqlQuery.filterQuery.kuery
+ : null
);
export const isFilterQueryDraftValidSelector = () =>
diff --git a/x-pack/legacy/plugins/siem/server/lib/detection_engine/alerts/delete_signals.ts b/x-pack/legacy/plugins/siem/server/lib/detection_engine/alerts/delete_signals.ts
index 007d8b9325a86..7a69c11ecf2e5 100644
--- a/x-pack/legacy/plugins/siem/server/lib/detection_engine/alerts/delete_signals.ts
+++ b/x-pack/legacy/plugins/siem/server/lib/detection_engine/alerts/delete_signals.ts
@@ -26,7 +26,7 @@ export const deleteSignals = async ({ alertsClient, actionsClient, id }: DeleteS
// TODO: Remove this as cast as soon as signal.actions TypeScript bug is fixed
// where it is trying to return AlertAction[] or RawAlertAction[]
- const actions = (signal.actions as (AlertAction[] | undefined)) || [];
+ const actions = (signal.actions as AlertAction[] | undefined) || [];
const actionsErrors = await deleteAllSignalActions(actionsClient, actions);
const deletedAlert = await alertsClient.delete({ id: signal.id });
diff --git a/x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/schemas.test.ts b/x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/schemas.test.ts
index 456a79efe874a..1045826bf488f 100644
--- a/x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/schemas.test.ts
+++ b/x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/schemas.test.ts
@@ -1153,7 +1153,9 @@ describe('update_signals', () => {
});
test('page validates', () => {
- expect(findSignalsSchema.validate>({ page: 5 }).error).toBeFalsy();
+ expect(
+ findSignalsSchema.validate>({ page: 5 }).error
+ ).toBeFalsy();
});
test('sort_field validates', () => {
diff --git a/x-pack/legacy/plugins/siem/server/lib/index_fields/elasticsearch_adapter.ts b/x-pack/legacy/plugins/siem/server/lib/index_fields/elasticsearch_adapter.ts
index 2bae05dbe3b93..83eecc459cd6e 100644
--- a/x-pack/legacy/plugins/siem/server/lib/index_fields/elasticsearch_adapter.ts
+++ b/x-pack/legacy/plugins/siem/server/lib/index_fields/elasticsearch_adapter.ts
@@ -44,9 +44,10 @@ export class ElasticsearchIndexFieldAdapter implements FieldsAdapter {
})
)
);
- return formatIndexFields(responsesIndexFields, Object.keys(
- indexesAliasIndices
- ) as IndexAlias[]);
+ return formatIndexFields(
+ responsesIndexFields,
+ Object.keys(indexesAliasIndices) as IndexAlias[]
+ );
}
}
diff --git a/x-pack/legacy/plugins/siem/server/lib/uncommon_processes/elasticsearch_adapter.test.ts b/x-pack/legacy/plugins/siem/server/lib/uncommon_processes/elasticsearch_adapter.test.ts
index 208681d002b5b..90839f5ac01c4 100644
--- a/x-pack/legacy/plugins/siem/server/lib/uncommon_processes/elasticsearch_adapter.test.ts
+++ b/x-pack/legacy/plugins/siem/server/lib/uncommon_processes/elasticsearch_adapter.test.ts
@@ -161,7 +161,10 @@ describe('elasticsearch_adapter', () => {
test('will return two hosts correctly', () => {
const hosts = getHosts(bucket2.hosts.buckets);
- expect(hosts).toEqual([{ id: ['123'], name: ['host-1'] }, { id: ['345'], name: ['host-2'] }]);
+ expect(hosts).toEqual([
+ { id: ['123'], name: ['host-1'] },
+ { id: ['345'], name: ['host-2'] },
+ ]);
});
test('will return a dot notation host', () => {
diff --git a/x-pack/legacy/plugins/siem/server/utils/build_query/fields.ts b/x-pack/legacy/plugins/siem/server/utils/build_query/fields.ts
index 574ec2d03bcf9..979262c7faff3 100644
--- a/x-pack/legacy/plugins/siem/server/utils/build_query/fields.ts
+++ b/x-pack/legacy/plugins/siem/server/utils/build_query/fields.ts
@@ -15,21 +15,18 @@ export const getFields = (
if (data.kind === 'Field' && data.selectionSet && !isEmpty(data.selectionSet.selections)) {
return getFields(data.selectionSet, fields);
} else if (data.kind === 'SelectionSet') {
- return data.selections.reduce(
- (res: string[], item: SelectionNode) => {
- if (item.kind === 'Field') {
- const field: FieldNode = item as FieldNode;
- if (field.name.kind === 'Name' && field.name.value.includes('kpi')) {
- return [...res, field.name.value];
- } else if (field.selectionSet && !isEmpty(field.selectionSet.selections)) {
- return getFields(field.selectionSet, res, postFields.concat(field.name.value));
- }
- return [...res, [...postFields, field.name.value].join('.')];
+ return data.selections.reduce((res: string[], item: SelectionNode) => {
+ if (item.kind === 'Field') {
+ const field: FieldNode = item as FieldNode;
+ if (field.name.kind === 'Name' && field.name.value.includes('kpi')) {
+ return [...res, field.name.value];
+ } else if (field.selectionSet && !isEmpty(field.selectionSet.selections)) {
+ return getFields(field.selectionSet, res, postFields.concat(field.name.value));
}
- return res;
- },
- fields as string[]
- );
+ return [...res, [...postFields, field.name.value].join('.')];
+ }
+ return res;
+ }, fields as string[]);
}
return fields;
diff --git a/x-pack/legacy/plugins/snapshot_restore/public/app/lib/authorization/components/with_privileges.tsx b/x-pack/legacy/plugins/snapshot_restore/public/app/lib/authorization/components/with_privileges.tsx
index 004ec8b9c0517..797e7480454a3 100644
--- a/x-pack/legacy/plugins/snapshot_restore/public/app/lib/authorization/components/with_privileges.tsx
+++ b/x-pack/legacy/plugins/snapshot_restore/public/app/lib/authorization/components/with_privileges.tsx
@@ -59,22 +59,19 @@ export const WithPrivileges = ({ privileges: requiredPrivileges, children }: Pro
return !privileges.missingPrivileges[section]!.includes(requiredPrivilege);
});
- const privilegesMissing = privilegesToArray.reduce(
- (acc, [section, privilege]) => {
- if (privilege === '*') {
- acc[section] = privileges.missingPrivileges[section] || [];
- } else if (
- privileges.missingPrivileges[section] &&
- privileges.missingPrivileges[section]!.includes(privilege)
- ) {
- const missing: string[] = acc[section] || [];
- acc[section] = [...missing, privilege];
- }
+ const privilegesMissing = privilegesToArray.reduce((acc, [section, privilege]) => {
+ if (privilege === '*') {
+ acc[section] = privileges.missingPrivileges[section] || [];
+ } else if (
+ privileges.missingPrivileges[section] &&
+ privileges.missingPrivileges[section]!.includes(privilege)
+ ) {
+ const missing: string[] = acc[section] || [];
+ acc[section] = [...missing, privilege];
+ }
- return acc;
- },
- {} as MissingPrivileges
- );
+ return acc;
+ }, {} as MissingPrivileges);
return children({ isLoading, hasPrivileges, privilegesMissing });
};
diff --git a/x-pack/legacy/plugins/snapshot_restore/public/app/sections/home/policy_list/policy_table/policy_table.tsx b/x-pack/legacy/plugins/snapshot_restore/public/app/sections/home/policy_list/policy_table/policy_table.tsx
index 01fc904906bf1..62038f9963836 100644
--- a/x-pack/legacy/plugins/snapshot_restore/public/app/sections/home/policy_list/policy_table/policy_table.tsx
+++ b/x-pack/legacy/plugins/snapshot_restore/public/app/sections/home/policy_list/policy_table/policy_table.tsx
@@ -308,7 +308,10 @@ export const PolicyTable: React.FunctionComponent = ({
return (
- deletePolicyPrompt(selectedItems.map(({ name }) => name), onPolicyDeleted)
+ deletePolicyPrompt(
+ selectedItems.map(({ name }) => name),
+ onPolicyDeleted
+ )
}
color="danger"
data-test-subj="srPolicyListBulkDeleteActionButton"
diff --git a/x-pack/legacy/plugins/task_manager/lib/fill_pool.test.ts b/x-pack/legacy/plugins/task_manager/lib/fill_pool.test.ts
index d7ac8d227fc4c..c4927475d586b 100644
--- a/x-pack/legacy/plugins/task_manager/lib/fill_pool.test.ts
+++ b/x-pack/legacy/plugins/task_manager/lib/fill_pool.test.ts
@@ -11,7 +11,10 @@ import { TaskPoolRunResult } from '../task_pool';
describe('fillPool', () => {
test('stops filling when there are no more tasks in the store', async () => {
- const tasks = [[1, 2, 3], [4, 5]];
+ const tasks = [
+ [1, 2, 3],
+ [4, 5],
+ ];
let index = 0;
const fetchAvailableTasks = async () => tasks[index++] || [];
const run = sinon.spy(async () => TaskPoolRunResult.RunningAllClaimedTasks);
@@ -23,7 +26,10 @@ describe('fillPool', () => {
});
test('stops filling when the pool has no more capacity', async () => {
- const tasks = [[1, 2, 3], [4, 5]];
+ const tasks = [
+ [1, 2, 3],
+ [4, 5],
+ ];
let index = 0;
const fetchAvailableTasks = async () => tasks[index++] || [];
const run = sinon.spy(async () => TaskPoolRunResult.RanOutOfCapacity);
@@ -35,7 +41,10 @@ describe('fillPool', () => {
});
test('calls the converter on the records prior to running', async () => {
- const tasks = [[1, 2, 3], [4, 5]];
+ const tasks = [
+ [1, 2, 3],
+ [4, 5],
+ ];
let index = 0;
const fetchAvailableTasks = async () => tasks[index++] || [];
const run = sinon.spy(async () => TaskPoolRunResult.RanOutOfCapacity);
@@ -66,7 +75,10 @@ describe('fillPool', () => {
const converter = (x: number) => x.toString();
try {
- const tasks = [[1, 2, 3], [4, 5]];
+ const tasks = [
+ [1, 2, 3],
+ [4, 5],
+ ];
let index = 0;
const fetchAvailableTasks = async () => tasks[index++] || [];
@@ -78,7 +90,10 @@ describe('fillPool', () => {
test('throws exception from converter', async () => {
try {
- const tasks = [[1, 2, 3], [4, 5]];
+ const tasks = [
+ [1, 2, 3],
+ [4, 5],
+ ];
let index = 0;
const fetchAvailableTasks = async () => tasks[index++] || [];
const run = sinon.spy(async () => TaskPoolRunResult.RanOutOfCapacity);
diff --git a/x-pack/legacy/plugins/task_manager/lib/sanitize_task_definitions.ts b/x-pack/legacy/plugins/task_manager/lib/sanitize_task_definitions.ts
index 24cb50a59adc8..f5856aa6fac33 100644
--- a/x-pack/legacy/plugins/task_manager/lib/sanitize_task_definitions.ts
+++ b/x-pack/legacy/plugins/task_manager/lib/sanitize_task_definitions.ts
@@ -16,13 +16,10 @@ import { TaskDefinition, TaskDictionary, validateTaskDefinition } from '../task'
export function sanitizeTaskDefinitions(
taskDefinitions: TaskDictionary = {}
): TaskDictionary {
- return Object.keys(taskDefinitions).reduce(
- (acc, type) => {
- const rawDefinition = taskDefinitions[type];
- rawDefinition.type = type;
- acc[type] = Joi.attempt(rawDefinition, validateTaskDefinition) as TaskDefinition;
- return acc;
- },
- {} as TaskDictionary
- );
+ return Object.keys(taskDefinitions).reduce((acc, type) => {
+ const rawDefinition = taskDefinitions[type];
+ rawDefinition.type = type;
+ acc[type] = Joi.attempt(rawDefinition, validateTaskDefinition) as TaskDefinition;
+ return acc;
+ }, {} as TaskDictionary);
}
diff --git a/x-pack/legacy/plugins/transform/common/utils/es_utils.ts b/x-pack/legacy/plugins/transform/common/utils/es_utils.ts
index c52b99c350e38..bed7ba8bc7736 100644
--- a/x-pack/legacy/plugins/transform/common/utils/es_utils.ts
+++ b/x-pack/legacy/plugins/transform/common/utils/es_utils.ts
@@ -33,7 +33,8 @@ export function isValidIndexName(indexName: string) {
// Cannot start with -, _, +
/^[^-_\+]+$/.test(indexName.charAt(0)) &&
// Cannot be . or ..
- (indexName !== '.' && indexName !== '..') &&
+ indexName !== '.' &&
+ indexName !== '..' &&
// Cannot be longer than 255 bytes (note it is bytes,
// so multi-byte characters will count towards the 255 limit faster)
isValidIndexNameLength(indexName)
diff --git a/x-pack/legacy/plugins/transform/public/app/hooks/use_get_transforms.ts b/x-pack/legacy/plugins/transform/public/app/hooks/use_get_transforms.ts
index df2ce6b56a5af..eec93d4e08996 100644
--- a/x-pack/legacy/plugins/transform/public/app/hooks/use_get_transforms.ts
+++ b/x-pack/legacy/plugins/transform/public/app/hooks/use_get_transforms.ts
@@ -70,32 +70,27 @@ export const useGetTransforms = (
const transformConfigs: GetTransformsResponse = await api.getTransforms();
const transformStats: GetTransformsStatsResponse = await api.getTransformsStats();
- const tableRows = transformConfigs.transforms.reduce(
- (reducedtableRows, config) => {
- const stats = isGetTransformsStatsResponseOk(transformStats)
- ? transformStats.transforms.find(d => config.id === d.id)
- : undefined;
-
- // A newly created transform might not have corresponding stats yet.
- // If that's the case we just skip the transform and don't add it to the transform list yet.
- if (!isTransformStats(stats)) {
- return reducedtableRows;
- }
-
- // Table with expandable rows requires `id` on the outer most level
- reducedtableRows.push({
- id: config.id,
- config,
- mode:
- typeof config.sync !== 'undefined'
- ? TRANSFORM_MODE.CONTINUOUS
- : TRANSFORM_MODE.BATCH,
- stats,
- });
+ const tableRows = transformConfigs.transforms.reduce((reducedtableRows, config) => {
+ const stats = isGetTransformsStatsResponseOk(transformStats)
+ ? transformStats.transforms.find(d => config.id === d.id)
+ : undefined;
+
+ // A newly created transform might not have corresponding stats yet.
+ // If that's the case we just skip the transform and don't add it to the transform list yet.
+ if (!isTransformStats(stats)) {
return reducedtableRows;
- },
- [] as TransformListRow[]
- );
+ }
+
+ // Table with expandable rows requires `id` on the outer most level
+ reducedtableRows.push({
+ id: config.id,
+ config,
+ mode:
+ typeof config.sync !== 'undefined' ? TRANSFORM_MODE.CONTINUOUS : TRANSFORM_MODE.BATCH,
+ stats,
+ });
+ return reducedtableRows;
+ }, [] as TransformListRow[]);
setTransforms(tableRows);
setErrorMessage(undefined);
diff --git a/x-pack/legacy/plugins/transform/public/app/lib/authorization/components/with_privileges.tsx b/x-pack/legacy/plugins/transform/public/app/lib/authorization/components/with_privileges.tsx
index 8bf7ea66d28b1..91e5be5331203 100644
--- a/x-pack/legacy/plugins/transform/public/app/lib/authorization/components/with_privileges.tsx
+++ b/x-pack/legacy/plugins/transform/public/app/lib/authorization/components/with_privileges.tsx
@@ -45,22 +45,19 @@ export const WithPrivileges = ({ privileges: requiredPrivileges, children }: Pro
const hasPrivilege = hasPrivilegeFactory(privileges);
const hasPrivileges = isLoading ? false : privilegesToArray.every(hasPrivilege);
- const privilegesMissing = privilegesToArray.reduce(
- (acc, [section, privilege]) => {
- if (privilege === '*') {
- acc[section] = privileges.missingPrivileges[section] || [];
- } else if (
- privileges.missingPrivileges[section] &&
- privileges.missingPrivileges[section]!.includes(privilege)
- ) {
- const missing: string[] = acc[section] || [];
- acc[section] = [...missing, privilege];
- }
+ const privilegesMissing = privilegesToArray.reduce((acc, [section, privilege]) => {
+ if (privilege === '*') {
+ acc[section] = privileges.missingPrivileges[section] || [];
+ } else if (
+ privileges.missingPrivileges[section] &&
+ privileges.missingPrivileges[section]!.includes(privilege)
+ ) {
+ const missing: string[] = acc[section] || [];
+ acc[section] = [...missing, privilege];
+ }
- return acc;
- },
- {} as MissingPrivileges
- );
+ return acc;
+ }, {} as MissingPrivileges);
return children({ isLoading, hasPrivileges, privilegesMissing });
};
diff --git a/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/source_index_preview/expanded_row.test.tsx b/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/source_index_preview/expanded_row.test.tsx
index ea81b33afbd23..bfde8f171874e 100644
--- a/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/source_index_preview/expanded_row.test.tsx
+++ b/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/source_index_preview/expanded_row.test.tsx
@@ -24,16 +24,13 @@ describe('Transform: ', () => {
arrayObject: [{ object1: 'the-object-1' }, { object2: 'the-objects-2' }],
} as Record;
- const flattenedSource = getFlattenedFields(source).reduce(
- (p, c) => {
- p[c] = getNestedProperty(source, c);
- if (p[c] === undefined) {
- p[c] = source[`"${c}"`];
- }
- return p;
- },
- {} as Record
- );
+ const flattenedSource = getFlattenedFields(source).reduce((p, c) => {
+ p[c] = getNestedProperty(source, c);
+ if (p[c] === undefined) {
+ p[c] = source[`"${c}"`];
+ }
+ return p;
+ }, {} as Record);
const props = {
item: {
diff --git a/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/transform_list.tsx b/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/transform_list.tsx
index a7e4e49440089..c6bae80e6de96 100644
--- a/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/transform_list.tsx
+++ b/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/transform_list.tsx
@@ -48,16 +48,13 @@ function getItemIdToExpandedRowMap(
itemIds: TransformId[],
transforms: TransformListRow[]
): ItemIdToExpandedRowMap {
- return itemIds.reduce(
- (m: ItemIdToExpandedRowMap, transformId: TransformId) => {
- const item = transforms.find(transform => transform.config.id === transformId);
- if (item !== undefined) {
- m[transformId] = ;
- }
- return m;
- },
- {} as ItemIdToExpandedRowMap
- );
+ return itemIds.reduce((m: ItemIdToExpandedRowMap, transformId: TransformId) => {
+ const item = transforms.find(transform => transform.config.id === transformId);
+ if (item !== undefined) {
+ m[transformId] = ;
+ }
+ return m;
+ }, {} as ItemIdToExpandedRowMap);
}
function stringMatch(str: string | undefined, substr: string) {
diff --git a/x-pack/legacy/plugins/upgrade_assistant/public/components/error_banner.tsx b/x-pack/legacy/plugins/upgrade_assistant/public/components/error_banner.tsx
index cb796230bf942..527f2b6486d7f 100644
--- a/x-pack/legacy/plugins/upgrade_assistant/public/components/error_banner.tsx
+++ b/x-pack/legacy/plugins/upgrade_assistant/public/components/error_banner.tsx
@@ -12,9 +12,10 @@ import { FormattedMessage } from '@kbn/i18n/react';
import { UpgradeAssistantTabProps } from './types';
-export const LoadingErrorBanner: React.StatelessComponent<
- Pick
-> = ({ loadingError }) => {
+export const LoadingErrorBanner: React.StatelessComponent> = ({ loadingError }) => {
if (get(loadingError, 'response.status') === 403) {
return (
{
- checkedIds[idForWarning(warning)] = false;
- return checkedIds;
- },
- {} as { [id: string]: boolean }
- ),
+ checkedIds: props.warnings.reduce((checkedIds, warning) => {
+ checkedIds[idForWarning(warning)] = false;
+ return checkedIds;
+ }, {} as { [id: string]: boolean }),
};
}
diff --git a/x-pack/legacy/plugins/upgrade_assistant/public/components/tabs/checkup/filter_bar.tsx b/x-pack/legacy/plugins/upgrade_assistant/public/components/tabs/checkup/filter_bar.tsx
index e04acfd5bf51e..0921b5e7e5cfa 100644
--- a/x-pack/legacy/plugins/upgrade_assistant/public/components/tabs/checkup/filter_bar.tsx
+++ b/x-pack/legacy/plugins/upgrade_assistant/public/components/tabs/checkup/filter_bar.tsx
@@ -37,13 +37,10 @@ export const FilterBar: React.StatelessComponent = ({
onFilterChange,
}) => {
const levelGroups = groupBy(allDeprecations, 'level');
- const levelCounts = Object.keys(levelGroups).reduce(
- (counts, level) => {
- counts[level] = levelGroups[level].length;
- return counts;
- },
- {} as { [level: string]: number }
- );
+ const levelCounts = Object.keys(levelGroups).reduce((counts, level) => {
+ counts[level] = levelGroups[level].length;
+ return counts;
+ }, {} as { [level: string]: number });
const allCount = allDeprecations.length;
diff --git a/x-pack/legacy/plugins/upgrade_assistant/public/components/tabs/overview/steps.tsx b/x-pack/legacy/plugins/upgrade_assistant/public/components/tabs/overview/steps.tsx
index 13d267cc5c31e..d43a86d2b0e06 100644
--- a/x-pack/legacy/plugins/upgrade_assistant/public/components/tabs/overview/steps.tsx
+++ b/x-pack/legacy/plugins/upgrade_assistant/public/components/tabs/overview/steps.tsx
@@ -92,17 +92,13 @@ const START_UPGRADE_STEP = {
),
};
-export const StepsUI: StatelessComponent<
- UpgradeAssistantTabProps & ReactIntl.InjectedIntlProps
-> = ({ checkupData, setSelectedTabIndex, intl }) => {
+export const StepsUI: StatelessComponent = ({ checkupData, setSelectedTabIndex, intl }) => {
const checkupDataTyped = (checkupData! as unknown) as { [checkupType: string]: any[] };
- const countByType = Object.keys(checkupDataTyped).reduce(
- (counts, checkupType) => {
- counts[checkupType] = checkupDataTyped[checkupType].length;
- return counts;
- },
- {} as { [checkupType: string]: number }
- );
+ const countByType = Object.keys(checkupDataTyped).reduce((counts, checkupType) => {
+ counts[checkupType] = checkupDataTyped[checkupType].length;
+ return counts;
+ }, {} as { [checkupType: string]: number });
return (
- Object.keys(deprecations.index_settings).reduce(
- (indexDeprecations, indexName) => {
- return indexDeprecations.concat(
- deprecations.index_settings[indexName].map(
- d =>
- ({
- ...d,
- index: indexName,
- reindex: /Index created before/.test(d.message),
- } as EnrichedDeprecationInfo)
- )
- );
- },
- [] as EnrichedDeprecationInfo[]
- );
+ Object.keys(deprecations.index_settings).reduce((indexDeprecations, indexName) => {
+ return indexDeprecations.concat(
+ deprecations.index_settings[indexName].map(
+ d =>
+ ({
+ ...d,
+ index: indexName,
+ reindex: /Index created before/.test(d.message),
+ } as EnrichedDeprecationInfo)
+ )
+ );
+ }, [] as EnrichedDeprecationInfo[]);
const getClusterDeprecations = (deprecations: DeprecationAPIResponse, isCloudEnabled: boolean) => {
const combined = deprecations.cluster_settings
diff --git a/x-pack/legacy/plugins/upgrade_assistant/server/lib/reindexing/reindex_service.ts b/x-pack/legacy/plugins/upgrade_assistant/server/lib/reindexing/reindex_service.ts
index 6fe4d72db3f16..41a4552b722de 100644
--- a/x-pack/legacy/plugins/upgrade_assistant/server/lib/reindexing/reindex_service.ts
+++ b/x-pack/legacy/plugins/upgrade_assistant/server/lib/reindexing/reindex_service.ts
@@ -393,9 +393,11 @@ export const reindexServiceFactory = (
const switchAlias = async (reindexOp: ReindexSavedObject) => {
const { indexName, newIndexName } = reindexOp.attributes;
- const existingAliases = (await callCluster('indices.getAlias', {
- index: indexName,
- }))[indexName].aliases;
+ const existingAliases = (
+ await callCluster('indices.getAlias', {
+ index: indexName,
+ })
+ )[indexName].aliases;
const extraAlises = Object.keys(existingAliases).map(aliasName => ({
add: { index: newIndexName, alias: aliasName, ...existingAliases[aliasName] },
diff --git a/x-pack/legacy/plugins/uptime/public/components/higher_order/uptime_graphql_query.tsx b/x-pack/legacy/plugins/uptime/public/components/higher_order/uptime_graphql_query.tsx
index 3228b15297974..219f92ce36e63 100644
--- a/x-pack/legacy/plugins/uptime/public/components/higher_order/uptime_graphql_query.tsx
+++ b/x-pack/legacy/plugins/uptime/public/components/higher_order/uptime_graphql_query.tsx
@@ -51,14 +51,16 @@ export function withUptimeGraphQL(WrappedComponent: any, query: any)
const { client, implementsCustomErrorState, variables } = props;
const fetch = () => {
setLoading(true);
- client.query({ fetchPolicy: 'network-only', query, variables }).then(
- (result: any) => {
- updateState(result.loading, result.data, result.errors);
- },
- (result: any) => {
- updateState(false, undefined, result.graphQLErrors);
- }
- );
+ client
+ .query({ fetchPolicy: 'network-only', query, variables })
+ .then(
+ (result: any) => {
+ updateState(result.loading, result.data, result.errors);
+ },
+ (result: any) => {
+ updateState(false, undefined, result.graphQLErrors);
+ }
+ );
};
useEffect(() => {
fetch();
diff --git a/x-pack/legacy/plugins/uptime/public/lib/helper/__tests__/series_has_down_values.test.ts b/x-pack/legacy/plugins/uptime/public/lib/helper/__tests__/series_has_down_values.test.ts
index 23ead8271f6ff..b739575a1dd4a 100644
--- a/x-pack/legacy/plugins/uptime/public/lib/helper/__tests__/series_has_down_values.test.ts
+++ b/x-pack/legacy/plugins/uptime/public/lib/helper/__tests__/series_has_down_values.test.ts
@@ -18,7 +18,10 @@ describe('seriesHasDownValues', () => {
it('identifies that a series does not have down values', () => {
expect(
- seriesHasDownValues([{ timestamp: 123, down: 0, up: 0 }, { timestamp: 125, down: 0, up: 0 }])
+ seriesHasDownValues([
+ { timestamp: 123, down: 0, up: 0 },
+ { timestamp: 125, down: 0, up: 0 },
+ ])
).toBe(false);
});
});
diff --git a/x-pack/legacy/plugins/uptime/server/kibana.index.ts b/x-pack/legacy/plugins/uptime/server/kibana.index.ts
index 099bbe2fc7185..874fb2e37e902 100644
--- a/x-pack/legacy/plugins/uptime/server/kibana.index.ts
+++ b/x-pack/legacy/plugins/uptime/server/kibana.index.ts
@@ -31,10 +31,7 @@ export interface KibanaServer extends Server {
export const initServerWithKibana = (server: UptimeCoreSetup, plugins: UptimeCorePlugins) => {
const { usageCollector, xpack } = plugins;
- const libs = compose(
- server,
- plugins
- );
+ const libs = compose(server, plugins);
usageCollector.collectorSet.register(KibanaTelemetryAdapter.initUsageCollector(usageCollector));
initUptimeServer(libs);
diff --git a/x-pack/legacy/plugins/uptime/server/lib/adapters/pings/elasticsearch_pings_adapter.ts b/x-pack/legacy/plugins/uptime/server/lib/adapters/pings/elasticsearch_pings_adapter.ts
index cad8b412f3e58..6c71d91794003 100644
--- a/x-pack/legacy/plugins/uptime/server/lib/adapters/pings/elasticsearch_pings_adapter.ts
+++ b/x-pack/legacy/plugins/uptime/server/lib/adapters/pings/elasticsearch_pings_adapter.ts
@@ -166,13 +166,19 @@ export class ElasticsearchPingsAdapter implements UMPingsAdapter {
const buckets: any[] = get(result, 'aggregations.by_id.buckets', []);
// @ts-ignore TODO fix destructuring implicit any
- return buckets.map(({ latest: { hits: { hits } } }) => {
- const timestamp = hits[0]._source[`@timestamp`];
- return {
- ...hits[0]._source,
- timestamp,
- };
- });
+ return buckets.map(
+ ({
+ latest: {
+ hits: { hits },
+ },
+ }) => {
+ const timestamp = hits[0]._source[`@timestamp`];
+ return {
+ ...hits[0]._source,
+ timestamp,
+ };
+ }
+ );
}
/**
diff --git a/x-pack/legacy/plugins/watcher/__jest__/client_integration/watch_create_threshold.test.tsx b/x-pack/legacy/plugins/watcher/__jest__/client_integration/watch_create_threshold.test.tsx
index f281408c9d439..aa7cca6774548 100644
--- a/x-pack/legacy/plugins/watcher/__jest__/client_integration/watch_create_threshold.test.tsx
+++ b/x-pack/legacy/plugins/watcher/__jest__/client_integration/watch_create_threshold.test.tsx
@@ -33,7 +33,11 @@ const SETTINGS = {
};
const WATCH_VISUALIZE_DATA = {
- count: [[1559404800000, 14], [1559448000000, 196], [1559491200000, 44]],
+ count: [
+ [1559404800000, 14],
+ [1559448000000, 196],
+ [1559491200000, 44],
+ ],
};
const mockHttpClient = axios.create({ adapter: axiosXhrAdapter });
diff --git a/x-pack/legacy/plugins/watcher/public/sections/watch_edit/components/threshold_watch_edit/threshold_watch_edit.tsx b/x-pack/legacy/plugins/watcher/public/sections/watch_edit/components/threshold_watch_edit/threshold_watch_edit.tsx
index ee89d9bfc176a..910d4f1e0b15c 100644
--- a/x-pack/legacy/plugins/watcher/public/sections/watch_edit/components/threshold_watch_edit/threshold_watch_edit.tsx
+++ b/x-pack/legacy/plugins/watcher/public/sections/watch_edit/components/threshold_watch_edit/threshold_watch_edit.tsx
@@ -320,7 +320,10 @@ export const ThresholdWatchEdit = ({ pageTitle }: { pageTitle: string }) => {
};
})}
onChange={async (selected: EuiComboBoxOptionProps[]) => {
- setWatchProperty('index', selected.map(aSelected => aSelected.value));
+ setWatchProperty(
+ 'index',
+ selected.map(aSelected => aSelected.value)
+ );
const indices = selected.map(s => s.value as string);
// reset time field and expression fields if indices are deleted
diff --git a/x-pack/legacy/plugins/watcher/public/sections/watch_edit/components/watch_edit.tsx b/x-pack/legacy/plugins/watcher/public/sections/watch_edit/components/watch_edit.tsx
index f3ebee479b664..25daf190dc1b1 100644
--- a/x-pack/legacy/plugins/watcher/public/sections/watch_edit/components/watch_edit.tsx
+++ b/x-pack/legacy/plugins/watcher/public/sections/watch_edit/components/watch_edit.tsx
@@ -60,7 +60,7 @@ const watchReducer = (state: any, action: any) => {
} else {
return {
...state,
- watch: new (Watch.getWatchTypes())[watch.type]({
+ watch: new (Watch.getWatchTypes()[watch.type])({
...watch,
[property]: value,
}),
@@ -69,7 +69,7 @@ const watchReducer = (state: any, action: any) => {
case 'addAction':
const { type, defaults } = payload;
- const newWatch = new (Watch.getWatchTypes())[watch.type](watch);
+ const newWatch = new (Watch.getWatchTypes()[watch.type])(watch);
newWatch.createAction(type, defaults);
return {
...state,
diff --git a/x-pack/legacy/plugins/xpack_main/server/telemetry_collection/get_stats_with_xpack.ts b/x-pack/legacy/plugins/xpack_main/server/telemetry_collection/get_stats_with_xpack.ts
index f19695ca06525..6915da5263624 100644
--- a/x-pack/legacy/plugins/xpack_main/server/telemetry_collection/get_stats_with_xpack.ts
+++ b/x-pack/legacy/plugins/xpack_main/server/telemetry_collection/get_stats_with_xpack.ts
@@ -7,36 +7,19 @@
// @ts-ignore
import { getXPack } from './get_xpack';
import { getLocalStats } from '../../../../../../src/legacy/core_plugins/telemetry/server/telemetry_collection';
+import {
+ StatsGetter,
+ getStatsCollectionConfig,
+} from '../../../../../../src/legacy/core_plugins/telemetry/server/collection_manager';
-/**
- * Get the telemetry data.
- *
- * @param {Object} req The incoming request.
- * @param {Object} config Kibana config.
- * @param {String} start The start time of the request (likely 20m ago).
- * @param {String} end The end time of the request.
- * @param {Boolean} unencrypted Is the request payload going to be unencrypted.
- * @return {Promise} An array of telemetry objects.
- */
-export async function getStatsWithXpack(
- req: any,
- config: any,
- start: string,
- end: string,
- unencrypted: boolean
-) {
- const useInternalUser = !unencrypted;
- const { server } = req;
- const { callWithRequest, callWithInternalUser } = server.plugins.elasticsearch.getCluster('data');
- const callCluster = useInternalUser
- ? callWithInternalUser
- : (...args: any[]) => callWithRequest(req, ...args);
+export const getStatsWithXpack: StatsGetter = async function(config) {
+ const { server, callCluster } = getStatsCollectionConfig(config, 'data');
- const localStats = await getLocalStats(req, { useInternalUser });
+ const localStats = await getLocalStats({ server, callCluster });
const { license, xpack } = await getXPack(callCluster);
localStats.license = license;
localStats.stack_stats.xpack = xpack;
return [localStats];
-}
+};
diff --git a/x-pack/plugins/encrypted_saved_objects/server/crypto/index.mock.ts b/x-pack/plugins/encrypted_saved_objects/server/crypto/index.mock.ts
index b1795b9439808..54a4203b89191 100644
--- a/x-pack/plugins/encrypted_saved_objects/server/crypto/index.mock.ts
+++ b/x-pack/plugins/encrypted_saved_objects/server/crypto/index.mock.ts
@@ -14,7 +14,7 @@ export const encryptedSavedObjectsServiceMock = {
create(registrations: EncryptedSavedObjectTypeRegistration[] = []) {
const mock: jest.Mocked = new (jest.requireMock(
'./encrypted_saved_objects_service'
- )).EncryptedSavedObjectsService();
+ ).EncryptedSavedObjectsService)();
function processAttributes>(
descriptor: Pick,
diff --git a/x-pack/plugins/encrypted_saved_objects/server/saved_objects/encrypted_saved_objects_client_wrapper.test.ts b/x-pack/plugins/encrypted_saved_objects/server/saved_objects/encrypted_saved_objects_client_wrapper.test.ts
index 8574293e3e6a6..d101b55d6ad37 100644
--- a/x-pack/plugins/encrypted_saved_objects/server/saved_objects/encrypted_saved_objects_client_wrapper.test.ts
+++ b/x-pack/plugins/encrypted_saved_objects/server/saved_objects/encrypted_saved_objects_client_wrapper.test.ts
@@ -370,7 +370,12 @@ describe('#bulkUpdate', () => {
mockBaseClient.bulkUpdate.mockResolvedValue(mockedResponse);
- await expect(wrapper.bulkUpdate(docs.map(doc => ({ ...doc })), {})).resolves.toEqual({
+ await expect(
+ wrapper.bulkUpdate(
+ docs.map(doc => ({ ...doc })),
+ {}
+ )
+ ).resolves.toEqual({
saved_objects: [
{
id: 'some-id',
diff --git a/x-pack/plugins/features/server/ui_capabilities_for_features.ts b/x-pack/plugins/features/server/ui_capabilities_for_features.ts
index 0b3bdfb599343..22c9379686b34 100644
--- a/x-pack/plugins/features/server/ui_capabilities_for_features.ts
+++ b/x-pack/plugins/features/server/ui_capabilities_for_features.ts
@@ -56,27 +56,21 @@ function getCapabilitiesFromFeature(feature: Feature): FeatureCapabilities {
}
function buildCapabilities(...allFeatureCapabilities: FeatureCapabilities[]): UICapabilities {
- return allFeatureCapabilities.reduce(
- (acc, capabilities) => {
- const mergableCapabilities: UICapabilities = _.omit(
- capabilities,
- ...ELIGIBLE_FLAT_MERGE_KEYS
- );
+ return allFeatureCapabilities.reduce((acc, capabilities) => {
+ const mergableCapabilities: UICapabilities = _.omit(capabilities, ...ELIGIBLE_FLAT_MERGE_KEYS);
- const mergedFeatureCapabilities = {
- ...mergableCapabilities,
- ...acc,
- };
+ const mergedFeatureCapabilities = {
+ ...mergableCapabilities,
+ ...acc,
+ };
- ELIGIBLE_FLAT_MERGE_KEYS.forEach(key => {
- mergedFeatureCapabilities[key] = {
- ...mergedFeatureCapabilities[key],
- ...capabilities[key],
- };
- });
+ ELIGIBLE_FLAT_MERGE_KEYS.forEach(key => {
+ mergedFeatureCapabilities[key] = {
+ ...mergedFeatureCapabilities[key],
+ ...capabilities[key],
+ };
+ });
- return mergedFeatureCapabilities;
- },
- {} as UICapabilities
- );
+ return mergedFeatureCapabilities;
+ }, {} as UICapabilities);
}
diff --git a/x-pack/plugins/licensing/server/__fixtures__/setup.ts b/x-pack/plugins/licensing/server/__fixtures__/setup.ts
index a0cb1ea1a2b67..02574d0851ba0 100644
--- a/x-pack/plugins/licensing/server/__fixtures__/setup.ts
+++ b/x-pack/plugins/licensing/server/__fixtures__/setup.ts
@@ -99,12 +99,7 @@ export async function setup(xpackInfo = {}, pluginInitializerContext: any = {})
clusterClient.callAsInternalUser.mockResolvedValueOnce(licenseMerge(xpackInfo));
const { license$ } = await plugin.setup(coreSetup);
- const license = await license$
- .pipe(
- skip(1),
- take(1)
- )
- .toPromise();
+ const license = await license$.pipe(skip(1), take(1)).toPromise();
return {
plugin,
diff --git a/x-pack/plugins/licensing/server/plugin.test.ts b/x-pack/plugins/licensing/server/plugin.test.ts
index 355aeef7f20c7..a85e1fb0e8f8f 100644
--- a/x-pack/plugins/licensing/server/plugin.test.ts
+++ b/x-pack/plugins/licensing/server/plugin.test.ts
@@ -30,12 +30,7 @@ describe('licensing plugin', () => {
clusterClient.callAsInternalUser.mockRejectedValue(new Error('test'));
const { license$ } = await plugin.setup(coreSetup);
- const finalLicense = await license$
- .pipe(
- skip(1),
- take(1)
- )
- .toPromise();
+ const finalLicense = await license$.pipe(skip(1), take(1)).toPromise();
expect(finalLicense).toBeInstanceOf(License);
});
diff --git a/x-pack/plugins/security/public/session/unauthorized_response_http_interceptor.test.ts b/x-pack/plugins/security/public/session/unauthorized_response_http_interceptor.test.ts
index 60f032652221b..6f339a6fc9c95 100644
--- a/x-pack/plugins/security/public/session/unauthorized_response_http_interceptor.test.ts
+++ b/x-pack/plugins/security/public/session/unauthorized_response_http_interceptor.test.ts
@@ -42,7 +42,10 @@ it(`logs out 401 responses`, async () => {
let fetchResolved = false;
let fetchRejected = false;
- http.fetch('/foo-api').then(() => (fetchResolved = true), () => (fetchRejected = true));
+ http.fetch('/foo-api').then(
+ () => (fetchResolved = true),
+ () => (fetchRejected = true)
+ );
await logoutPromise;
await drainPromiseQueue();
diff --git a/x-pack/plugins/security/server/authentication/api_keys.test.ts b/x-pack/plugins/security/server/authentication/api_keys.test.ts
index 3fca1007413d4..dfddf2036f1b8 100644
--- a/x-pack/plugins/security/server/authentication/api_keys.test.ts
+++ b/x-pack/plugins/security/server/authentication/api_keys.test.ts
@@ -24,9 +24,9 @@ describe('API Keys', () => {
beforeEach(() => {
mockClusterClient = elasticsearchServiceMock.createClusterClient();
mockScopedClusterClient = elasticsearchServiceMock.createScopedClusterClient();
- mockClusterClient.asScoped.mockReturnValue((mockScopedClusterClient as unknown) as jest.Mocked<
- IScopedClusterClient
- >);
+ mockClusterClient.asScoped.mockReturnValue(
+ (mockScopedClusterClient as unknown) as jest.Mocked
+ );
mockLicense = licenseMock.create();
mockLicense.isEnabled.mockReturnValue(true);
diff --git a/x-pack/plugins/security/server/authentication/providers/kerberos.ts b/x-pack/plugins/security/server/authentication/providers/kerberos.ts
index 2caba6ee20f61..0e31dd3d51aba 100644
--- a/x-pack/plugins/security/server/authentication/providers/kerberos.ts
+++ b/x-pack/plugins/security/server/authentication/providers/kerberos.ts
@@ -54,7 +54,8 @@ export class KerberosAuthenticationProvider extends BaseAuthenticationProvider {
const authenticationScheme = getRequestAuthenticationScheme(request);
if (
authenticationScheme &&
- (authenticationScheme !== 'negotiate' && authenticationScheme !== 'bearer')
+ authenticationScheme !== 'negotiate' &&
+ authenticationScheme !== 'bearer'
) {
this.logger.debug(`Unsupported authentication scheme: ${authenticationScheme}`);
return AuthenticationResult.notHandled();
diff --git a/x-pack/plugins/security/server/authentication/providers/oidc.ts b/x-pack/plugins/security/server/authentication/providers/oidc.ts
index ac8f6cc61edfa..824189fa77a26 100644
--- a/x-pack/plugins/security/server/authentication/providers/oidc.ts
+++ b/x-pack/plugins/security/server/authentication/providers/oidc.ts
@@ -250,7 +250,9 @@ export class OIDCAuthenticationProvider extends BaseAuthenticationProvider {
// user usually doesn't have `cluster:admin/xpack/security/oidc/prepare`.
const { state, nonce, redirect } = await this.options.client.callAsInternalUser(
'shield.oidcPrepare',
- { body: oidcPrepareParams }
+ {
+ body: oidcPrepareParams,
+ }
);
this.logger.debug('Redirecting to OpenID Connect Provider with authentication request.');
diff --git a/x-pack/plugins/security/server/authentication/providers/pki.ts b/x-pack/plugins/security/server/authentication/providers/pki.ts
index 788395feae442..fa3e1959ba7de 100644
--- a/x-pack/plugins/security/server/authentication/providers/pki.ts
+++ b/x-pack/plugins/security/server/authentication/providers/pki.ts
@@ -214,9 +214,11 @@ export class PKIAuthenticationProvider extends BaseAuthenticationProvider {
const certificateChain = this.getCertificateChain(peerCertificate);
let accessToken: string;
try {
- accessToken = (await this.options.client.callAsInternalUser('shield.delegatePKI', {
- body: { x509_certificate_chain: certificateChain },
- })).access_token;
+ accessToken = (
+ await this.options.client.callAsInternalUser('shield.delegatePKI', {
+ body: { x509_certificate_chain: certificateChain },
+ })
+ ).access_token;
} catch (err) {
this.logger.debug(
`Failed to exchange peer certificate chain to an access token: ${err.message}`
diff --git a/x-pack/plugins/security/server/authentication/providers/saml.ts b/x-pack/plugins/security/server/authentication/providers/saml.ts
index b21a23718f861..a8683796293af 100644
--- a/x-pack/plugins/security/server/authentication/providers/saml.ts
+++ b/x-pack/plugins/security/server/authentication/providers/saml.ts
@@ -502,7 +502,9 @@ export class SAMLAuthenticationProvider extends BaseAuthenticationProvider {
// user usually doesn't have `cluster:admin/xpack/security/saml/prepare`.
const { id: requestId, redirect } = await this.options.client.callAsInternalUser(
'shield.samlPrepare',
- { body: { realm: this.realm } }
+ {
+ body: { realm: this.realm },
+ }
);
this.logger.debug('Redirecting to Identity Provider with SAML request.');
diff --git a/x-pack/plugins/security/server/authentication/tokens.ts b/x-pack/plugins/security/server/authentication/tokens.ts
index 8e91faa95b459..2906f28912d5b 100644
--- a/x-pack/plugins/security/server/authentication/tokens.ts
+++ b/x-pack/plugins/security/server/authentication/tokens.ts
@@ -96,10 +96,11 @@ export class Tokens {
if (refreshToken) {
let invalidatedTokensCount;
try {
- invalidatedTokensCount = (await this.options.client.callAsInternalUser(
- 'shield.deleteAccessToken',
- { body: { refresh_token: refreshToken } }
- )).invalidated_tokens;
+ invalidatedTokensCount = (
+ await this.options.client.callAsInternalUser('shield.deleteAccessToken', {
+ body: { refresh_token: refreshToken },
+ })
+ ).invalidated_tokens;
} catch (err) {
this.logger.debug(`Failed to invalidate refresh token: ${err.message}`);
// We don't re-throw the error here to have a chance to invalidate access token if it's provided.
@@ -120,10 +121,11 @@ export class Tokens {
if (accessToken) {
let invalidatedTokensCount;
try {
- invalidatedTokensCount = (await this.options.client.callAsInternalUser(
- 'shield.deleteAccessToken',
- { body: { token: accessToken } }
- )).invalidated_tokens;
+ invalidatedTokensCount = (
+ await this.options.client.callAsInternalUser('shield.deleteAccessToken', {
+ body: { token: accessToken },
+ })
+ ).invalidated_tokens;
} catch (err) {
this.logger.debug(`Failed to invalidate access token: ${err.message}`);
invalidationError = err;
diff --git a/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/management.ts b/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/management.ts
index 99a4d11fb13b7..0180554a47ccc 100644
--- a/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/management.ts
+++ b/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/management.ts
@@ -15,11 +15,8 @@ export class FeaturePrivilegeManagementBuilder extends BaseFeaturePrivilegeBuild
return [];
}
- return Object.entries(managementSections).reduce(
- (acc, [sectionId, items]) => {
- return [...acc, ...items.map(item => this.actions.ui.get('management', sectionId, item))];
- },
- [] as string[]
- );
+ return Object.entries(managementSections).reduce((acc, [sectionId, items]) => {
+ return [...acc, ...items.map(item => this.actions.ui.get('management', sectionId, item))];
+ }, [] as string[]);
}
}
diff --git a/x-pack/plugins/security/server/authorization/privileges_serializer.ts b/x-pack/plugins/security/server/authorization/privileges_serializer.ts
index 3a101324ec196..0c5b37883bfb1 100644
--- a/x-pack/plugins/security/server/authorization/privileges_serializer.ts
+++ b/x-pack/plugins/security/server/authorization/privileges_serializer.ts
@@ -28,64 +28,52 @@ export const serializePrivileges = (
): SerializedPrivileges => {
return {
[application]: {
- ...Object.entries(privilegeMap.global).reduce(
- (acc, [privilegeName, privilegeActions]) => {
- const name = PrivilegeSerializer.serializeGlobalBasePrivilege(privilegeName);
- acc[name] = {
- application,
- name: privilegeName,
- actions: privilegeActions,
- metadata: {},
- };
- return acc;
- },
- {} as Record
- ),
- ...Object.entries(privilegeMap.space).reduce(
- (acc, [privilegeName, privilegeActions]) => {
- const name = PrivilegeSerializer.serializeSpaceBasePrivilege(privilegeName);
+ ...Object.entries(privilegeMap.global).reduce((acc, [privilegeName, privilegeActions]) => {
+ const name = PrivilegeSerializer.serializeGlobalBasePrivilege(privilegeName);
+ acc[name] = {
+ application,
+ name: privilegeName,
+ actions: privilegeActions,
+ metadata: {},
+ };
+ return acc;
+ }, {} as Record),
+ ...Object.entries(privilegeMap.space).reduce((acc, [privilegeName, privilegeActions]) => {
+ const name = PrivilegeSerializer.serializeSpaceBasePrivilege(privilegeName);
+ acc[name] = {
+ application,
+ name,
+ actions: privilegeActions,
+ metadata: {},
+ };
+ return acc;
+ }, {} as Record),
+ ...Object.entries(privilegeMap.features).reduce((acc, [featureName, featurePrivileges]) => {
+ Object.entries(featurePrivileges).forEach(([privilegeName, privilegeActions]) => {
+ const name = PrivilegeSerializer.serializeFeaturePrivilege(featureName, privilegeName);
+ if (Object.keys(acc).includes(name)) {
+ throw new Error(`Detected duplicate feature privilege name: ${name}`);
+ }
acc[name] = {
application,
name,
actions: privilegeActions,
metadata: {},
};
- return acc;
- },
- {} as Record
- ),
- ...Object.entries(privilegeMap.features).reduce(
- (acc, [featureName, featurePrivileges]) => {
- Object.entries(featurePrivileges).forEach(([privilegeName, privilegeActions]) => {
- const name = PrivilegeSerializer.serializeFeaturePrivilege(featureName, privilegeName);
- if (Object.keys(acc).includes(name)) {
- throw new Error(`Detected duplicate feature privilege name: ${name}`);
- }
- acc[name] = {
- application,
- name,
- actions: privilegeActions,
- metadata: {},
- };
- });
+ });
- return acc;
- },
- {} as Record
- ),
- ...Object.entries(privilegeMap.reserved).reduce(
- (acc, [privilegeName, privilegeActions]) => {
- const name = PrivilegeSerializer.serializeReservedPrivilege(privilegeName);
- acc[name] = {
- application,
- name,
- actions: privilegeActions,
- metadata: {},
- };
- return acc;
- },
- {} as Record
- ),
+ return acc;
+ }, {} as Record),
+ ...Object.entries(privilegeMap.reserved).reduce((acc, [privilegeName, privilegeActions]) => {
+ const name = PrivilegeSerializer.serializeReservedPrivilege(privilegeName);
+ acc[name] = {
+ application,
+ name,
+ actions: privilegeActions,
+ metadata: {},
+ };
+ return acc;
+ }, {} as Record),
},
};
};
diff --git a/x-pack/plugins/security/server/routes/authorization/roles/model/elasticsearch_role.ts b/x-pack/plugins/security/server/routes/authorization/roles/model/elasticsearch_role.ts
index c590c24923a8c..609b7d2f35c4b 100644
--- a/x-pack/plugins/security/server/routes/authorization/roles/model/elasticsearch_role.ts
+++ b/x-pack/plugins/security/server/routes/authorization/roles/model/elasticsearch_role.ts
@@ -208,19 +208,16 @@ function transformRoleApplicationsToKibanaPrivileges(
base: basePrivileges.map(privilege =>
PrivilegeSerializer.serializeGlobalBasePrivilege(privilege)
),
- feature: featurePrivileges.reduce(
- (acc, privilege) => {
- const featurePrivilege = PrivilegeSerializer.deserializeFeaturePrivilege(privilege);
- return {
- ...acc,
- [featurePrivilege.featureId]: getUniqueList([
- ...(acc[featurePrivilege.featureId] || []),
- featurePrivilege.privilege,
- ]),
- };
- },
- {} as RoleKibanaPrivilege['feature']
- ),
+ feature: featurePrivileges.reduce((acc, privilege) => {
+ const featurePrivilege = PrivilegeSerializer.deserializeFeaturePrivilege(privilege);
+ return {
+ ...acc,
+ [featurePrivilege.featureId]: getUniqueList([
+ ...(acc[featurePrivilege.featureId] || []),
+ featurePrivilege.privilege,
+ ]),
+ };
+ }, {} as RoleKibanaPrivilege['feature']),
spaces: ['*'],
};
}
@@ -235,19 +232,16 @@ function transformRoleApplicationsToKibanaPrivileges(
base: basePrivileges.map(privilege =>
PrivilegeSerializer.deserializeSpaceBasePrivilege(privilege)
),
- feature: featurePrivileges.reduce(
- (acc, privilege) => {
- const featurePrivilege = PrivilegeSerializer.deserializeFeaturePrivilege(privilege);
- return {
- ...acc,
- [featurePrivilege.featureId]: getUniqueList([
- ...(acc[featurePrivilege.featureId] || []),
- featurePrivilege.privilege,
- ]),
- };
- },
- {} as RoleKibanaPrivilege['feature']
- ),
+ feature: featurePrivileges.reduce((acc, privilege) => {
+ const featurePrivilege = PrivilegeSerializer.deserializeFeaturePrivilege(privilege);
+ return {
+ ...acc,
+ [featurePrivilege.featureId]: getUniqueList([
+ ...(acc[featurePrivilege.featureId] || []),
+ featurePrivilege.privilege,
+ ]),
+ };
+ }, {} as RoleKibanaPrivilege['feature']),
spaces: resources.map(resource => ResourceSerializer.deserializeSpaceResource(resource)),
};
}),
diff --git a/x-pack/plugins/security/server/saved_objects/secure_saved_objects_client_wrapper.test.ts b/x-pack/plugins/security/server/saved_objects/secure_saved_objects_client_wrapper.test.ts
index f802c011f207e..3c04508e3a74a 100644
--- a/x-pack/plugins/security/server/saved_objects/secure_saved_objects_client_wrapper.test.ts
+++ b/x-pack/plugins/security/server/saved_objects/secure_saved_objects_client_wrapper.test.ts
@@ -171,7 +171,10 @@ describe(`spaces disabled`, () => {
const client = new SecureSavedObjectsClientWrapper(options);
- const objects = [{ type: type1, attributes: {} }, { type: type2, attributes: {} }];
+ const objects = [
+ { type: type1, attributes: {} },
+ { type: type2, attributes: {} },
+ ];
const apiCallOptions = Object.freeze({ namespace: 'some-ns' });
await expect(client.bulkCreate(objects, apiCallOptions)).rejects.toThrowError(
options.forbiddenError
@@ -483,7 +486,10 @@ describe(`spaces disabled`, () => {
const client = new SecureSavedObjectsClientWrapper(options);
- const objects = [{ type: type1, id: `bar-${type1}` }, { type: type2, id: `bar-${type2}` }];
+ const objects = [
+ { type: type1, id: `bar-${type1}` },
+ { type: type2, id: `bar-${type2}` },
+ ];
const apiCallOptions = Object.freeze({ namespace: 'some-ns' });
await expect(client.bulkGet(objects, apiCallOptions)).rejects.toThrowError(
options.forbiddenError
@@ -526,7 +532,10 @@ describe(`spaces disabled`, () => {
const client = new SecureSavedObjectsClientWrapper(options);
- const objects = [{ type: type1, id: `id-${type1}` }, { type: type2, id: `id-${type2}` }];
+ const objects = [
+ { type: type1, id: `id-${type1}` },
+ { type: type2, id: `id-${type2}` },
+ ];
const apiCallOptions = Object.freeze({ namespace: 'some-ns' });
await expect(client.bulkGet(objects, apiCallOptions)).resolves.toBe(apiCallReturnValue);
diff --git a/x-pack/plugins/spaces/server/routes/api/external/copy_to_space.test.ts b/x-pack/plugins/spaces/server/routes/api/external/copy_to_space.test.ts
index f25908147bfe5..4f78828b14dc2 100644
--- a/x-pack/plugins/spaces/server/routes/api/external/copy_to_space.test.ts
+++ b/x-pack/plugins/spaces/server/routes/api/external/copy_to_space.test.ts
@@ -172,7 +172,10 @@ describe('copy to space', () => {
it(`requires objects to be unique`, async () => {
const payload = {
spaces: ['a-space'],
- objects: [{ type: 'foo', id: 'bar' }, { type: 'foo', id: 'bar' }],
+ objects: [
+ { type: 'foo', id: 'bar' },
+ { type: 'foo', id: 'bar' },
+ ],
};
const { copyToSpace } = await setup();
@@ -185,7 +188,10 @@ describe('copy to space', () => {
it('does not allow namespace agnostic types to be copied (via "supportedTypes" property)', async () => {
const payload = {
spaces: ['a-space'],
- objects: [{ type: 'globalType', id: 'bar' }, { type: 'visualization', id: 'bar' }],
+ objects: [
+ { type: 'globalType', id: 'bar' },
+ { type: 'visualization', id: 'bar' },
+ ],
};
const { copyToSpace, legacyAPI } = await setup();
@@ -307,7 +313,10 @@ describe('copy to space', () => {
it(`requires objects to be unique`, async () => {
const payload = {
retries: {},
- objects: [{ type: 'foo', id: 'bar' }, { type: 'foo', id: 'bar' }],
+ objects: [
+ { type: 'foo', id: 'bar' },
+ { type: 'foo', id: 'bar' },
+ ],
};
const { resolveConflicts } = await setup();
diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/alerts.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/alerts.ts
index 7a984acb2c09f..1252dd1400807 100644
--- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/alerts.ts
+++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/alerts.ts
@@ -90,10 +90,9 @@ export default function alertTests({ getService }: FtrProviderContext) {
case 'superuser at space1':
case 'space_1_all at space1':
expect(response.statusCode).to.eql(200);
- const alertTestRecord = (await esTestIndexTool.waitForDocs(
- 'alert:test.always-firing',
- reference
- ))[0];
+ const alertTestRecord = (
+ await esTestIndexTool.waitForDocs('alert:test.always-firing', reference)
+ )[0];
expect(alertTestRecord._source).to.eql({
source: 'alert:test.always-firing',
reference,
@@ -103,10 +102,9 @@ export default function alertTests({ getService }: FtrProviderContext) {
reference,
},
});
- const actionTestRecord = (await esTestIndexTool.waitForDocs(
- 'action:test.index-record',
- reference
- ))[0];
+ const actionTestRecord = (
+ await esTestIndexTool.waitForDocs('action:test.index-record', reference)
+ )[0];
expect(actionTestRecord._source).to.eql({
config: {
unencrypted: `This value shouldn't get encrypted`,
@@ -265,10 +263,9 @@ export default function alertTests({ getService }: FtrProviderContext) {
case 'space_1_all at space1':
expect(response.statusCode).to.eql(200);
objectRemover.add(space.id, response.body.id, 'alert');
- alertTestRecord = (await esTestIndexTool.waitForDocs(
- 'alert:test.authorization',
- reference
- ))[0];
+ alertTestRecord = (
+ await esTestIndexTool.waitForDocs('alert:test.authorization', reference)
+ )[0];
expect(alertTestRecord._source.state).to.eql({
callClusterSuccess: false,
savedObjectsClientSuccess: false,
@@ -288,10 +285,9 @@ export default function alertTests({ getService }: FtrProviderContext) {
case 'superuser at space1':
expect(response.statusCode).to.eql(200);
objectRemover.add(space.id, response.body.id, 'alert');
- alertTestRecord = (await esTestIndexTool.waitForDocs(
- 'alert:test.authorization',
- reference
- ))[0];
+ alertTestRecord = (
+ await esTestIndexTool.waitForDocs('alert:test.authorization', reference)
+ )[0];
expect(alertTestRecord._source.state).to.eql({
callClusterSuccess: true,
savedObjectsClientSuccess: false,
@@ -362,10 +358,9 @@ export default function alertTests({ getService }: FtrProviderContext) {
case 'space_1_all at space1':
expect(response.statusCode).to.eql(200);
objectRemover.add(space.id, response.body.id, 'alert');
- actionTestRecord = (await esTestIndexTool.waitForDocs(
- 'action:test.authorization',
- reference
- ))[0];
+ actionTestRecord = (
+ await esTestIndexTool.waitForDocs('action:test.authorization', reference)
+ )[0];
expect(actionTestRecord._source.state).to.eql({
callClusterSuccess: false,
savedObjectsClientSuccess: false,
@@ -385,10 +380,9 @@ export default function alertTests({ getService }: FtrProviderContext) {
case 'superuser at space1':
expect(response.statusCode).to.eql(200);
objectRemover.add(space.id, response.body.id, 'alert');
- actionTestRecord = (await esTestIndexTool.waitForDocs(
- 'action:test.authorization',
- reference
- ))[0];
+ actionTestRecord = (
+ await esTestIndexTool.waitForDocs('action:test.authorization', reference)
+ )[0];
expect(actionTestRecord._source.state).to.eql({
callClusterSuccess: true,
savedObjectsClientSuccess: false,
diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/alerts.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/alerts.ts
index 02e0b3795fcc5..badec079d6828 100644
--- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/alerts.ts
+++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/alerts.ts
@@ -68,10 +68,9 @@ export default function alertTests({ getService }: FtrProviderContext) {
const response = await alertUtils.createAlwaysFiringAction({ reference });
expect(response.statusCode).to.eql(200);
- const alertTestRecord = (await esTestIndexTool.waitForDocs(
- 'alert:test.always-firing',
- reference
- ))[0];
+ const alertTestRecord = (
+ await esTestIndexTool.waitForDocs('alert:test.always-firing', reference)
+ )[0];
expect(alertTestRecord._source).to.eql({
source: 'alert:test.always-firing',
reference,
@@ -81,10 +80,9 @@ export default function alertTests({ getService }: FtrProviderContext) {
reference,
},
});
- const actionTestRecord = (await esTestIndexTool.waitForDocs(
- 'action:test.index-record',
- reference
- ))[0];
+ const actionTestRecord = (
+ await esTestIndexTool.waitForDocs('action:test.index-record', reference)
+ )[0];
expect(actionTestRecord._source).to.eql({
config: {
unencrypted: `This value shouldn't get encrypted`,
@@ -207,10 +205,9 @@ export default function alertTests({ getService }: FtrProviderContext) {
expect(response.statusCode).to.eql(200);
objectRemover.add(Spaces.space1.id, response.body.id, 'alert');
- const alertTestRecord = (await esTestIndexTool.waitForDocs(
- 'alert:test.authorization',
- reference
- ))[0];
+ const alertTestRecord = (
+ await esTestIndexTool.waitForDocs('alert:test.authorization', reference)
+ )[0];
expect(alertTestRecord._source.state).to.eql({
callClusterSuccess: true,
savedObjectsClientSuccess: false,
@@ -263,10 +260,9 @@ export default function alertTests({ getService }: FtrProviderContext) {
expect(response.statusCode).to.eql(200);
objectRemover.add(Spaces.space1.id, response.body.id, 'alert');
- const actionTestRecord = (await esTestIndexTool.waitForDocs(
- 'action:test.authorization',
- reference
- ))[0];
+ const actionTestRecord = (
+ await esTestIndexTool.waitForDocs('action:test.authorization', reference)
+ )[0];
expect(actionTestRecord._source.state).to.eql({
callClusterSuccess: true,
savedObjectsClientSuccess: false,
diff --git a/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_security.ts b/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_security.ts
index 0834ff11ced58..d60b286e3337a 100644
--- a/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_security.ts
+++ b/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_security.ts
@@ -47,7 +47,6 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
});
await PageObjects.security.logout();
-
await PageObjects.security.login(
'global_advanced_settings_all_user',
'global_advanced_settings_all_user-password',
@@ -55,7 +54,6 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
expectSpaceSelector: false,
}
);
-
await kibanaServer.uiSettings.replace({});
await PageObjects.settings.navigateTo();
});
diff --git a/x-pack/test/functional/services/infra_source_configuration_form.ts b/x-pack/test/functional/services/infra_source_configuration_form.ts
index a311f38b67c18..ab61d5232fa1c 100644
--- a/x-pack/test/functional/services/infra_source_configuration_form.ts
+++ b/x-pack/test/functional/services/infra_source_configuration_form.ts
@@ -38,10 +38,12 @@ export function InfraSourceConfigurationFormProvider({ getService }: FtrProvider
async addTimestampLogColumn() {
await (await this.getAddLogColumnButton()).click();
await retry.try(async () => {
- await (await testSubjects.findDescendant(
- '~addTimestampLogColumn',
- await this.getAddLogColumnPopover()
- )).click();
+ await (
+ await testSubjects.findDescendant(
+ '~addTimestampLogColumn',
+ await this.getAddLogColumnPopover()
+ )
+ ).click();
});
},
async addFieldLogColumn(fieldName: string) {
@@ -49,10 +51,9 @@ export function InfraSourceConfigurationFormProvider({ getService }: FtrProvider
await retry.try(async () => {
const popover = await this.getAddLogColumnPopover();
await (await testSubjects.findDescendant('~fieldSearchInput', popover)).type(fieldName);
- await (await testSubjects.findDescendant(
- `~addFieldLogColumn:${fieldName}`,
- popover
- )).click();
+ await (
+ await testSubjects.findDescendant(`~addFieldLogColumn:${fieldName}`, popover)
+ ).click();
});
},
async getLogColumnPanels(): Promise {
@@ -98,10 +99,9 @@ export function InfraSourceConfigurationFormProvider({ getService }: FtrProvider
return await testSubjects.find('~sourceConfigurationContent');
},
async saveConfiguration() {
- await (await testSubjects.findDescendant(
- '~applySettingsButton',
- await this.getForm()
- )).click();
+ await (
+ await testSubjects.findDescendant('~applySettingsButton', await this.getForm())
+ ).click();
await retry.try(async () => {
const element = await testSubjects.findDescendant(
diff --git a/x-pack/test/plugin_api_integration/test_suites/encrypted_saved_objects/encrypted_saved_objects_api.ts b/x-pack/test/plugin_api_integration/test_suites/encrypted_saved_objects/encrypted_saved_objects_api.ts
index 1c7be6def614d..98d653d71b5ec 100644
--- a/x-pack/test/plugin_api_integration/test_suites/encrypted_saved_objects/encrypted_saved_objects_api.ts
+++ b/x-pack/test/plugin_api_integration/test_suites/encrypted_saved_objects/encrypted_saved_objects_api.ts
@@ -252,7 +252,10 @@ export default function({ getService }: FtrProviderContext) {
});
describe('within a default space', () => {
- runTests(() => '/api/saved_objects/', id => `${SAVED_OBJECT_WITH_SECRET_TYPE}:${id}`);
+ runTests(
+ () => '/api/saved_objects/',
+ id => `${SAVED_OBJECT_WITH_SECRET_TYPE}:${id}`
+ );
});
describe('within a custom space', () => {
diff --git a/x-pack/test/spaces_api_integration/common/suites/copy_to_space.ts b/x-pack/test/spaces_api_integration/common/suites/copy_to_space.ts
index 85e877912ab6c..7383bb3409f1a 100644
--- a/x-pack/test/spaces_api_integration/common/suites/copy_to_space.ts
+++ b/x-pack/test/spaces_api_integration/common/suites/copy_to_space.ts
@@ -139,19 +139,16 @@ export function copyToSpaceTestSuiteFactory(
}
const { countByType } = spaceBucket;
- const expectedBuckets = Object.entries(expectedCounts).reduce(
- (acc, entry) => {
- const [type, count] = entry;
- return [
- ...acc,
- {
- key: type,
- doc_count: count,
- },
- ];
- },
- [] as CountByTypeBucket[]
- );
+ const expectedBuckets = Object.entries(expectedCounts).reduce((acc, entry) => {
+ const [type, count] = entry;
+ return [
+ ...acc,
+ {
+ key: type,
+ doc_count: count,
+ },
+ ];
+ }, [] as CountByTypeBucket[]);
expectedBuckets.sort(bucketSorter);
countByType.buckets.sort(bucketSorter);
diff --git a/x-pack/test_utils/testbed/mount_component.tsx b/x-pack/test_utils/testbed/mount_component.tsx
index b1f82ceae3b42..4984ccca7cef9 100644
--- a/x-pack/test_utils/testbed/mount_component.tsx
+++ b/x-pack/test_utils/testbed/mount_component.tsx
@@ -31,9 +31,10 @@ const getCompFromConfig = ({ Component, memoryRouter, store, onRouter }: Config)
const { componentRoutePath, initialEntries, initialIndex } = memoryRouter!;
// Wrap the componenet with a MemoryRouter and attach it to a react-router
- Comp = WithMemoryRouter(initialEntries, initialIndex)(
- WithRoute(componentRoutePath, onRouter)(Comp)
- );
+ Comp = WithMemoryRouter(
+ initialEntries,
+ initialIndex
+ )(WithRoute(componentRoutePath, onRouter)(Comp));
}
return Comp;
diff --git a/yarn.lock b/yarn.lock
index 71f032cf720dc..4990d2bab0a77 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -21805,10 +21805,10 @@ prettier@1.16.4:
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.16.4.tgz#73e37e73e018ad2db9c76742e2647e21790c9717"
integrity sha512-ZzWuos7TI5CKUeQAtFd6Zhm2s6EpAD/ZLApIhsF9pRvRtM1RFo61dM/4MSRUA0SuLugA/zgrZD8m0BaY46Og7g==
-prettier@^1.18.2:
- version "1.18.2"
- resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.18.2.tgz#6823e7c5900017b4bd3acf46fe9ac4b4d7bda9ea"
- integrity sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw==
+prettier@^1.19.1:
+ version "1.19.1"
+ resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb"
+ integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==
pretty-bytes@^4.0.2:
version "4.0.2"
@@ -27891,7 +27891,7 @@ typescript-fsa@^2.0.0, typescript-fsa@^2.5.0:
resolved "https://registry.yarnpkg.com/typescript-fsa/-/typescript-fsa-2.5.0.tgz#1baec01b5e8f5f34c322679d1327016e9e294faf"
integrity sha1-G67AG16PXzTDImedEycBbp4pT68=
-typescript@3.5.1, typescript@3.5.3, typescript@^3.0.1, typescript@^3.0.3, typescript@^3.2.2, typescript@^3.3.3333, typescript@^3.4.5, typescript@~3.3.3333, typescript@~3.5.3:
+typescript@3.5.3, typescript@^3.0.1, typescript@^3.0.3, typescript@^3.2.2, typescript@^3.3.3333, typescript@^3.4.5, typescript@~3.3.3333, typescript@~3.5.3:
version "3.5.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.5.3.tgz#c830f657f93f1ea846819e929092f5fe5983e977"
integrity sha512-ACzBtm/PhXBDId6a6sDJfroT2pOWt/oOnk4/dElG5G33ZL776N3Y6/6bKZJBFpd+b05F3Ct9qDjMeJmRWtE2/g==