UI: include team_id when nav to new policy from host details (#13757)

This commit is contained in:
Jacob Shandling 2023-09-06 11:07:13 -07:00 committed by GitHub
parent 6130a7bbd7
commit 72f5c5b30c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 3 deletions

View file

@ -155,6 +155,7 @@ const reducer = (state: InitialStateType, action: IAction) => {
}
};
// TODO: Can we remove policyTeamId in favor of always using URL team_id param?
export const PolicyContext = createContext<InitialStateType>(initialState);
const PolicyProvider = ({ children }: Props): JSX.Element => {

View file

@ -464,7 +464,9 @@ const HostDetailsPage = ({
setLastEditedQueryBody(osPolicyQuery);
setLastEditedQueryResolution("");
setLastEditedQueryCritical(false);
router.replace(NEW_POLICY);
router.replace(
`${NEW_POLICY}${host?.team_id ? `?team_id=${host?.team_id}` : ""}`
);
};
const onDestroyHost = async () => {

View file

@ -12,7 +12,7 @@ import Icon from "components/Icon/Icon";
import { ITeam } from "interfaces/team";
interface IRenderOSPolicyModal {
interface IOSPolicyModal {
onCreateNewPolicy: (team: ITeam) => void;
onCancel: () => void;
osVersion?: string;
@ -30,7 +30,7 @@ const OSPolicyModal = ({
detailsUpdatedAt,
osPolicy,
osPolicyLabel,
}: IRenderOSPolicyModal): JSX.Element => {
}: IOSPolicyModal): JSX.Element => {
const [copyMessage, setCopyMessage] = useState("");
const renderOsPolicyLabel = () => {