-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Security Solution][Endpoint] Display empty state UI on the artifacts…
… subtab of policy details when no trusted application exist (#113802) * Adds new empty prom when there is no TA or non already assigned one * Adds policy name to text message * Fix error in tabs component * Fix mulilangs in empty state components * API call that checks if any TA exists with actions and reducers * Adds current policy id and name to the empty state component instead of a fake ones * Adds unit test for layout * Switch empty state depending on results and added unit test * Fix multilang keys and join code into a hook to avoid duplications * Fix TS error * Canges icon * Fixes pr comments * Fix ts error in test
- Loading branch information
1 parent
280d1d8
commit 9a31e86
Showing
15 changed files
with
463 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
...plugins/security_solution/public/management/pages/policy/view/trusted_apps/empty/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* | ||
* 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 { PolicyTrustedAppsEmptyUnassigned } from './policy_trusted_apps_empty_unassigned'; | ||
export { PolicyTrustedAppsEmptyUnexisting } from './policy_trusted_apps_empty_unexisting'; |
69 changes: 69 additions & 0 deletions
69
.../management/pages/policy/view/trusted_apps/empty/policy_trusted_apps_empty_unassigned.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* 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, { memo, useCallback } from 'react'; | ||
import { EuiEmptyPrompt, EuiButton, EuiPageTemplate, EuiLink } from '@elastic/eui'; | ||
import { FormattedMessage } from '@kbn/i18n/react'; | ||
import { usePolicyDetailsNavigateCallback } from '../../policy_hooks'; | ||
import { useGetLinkTo } from './use_policy_trusted_apps_empty_hooks'; | ||
|
||
interface CommonProps { | ||
policyId: string; | ||
policyName: string; | ||
} | ||
|
||
export const PolicyTrustedAppsEmptyUnassigned = memo<CommonProps>(({ policyId, policyName }) => { | ||
const navigateCallback = usePolicyDetailsNavigateCallback(); | ||
const { onClickHandler, toRouteUrl } = useGetLinkTo(policyId, policyName); | ||
const onClickPrimaryButtonHandler = useCallback( | ||
() => | ||
navigateCallback({ | ||
show: 'list', | ||
}), | ||
[navigateCallback] | ||
); | ||
return ( | ||
<EuiPageTemplate template="centeredContent"> | ||
<EuiEmptyPrompt | ||
iconType="plusInCircle" | ||
data-test-subj="policy-trusted-apps-empty-unassigned" | ||
title={ | ||
<h2> | ||
<FormattedMessage | ||
id="xpack.securitySolution.endpoint.policy.trustedApps.empty.unassigned.title" | ||
defaultMessage="No assigned trusted applications" | ||
/> | ||
</h2> | ||
} | ||
body={ | ||
<FormattedMessage | ||
id="xpack.securitySolution.endpoint.policy.trustedApps.empty.unassigned.content" | ||
defaultMessage="There are currently no trusted applications assigned to {policyName}. Assign trusted applications now or add and manage them on the trusted applications page." | ||
values={{ policyName }} | ||
/> | ||
} | ||
actions={[ | ||
<EuiButton color="primary" fill onClick={onClickPrimaryButtonHandler}> | ||
<FormattedMessage | ||
id="xpack.securitySolution.endpoint.policy.trustedApps.empty.unassigned.primaryAction" | ||
defaultMessage="Assign trusted applications" | ||
/> | ||
</EuiButton>, | ||
// eslint-disable-next-line @elastic/eui/href-or-on-click | ||
<EuiLink onClick={onClickHandler} href={toRouteUrl}> | ||
<FormattedMessage | ||
id="xpack.securitySolution.endpoint.policy.trustedApps.empty.unassigned.secondaryAction" | ||
defaultMessage="Manage trusted applications" | ||
/> | ||
</EuiLink>, | ||
]} | ||
/> | ||
</EuiPageTemplate> | ||
); | ||
}); | ||
|
||
PolicyTrustedAppsEmptyUnassigned.displayName = 'PolicyTrustedAppsEmptyUnassigned'; |
53 changes: 53 additions & 0 deletions
53
.../management/pages/policy/view/trusted_apps/empty/policy_trusted_apps_empty_unexisting.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* 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, { memo } from 'react'; | ||
import { EuiEmptyPrompt, EuiButton, EuiPageTemplate } from '@elastic/eui'; | ||
import { FormattedMessage } from '@kbn/i18n/react'; | ||
import { useGetLinkTo } from './use_policy_trusted_apps_empty_hooks'; | ||
|
||
interface CommonProps { | ||
policyId: string; | ||
policyName: string; | ||
} | ||
|
||
export const PolicyTrustedAppsEmptyUnexisting = memo<CommonProps>(({ policyId, policyName }) => { | ||
const { onClickHandler, toRouteUrl } = useGetLinkTo(policyId, policyName); | ||
return ( | ||
<EuiPageTemplate template="centeredContent"> | ||
<EuiEmptyPrompt | ||
iconType="plusInCircle" | ||
data-test-subj="policy-trusted-apps-empty-unexisting" | ||
title={ | ||
<h2> | ||
<FormattedMessage | ||
id="xpack.securitySolution.endpoint.policy.trustedApps.empty.unexisting.title" | ||
defaultMessage="No trusted applications exist" | ||
/> | ||
</h2> | ||
} | ||
body={ | ||
<FormattedMessage | ||
id="xpack.securitySolution.endpoint.policy.trustedApps.empty.unexisting.content" | ||
defaultMessage="There are currently no trusted applications applied to your endpoints." | ||
/> | ||
} | ||
actions={ | ||
// eslint-disable-next-line @elastic/eui/href-or-on-click | ||
<EuiButton color="primary" fill onClick={onClickHandler} href={toRouteUrl}> | ||
<FormattedMessage | ||
id="xpack.securitySolution.endpoint.policy.trustedApps.empty.unexisting.action" | ||
defaultMessage="Add trusted application" | ||
/> | ||
</EuiButton> | ||
} | ||
/> | ||
</EuiPageTemplate> | ||
); | ||
}); | ||
|
||
PolicyTrustedAppsEmptyUnexisting.displayName = 'PolicyTrustedAppsEmptyUnexisting'; |
Oops, something went wrong.