Skip to content

Commit

Permalink
fix(kubernetes): disable project cluster filtration by stack/detail (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
maggieneterval authored and mergify[bot] committed Oct 25, 2019
1 parent 86a365b commit 114303a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/scripts/modules/core/src/help/help.contents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -385,9 +385,9 @@ const helpContents: { [key: string]: string } = {
<p>Filters the list of load balancers and server groups (if enabled)
to only show load balancers with instances failing the health check for the load balancer.</p>`,
'project.cluster.stack':
'<p>(Optional field)</p><p>Filters displayed clusters by stack.</p><p>Enter <samp>*</samp> to include all stacks; leave blank to omit any clusters with a stack.</p>',
'<p>(Optional field)</p><p>Filters displayed clusters by stack.</p><p>Enter <samp>*</samp> to include all stacks; leave blank to omit any clusters with a stack.</p><p>Only <samp>*</samp> is valid for Kubernetes V2 accounts.</p>',
'project.cluster.detail':
'<p>(Optional field)</p><p>Filters displayed clusters by detail.</p><p>Enter <samp>*</samp> to include all details; leave blank to omit any clusters with a detail.</p>',
'<p>(Optional field)</p><p>Filters displayed clusters by detail.</p><p>Enter <samp>*</samp> to include all details; leave blank to omit any clusters with a detail.</p><p>Only <samp>*</samp> is valid for Kubernetes V2 accounts.</p>',
'instanceType.storageOverridden':
'<p>These storage settings have been cloned from the base server group and differ from the default settings for this instance type.</p>',
'instanceType.unavailable': '<p>This instance type is not available for the selected configuration.</p>',
Expand Down
22 changes: 20 additions & 2 deletions app/scripts/modules/core/src/projects/configure/Clusters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ export class Clusters extends React.Component<IClustersProps> implements IWizard
formik.setFieldValue(path, isChecked ? [] : null);
}

private areStackAndDetailDisabled(cluster: IProjectCluster): boolean {
const account = this.props.accounts.find(({ name }) => name === cluster.account);
return account.type === 'kubernetes' && account.providerVersion === 'v2';
}

public render() {
const { HelpField } = NgReact;
const { accounts } = this.props;
Expand Down Expand Up @@ -87,6 +92,7 @@ export class Clusters extends React.Component<IClustersProps> implements IWizard
{clusters.map((cluster, idx) => {
const clusterPath = `config.clusters[${idx}]`;
const applicationsPath = `${clusterPath}.applications`;
const areStackAndDetailDisabled = this.areStackAndDetailDisabled(cluster);

return (
<tr key={idx}>
Expand Down Expand Up @@ -118,14 +124,26 @@ export class Clusters extends React.Component<IClustersProps> implements IWizard
<td>
<FormikFormField
name={`${clusterPath}.stack`}
input={props => <TextInput {...props} inputClassName="sp-padding-xs-xaxis" />}
input={props => (
<TextInput
{...props}
disabled={areStackAndDetailDisabled}
inputClassName="sp-padding-xs-xaxis"
/>
)}
/>
</td>

<td>
<FormikFormField
name={`${clusterPath}.detail`}
input={props => <TextInput {...props} inputClassName="sp-padding-xs-xaxis" />}
input={props => (
<TextInput
{...props}
disabled={areStackAndDetailDisabled}
inputClassName="sp-padding-xs-xaxis"
/>
)}
/>
</td>

Expand Down

0 comments on commit 114303a

Please sign in to comment.