Skip to content

Commit

Permalink
Merge branch 'master' into add-inventory-metric-threshold-alerts
Browse files Browse the repository at this point in the history
  • Loading branch information
phillipb committed Apr 29, 2020
2 parents 42da994 + 7354ff6 commit c996568
Show file tree
Hide file tree
Showing 629 changed files with 5,317 additions and 2,429 deletions.
31 changes: 13 additions & 18 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@
/x-pack/legacy/plugins/ingest_manager/ @elastic/ingest-management
/x-pack/plugins/observability/ @elastic/logs-metrics-ui @elastic/apm-ui @elastic/uptime @elastic/ingest-management
/x-pack/legacy/plugins/monitoring/ @elastic/stack-monitoring-ui
/x-pack/legacy/plugins/uptime @elastic/uptime
/x-pack/plugins/uptime @elastic/uptime

# Machine Learning
Expand Down Expand Up @@ -167,16 +166,13 @@
/x-pack/plugins/telemetry_collection_xpack/ @elastic/pulse

# Kibana Alerting Services
/x-pack/legacy/plugins/alerting/ @elastic/kibana-alerting-services
/x-pack/legacy/plugins/actions/ @elastic/kibana-alerting-services
/x-pack/plugins/alerting/ @elastic/kibana-alerting-services
/x-pack/plugins/actions/ @elastic/kibana-alerting-services
/x-pack/plugins/event_log/ @elastic/kibana-alerting-services
/x-pack/plugins/task_manager/ @elastic/kibana-alerting-services
/x-pack/test/alerting_api_integration/ @elastic/kibana-alerting-services
/x-pack/test/plugin_api_integration/plugins/task_manager/ @elastic/kibana-alerting-services
/x-pack/test/plugin_api_integration/test_suites/task_manager/ @elastic/kibana-alerting-services
/x-pack/legacy/plugins/triggers_actions_ui/ @elastic/kibana-alerting-services
/x-pack/plugins/triggers_actions_ui/ @elastic/kibana-alerting-services
/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/ @elastic/kibana-alerting-services
/x-pack/test/functional_with_es_ssl/fixtures/plugins/alerts/ @elastic/kibana-alerting-services
Expand Down Expand Up @@ -209,22 +205,21 @@
/x-pack/plugins/watcher/ @elastic/es-ui

# Endpoint
/x-pack/plugins/endpoint/ @elastic/endpoint-app-team
/x-pack/test/api_integration/apis/endpoint/ @elastic/endpoint-app-team
/x-pack/test/endpoint_api_integration_no_ingest/ @elastic/endpoint-app-team
/x-pack/test/functional_endpoint/ @elastic/endpoint-app-team
/x-pack/test/functional_endpoint_ingest_failure/ @elastic/endpoint-app-team
/x-pack/test/functional/es_archives/endpoint/ @elastic/endpoint-app-team
/x-pack/test/plugin_functional/plugins/resolver_test/ @elastic/endpoint-app-team
/x-pack/test/plugin_functional/test_suites/resolver/ @elastic/endpoint-app-team
/x-pack/plugins/endpoint/ @elastic/endpoint-app-team @elastic/siem
/x-pack/test/api_integration/apis/endpoint/ @elastic/endpoint-app-team @elastic/siem
/x-pack/test/endpoint_api_integration_no_ingest/ @elastic/endpoint-app-team @elastic/siem
/x-pack/test/functional_endpoint/ @elastic/endpoint-app-team @elastic/siem
/x-pack/test/functional_endpoint_ingest_failure/ @elastic/endpoint-app-team @elastic/siem
/x-pack/test/functional/es_archives/endpoint/ @elastic/endpoint-app-team @elastic/siem
/x-pack/test/plugin_functional/plugins/resolver_test/ @elastic/endpoint-app-team @elastic/siem
/x-pack/test/plugin_functional/test_suites/resolver/ @elastic/endpoint-app-team @elastic/siem

# SIEM
/x-pack/legacy/plugins/siem/ @elastic/siem
/x-pack/plugins/siem/ @elastic/siem
/x-pack/test/detection_engine_api_integration @elastic/siem
/x-pack/test/api_integration/apis/siem @elastic/siem
/x-pack/plugins/case @elastic/siem
/x-pack/plugins/lists @elastic/siem
/x-pack/plugins/siem/ @elastic/siem @elastic/endpoint-app-team
/x-pack/test/detection_engine_api_integration @elastic/siem @elastic/endpoint-app-team
/x-pack/test/api_integration/apis/siem @elastic/siem @elastic/endpoint-app-team
/x-pack/plugins/case @elastic/siem @elastic/endpoint-app-team
/x-pack/plugins/lists @elastic/siem @elastic/endpoint-app-team

# Security Intelligence And Analytics
/x-pack/plugins/siem/server/lib/detection_engine/rules/prepackaged_rules @elastic/security-intelligence-analytics
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,15 @@
* under the License.
*/

import React, { useEffect } from 'react';
import React, { lazy, Suspense } from 'react';
import ReactDOM from 'react-dom';
import { HashRouter, Switch, Route, useParams, useLocation } from 'react-router-dom';
import { parse } from 'query-string';
import { get } from 'lodash';
import { i18n } from '@kbn/i18n';
import { HashRouter, Switch, Route } from 'react-router-dom';
import { I18nProvider } from '@kbn/i18n/react';
import { CoreSetup, CoreStart, ChromeBreadcrumb, Capabilities } from 'src/core/public';
import { EuiLoadingSpinner } from '@elastic/eui';
import { CoreSetup, Capabilities } from 'src/core/public';
import { ManagementAppMountParams } from '../../../management/public';
import { DataPublicPluginStart } from '../../../data/public';
import { StartDependencies, SavedObjectsManagementPluginStart } from '../plugin';
import {
ISavedObjectsManagementServiceRegistry,
SavedObjectsManagementActionServiceStart,
} from '../services';
import { SavedObjectsTable } from './objects_table';
import { SavedObjectEdition } from './object_view';
import { ISavedObjectsManagementServiceRegistry } from '../services';
import { getAllowedTypes } from './../lib';

interface MountParams {
Expand All @@ -44,6 +36,8 @@ interface MountParams {

let allowedObjectTypes: string[] | undefined;

const SavedObjectsEditionPage = lazy(() => import('./saved_objects_edition_page'));
const SavedObjectsTablePage = lazy(() => import('./saved_objects_table_page'));
export const mountManagementSection = async ({
core,
mountParams,
Expand All @@ -63,23 +57,27 @@ export const mountManagementSection = async ({
<Switch>
<Route path={'/:service/:id'} exact={true}>
<RedirectToHomeIfUnauthorized capabilities={capabilities}>
<SavedObjectsEditionPage
coreStart={coreStart}
serviceRegistry={serviceRegistry}
setBreadcrumbs={setBreadcrumbs}
/>
<Suspense fallback={<EuiLoadingSpinner />}>
<SavedObjectsEditionPage
coreStart={coreStart}
serviceRegistry={serviceRegistry}
setBreadcrumbs={setBreadcrumbs}
/>
</Suspense>
</RedirectToHomeIfUnauthorized>
</Route>
<Route path={'/'} exact={false}>
<RedirectToHomeIfUnauthorized capabilities={capabilities}>
<SavedObjectsTablePage
coreStart={coreStart}
dataStart={data}
serviceRegistry={serviceRegistry}
actionRegistry={pluginStart.actions}
allowedTypes={allowedObjectTypes}
setBreadcrumbs={setBreadcrumbs}
/>
<Suspense fallback={<EuiLoadingSpinner />}>
<SavedObjectsTablePage
coreStart={coreStart}
dataStart={data}
serviceRegistry={serviceRegistry}
actionRegistry={pluginStart.actions}
allowedTypes={allowedObjectTypes}
setBreadcrumbs={setBreadcrumbs}
/>
</Suspense>
</RedirectToHomeIfUnauthorized>
</Route>
</Switch>
Expand All @@ -103,110 +101,3 @@ const RedirectToHomeIfUnauthorized: React.FunctionComponent<{
}
return children! as React.ReactElement;
};

const SavedObjectsEditionPage = ({
coreStart,
serviceRegistry,
setBreadcrumbs,
}: {
coreStart: CoreStart;
serviceRegistry: ISavedObjectsManagementServiceRegistry;
setBreadcrumbs: (crumbs: ChromeBreadcrumb[]) => void;
}) => {
const { service: serviceName, id } = useParams<{ service: string; id: string }>();
const capabilities = coreStart.application.capabilities;

const { search } = useLocation();
const query = parse(search);
const service = serviceRegistry.get(serviceName);

useEffect(() => {
setBreadcrumbs([
{
text: i18n.translate('savedObjectsManagement.breadcrumb.index', {
defaultMessage: 'Saved objects',
}),
href: '#/management/kibana/objects',
},
{
text: i18n.translate('savedObjectsManagement.breadcrumb.edit', {
defaultMessage: 'Edit {savedObjectType}',
values: { savedObjectType: service?.service.type ?? 'object' },
}),
},
]);
}, [setBreadcrumbs, service]);

return (
<SavedObjectEdition
id={id}
serviceName={serviceName}
serviceRegistry={serviceRegistry}
savedObjectsClient={coreStart.savedObjects.client}
overlays={coreStart.overlays}
notifications={coreStart.notifications}
capabilities={capabilities}
notFoundType={query.notFound as string}
/>
);
};

const SavedObjectsTablePage = ({
coreStart,
dataStart,
allowedTypes,
serviceRegistry,
actionRegistry,
setBreadcrumbs,
}: {
coreStart: CoreStart;
dataStart: DataPublicPluginStart;
allowedTypes: string[];
serviceRegistry: ISavedObjectsManagementServiceRegistry;
actionRegistry: SavedObjectsManagementActionServiceStart;
setBreadcrumbs: (crumbs: ChromeBreadcrumb[]) => void;
}) => {
const capabilities = coreStart.application.capabilities;
const itemsPerPage = coreStart.uiSettings.get<number>('savedObjects:perPage', 50);

useEffect(() => {
setBreadcrumbs([
{
text: i18n.translate('savedObjectsManagement.breadcrumb.index', {
defaultMessage: 'Saved objects',
}),
href: '#/management/kibana/objects',
},
]);
}, [setBreadcrumbs]);

return (
<SavedObjectsTable
allowedTypes={allowedTypes}
serviceRegistry={serviceRegistry}
actionRegistry={actionRegistry}
savedObjectsClient={coreStart.savedObjects.client}
indexPatterns={dataStart.indexPatterns}
search={dataStart.search}
http={coreStart.http}
overlays={coreStart.overlays}
notifications={coreStart.notifications}
applications={coreStart.application}
perPageConfig={itemsPerPage}
goInspectObject={savedObject => {
const { editUrl } = savedObject.meta;
if (editUrl) {
// previously, kbnUrl.change(object.meta.editUrl); was used.
// using direct access to location.hash seems the only option for now,
// as using react-router-dom will prefix the url with the router's basename
// which should be ignored there.
window.location.hash = editUrl;
}
}}
canGoInApp={savedObject => {
const { inAppUrl } = savedObject.meta;
return inAppUrl ? get(capabilities, inAppUrl.uiCapabilitiesPath) : false;
}}
/>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import React, { useEffect } from 'react';
import { useParams, useLocation } from 'react-router-dom';
import { parse } from 'query-string';
import { i18n } from '@kbn/i18n';
import { CoreStart, ChromeBreadcrumb } from 'src/core/public';
import { ISavedObjectsManagementServiceRegistry } from '../services';
import { SavedObjectEdition } from './object_view';

const SavedObjectsEditionPage = ({
coreStart,
serviceRegistry,
setBreadcrumbs,
}: {
coreStart: CoreStart;
serviceRegistry: ISavedObjectsManagementServiceRegistry;
setBreadcrumbs: (crumbs: ChromeBreadcrumb[]) => void;
}) => {
const { service: serviceName, id } = useParams<{ service: string; id: string }>();
const capabilities = coreStart.application.capabilities;

const { search } = useLocation();
const query = parse(search);
const service = serviceRegistry.get(serviceName);

useEffect(() => {
setBreadcrumbs([
{
text: i18n.translate('savedObjectsManagement.breadcrumb.index', {
defaultMessage: 'Saved objects',
}),
href: '#/management/kibana/objects',
},
{
text: i18n.translate('savedObjectsManagement.breadcrumb.edit', {
defaultMessage: 'Edit {savedObjectType}',
values: { savedObjectType: service?.service.type ?? 'object' },
}),
},
]);
}, [setBreadcrumbs, service]);

return (
<SavedObjectEdition
id={id}
serviceName={serviceName}
serviceRegistry={serviceRegistry}
savedObjectsClient={coreStart.savedObjects.client}
overlays={coreStart.overlays}
notifications={coreStart.notifications}
capabilities={capabilities}
notFoundType={query.notFound as string}
/>
);
};

// eslint-disable-next-line import/no-default-export
export { SavedObjectsEditionPage as default };
Loading

0 comments on commit c996568

Please sign in to comment.