|
|
@ -198,7 +198,7 @@ const PrepareHostForm: FC = () => { |
|
|
|
const accessSection = useMemo( |
|
|
|
const accessSection = useMemo( |
|
|
|
() => ( |
|
|
|
() => ( |
|
|
|
<GateForm |
|
|
|
<GateForm |
|
|
|
formContainer={isShowAccessSubmit} |
|
|
|
allowSubmit={isShowAccessSubmit} |
|
|
|
gridProps={{ |
|
|
|
gridProps={{ |
|
|
|
wrapperBoxProps: { |
|
|
|
wrapperBoxProps: { |
|
|
|
sx: { |
|
|
|
sx: { |
|
|
@ -218,26 +218,18 @@ const PrepareHostForm: FC = () => { |
|
|
|
} |
|
|
|
} |
|
|
|
}} |
|
|
|
}} |
|
|
|
onSubmitAppend={( |
|
|
|
onSubmitAppend={( |
|
|
|
{ getValue: getIdentifier }, |
|
|
|
ipAddress, |
|
|
|
{ getValue: getPassphrase }, |
|
|
|
password, |
|
|
|
setMessage, |
|
|
|
setGateMessage, |
|
|
|
setIsSubmitting, |
|
|
|
setGateIsSubmitting, |
|
|
|
) => { |
|
|
|
) => { |
|
|
|
const identifierValue = getIdentifier?.call(null); |
|
|
|
const body = { ipAddress, password }; |
|
|
|
const passphraseValue = getPassphrase?.call(null); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
api |
|
|
|
api |
|
|
|
.put<{ |
|
|
|
.put<APICommandInquireHostResponseBody>( |
|
|
|
hostName: string; |
|
|
|
'/command/inquire-host', |
|
|
|
hostOS: string; |
|
|
|
body, |
|
|
|
hostUUID: string; |
|
|
|
) |
|
|
|
isConnected: boolean; |
|
|
|
|
|
|
|
isInetConnected: boolean; |
|
|
|
|
|
|
|
isOSRegistered: boolean; |
|
|
|
|
|
|
|
}>('/command/inquire-host', { |
|
|
|
|
|
|
|
ipAddress: identifierValue, |
|
|
|
|
|
|
|
password: passphraseValue, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.then( |
|
|
|
.then( |
|
|
|
({ |
|
|
|
({ |
|
|
|
data: { |
|
|
|
data: { |
|
|
@ -265,14 +257,14 @@ const PrepareHostForm: FC = () => { |
|
|
|
setIsShowRedhatSection(true); |
|
|
|
setIsShowRedhatSection(true); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
setConnectedHostIPAddress(identifierValue); |
|
|
|
setConnectedHostIPAddress(ipAddress); |
|
|
|
setConnectedHostPassword(passphraseValue); |
|
|
|
setConnectedHostPassword(password); |
|
|
|
setConnectedHostUUID(hostUUID); |
|
|
|
setConnectedHostUUID(hostUUID); |
|
|
|
|
|
|
|
|
|
|
|
setIsShowAccessSubmit(false); |
|
|
|
setIsShowAccessSubmit(false); |
|
|
|
setIsShowOptionalSection(true); |
|
|
|
setIsShowOptionalSection(true); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
setMessage?.call(null, { |
|
|
|
setGateMessage({ |
|
|
|
children: `Failed to establish a connection with the given host credentials.`, |
|
|
|
children: `Failed to establish a connection with the given host credentials.`, |
|
|
|
type: 'error', |
|
|
|
type: 'error', |
|
|
|
}); |
|
|
|
}); |
|
|
@ -282,10 +274,10 @@ const PrepareHostForm: FC = () => { |
|
|
|
.catch((apiError) => { |
|
|
|
.catch((apiError) => { |
|
|
|
const emsg = handleAPIError(apiError); |
|
|
|
const emsg = handleAPIError(apiError); |
|
|
|
|
|
|
|
|
|
|
|
setMessage?.call(null, emsg); |
|
|
|
setGateMessage?.call(null, emsg); |
|
|
|
}) |
|
|
|
}) |
|
|
|
.finally(() => { |
|
|
|
.finally(() => { |
|
|
|
setIsSubmitting(false); |
|
|
|
setGateIsSubmitting(false); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}} |
|
|
|
}} |
|
|
|
passphraseLabel="Host root password" |
|
|
|
passphraseLabel="Host root password" |
|
|
|