diff --git a/app/scripts/modules/core/src/projects/configure/Clusters.tsx b/app/scripts/modules/core/src/projects/configure/Clusters.tsx index 25f20755f0a..d81d4441848 100644 --- a/app/scripts/modules/core/src/projects/configure/Clusters.tsx +++ b/app/scripts/modules/core/src/projects/configure/Clusters.tsx @@ -30,6 +30,11 @@ export class Clusters extends React.Component implements IWizard errors.applications = applicationErrors; } + const areStackAndDetailDisabled = this.areStackAndDetailDisabled(cluster); + errors.stack = areStackAndDetailDisabled && cluster.stack !== '*' && 'Only * is valid for the selected account'; + errors.detail = + areStackAndDetailDisabled && cluster.detail !== '*' && 'Only * is valid for the selected account'; + return Object.keys(errors).length ? errors : null; }); @@ -51,6 +56,9 @@ export class Clusters extends React.Component implements IWizard } private areStackAndDetailDisabled(cluster: IProjectCluster): boolean { + if (!cluster || !cluster.account) { + return false; + } const account = this.props.accounts.find(({ name }) => name === cluster.account); return account.type === 'kubernetes' && account.providerVersion === 'v2'; } @@ -92,7 +100,6 @@ export class Clusters extends React.Component implements IWizard {clusters.map((cluster, idx) => { const clusterPath = `config.clusters[${idx}]`; const applicationsPath = `${clusterPath}.applications`; - const areStackAndDetailDisabled = this.areStackAndDetailDisabled(cluster); return ( @@ -124,26 +131,14 @@ export class Clusters extends React.Component implements IWizard ( - - )} + input={props => } /> ( - - )} + input={props => } />