|
|
@ -24,14 +24,8 @@ const PrepareNetworkForm = withRouter( |
|
|
|
}) => { |
|
|
|
}) => { |
|
|
|
const { protect } = useProtect(); |
|
|
|
const { protect } = useProtect(); |
|
|
|
|
|
|
|
|
|
|
|
const [dataHostName, setDataHostName] = useProtectedState< |
|
|
|
const [dataHostDetail, setHostDetail] = useProtectedState< |
|
|
|
string | undefined |
|
|
|
APIHostDetail | undefined |
|
|
|
>(undefined, protect); |
|
|
|
|
|
|
|
const [dataHostUUID, setDataHostUUID] = useProtectedState< |
|
|
|
|
|
|
|
string | undefined |
|
|
|
|
|
|
|
>(undefined, protect); |
|
|
|
|
|
|
|
const [dataShortHostName, setDataShortHostName] = useProtectedState< |
|
|
|
|
|
|
|
string | undefined |
|
|
|
|
|
|
|
>(undefined, protect); |
|
|
|
>(undefined, protect); |
|
|
|
const [fatalErrorMessage, setFatalErrorMessage] = useProtectedState< |
|
|
|
const [fatalErrorMessage, setFatalErrorMessage] = useProtectedState< |
|
|
|
Message | undefined |
|
|
|
Message | undefined |
|
|
@ -41,10 +35,12 @@ const PrepareNetworkForm = withRouter( |
|
|
|
const panelHeaderElement = useMemo( |
|
|
|
const panelHeaderElement = useMemo( |
|
|
|
() => ( |
|
|
|
() => ( |
|
|
|
<PanelHeader> |
|
|
|
<PanelHeader> |
|
|
|
<HeaderText>Prepare network on {dataShortHostName}</HeaderText> |
|
|
|
<HeaderText> |
|
|
|
|
|
|
|
Prepare network on {dataHostDetail?.shortHostName} |
|
|
|
|
|
|
|
</HeaderText> |
|
|
|
</PanelHeader> |
|
|
|
</PanelHeader> |
|
|
|
), |
|
|
|
), |
|
|
|
[dataShortHostName], |
|
|
|
[dataHostDetail], |
|
|
|
); |
|
|
|
); |
|
|
|
const contentElement = useMemo(() => { |
|
|
|
const contentElement = useMemo(() => { |
|
|
|
let result; |
|
|
|
let result; |
|
|
@ -64,12 +60,12 @@ const PrepareNetworkForm = withRouter( |
|
|
|
formControlProps={{ sx: { maxWidth: '20em' } }} |
|
|
|
formControlProps={{ sx: { maxWidth: '20em' } }} |
|
|
|
id="prepare-network-host-name" |
|
|
|
id="prepare-network-host-name" |
|
|
|
label="Host name" |
|
|
|
label="Host name" |
|
|
|
value={dataHostName} |
|
|
|
value={dataHostDetail?.hostName} |
|
|
|
/> |
|
|
|
/> |
|
|
|
} |
|
|
|
} |
|
|
|
required |
|
|
|
required |
|
|
|
/> |
|
|
|
/> |
|
|
|
<NetworkInitForm targetHostUUID={dataHostUUID} /> |
|
|
|
<NetworkInitForm hostDetail={dataHostDetail} /> |
|
|
|
<FlexBox row justifyContent="flex-end"> |
|
|
|
<FlexBox row justifyContent="flex-end"> |
|
|
|
<ContainedButton>Prepare network</ContainedButton> |
|
|
|
<ContainedButton>Prepare network</ContainedButton> |
|
|
|
</FlexBox> |
|
|
|
</FlexBox> |
|
|
@ -79,13 +75,7 @@ const PrepareNetworkForm = withRouter( |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
return result; |
|
|
|
}, [ |
|
|
|
}, [dataHostDetail, fatalErrorMessage, isLoading, panelHeaderElement]); |
|
|
|
dataHostName, |
|
|
|
|
|
|
|
dataHostUUID, |
|
|
|
|
|
|
|
fatalErrorMessage, |
|
|
|
|
|
|
|
isLoading, |
|
|
|
|
|
|
|
panelHeaderElement, |
|
|
|
|
|
|
|
]); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|
if (isReady) { |
|
|
|
if (isReady) { |
|
|
@ -98,10 +88,8 @@ const PrepareNetworkForm = withRouter( |
|
|
|
: queryHostUUID |
|
|
|
: queryHostUUID |
|
|
|
}`,
|
|
|
|
}`,
|
|
|
|
) |
|
|
|
) |
|
|
|
.then(({ data: { hostName, hostUUID, shortHostName } }) => { |
|
|
|
.then(({ data }) => { |
|
|
|
setDataHostName(hostName); |
|
|
|
setHostDetail(data); |
|
|
|
setDataHostUUID(hostUUID); |
|
|
|
|
|
|
|
setDataShortHostName(shortHostName); |
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
.catch((error) => { |
|
|
|
.catch((error) => { |
|
|
|
const { children } = handleAPIError(error); |
|
|
|
const { children } = handleAPIError(error); |
|
|
@ -127,10 +115,8 @@ const PrepareNetworkForm = withRouter( |
|
|
|
fatalErrorMessage, |
|
|
|
fatalErrorMessage, |
|
|
|
isReady, |
|
|
|
isReady, |
|
|
|
queryHostUUID, |
|
|
|
queryHostUUID, |
|
|
|
setDataHostName, |
|
|
|
|
|
|
|
setDataHostUUID, |
|
|
|
|
|
|
|
setDataShortHostName, |
|
|
|
|
|
|
|
setFatalErrorMessage, |
|
|
|
setFatalErrorMessage, |
|
|
|
|
|
|
|
setHostDetail, |
|
|
|
setIsLoading, |
|
|
|
setIsLoading, |
|
|
|
]); |
|
|
|
]); |
|
|
|
|
|
|
|
|
|
|
|