Skip to content
Snippets Groups Projects

CE-2918: Host selector not displaying result

Merged CE-2918: Host selector not displaying result
All threads resolved!
Merged Johanna Szepanski requested to merge CE-2918-host-selector-not-displaying-result into develop
All threads resolved!
@@ -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";
@@ -21,6 +21,14 @@ import {
import { useTypingTimer } from "../../common/SearchBoxFilter/TypingTimer";
import { apiContext } from "../../../api/DeployApi";
/* const initHost = (activeDeployment) => {
return {
fqdn: activeDeployment.host.fqdn,
hostId: activeDeployment.host.hostId
};
}*/
export default function ChangeHostAdmin({
ioc,
getIOC,
@@ -30,15 +38,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]
);
const [host, setHost] = useState(initHost);
const client = useContext(apiContext);
const {
@@ -53,8 +58,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 +85,10 @@ export default function ChangeHostAdmin({
useEffect(() => {
if (updatedIoc) {
getIOC();
setHost({
fqdn: updatedIoc.activeDeployment.host.fqdn,
hostId: updatedIoc.activeDeployment.host.hostId
});
resetTab();
setButtonDisabled(false);
}
@@ -103,11 +111,11 @@ export default function ChangeHostAdmin({
},
{
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 +196,7 @@ export default function ChangeHostAdmin({
clearOnBlur={false}
value={host}
getOptionLabel={(option) => {
return option?.netBoxHost?.fqdn ?? "";
return option?.fqdn ?? "";
}}
renderInput={(params) => (
<TextField
Loading