Skip to content
This repository has been archived by the owner on Dec 6, 2024. It is now read-only.

Commit

Permalink
fix: select cidr field only in non-TRE env (#941)
Browse files Browse the repository at this point in the history
* fix: select cidr field only in non-TRE env
  • Loading branch information
SanketD92 authored Mar 3, 2022
1 parent dd2ccfd commit 897670b
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,9 @@ class CreateInternalEnvForm extends React.Component {

renderForm() {
const form = this.form;
const askForCidr = !_.isUndefined(this.props.defaultCidr) && !this.isAppStreamEnabled;
const shouldAskforCidr = !_.isUndefined(this.props.defaultCidr) && !this.isAppStreamEnabled;
const configurations = this.configurations;
const field = form.$('cidr');
const cidrField = shouldAskforCidr ? form.$('cidr') : undefined;

// we show the AppStream configuration warning when the feature is enabled,
// and the user's projects are not linked to AppStream-configured accounts
Expand All @@ -179,8 +179,8 @@ class CreateInternalEnvForm extends React.Component {
{({ processing, onCancel }) => (
<>
<Input dataTestId="workspace-name" field={form.$('name')} />
{askForCidr && <Input field={field} />}
{askForCidr && !_.isEmpty(field.value) && field.value.split('/')[1] <= 16 && (
{shouldAskforCidr && <Input field={cidrField} />}
{shouldAskforCidr && !_.isEmpty(cidrField.value) && cidrField.value.split('/')[1] <= 16 && (
<Message
className="mb4"
icon="warning"
Expand Down

0 comments on commit 897670b

Please sign in to comment.