Skip to content

Commit

Permalink
company name can be 255 characters on all pages (oncokb#1106)
Browse files Browse the repository at this point in the history
  • Loading branch information
jfkonecn authored Apr 11, 2024
1 parent 5a3d9d2 commit 9a2dba3
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 14 deletions.
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
12.16.1
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import {
LONG_TEXT_VAL,
SHORT_TEXT_VAL,
TEXT_VAL,
OPTIONAL_TEXT_VAL,
} from 'app/shared/utils/FormValidationUtils';
import { NOT_USED_IN_AI_MODELS } from 'app/config/constants/terms';

Expand Down Expand Up @@ -463,6 +464,9 @@ export class NewAccountForm extends React.Component<INewAccountForm> {
ACCOUNT_TITLES.POSITION,
this.selectedLicense
)}
validate={{
...OPTIONAL_TEXT_VAL,
}}
/>
<AvField
name="email"
Expand Down Expand Up @@ -610,7 +614,7 @@ export class NewAccountForm extends React.Component<INewAccountForm> {
errorMessage:
'Please let us know where you located.',
},
...SHORT_TEXT_VAL,
...TEXT_VAL,
}}
/>
<AvField
Expand All @@ -625,7 +629,7 @@ export class NewAccountForm extends React.Component<INewAccountForm> {
errorMessage:
'Please let us know where you located.',
},
...SHORT_TEXT_VAL,
...TEXT_VAL,
}}
/>
<AvField
Expand Down
12 changes: 9 additions & 3 deletions src/main/webapp/app/components/newCompanyForm/NewCompanyForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ import { getSectionClassName } from 'app/pages/account/AccountUtils';
import { FormTextAreaField } from '../../shared/textarea/FormTextAreaField';
import { FormSelectWithLabelField } from '../../shared/select/FormSelectWithLabelField';
import { AvField, AvForm } from 'availity-reactstrap-validation';
import {
LONG_TEXT_VAL,
SHORT_TEXT_VAL,
TEXT_VAL,
OPTIONAL_TEXT_VAL,
} from 'app/shared/utils/FormValidationUtils';
import {
LicenseType,
LICENSE_TITLES,
Expand Down Expand Up @@ -137,7 +143,7 @@ export class NewCompanyForm extends React.Component<INewCompanyFormProps> {
label="Name"
validate={{
...fieldRequiredValidation('company name'),
...textValidation(1, 100),
...TEXT_VAL,
async: debouncedCompanyNameValidator,
}}
/>
Expand All @@ -160,12 +166,12 @@ export class NewCompanyForm extends React.Component<INewCompanyFormProps> {
<AvField
name="businessContact"
label="Business Contact"
validate={{ ...textValidation(0, 255) }}
validate={{ ...OPTIONAL_TEXT_VAL }}
/>
<AvField
name="legalContact"
label="Legal Contact"
validate={{ ...textValidation(0, 255) }}
validate={{ ...OPTIONAL_TEXT_VAL }}
/>
<FormListField
list={this.companyDomains}
Expand Down
12 changes: 9 additions & 3 deletions src/main/webapp/app/pages/companyPage/CompanyPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import {
debouncedCompanyNameValidator,
fieldRequiredValidation,
textValidation,
OPTIONAL_TEXT_VAL,
} from 'app/shared/utils/FormValidationUtils';
import { Link } from 'react-router-dom';
import { QuickToolButton } from '../userPage/QuickToolButton';
Expand Down Expand Up @@ -69,6 +70,11 @@ import UsageText from 'app/shared/texts/UsageText';
import { DateSelector } from 'app/components/dateSelector/DateSelector';
import { DownloadButton } from 'app/components/downloadButton/DownloadButton';
import { RouterStore } from 'mobx-react-router';
import {
LONG_TEXT_VAL,
SHORT_TEXT_VAL,
TEXT_VAL,
} from 'app/shared/utils/FormValidationUtils';

interface MatchParams {
id: string;
Expand Down Expand Up @@ -563,7 +569,7 @@ export default class CompanyPage extends React.Component<ICompanyPage> {
}
validate={{
...fieldRequiredValidation('company name'),
...textValidation(1, 100),
...TEXT_VAL,
async: (
value: string,
ctx: any,
Expand Down Expand Up @@ -618,7 +624,7 @@ export default class CompanyPage extends React.Component<ICompanyPage> {
Business Contact
</span>
}
validate={{ ...textValidation(0, 255) }}
validate={{ ...OPTIONAL_TEXT_VAL }}
/>
<AvField
name="legalContact"
Expand All @@ -628,7 +634,7 @@ export default class CompanyPage extends React.Component<ICompanyPage> {
Legal Contact
</span>
}
validate={{ ...textValidation(0, 255) }}
validate={{ ...OPTIONAL_TEXT_VAL }}
/>
<div className="form-group">
<div className={'font-weight-bold'}>
Expand Down
11 changes: 6 additions & 5 deletions src/main/webapp/app/pages/userPage/UserPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ import {
LONG_TEXT_VAL,
SHORT_TEXT_VAL,
TEXT_VAL,
OPTIONAL_TEXT_VAL,
} from 'app/shared/utils/FormValidationUtils';
import AuthenticationStore from 'app/store/AuthenticationStore';
import ButtonWithTooltip from 'app/shared/button/ButtonWithTooltip';
Expand All @@ -83,7 +84,7 @@ import {
import UserUsageDetailsTable from 'app/pages/usageAnalysisPage/UserUsageDetailsTable';
import { DateSelector } from 'app/components/dateSelector/DateSelector';
import { KeyInputGroups } from 'app/pages/userPage/KeyInputGroups';
import { Input, Label } from 'reactstrap';
import { Label } from 'reactstrap';
import {
getAccountActivationLink,
getPasswordResetLink,
Expand Down Expand Up @@ -873,7 +874,7 @@ export default class UserPage extends React.Component<IUserPage> {
licenseType={this.selectedLicense}
/>
}
validate={SHORT_TEXT_VAL}
validate={OPTIONAL_TEXT_VAL}
value={this.user.jobTitle}
/>
<AvField
Expand All @@ -893,7 +894,7 @@ export default class UserPage extends React.Component<IUserPage> {
) : null}
</>
}
validate={SHORT_TEXT_VAL}
validate={TEXT_VAL}
value={
this.user.company
? this.user.company.name
Expand Down Expand Up @@ -925,7 +926,7 @@ export default class UserPage extends React.Component<IUserPage> {
/>
}
value={this.user.city}
validate={SHORT_TEXT_VAL}
validate={TEXT_VAL}
/>
<AvField
name="country"
Expand All @@ -936,7 +937,7 @@ export default class UserPage extends React.Component<IUserPage> {
/>
}
value={this.user.country}
validate={SHORT_TEXT_VAL}
validate={TEXT_VAL}
/>
<div className={'mb-2 font-weight-bold'}>
Account Type
Expand Down
4 changes: 3 additions & 1 deletion src/main/webapp/app/shared/utils/FormValidationUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ export const textValidation = (minLength?: number, maxLength?: number) => {
return validation;
};

export const OPTIONAL_TEXT_VAL = textValidation(0, 255);

export const TEXT_VAL = textValidation(2, 255);

export const SHORT_TEXT_VAL = textValidation(2, 50);
Expand All @@ -89,7 +91,7 @@ export const EMAIL_VAL = {
errorMessage: 'Your email is required to be at least 5 characters.',
},
maxLength: {
value: 254,
value: 50,
errorMessage: 'Your email cannot be longer than 50 characters.',
},
};
Expand Down

0 comments on commit 9a2dba3

Please sign in to comment.