Skip to content

Commit

Permalink
Fix navigation when creating inline policy from integrations screen
Browse files Browse the repository at this point in the history
  • Loading branch information
kpollich committed Feb 7, 2022
1 parent 553220b commit f985f5a
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
import type { EuiStepProps } from '@elastic/eui/src/components/steps/step';
import { safeLoad } from 'js-yaml';

import { splitPkgKey } from '../../../../../../common';
import { PLUGIN_ID, splitPkgKey } from '../../../../../../common';
import type {
AgentPolicy,
NewPackagePolicy,
Expand Down Expand Up @@ -317,7 +317,14 @@ export const CreatePackagePolicyPage: React.FunctionComponent = () => {
mappingOptions: routeState.onSaveQueryParams,
paramsToApply,
});
navigateToApp(appId, { ...options, path: pathWithQueryString });

// In the case of a new policy creation, we always navigate to the Fleet agent policy details page
// for the newly-created policy
if (wasNewAgentPolicyCreated) {
navigateToApp(PLUGIN_ID, { ...options, path: pathWithQueryString });
} else {
navigateToApp(appId, { ...options, path: pathWithQueryString });
}
} else {
navigateToApp(...routeState.onSaveNavigateTo);
}
Expand Down

0 comments on commit f985f5a

Please sign in to comment.