mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 17:08:53 +00:00
Default policy renders on refresh of new policy page, changelog (#3243)
This commit is contained in:
parent
1ed5c46946
commit
37ffb88ec8
2 changed files with 8 additions and 1 deletions
1
changes/issue-3240-refresh-new-policy-defaults
Normal file
1
changes/issue-3240-refresh-new-policy-defaults
Normal file
|
|
@ -0,0 +1 @@
|
|||
* Default policy renders if user refreshes the policy creation page
|
||||
|
|
@ -6,7 +6,7 @@ import { InjectedRouter, Params } from "react-router/lib/Router";
|
|||
import Fleet from "fleet"; // @ts-ignore
|
||||
import { AppContext } from "context/app";
|
||||
import { PolicyContext } from "context/policy";
|
||||
import { QUERIES_PAGE_STEPS } from "utilities/constants";
|
||||
import { QUERIES_PAGE_STEPS, DEFAULT_POLICY } from "utilities/constants";
|
||||
import globalPoliciesAPI from "services/entities/global_policies"; // @ts-ignore
|
||||
import teamPoliciesAPI from "services/entities/team_policies"; // @ts-ignore
|
||||
import hostAPI from "services/entities/hosts"; // @ts-ignore
|
||||
|
|
@ -59,6 +59,12 @@ const PolicyPage = ({
|
|||
setLastEditedQueryResolution,
|
||||
} = useContext(PolicyContext);
|
||||
|
||||
useEffect(() => {
|
||||
if (lastEditedQueryBody === "") {
|
||||
setLastEditedQueryBody(DEFAULT_POLICY.query);
|
||||
}
|
||||
}, []);
|
||||
|
||||
const [step, setStep] = useState<string>(QUERIES_PAGE_STEPS[1]);
|
||||
const [selectedTargets, setSelectedTargets] = useState<ITarget[]>([]);
|
||||
const [isLiveQueryRunnable, setIsLiveQueryRunnable] = useState<boolean>(true);
|
||||
|
|
|
|||
Loading…
Reference in a new issue