mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Turn AssetInventory sub-plugin into a Security solution page (#205363)
## Summary Turn AssetInventory plugin into a simple Security solution page based on this conversation: - https://github.com/elastic/security-team/issues/10346 Follow-up of this work, where we initially developed the Asset Inventory bare-bones as a plugin: - https://github.com/elastic/kibana/issues/201704 Part of this work stream though not originally planned: - https://github.com/elastic/security-team/issues/11247?reload=1 ### Motivation Reasoning behind is enabling fast development changes without any major refactors in other packages/components that need to be reused, which seems impossible as of now with the current codebase. ### Checklist - [x] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [x] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [x] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) ### Identify risks In the future, we'll probably have to turn AssetInventory into a sub-plugin again. Doing so doesn't bring any risk in the present, and should only involve the re-generation of the deleted files in this PR. --------- Co-authored-by: Paulo Henrique <paulo.henrique@elastic.co> Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
0c0dd631bb
commit
1e9606de9c
26 changed files with 36 additions and 452 deletions
7
.github/CODEOWNERS
vendored
7
.github/CODEOWNERS
vendored
|
@ -989,7 +989,6 @@ x-pack/solutions/security/packages/navigation @elastic/security-threat-hunting-e
|
|||
x-pack/solutions/security/packages/side_nav @elastic/security-threat-hunting-explore
|
||||
x-pack/solutions/security/packages/storybook/config @elastic/security-threat-hunting-explore
|
||||
x-pack/solutions/security/packages/upselling @elastic/security-threat-hunting-explore
|
||||
x-pack/solutions/security/plugins/asset_inventory @elastic/kibana-cloud-security-posture
|
||||
x-pack/solutions/security/plugins/cloud_defend @elastic/kibana-cloud-security-posture
|
||||
x-pack/solutions/security/plugins/cloud_security_posture @elastic/kibana-cloud-security-posture
|
||||
x-pack/solutions/security/plugins/ecs_data_quality_dashboard @elastic/security-threat-hunting-explore
|
||||
|
@ -2205,6 +2204,10 @@ x-pack/test/security_solution_api_integration/test_suites/sources @elastic/secur
|
|||
/x-pack/test/security_solution_playwright @elastic/security-engineering-productivity
|
||||
/x-pack/solutions/security/plugins/security_solution/scripts/run_cypress @MadameSheema @patrykkopycinski @maximpn @banderror
|
||||
|
||||
## Security Solution sub teams - Cloud Security Posture
|
||||
|
||||
x-pack/solutions/security/plugins/security_solution/public/asset_inventory @elastic/kibana-cloud-security-posture
|
||||
|
||||
## Security Solution sub teams - Threat Hunting
|
||||
|
||||
/x-pack/solutions/security/plugins/security_solution/server/lib/siem_migrations @elastic/security-threat-hunting
|
||||
|
@ -2542,6 +2545,7 @@ x-pack/solutions/security/plugins/security_solution/public/security_integrations
|
|||
x-pack/solutions/security/plugins/security_solution/server/security_integrations @elastic/security-service-integrations
|
||||
x-pack/solutions/security/plugins/security_solution/server/lib/security_integrations @elastic/security-service-integrations
|
||||
|
||||
|
||||
# Kibana design
|
||||
# scss overrides should be below this line for specificity
|
||||
**/*.scss @elastic/kibana-design
|
||||
|
@ -3322,7 +3326,6 @@ x-pack/solutions/security/packages/index-adapter @elastic/security-threat-huntin
|
|||
x-pack/solutions/security/packages/navigation @elastic/security-threat-hunting-explore
|
||||
x-pack/solutions/security/packages/side_nav @elastic/security-threat-hunting-explore
|
||||
x-pack/solutions/security/packages/upselling @elastic/security-threat-hunting-explore
|
||||
x-pack/solutions/security/plugins/asset_inventory @elastic/kibana-cloud-security-posture
|
||||
x-pack/solutions/security/plugins/cloud_defend @elastic/kibana-cloud-security-posture
|
||||
x-pack/solutions/security/plugins/cloud_security_posture @elastic/kibana-cloud-security-posture
|
||||
x-pack/solutions/security/plugins/ecs_data_quality_dashboard @elastic/security-threat-hunting-explore
|
||||
|
|
|
@ -467,10 +467,6 @@ The plugin exposes the static DefaultEditorController class to consume.
|
|||
|WARNING: Missing README.
|
||||
|
||||
|
||||
|{kib-repo}blob/{branch}/x-pack/solutions/security/plugins/asset_inventory/README.md[assetInventory]
|
||||
|Centralized asset inventory experience within the Elastic Security solution. A central place for users to view and manage all their assets from different environments.
|
||||
|
||||
|
||||
|{kib-repo}blob/{branch}/x-pack/platform/plugins/private/banners/README.md[banners]
|
||||
|Allow to add a header banner that will be displayed on every page of the Kibana application
|
||||
|
||||
|
|
|
@ -192,7 +192,6 @@
|
|||
"@kbn/apm-utils": "link:src/platform/packages/shared/kbn-apm-utils",
|
||||
"@kbn/app-link-test-plugin": "link:test/plugin_functional/plugins/app_link_test",
|
||||
"@kbn/application-usage-test-plugin": "link:x-pack/test/usage_collection/plugins/application_usage_test",
|
||||
"@kbn/asset-inventory-plugin": "link:x-pack/solutions/security/plugins/asset_inventory",
|
||||
"@kbn/audit-log-plugin": "link:x-pack/test/security_api_integration/plugins/audit_log",
|
||||
"@kbn/avc-banner": "link:src/platform/packages/shared/kbn-avc-banner",
|
||||
"@kbn/banners-plugin": "link:x-pack/platform/plugins/private/banners",
|
||||
|
|
|
@ -5,7 +5,6 @@ pageLoadAssetSize:
|
|||
aiops: 18000
|
||||
alerting: 106936
|
||||
apm: 64385
|
||||
assetInventory: 18478
|
||||
banners: 17946
|
||||
canvas: 29355
|
||||
cases: 180037
|
||||
|
|
|
@ -98,8 +98,6 @@
|
|||
"@kbn/app-link-test-plugin/*": ["test/plugin_functional/plugins/app_link_test/*"],
|
||||
"@kbn/application-usage-test-plugin": ["x-pack/test/usage_collection/plugins/application_usage_test"],
|
||||
"@kbn/application-usage-test-plugin/*": ["x-pack/test/usage_collection/plugins/application_usage_test/*"],
|
||||
"@kbn/asset-inventory-plugin": ["x-pack/solutions/security/plugins/asset_inventory"],
|
||||
"@kbn/asset-inventory-plugin/*": ["x-pack/solutions/security/plugins/asset_inventory/*"],
|
||||
"@kbn/audit-log-plugin": ["x-pack/test/security_api_integration/plugins/audit_log"],
|
||||
"@kbn/audit-log-plugin/*": ["x-pack/test/security_api_integration/plugins/audit_log/*"],
|
||||
"@kbn/avc-banner": ["src/platform/packages/shared/kbn-avc-banner"],
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
# Asset Inventory Kibana Plugin
|
||||
|
||||
Centralized asset inventory experience within the Elastic Security solution. A central place for users to view and manage all their assets from different environments.
|
||||
|
||||
---
|
||||
|
||||
## Development
|
||||
|
||||
See the [kibana contributing guide](https://github.com/elastic/kibana/blob/main/CONTRIBUTING.md) for instructions setting up your development environment.
|
||||
|
||||
### Feature flag
|
||||
|
||||
First, enable the `assetInventoryStoreEnabled` experimental feature flag by adding the following to your `kibana.dev.yml`:
|
||||
|
||||
```yml
|
||||
xpack.securitySolution.enableExperimental: ['assetInventoryStoreEnabled']
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
For general guidelines, read [Kibana Testing Guide](https://www.elastic.co/guide/en/kibana/current/development-tests.html) for more details
|
|
@ -1,8 +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
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
export const PLUGIN_ID = 'assetInventory';
|
||||
export const PLUGIN_NAME = 'assetInventory';
|
|
@ -1,17 +0,0 @@
|
|||
{
|
||||
"type": "plugin",
|
||||
"id": "@kbn/asset-inventory-plugin",
|
||||
"owner": ["@elastic/kibana-cloud-security-posture"],
|
||||
"group": "security",
|
||||
"visibility": "private",
|
||||
"description": "Centralized asset inventory experience within the Elastic Security solution. A central place for users to view and manage all their assets from different environments",
|
||||
"plugin": {
|
||||
"id": "assetInventory",
|
||||
"browser": true,
|
||||
"server": true,
|
||||
"configPath": ["xpack", "assetInventory"],
|
||||
"requiredPlugins": [],
|
||||
"requiredBundles": [],
|
||||
"optionalPlugins": []
|
||||
}
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
{
|
||||
"author": "Elastic",
|
||||
"name": "@kbn/asset-inventory-plugin",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"license": "Elastic License 2.0"
|
||||
}
|
|
@ -1,14 +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
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
import { AssetInventoryPlugin } from './plugin';
|
||||
|
||||
// This exports static code and TypeScript types,
|
||||
// as well as, Kibana Platform `plugin()` initializer.
|
||||
export function plugin() {
|
||||
return new AssetInventoryPlugin();
|
||||
}
|
||||
export type { AssetInventoryPluginSetup, AssetInventoryPluginStart } from './types';
|
|
@ -1,34 +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
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import React, { lazy, Suspense } from 'react';
|
||||
import { EuiLoadingSpinner } from '@elastic/eui';
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||
import { AppPluginStartDependencies } from '../types';
|
||||
|
||||
// Initializing react-query
|
||||
const queryClient = new QueryClient({
|
||||
defaultOptions: {
|
||||
queries: {
|
||||
refetchOnWindowFocus: false,
|
||||
refetchOnMount: false,
|
||||
refetchOnReconnect: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const AssetInventoryLazy = lazy(() => import('../components/app'));
|
||||
|
||||
export const getAssetInventoryLazy = (props: AppPluginStartDependencies) => {
|
||||
return (
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<Suspense fallback={<EuiLoadingSpinner />}>
|
||||
<AssetInventoryLazy {...props} />
|
||||
</Suspense>
|
||||
</QueryClientProvider>
|
||||
);
|
||||
};
|
|
@ -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
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
import type { CoreSetup, CoreStart, Plugin } from '@kbn/core/public';
|
||||
import type {
|
||||
AssetInventoryPluginSetup,
|
||||
AssetInventoryPluginStart,
|
||||
AppPluginStartDependencies,
|
||||
} from './types';
|
||||
import { getAssetInventoryLazy } from './methods';
|
||||
|
||||
export class AssetInventoryPlugin
|
||||
implements Plugin<AssetInventoryPluginSetup, AssetInventoryPluginStart>
|
||||
{
|
||||
public setup(core: CoreSetup): AssetInventoryPluginSetup {
|
||||
return {};
|
||||
}
|
||||
public start(coreStart: CoreStart): AssetInventoryPluginStart {
|
||||
return {
|
||||
getAssetInventoryPage: (assetInventoryDeps: AppPluginStartDependencies) => {
|
||||
return getAssetInventoryLazy(assetInventoryDeps);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
public stop() {}
|
||||
}
|
|
@ -1,16 +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
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface AssetInventoryPluginSetup {}
|
||||
|
||||
export interface AssetInventoryPluginStart {
|
||||
getAssetInventoryPage: (assetInventoryStartDeps: AppPluginStartDependencies) => JSX.Element;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface AppPluginStartDependencies {}
|
|
@ -1,142 +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
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
import { transformError } from '@kbn/securitysolution-es-utils';
|
||||
import { TransformPutTransformRequest } from '@elastic/elasticsearch/lib/api/types';
|
||||
import type { ElasticsearchClient, Logger } from '@kbn/core/server';
|
||||
import { errors } from '@elastic/elasticsearch';
|
||||
|
||||
// TODO: Move transforms to integration package
|
||||
export const initializeTransforms = async (
|
||||
esClient: ElasticsearchClient,
|
||||
logger: Logger
|
||||
): Promise<void> => {
|
||||
// Deletes old assets from previous versions as part of upgrade process
|
||||
await deletePreviousTransformsVersions(esClient, logger);
|
||||
// TODO initialize transforms here
|
||||
// await initializeTransform(esClient, <TRANSFORM_HERE>, logger);
|
||||
};
|
||||
|
||||
export const initializeTransform = async (
|
||||
esClient: ElasticsearchClient,
|
||||
transform: TransformPutTransformRequest,
|
||||
logger: Logger
|
||||
) => {
|
||||
const success = await createTransformIfNotExists(esClient, transform, logger);
|
||||
|
||||
if (success) {
|
||||
await startTransformIfNotStarted(esClient, transform.transform_id, logger);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks if a transform exists, And if not creates it
|
||||
*
|
||||
* @param transform - the transform to create. If a transform with the same transform_id already exists, nothing is created or updated.
|
||||
*
|
||||
* @return true if the transform exits or created, false otherwise.
|
||||
*/
|
||||
export const createTransformIfNotExists = async (
|
||||
esClient: ElasticsearchClient,
|
||||
transform: TransformPutTransformRequest,
|
||||
logger: Logger
|
||||
) => {
|
||||
try {
|
||||
await esClient.transform.getTransform({
|
||||
transform_id: transform.transform_id,
|
||||
});
|
||||
return true;
|
||||
} catch (existErr) {
|
||||
const existError = transformError(existErr);
|
||||
if (existError.statusCode === 404) {
|
||||
try {
|
||||
await esClient.transform.putTransform(transform);
|
||||
return true;
|
||||
} catch (createErr) {
|
||||
const createError = transformError(createErr);
|
||||
logger.error(
|
||||
`Failed to create transform ${transform.transform_id}: ${createError.message}`
|
||||
);
|
||||
}
|
||||
} else {
|
||||
logger.error(
|
||||
`Failed to check if transform ${transform.transform_id} exists: ${existError.message}`
|
||||
);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
export const startTransformIfNotStarted = async (
|
||||
esClient: ElasticsearchClient,
|
||||
transformId: string,
|
||||
logger: Logger
|
||||
) => {
|
||||
try {
|
||||
const transformStats = await esClient.transform.getTransformStats({
|
||||
transform_id: transformId,
|
||||
});
|
||||
|
||||
if (transformStats.count <= 0) {
|
||||
logger.error(`Failed starting transform ${transformId}: couldn't find transform`);
|
||||
return;
|
||||
}
|
||||
|
||||
const fetchedTransformStats = transformStats.transforms[0];
|
||||
|
||||
// trying to restart the transform in case it comes to a full stop or failure
|
||||
if (fetchedTransformStats.state === 'stopped' || fetchedTransformStats.state === 'failed') {
|
||||
try {
|
||||
return await esClient.transform.startTransform({ transform_id: transformId });
|
||||
} catch (startErr) {
|
||||
const startError = transformError(startErr);
|
||||
logger.error(
|
||||
`Failed to start transform ${transformId}. Transform State: Transform State: ${fetchedTransformStats.state}. Error: ${startError.message}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (fetchedTransformStats.state === 'stopping' || fetchedTransformStats.state === 'aborting') {
|
||||
logger.error(
|
||||
`Not starting transform ${transformId} since it's state is: ${fetchedTransformStats.state}`
|
||||
);
|
||||
}
|
||||
} catch (statsErr) {
|
||||
const statsError = transformError(statsErr);
|
||||
logger.error(`Failed to check if transform ${transformId} is started: ${statsError.message}`);
|
||||
}
|
||||
};
|
||||
|
||||
const deletePreviousTransformsVersions = async (esClient: ElasticsearchClient, logger: Logger) => {
|
||||
// TODO Concat all deprecated transforms versions
|
||||
const deprecatedTransforms: string[] = [];
|
||||
|
||||
for (const transform of deprecatedTransforms) {
|
||||
const response = await deleteTransformSafe(esClient, logger, transform);
|
||||
if (response) return;
|
||||
}
|
||||
};
|
||||
|
||||
const deleteTransformSafe = async (
|
||||
esClient: ElasticsearchClient,
|
||||
logger: Logger,
|
||||
name: string
|
||||
): Promise<boolean> => {
|
||||
try {
|
||||
await esClient.transform.deleteTransform({ transform_id: name, force: true });
|
||||
logger.info(`Deleted transform successfully [Name: ${name}]`);
|
||||
return true;
|
||||
} catch (e) {
|
||||
if (e instanceof errors.ResponseError && e.statusCode === 404) {
|
||||
logger.trace(`Transform not exists [Name: ${name}]`);
|
||||
return false;
|
||||
} else {
|
||||
logger.error(`Failed to delete transform [Name: ${name}]`);
|
||||
logger.error(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
|
@ -1,17 +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
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
import type { PluginInitializerContext } from '@kbn/core/server';
|
||||
|
||||
// This exports static code and TypeScript types,
|
||||
// as well as, Kibana Platform `plugin()` initializer.
|
||||
|
||||
export async function plugin(initializerContext: PluginInitializerContext) {
|
||||
const { AssetInventoryPlugin } = await import('./plugin');
|
||||
return new AssetInventoryPlugin(initializerContext);
|
||||
}
|
||||
|
||||
export type { AssetInventoryPluginSetup, AssetInventoryPluginStart } from './types';
|
|
@ -1,63 +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
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
import type {
|
||||
PluginInitializerContext,
|
||||
CoreSetup,
|
||||
CoreStart,
|
||||
Plugin,
|
||||
Logger,
|
||||
} from '@kbn/core/server';
|
||||
|
||||
import type { AssetInventoryPluginSetup, AssetInventoryPluginStart } from './types';
|
||||
import { defineRoutes } from './routes';
|
||||
// TODO Uncomment this line when initialize() is enabled
|
||||
// import { initializeTransforms } from './create_transforms/create_transforms';
|
||||
|
||||
export class AssetInventoryPlugin
|
||||
implements Plugin<AssetInventoryPluginSetup, AssetInventoryPluginStart>
|
||||
{
|
||||
private readonly logger: Logger;
|
||||
|
||||
// TODO Uncomment this line when initialize() is enabled
|
||||
// private isInitialized: boolean = false;
|
||||
|
||||
constructor(initializerContext: PluginInitializerContext) {
|
||||
this.logger = initializerContext.logger.get();
|
||||
}
|
||||
|
||||
public setup(core: CoreSetup) {
|
||||
this.logger.debug('assetInventory: Setup');
|
||||
const router = core.http.createRouter();
|
||||
|
||||
// Register server side APIs
|
||||
defineRoutes(router);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
public start(core: CoreStart) {
|
||||
this.logger.debug('assetInventory: Started');
|
||||
|
||||
// TODO Invoke initialize() when it's due
|
||||
// this.initialize(core).catch(() => {});
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
public stop() {}
|
||||
|
||||
/**
|
||||
* Initialization is idempotent and required for (re)creating indices and transforms.
|
||||
*/
|
||||
// TODO Uncomment these lines when initialize() is enabled
|
||||
// async initialize(core: CoreStart): Promise<void> {
|
||||
// this.logger.debug('initialize');
|
||||
// const esClient = core.elasticsearch.client.asInternalUser;
|
||||
// await initializeTransforms(esClient, this.logger);
|
||||
// this.isInitialized = true;
|
||||
// }
|
||||
}
|
|
@ -1,23 +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
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
import type { IRouter } from '@kbn/core/server';
|
||||
|
||||
export function defineRoutes(router: IRouter) {
|
||||
router.get(
|
||||
{
|
||||
path: '/api/asset_inventory/example',
|
||||
validate: false,
|
||||
},
|
||||
async (context, request, response) => {
|
||||
return response.ok({
|
||||
body: {
|
||||
time: new Date().toISOString(),
|
||||
},
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
|
@ -1,10 +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
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface AssetInventoryPluginSetup {}
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface AssetInventoryPluginStart {}
|
|
@ -1,18 +0,0 @@
|
|||
{
|
||||
"extends": "../../../../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "target/types"
|
||||
},
|
||||
"include": [
|
||||
"common/**/*.ts",
|
||||
"common/**/*.json",
|
||||
"public/**/*.ts",
|
||||
"public/**/*.tsx",
|
||||
"public/**/*.json",
|
||||
"server/**/*.ts",
|
||||
"server/**/*.json",
|
||||
"../../../../../typings/**/*"
|
||||
],
|
||||
"exclude": ["target/**/*"],
|
||||
"kbn_references": ["@kbn/core", "@kbn/i18n-react", "@kbn/securitysolution-es-utils"]
|
||||
}
|
|
@ -16,7 +16,6 @@
|
|||
],
|
||||
"requiredPlugins": [
|
||||
"actions",
|
||||
"assetInventory",
|
||||
"alerting",
|
||||
"cases",
|
||||
"cloud",
|
||||
|
|
|
@ -16,7 +16,10 @@ const AssetInventoryApp = () => {
|
|||
<EuiPageTemplate.Header>
|
||||
<EuiTitle size="l">
|
||||
<h1>
|
||||
<FormattedMessage id="assetInventory.allAssets" defaultMessage="All Assets" />
|
||||
<FormattedMessage
|
||||
id="xpack.securitySolution.assetInventory.allAssets"
|
||||
defaultMessage="All Assets"
|
||||
/>
|
||||
</h1>
|
||||
</EuiTitle>
|
||||
</EuiPageTemplate.Header>
|
|
@ -5,19 +5,18 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import React, { lazy, Suspense } from 'react';
|
||||
import { EuiLoadingSpinner } from '@elastic/eui';
|
||||
import { SecuritySolutionPageWrapper } from '../../common/components/page_wrapper';
|
||||
import { useKibana } from '../../common/lib/kibana';
|
||||
import { SecurityPageName } from '../../../common/constants';
|
||||
import { SpyRoute } from '../../common/utils/route/spy_routes';
|
||||
|
||||
const AssetInventoryLazy = lazy(() => import('../components/app'));
|
||||
|
||||
export const AssetInventoryContainer = React.memo(() => {
|
||||
const { assetInventory } = useKibana().services;
|
||||
|
||||
return (
|
||||
<SecuritySolutionPageWrapper noPadding>
|
||||
{assetInventory.getAssetInventoryPage({})}
|
||||
<SpyRoute pageName={SecurityPageName.assetInventory} />
|
||||
<Suspense fallback={<EuiLoadingSpinner />}>
|
||||
<AssetInventoryLazy />
|
||||
</Suspense>
|
||||
</SecuritySolutionPageWrapper>
|
||||
);
|
||||
});
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||
|
||||
import type { SecuritySubPluginRoutes } from '../app/types';
|
||||
import { SecurityPageName } from '../app/types';
|
||||
import { ASSET_INVENTORY_PATH } from '../../common/constants';
|
||||
|
@ -13,12 +15,25 @@ import { PluginTemplateWrapper } from '../common/components/plugin_template_wrap
|
|||
import { SecurityRoutePageWrapper } from '../common/components/security_route_page_wrapper';
|
||||
import { AssetInventoryContainer } from './pages';
|
||||
|
||||
// Initializing react-query
|
||||
const queryClient = new QueryClient({
|
||||
defaultOptions: {
|
||||
queries: {
|
||||
refetchOnWindowFocus: false,
|
||||
refetchOnMount: false,
|
||||
refetchOnReconnect: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const AssetInventoryRoutes = () => (
|
||||
<PluginTemplateWrapper>
|
||||
<SecurityRoutePageWrapper pageName={SecurityPageName.assetInventory}>
|
||||
<AssetInventoryContainer />
|
||||
</SecurityRoutePageWrapper>
|
||||
</PluginTemplateWrapper>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<PluginTemplateWrapper>
|
||||
<SecurityRoutePageWrapper pageName={SecurityPageName.assetInventory}>
|
||||
<AssetInventoryContainer />
|
||||
</SecurityRoutePageWrapper>
|
||||
</PluginTemplateWrapper>
|
||||
</QueryClientProvider>
|
||||
);
|
||||
|
||||
export const routes: SecuritySubPluginRoutes = [
|
||||
|
|
|
@ -49,7 +49,6 @@ import type { GuidedOnboardingPluginStart } from '@kbn/guided-onboarding-plugin/
|
|||
import type { DataViewsServicePublic } from '@kbn/data-views-plugin/public';
|
||||
import type { ContentManagementPublicStart } from '@kbn/content-management-plugin/public';
|
||||
import type { ExpressionsStart } from '@kbn/expressions-plugin/public';
|
||||
import type { AssetInventoryPluginStart } from '@kbn/asset-inventory-plugin/public';
|
||||
|
||||
import type { DiscoverStart } from '@kbn/discover-plugin/public';
|
||||
import type { ManagementSetup } from '@kbn/management-plugin/public';
|
||||
|
@ -123,7 +122,6 @@ export interface SetupPlugins {
|
|||
* in the code.
|
||||
*/
|
||||
export interface StartPlugins {
|
||||
assetInventory: AssetInventoryPluginStart;
|
||||
cases: CasesPublicStart;
|
||||
data: DataPublicPluginStart;
|
||||
unifiedSearch: UnifiedSearchPublicPluginStart;
|
||||
|
|
|
@ -215,7 +215,6 @@
|
|||
"@kbn/cbor",
|
||||
"@kbn/zod",
|
||||
"@kbn/cloud-security-posture",
|
||||
"@kbn/asset-inventory-plugin",
|
||||
"@kbn/security-solution-distribution-bar",
|
||||
"@kbn/cloud-security-posture-common",
|
||||
"@kbn/cloud-security-posture-graph",
|
||||
|
|
|
@ -4049,10 +4049,6 @@
|
|||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@kbn/asset-inventory-plugin@link:x-pack/solutions/security/plugins/asset_inventory":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@kbn/audit-log-plugin@link:x-pack/test/security_api_integration/plugins/audit_log":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue