Skip to content
Snippets Groups Projects
Commit 99c46b55 authored by EREBUS_DMN\jsz's avatar EREBUS_DMN\jsz Committed by Johanna Szepanski
Browse files

fixed bug host selector not displaying search result

parent b647e25d
No related branches found
No related tags found
2 merge requests!497CE-2790: Prepare for 4.0.0,!487CE-2918: Host selector not displaying result
Pipeline #191940 waiting for manual action
......@@ -2,8 +2,8 @@ import React, {
useState,
useEffect,
useCallback,
useMemo,
useContext
useContext,
useMemo
} from "react";
import AccessControl from "../../auth/AccessControl";
import { ConfirmationDialog, useAPIMethod } from "@ess-ics/ce-ui-common";
......@@ -30,15 +30,12 @@ export default function ChangeHostAdmin({
}) {
const initHost = useMemo(
() => ({
netBoxHost: {
fqdn: ioc?.activeDeployment.host.fqdn,
hostId: ioc?.activeDeployment.host.hostId
}
fqdn: ioc.activeDeployment.host.fqdn,
hostId: ioc.activeDeployment.host.hostId
}),
[ioc?.activeDeployment?.host]
[ioc.activeDeployment.host]
);
const [host, setHost] = useState(initHost);
const client = useContext(apiContext);
const {
......@@ -53,8 +50,7 @@ export default function ChangeHostAdmin({
const [query, onHostKeyUp] = useTypingTimer({ interval: 500 });
const noModification = useCallback(
() =>
!host || host?.netBoxHost?.hostId === ioc.activeDeployment.host.hostId,
() => !host || host?.hostId === ioc.activeDeployment.host.hostId,
[host, ioc]
);
......@@ -81,6 +77,10 @@ export default function ChangeHostAdmin({
useEffect(() => {
if (updatedIoc) {
getIOC();
setHost({
fqdn: updatedIoc.activeDeployment.host.fqdn,
hostId: updatedIoc.activeDeployment.host.hostId
});
resetTab();
setButtonDisabled(false);
}
......@@ -99,15 +99,15 @@ export default function ChangeHostAdmin({
setButtonDisabled(true);
updateHost(
{
ioc_id: ioc?.id
ioc_id: ioc.id
},
{
requestBody: {
hostId: host?.netBoxHost.hostId
hostId: host?.hostId
}
}
);
}, [updateHost, ioc, host?.netBoxHost?.hostId, setButtonDisabled]);
}, [updateHost, ioc, host?.hostId, setButtonDisabled]);
let disabledButtonTitle = "";
if (buttonDisabled || ioc.operationInProgress) {
......@@ -188,7 +188,7 @@ export default function ChangeHostAdmin({
clearOnBlur={false}
value={host}
getOptionLabel={(option) => {
return option?.netBoxHost?.fqdn ?? "";
return option?.fqdn ?? "";
}}
renderInput={(params) => (
<TextField
......
......@@ -20,7 +20,7 @@ export default function IOCAdmin({
buttonDisabled={buttonDisabled}
setButtonDisabled={setButtonDisabled}
/>
{ioc.activeDeployment && (
{ioc.activeDeployment ? (
<ChangeHostAdmin
ioc={ioc}
getIOC={getIOC}
......@@ -28,7 +28,7 @@ export default function IOCAdmin({
buttonDisabled={buttonDisabled}
setButtonDisabled={setButtonDisabled}
/>
)}
) : null}
<AdministerUndeployment
ioc={ioc}
buttonDisabled={buttonDisabled}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment