mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[D4C] added k8s dashboard as an asset to cloud-defend integration (#157928)
## Summary Ties the k8s dashboard as an asset of cloud_defend integration. Also fixes a css layout regression due to some test refactors. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
5af528b807
commit
08e55fd689
9 changed files with 68 additions and 21 deletions
|
@ -7,10 +7,7 @@
|
|||
"id": "cloudDefend",
|
||||
"server": true,
|
||||
"browser": true,
|
||||
"configPath": [
|
||||
"xpack",
|
||||
"cloudDefend"
|
||||
],
|
||||
"configPath": ["xpack", "cloudDefend"],
|
||||
"requiredPlugins": [
|
||||
"navigation",
|
||||
"data",
|
||||
|
@ -19,14 +16,10 @@
|
|||
"kibanaReact",
|
||||
"cloud",
|
||||
"security",
|
||||
"licensing"
|
||||
"licensing",
|
||||
"kubernetesSecurity"
|
||||
],
|
||||
"optionalPlugins": [
|
||||
"usageCollection"
|
||||
],
|
||||
"requiredBundles": [
|
||||
"kibanaReact",
|
||||
"usageCollection"
|
||||
]
|
||||
"optionalPlugins": ["usageCollection"],
|
||||
"requiredBundles": ["kibanaReact", "usageCollection"]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { KUBERNETES_PATH, KUBERNETES_TITLE } from '@kbn/kubernetes-security-plugin/public';
|
||||
import type { CloudDefendPage, CloudDefendPageNavigationItem } from './types';
|
||||
|
||||
const NAV_ITEMS_NAMES = {
|
||||
|
@ -23,4 +24,9 @@ export const cloudDefendPages: Record<CloudDefendPage, CloudDefendPageNavigation
|
|||
path: `${CLOUD_DEFEND_BASE_PATH}/policies`,
|
||||
id: 'cloud_defend-policies',
|
||||
},
|
||||
dashboard: {
|
||||
name: KUBERNETES_TITLE,
|
||||
path: KUBERNETES_PATH,
|
||||
id: 'kubernetes_security-dashboard',
|
||||
},
|
||||
};
|
||||
|
|
|
@ -14,10 +14,10 @@ export interface CloudDefendPageNavigationItem extends CloudDefendNavigationItem
|
|||
id: CloudDefendPageId;
|
||||
}
|
||||
|
||||
export type CloudDefendPage = 'policies';
|
||||
export type CloudDefendPage = 'policies' | 'dashboard';
|
||||
|
||||
/**
|
||||
* All the IDs for the cloud defend pages.
|
||||
* This needs to match the cloud defend page entries in `SecurityPageName` in `x-pack/plugins/security_solution/common/constants.ts`.
|
||||
*/
|
||||
export type CloudDefendPageId = 'cloud_defend-policies';
|
||||
export type CloudDefendPageId = 'cloud_defend-policies' | 'kubernetes_security-dashboard';
|
||||
|
|
|
@ -557,9 +557,8 @@ describe('<ControlGeneralViewSelector />', () => {
|
|||
|
||||
const count = getByTestId('cloud-defend-conditions-count');
|
||||
expect(count).toBeTruthy();
|
||||
expect(count.childNodes[0]).toHaveTextContent('Conditions:');
|
||||
expect(count.childNodes[1]).toHaveTextContent('1');
|
||||
expect(count.querySelector(`[title^='operation']`)).toBeTruthy();
|
||||
expect(count).toHaveTextContent('1');
|
||||
expect(count.title).toEqual('operation');
|
||||
|
||||
act(() => title.click());
|
||||
|
||||
|
|
|
@ -396,14 +396,18 @@ export const ControlGeneralViewSelector = ({
|
|||
<EuiFlexGroup alignItems="center" gutterSize="none">
|
||||
<div>
|
||||
{accordionState === 'closed' && (
|
||||
<div data-test-subj="cloud-defend-conditions-count">
|
||||
<>
|
||||
<EuiText css={styles.conditionsBadge} size="xs">
|
||||
<b>{i18n.conditions}</b>
|
||||
</EuiText>
|
||||
<EuiBadge title={conditionsAdded.join(',')} color="hollow">
|
||||
<EuiBadge
|
||||
title={conditionsAdded.join(',')}
|
||||
color="hollow"
|
||||
data-test-subj="cloud-defend-conditions-count"
|
||||
>
|
||||
{conditionsAdded.length}
|
||||
</EuiBadge>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
{!usedByResponse && (
|
||||
<EuiBadge title={i18n.unusedSelectorHelp} color="warning">
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* 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 from 'react';
|
||||
import { type CustomAssetsAccordionProps, CustomAssetsAccordion } from '@kbn/fleet-plugin/public';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { useKibana } from '../../common/hooks/use_kibana';
|
||||
import { cloudDefendPages } from '../../common/navigation/constants';
|
||||
|
||||
const SECURITY_APP_NAME = 'securitySolutionUI';
|
||||
|
||||
export const CloudDefendCustomAssetsExtension = () => {
|
||||
const { application } = useKibana().services;
|
||||
|
||||
const views: CustomAssetsAccordionProps['views'] = [
|
||||
{
|
||||
name: cloudDefendPages.dashboard.name,
|
||||
url: application.getUrlForApp(SECURITY_APP_NAME, { path: cloudDefendPages.dashboard.path }),
|
||||
description: i18n.translate(
|
||||
'xpack.cloudDefend.createPackagePolicy.customAssetsTab.dashboardViewLabel',
|
||||
{ defaultMessage: 'View k8s dashboard' }
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
return <CustomAssetsAccordion views={views} initialIsOpen />;
|
||||
};
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export { CloudDefendCustomAssetsExtension as default };
|
|
@ -23,6 +23,10 @@ const LazyPolicyReplaceDefineStepExtension = lazy(
|
|||
() => import('./components/fleet_extensions/package_policy_replace_define_step_extension')
|
||||
);
|
||||
|
||||
const LazyCustomAssets = lazy(
|
||||
() => import('./components/fleet_extensions/custom_assets_extension')
|
||||
);
|
||||
|
||||
const RouterLazy = lazy(() => import('./application/router'));
|
||||
const Router = (props: CloudDefendRouterProps) => (
|
||||
<Suspense fallback={<LoadingState />}>
|
||||
|
@ -58,6 +62,12 @@ export class CloudDefendPlugin
|
|||
Component: LazyPolicyReplaceDefineStepExtension,
|
||||
});
|
||||
|
||||
plugins.fleet.registerExtension({
|
||||
package: INTEGRATION_PACKAGE_NAME,
|
||||
view: 'package-detail-assets',
|
||||
Component: LazyCustomAssets,
|
||||
});
|
||||
|
||||
const CloudDefendRouter = (props: CloudDefendRouterProps) => (
|
||||
<KibanaContextProvider services={{ ...core, ...plugins }}>
|
||||
<RedirectAppLinks coreStart={core}>
|
||||
|
|
|
@ -32,7 +32,8 @@
|
|||
"@kbn/es-types",
|
||||
"@kbn/data-views-plugin",
|
||||
"@kbn/utility-types",
|
||||
"@kbn/utility-types-jest"
|
||||
"@kbn/utility-types-jest",
|
||||
"@kbn/kubernetes-security-plugin"
|
||||
],
|
||||
"exclude": ["target/**/*"]
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
import { KubernetesSecurityPlugin } from './plugin';
|
||||
|
||||
export type { KubernetesSecurityStart } from './types';
|
||||
export { KUBERNETES_TITLE, KUBERNETES_PATH } from '../common/constants';
|
||||
|
||||
export function plugin() {
|
||||
return new KubernetesSecurityPlugin();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue