diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/event_filters/delete_modal/policy_event_filters_delete_modal.test.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/event_filters/delete_modal/policy_event_filters_delete_modal.test.tsx
index 20522e35e8983..2e00dab303007 100644
--- a/x-pack/plugins/security_solution/public/management/pages/policy/view/event_filters/delete_modal/policy_event_filters_delete_modal.test.tsx
+++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/event_filters/delete_modal/policy_event_filters_delete_modal.test.tsx
@@ -39,6 +39,7 @@ describe('Policy details event filter delete modal', () => {
renderResult = mockedContext.render(
diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/event_filters/delete_modal/policy_event_filters_delete_modal.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/event_filters/delete_modal/policy_event_filters_delete_modal.tsx
index eca26a0026dd1..bfa2f09ab9773 100644
--- a/x-pack/plugins/security_solution/public/management/pages/policy/view/event_filters/delete_modal/policy_event_filters_delete_modal.tsx
+++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/event_filters/delete_modal/policy_event_filters_delete_modal.tsx
@@ -16,10 +16,12 @@ import { useBulkUpdateEventFilters } from '../hooks';
export const PolicyEventFiltersDeleteModal = ({
policyId,
+ policyName,
exception,
onCancel,
}: {
policyId: string;
+ policyName: string;
exception: ExceptionListItemSchema;
onCancel: () => void;
}) => {
@@ -36,8 +38,8 @@ export const PolicyEventFiltersDeleteModal = ({
text: i18n.translate(
'xpack.securitySolution.endpoint.policy.eventFilters.list.removeDialog.successToastText',
{
- defaultMessage: '"{exception}" has been removed from policy',
- values: { exception: exception.name },
+ defaultMessage: '"{eventFilterName}" has been removed from {policyName} policy',
+ values: { eventFilterName: exception.name, policyName },
}
),
});
diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/event_filters/empty/policy_event_filters_empty_unexisting.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/event_filters/empty/policy_event_filters_empty_unexisting.tsx
index c4b9e778664ef..7976fc8a566da 100644
--- a/x-pack/plugins/security_solution/public/management/pages/policy/view/event_filters/empty/policy_event_filters_empty_unexisting.tsx
+++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/event_filters/empty/policy_event_filters_empty_unexisting.tsx
@@ -16,7 +16,7 @@ interface CommonProps {
}
export const PolicyEventFiltersEmptyUnexisting = memo(({ policyId, policyName }) => {
- const { onClickHandler, toRouteUrl } = useGetLinkTo(policyId, policyName);
+ const { onClickHandler, toRouteUrl } = useGetLinkTo(policyId, policyName, { show: 'create' });
return (
{
+export const useGetLinkTo = (
+ policyId: string,
+ policyName: string,
+ location?: Partial
+) => {
const { getAppUrl } = useAppUrl();
const { toRoutePath, toRouteUrl } = useMemo(() => {
- const path = getEventFiltersListPath();
+ const path = getEventFiltersListPath(location);
return {
toRoutePath: path,
toRouteUrl: getAppUrl({ path }),
};
- }, [getAppUrl]);
+ }, [getAppUrl, location]);
const policyEventFiltersPath = useMemo(() => getPolicyEventFiltersPath(policyId), [policyId]);
const policyEventFilterRouteState = useMemo(() => {
@@ -55,5 +60,6 @@ export const useGetLinkTo = (policyId: string, policyName: string) => {
return {
onClickHandler,
toRouteUrl,
+ state: policyEventFilterRouteState,
};
};
diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/event_filters/list/policy_event_filters_list.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/event_filters/list/policy_event_filters_list.tsx
index 5ab6f4bfb0eba..63930610f8aa7 100644
--- a/x-pack/plugins/security_solution/public/management/pages/policy/view/event_filters/list/policy_event_filters_list.tsx
+++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/event_filters/list/policy_event_filters_list.tsx
@@ -33,6 +33,7 @@ import { PolicyEventFiltersDeleteModal } from '../delete_modal';
import { isGlobalPolicyEffected } from '../../../../../components/effected_policy_select/utils';
import { getEventFiltersListPath } from '../../../../../common/routing';
import { useUserPrivileges } from '../../../../../../common/components/user_privileges';
+import { useGetLinkTo } from '../empty/use_policy_event_filters_empty_hooks';
interface PolicyEventFiltersListProps {
policy: ImmutableObject;
@@ -47,6 +48,7 @@ export const PolicyEventFiltersList = React.memo(({
const [exceptionItemToDelete, setExceptionItemToDelete] = useState<
ExceptionListItemSchema | undefined
>();
+ const { state } = useGetLinkTo(policy.id, policy.name);
const {
data: eventFilters,
@@ -116,7 +118,7 @@ export const PolicyEventFiltersList = React.memo(({
),
href: getAppUrl({ appId: APP_UI_ID, path: viewUrlPath }),
navigateAppId: APP_UI_ID,
- navigateOptions: { path: viewUrlPath },
+ navigateOptions: { path: viewUrlPath, state },
'data-test-subj': 'view-full-details-action',
};
const item = artifact as ExceptionListItemSchema;
@@ -159,6 +161,7 @@ export const PolicyEventFiltersList = React.memo(({
{exceptionItemToDelete && (
diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/host_isolation_exceptions/components/delete_modal.test.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/host_isolation_exceptions/components/delete_modal.test.tsx
index bd9bfbf5d653d..5e750b5599d71 100644
--- a/x-pack/plugins/security_solution/public/management/pages/policy/view/host_isolation_exceptions/components/delete_modal.test.tsx
+++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/host_isolation_exceptions/components/delete_modal.test.tsx
@@ -43,6 +43,7 @@ describe('Policy details host isolation exceptions delete modal', () => {
(renderResult = mockedContext.render(
diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/host_isolation_exceptions/components/delete_modal.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/host_isolation_exceptions/components/delete_modal.tsx
index 655107b8f357d..ad8868bf68346 100644
--- a/x-pack/plugins/security_solution/public/management/pages/policy/view/host_isolation_exceptions/components/delete_modal.tsx
+++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/host_isolation_exceptions/components/delete_modal.tsx
@@ -17,10 +17,12 @@ import { updateOneHostIsolationExceptionItem } from '../../../../host_isolation_
export const PolicyHostIsolationExceptionsDeleteModal = ({
policyId,
+ policyName,
exception,
onCancel,
}: {
policyId: string;
+ policyName: string;
exception: ExceptionListItemSchema;
onCancel: () => void;
}) => {
@@ -51,8 +53,9 @@ export const PolicyHostIsolationExceptionsDeleteModal = ({
text: i18n.translate(
'xpack.securitySolution.endpoint.policy.hostIsolationExceptions.list.removeDialog.successToastText',
{
- defaultMessage: '"{exception}" has been removed from policy',
- values: { exception: exception.name },
+ defaultMessage:
+ '"{hostIsolationExceptionName}" has been removed from {policyName} policy',
+ values: { hostIsolationExceptionName: exception.name, policyName },
}
),
});
diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/host_isolation_exceptions/components/empty_unexisting.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/host_isolation_exceptions/components/empty_unexisting.tsx
index 34246caf7c313..94185904ce6cc 100644
--- a/x-pack/plugins/security_solution/public/management/pages/policy/view/host_isolation_exceptions/components/empty_unexisting.tsx
+++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/host_isolation_exceptions/components/empty_unexisting.tsx
@@ -16,7 +16,7 @@ export const PolicyHostIsolationExceptionsEmptyUnexisting = ({
}: {
policy: PolicyData;
}) => {
- const { onClickHandler, toRouteUrl } = useGetLinkTo(policy.id, policy.name);
+ const { onClickHandler, toRouteUrl } = useGetLinkTo(policy.id, policy.name, { show: 'create' });
return (
diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/host_isolation_exceptions/components/list.test.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/host_isolation_exceptions/components/list.test.tsx
index 4ad3919fcc563..17e3ace9a6410 100644
--- a/x-pack/plugins/security_solution/public/management/pages/policy/view/host_isolation_exceptions/components/list.test.tsx
+++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/host_isolation_exceptions/components/list.test.tsx
@@ -52,7 +52,7 @@ describe('Policy details host isolation exceptions tab', () => {
({ history } = mockedContext);
render = () =>
(renderResult = mockedContext.render(
-
+
));
act(() => {
diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/host_isolation_exceptions/components/list.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/host_isolation_exceptions/components/list.tsx
index feee5491da314..3b5244aad30da 100644
--- a/x-pack/plugins/security_solution/public/management/pages/policy/view/host_isolation_exceptions/components/list.tsx
+++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/host_isolation_exceptions/components/list.tsx
@@ -33,14 +33,23 @@ import { getCurrentArtifactsLocation } from '../../../store/policy_details/selec
import { usePolicyDetailsSelector } from '../../policy_hooks';
import { PolicyHostIsolationExceptionsDeleteModal } from './delete_modal';
import { useFetchHostIsolationExceptionsList } from '../../../../host_isolation_exceptions/view/hooks';
-
-export const PolicyHostIsolationExceptionsList = ({ policyId }: { policyId: string }) => {
+import { useGetLinkTo } from './use_policy_host_isolation_exceptions_empty_hooks';
+
+export const PolicyHostIsolationExceptionsList = ({
+ policyId,
+ policyName,
+}: {
+ policyId: string;
+ policyName: string;
+}) => {
const history = useHistory();
const { getAppUrl } = useAppUrl();
const privileges = useUserPrivileges().endpointPrivileges;
const location = usePolicyDetailsSelector(getCurrentArtifactsLocation);
+ const { state } = useGetLinkTo(policyId, policyName);
+
// load the list of policies>
const policiesRequest = useGetEndpointSpecificPolicies();
const urlParams = usePolicyDetailsSelector(getCurrentArtifactsLocation);
@@ -127,7 +136,7 @@ export const PolicyHostIsolationExceptionsList = ({ policyId }: { policyId: stri
),
href: getAppUrl({ appId: APP_UI_ID, path: viewUrlPath }),
navigateAppId: APP_UI_ID,
- navigateOptions: { path: viewUrlPath },
+ navigateOptions: { path: viewUrlPath, state },
'data-test-subj': 'view-full-details-action',
};
@@ -172,6 +181,7 @@ export const PolicyHostIsolationExceptionsList = ({ policyId }: { policyId: stri
{exceptionItemToDelete ? (
diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/host_isolation_exceptions/components/use_policy_host_isolation_exceptions_empty_hooks.ts b/x-pack/plugins/security_solution/public/management/pages/policy/view/host_isolation_exceptions/components/use_policy_host_isolation_exceptions_empty_hooks.ts
index 6aba11a4499ea..494dfd9a7ae08 100644
--- a/x-pack/plugins/security_solution/public/management/pages/policy/view/host_isolation_exceptions/components/use_policy_host_isolation_exceptions_empty_hooks.ts
+++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/host_isolation_exceptions/components/use_policy_host_isolation_exceptions_empty_hooks.ts
@@ -14,16 +14,21 @@ import {
getHostIsolationExceptionsListPath,
} from '../../../../../common/routing';
import { APP_UI_ID } from '../../../../../../../common/constants';
+import { HostIsolationExceptionsPageLocation } from '../../../../host_isolation_exceptions/types';
-export const useGetLinkTo = (policyId: string, policyName: string) => {
+export const useGetLinkTo = (
+ policyId: string,
+ policyName: string,
+ location?: Partial
+) => {
const { getAppUrl } = useAppUrl();
const { toRoutePath, toRouteUrl } = useMemo(() => {
- const path = getHostIsolationExceptionsListPath();
+ const path = getHostIsolationExceptionsListPath(location);
return {
toRoutePath: path,
toRouteUrl: getAppUrl({ path }),
};
- }, [getAppUrl]);
+ }, [getAppUrl, location]);
const policyHostIsolationExceptionsPath = useMemo(
() => getPolicyHostIsolationExceptionsPath(policyId),
@@ -61,5 +66,6 @@ export const useGetLinkTo = (policyId: string, policyName: string) => {
return {
onClickHandler,
toRouteUrl,
+ state: policyHostIsolationExceptionsRouteState,
};
};
diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/host_isolation_exceptions/host_isolation_exceptions_tab.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/host_isolation_exceptions/host_isolation_exceptions_tab.tsx
index 1836997e74c16..f9ec756a8be76 100644
--- a/x-pack/plugins/security_solution/public/management/pages/policy/view/host_isolation_exceptions/host_isolation_exceptions_tab.tsx
+++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/host_isolation_exceptions/host_isolation_exceptions_tab.tsx
@@ -181,7 +181,7 @@ export const PolicyHostIsolationExceptionsTab = ({ policy }: { policy: PolicyDat
color="transparent"
borderRadius="none"
>
-
+
) : (
diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/trusted_apps/empty/policy_trusted_apps_empty_unexisting.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/trusted_apps/empty/policy_trusted_apps_empty_unexisting.tsx
index 1c96398b8347e..1fe834a9fce46 100644
--- a/x-pack/plugins/security_solution/public/management/pages/policy/view/trusted_apps/empty/policy_trusted_apps_empty_unexisting.tsx
+++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/trusted_apps/empty/policy_trusted_apps_empty_unexisting.tsx
@@ -16,7 +16,7 @@ interface CommonProps {
}
export const PolicyTrustedAppsEmptyUnexisting = memo(({ policyId, policyName }) => {
- const { onClickHandler, toRouteUrl } = useGetLinkTo(policyId, policyName);
+ const { onClickHandler, toRouteUrl } = useGetLinkTo(policyId, policyName, { show: 'create' });
return (
{
+export const useGetLinkTo = (
+ policyId: string,
+ policyName: string,
+ location?: Partial
+) => {
const { getAppUrl } = useAppUrl();
const { toRoutePath, toRouteUrl } = useMemo(() => {
- const path = getTrustedAppsListPath();
+ const path = getTrustedAppsListPath(location);
return {
toRoutePath: path,
toRouteUrl: getAppUrl({ path }),
};
- }, [getAppUrl]);
+ }, [getAppUrl, location]);
const policyTrustedAppsPath = useMemo(() => getPolicyTrustedAppsPath(policyId), [policyId]);
const policyTrustedAppRouteState = useMemo(() => {
@@ -55,5 +60,6 @@ export const useGetLinkTo = (policyId: string, policyName: string) => {
return {
onClickHandler,
toRouteUrl,
+ state: policyTrustedAppRouteState,
};
};
diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/trusted_apps/layout/policy_trusted_apps_layout.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/trusted_apps/layout/policy_trusted_apps_layout.tsx
index 83fb3663104a6..dd89cca43c10d 100644
--- a/x-pack/plugins/security_solution/public/management/pages/policy/view/trusted_apps/layout/policy_trusted_apps_layout.tsx
+++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/trusted_apps/layout/policy_trusted_apps_layout.tsx
@@ -166,7 +166,7 @@ export const PolicyTrustedAppsLayout = React.memo(() => {
/>
)
) : displayHeaderAndContent ? (
-
+
) : (
)}
diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/trusted_apps/list/policy_trusted_apps_list.test.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/trusted_apps/list/policy_trusted_apps_list.test.tsx
index 67b435f4873a1..da304adc2db44 100644
--- a/x-pack/plugins/security_solution/public/management/pages/policy/view/trusted_apps/list/policy_trusted_apps_list.test.tsx
+++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/trusted_apps/list/policy_trusted_apps_list.test.tsx
@@ -87,7 +87,7 @@ describe('when rendering the PolicyTrustedAppsList', () => {
mockedApis = policyDetailsPageAllApiHttpMocks(appTestContext.coreStart.http);
waitForAction = appTestContext.middlewareSpy.waitForAction;
- componentRenderProps = {};
+ componentRenderProps = { policyId: '9f08b220-342d-4c8d-8971-4cf96adcac29', policyName: 'test' };
render = async (waitForLoadedState: boolean = true) => {
appTestContext.history.push(
diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/trusted_apps/list/policy_trusted_apps_list.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/trusted_apps/list/policy_trusted_apps_list.tsx
index fa4d4e40b3e52..54dabf87f474b 100644
--- a/x-pack/plugins/security_solution/public/management/pages/policy/view/trusted_apps/list/policy_trusted_apps_list.tsx
+++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/trusted_apps/list/policy_trusted_apps_list.tsx
@@ -22,7 +22,6 @@ import {
getPolicyTrustedAppsListPagination,
getTrustedAppsAllPoliciesById,
isPolicyTrustedAppListLoading,
- policyIdFromParams,
getCurrentPolicyArtifactsFilter,
} from '../../../store/policy_details/selectors';
import {
@@ -39,21 +38,23 @@ import { ArtifactEntryCollapsibleCardProps } from '../../../../../components/art
import { useTestIdGenerator } from '../../../../../components/hooks/use_test_id_generator';
import { RemoveTrustedAppFromPolicyModal } from './remove_trusted_app_from_policy_modal';
import { useUserPrivileges } from '../../../../../../common/components/user_privileges';
+import { useGetLinkTo } from '../empty/use_policy_trusted_apps_empty_hooks';
const DATA_TEST_SUBJ = 'policyTrustedAppsGrid';
export interface PolicyTrustedAppsListProps {
hideTotalShowingLabel?: boolean;
+ policyId: string;
+ policyName: string;
}
export const PolicyTrustedAppsList = memo(
- ({ hideTotalShowingLabel = false }) => {
+ ({ hideTotalShowingLabel = false, policyId, policyName }) => {
const getTestId = useTestIdGenerator(DATA_TEST_SUBJ);
const toasts = useToasts();
const history = useHistory();
const { getAppUrl } = useAppUrl();
const { canCreateArtifactsByPolicy } = useUserPrivileges().endpointPrivileges;
- const policyId = usePolicyDetailsSelector(policyIdFromParams);
const isLoading = usePolicyDetailsSelector(isPolicyTrustedAppListLoading);
const defaultFilter = usePolicyDetailsSelector(getCurrentPolicyArtifactsFilter);
const trustedAppItems = usePolicyDetailsSelector(getPolicyTrustedAppList);
@@ -62,6 +63,7 @@ export const PolicyTrustedAppsList = memo(
const allPoliciesById = usePolicyDetailsSelector(getTrustedAppsAllPoliciesById);
const trustedAppsApiError = usePolicyDetailsSelector(getPolicyTrustedAppListError);
const navigateCallback = usePolicyDetailsNavigateCallback();
+ const { state } = useGetLinkTo(policyId, policyName);
const [isCardExpanded, setCardExpanded] = useState>({});
const [trustedAppsForRemoval, setTrustedAppsForRemoval] = useState([]);
@@ -152,7 +154,7 @@ export const PolicyTrustedAppsList = memo(
),
href: getAppUrl({ appId: APP_UI_ID, path: viewUrlPath }),
navigateAppId: APP_UI_ID,
- navigateOptions: { path: viewUrlPath },
+ navigateOptions: { path: viewUrlPath, state },
'data-test-subj': getTestId('viewFullDetailsAction'),
},
];
@@ -201,6 +203,7 @@ export const PolicyTrustedAppsList = memo(
isCardExpanded,
trustedAppItems,
canCreateArtifactsByPolicy,
+ state,
]);
const provideCardProps = useCallback['cardComponentProps']>(