mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 01:18:42 +00:00
Update policy back link to return to selected team (#3190)
This commit is contained in:
parent
17bd4d5110
commit
4c19c9c8b1
5 changed files with 10 additions and 5 deletions
1
changes/issue-3130-fix-policy-back-link
Normal file
1
changes/issue-3130-fix-policy-back-link
Normal file
|
|
@ -0,0 +1 @@
|
|||
* Update policy back link to return to selected team
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
import React, { useCallback, useContext, useEffect, useState } from "react";
|
||||
import { Link } from "react-router";
|
||||
import { useQuery } from "react-query";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { noop } from "lodash";
|
||||
|
|
@ -261,7 +260,7 @@ const ManagePolicyPage = (managePoliciesPageProps: {
|
|||
if (userTeams && !userTeams.find((t) => t.id === teamId)) {
|
||||
if (isOnGlobalTeam) {
|
||||
// For global users, default to zero (i.e. all teams).
|
||||
if (teamId !== 0) {
|
||||
if (teamId === undefined) {
|
||||
handleTeamSelect(0);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -140,9 +140,14 @@ const QueryEditor = ({
|
|||
return null;
|
||||
}
|
||||
|
||||
const backPath = policyTeamId ? `?team_id=${policyTeamId}` : "";
|
||||
|
||||
return (
|
||||
<div className={`${baseClass}__form body-wrap`}>
|
||||
<Link to={PATHS.MANAGE_POLICIES} className={`${baseClass}__back-link`}>
|
||||
<Link
|
||||
to={`${PATHS.MANAGE_POLICIES}/${backPath}`}
|
||||
className={`${baseClass}__back-link`}
|
||||
>
|
||||
<img src={BackChevron} alt="back chevron" id="back-chevron" />
|
||||
<span>Back to policies</span>
|
||||
</Link>
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ const QueryEditor = ({
|
|||
goToSelectTargets,
|
||||
onOpenSchemaSidebar,
|
||||
renderLiveQueryWarning,
|
||||
}: IQueryEditorProps) => {
|
||||
}: IQueryEditorProps): JSX.Element | null => {
|
||||
const dispatch = useDispatch();
|
||||
const { currentUser } = useContext(AppContext);
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ const RunQuery = ({
|
|||
queryIdForEdit,
|
||||
setSelectedTargets,
|
||||
goToQueryEditor,
|
||||
}: IRunQueryProps) => {
|
||||
}: IRunQueryProps): JSX.Element | null => {
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const [isQueryFinished, setIsQueryFinished] = useState<boolean>(false);
|
||||
|
|
|
|||
Loading…
Reference in a new issue