Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ const HostSelectionForm: React.FC<HostSelectionFormProps> = ({
onAutoSelectChange={onAutoSelectChange}
onHostSelect={onHostSelect}
isNutanix={isNutanix}
hostsBinding={nextRequested && !showClusterErrors}
/>
</GridItem>
{(showClusterErrors || showFormErrors) && !!alerts.length && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const ClusterDeploymentHostsSelection: React.FC<ClusterDeploymentHostsSelectionP
onHostSelect,
onSetInstallationDiskId,
isNutanix,
hostsBinding,
}) => {
const { t } = useTranslation();
const { values } = useFormikContext<ClusterDeploymentHostsSelectionValues>();
Expand All @@ -54,7 +55,7 @@ const ClusterDeploymentHostsSelection: React.FC<ClusterDeploymentHostsSelectionP
const cpuArchitecture = getClusterDeploymentCpuArchitecture(clusterDeployment);

const availableAgents = React.useMemo(() => {
const filtered = getAgentsForSelection(agents).filter(
const filtered = getAgentsForSelection(agents, hostsBinding).filter(
(agent) =>
(agent.spec.clusterDeploymentName?.name === cdName &&
agent.spec.clusterDeploymentName?.namespace === cdNamespace) ||
Expand All @@ -66,7 +67,7 @@ const ClusterDeploymentHostsSelection: React.FC<ClusterDeploymentHostsSelectionP
return isNutanix
? filtered.filter((a) => a.status?.inventory?.systemVendor?.manufacturer === 'Nutanix')
: filtered;
}, [agents, cdNamespace, cdName, cpuArchitecture, isNutanix]);
}, [agents, hostsBinding, isNutanix, cdName, cdNamespace, cpuArchitecture]);

const hostRequirementText = getHostRequirementText(isSNOCluster, isTNA, t);

Expand Down
1 change: 1 addition & 0 deletions libs/ui-lib/lib/cim/components/ClusterDeployment/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ export type ClusterDeploymentHostsSelectionProps = {
onAutoSelectChange: VoidFunction;
onHostSelect: VoidFunction;
isNutanix: boolean;
hostsBinding?: boolean;
};

export type InfraEnvAgentTableProps = Pick<
Expand Down
6 changes: 5 additions & 1 deletion libs/ui-lib/lib/cim/components/helpers/agents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,13 @@ const AGENT_FOR_SELECTION_STATUSES: AgentStatus[] = [
export const hostToAgent = (agents: AgentK8sResource[] = [], host: Host) =>
agents.find((a) => a.metadata?.uid === host.id) as AgentK8sResource;

export const getAgentsForSelection = (agents: AgentK8sResource[]) =>
export const getAgentsForSelection = (agents: AgentK8sResource[], isSubmitting?: boolean) =>
agents.filter((agent) => {
const key = getAgentStatusKey(agent);
if (isSubmitting) {
return [...AGENT_FOR_SELECTION_STATUSES, 'specSyncErr'].includes(key as AgentStatus);
}

return AGENT_FOR_SELECTION_STATUSES.includes(key as AgentStatus);
});

Expand Down
Loading