GUI: fix target IP not always shown

This commit is contained in:
DavHau
2025-05-13 17:24:28 +07:00
parent c8ea42b522
commit cb758a4849

View File

@@ -78,7 +78,6 @@ function sleep(ms: number) {
} }
interface InstallMachineProps { interface InstallMachineProps {
name?: string; name?: string;
targetHost?: string | null;
machine: MachineData; machine: MachineData;
} }
const InstallMachine = (props: InstallMachineProps) => { const InstallMachine = (props: InstallMachineProps) => {
@@ -104,7 +103,7 @@ const InstallMachine = (props: InstallMachineProps) => {
if (!curr_uri) { if (!curr_uri) {
return; return;
} }
if (!props.name || !props.targetHost) { if (!props.name) {
return; return;
} }
@@ -266,7 +265,7 @@ const InstallMachine = (props: InstallMachineProps) => {
}} }}
initial={ initial={
getValue(formStore, "1") || { getValue(formStore, "1") || {
target: props.targetHost || "", target: props.machine.machine.deploy?.targetHost || "",
report: false, report: false,
} }
} }
@@ -405,6 +404,9 @@ const MachineForm = (props: MachineDetailsProps) => {
), ),
}, },
}); });
queryClient.invalidateQueries({
queryKey: [activeURI(), "machine", machineName(), "get_machine_details"],
});
return null; return null;
}; };
@@ -661,11 +663,7 @@ const MachineForm = (props: MachineDetailsProps) => {
handleClose={() => setInstallModalOpen(false)} handleClose={() => setInstallModalOpen(false)}
class="min-w-[600px]" class="min-w-[600px]"
> >
<InstallMachine <InstallMachine name={machineName()} machine={props.initialData} />
name={machineName()}
targetHost={getValue(formStore, "machine.deploy.targetHost")}
machine={props.initialData}
/>
</Modal> </Modal>
</> </>
); );