mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 08:58:41 +00:00
Refetch host scripts and activities when exiting related modals
This commit is contained in:
parent
6094bb2c53
commit
f983ada42a
2 changed files with 15 additions and 14 deletions
|
|
@ -612,7 +612,10 @@ const HostDetailsPage = ({
|
|||
|
||||
const onCancelScriptDetailsModal = useCallback(() => {
|
||||
setScriptDetailsId("");
|
||||
}, []);
|
||||
// refetch activities to make sure they up-to-date with what was displayed in the modal
|
||||
refetchPastActivities();
|
||||
refetchUpcomingActivities();
|
||||
}, [refetchPastActivities, refetchUpcomingActivities]);
|
||||
|
||||
const onCancelSoftwareInstallDetailsModal = useCallback(() => {
|
||||
setSoftwareInstallUuid("");
|
||||
|
|
@ -963,15 +966,17 @@ const HostDetailsPage = ({
|
|||
hostsTeamId={host?.team_id}
|
||||
/>
|
||||
)}
|
||||
{showRunScriptModal && (
|
||||
<RunScriptModal
|
||||
host={host}
|
||||
currentUser={currentUser}
|
||||
scriptDetailsId={scriptDetailsId}
|
||||
setScriptDetailsId={setScriptDetailsId}
|
||||
onClose={onCloseRunScriptModal}
|
||||
/>
|
||||
)}
|
||||
{showRunScriptModal &&
|
||||
// force run script modal to unmount when script details modal is shown;
|
||||
// it will be remounted when script details modal is closed
|
||||
!scriptDetailsId && (
|
||||
<RunScriptModal
|
||||
host={host}
|
||||
currentUser={currentUser}
|
||||
setScriptDetailsId={setScriptDetailsId}
|
||||
onClose={onCloseRunScriptModal}
|
||||
/>
|
||||
)}
|
||||
{!!host && showTransferHostModal && (
|
||||
<TransferHostModal
|
||||
onCancel={() => setShowTransferHostModal(false)}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ const baseClass = "run-script-modal";
|
|||
interface IScriptsProps {
|
||||
currentUser: IUser | null;
|
||||
host: IHost;
|
||||
scriptDetailsId: string;
|
||||
setScriptDetailsId: React.Dispatch<React.SetStateAction<string>>;
|
||||
onClose: () => void;
|
||||
}
|
||||
|
|
@ -41,7 +40,6 @@ const EmptyComponent = () => <></>;
|
|||
const RunScriptModal = ({
|
||||
currentUser,
|
||||
host,
|
||||
scriptDetailsId,
|
||||
setScriptDetailsId,
|
||||
onClose,
|
||||
}: IScriptsProps) => {
|
||||
|
|
@ -123,7 +121,6 @@ const RunScriptModal = ({
|
|||
|
||||
if (!config) return null;
|
||||
|
||||
const isShowingScriptDetails = !!scriptDetailsId; // used to set css visibility for this modal to hidden when the script details modal is open
|
||||
const tableData = hostScriptResponse?.scripts;
|
||||
|
||||
return (
|
||||
|
|
@ -132,7 +129,6 @@ const RunScriptModal = ({
|
|||
onExit={onClose}
|
||||
onEnter={onClose}
|
||||
className={`${baseClass}`}
|
||||
isHidden={isShowingScriptDetails}
|
||||
isLoading={runScriptRequested || isFetching || isLoading}
|
||||
>
|
||||
<>
|
||||
|
|
|
|||
Loading…
Reference in a new issue