diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2018-10-05 14:35:06 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2018-10-10 09:23:02 +0200 |
commit | 705fd53a666017eb147d33f5d82d9a2ea85e59b3 (patch) | |
tree | 79635fb93bc4515b8a4b177f2f7b4d7646e8cdd3 /server/sonar-web/src/main/js | |
parent | f5a9eedb6aded3cc5cbf514419cf23c6e2165373 (diff) | |
download | sonarqube-705fd53a666017eb147d33f5d82d9a2ea85e59b3.tar.gz sonarqube-705fd53a666017eb147d33f5d82d9a2ea85e59b3.zip |
SONARCLOUD-128 allow up to 300 characters for org name and key
Diffstat (limited to 'server/sonar-web/src/main/js')
5 files changed, 19 insertions, 15 deletions
diff --git a/server/sonar-web/src/main/js/apps/create/organization/OrganizationDetailsStep.tsx b/server/sonar-web/src/main/js/apps/create/organization/OrganizationDetailsStep.tsx index 4c7f28a20a6..7ae7f7867bb 100644 --- a/server/sonar-web/src/main/js/apps/create/organization/OrganizationDetailsStep.tsx +++ b/server/sonar-web/src/main/js/apps/create/organization/OrganizationDetailsStep.tsx @@ -84,11 +84,11 @@ export default class OrganizationDetailsStep extends React.PureComponent<Props, errors.avatar = translate('onboarding.create_organization.avatar.error'); } - if (name.length > 0 && (name.length < 2 || name.length > 64)) { + if (name.length > 300) { errors.name = translate('onboarding.create_organization.display_name.error'); } - if (key.length < 2 || key.length > 32 || !/^[a-z0-9][a-z0-9-]*[a-z0-9]$/.test(key)) { + if (key.length > 300 || !/^[a-z0-9][a-z0-9-]*[a-z0-9]?$/.test(key)) { errors.key = translate('onboarding.create_organization.organization_name.error'); } @@ -134,7 +134,7 @@ export default class OrganizationDetailsStep extends React.PureComponent<Props, required={true} touched={touched.key} value={values.key}> - {props => <input autoFocus={true} {...props} />} + {props => <input autoFocus={true} maxLength={300} {...props} />} </OrganizationDetailsInput> <div className="big-spacer-top"> <ResetButtonLink onClick={this.handleAdditionalClick}> @@ -224,7 +224,7 @@ export default class OrganizationDetailsStep extends React.PureComponent<Props, return organization ? ( <div className="boxed-group-actions display-flex-center"> <AlertSuccessIcon className="spacer-right" /> - <strong>{organization.key}</strong> + <strong className="text-limited">{organization.key}</strong> </div> ) : null; }; diff --git a/server/sonar-web/src/main/js/apps/create/organization/__tests__/OrganizationDetailsStep-test.tsx b/server/sonar-web/src/main/js/apps/create/organization/__tests__/OrganizationDetailsStep-test.tsx index 056856e7c6d..5eb6b9a65b4 100644 --- a/server/sonar-web/src/main/js/apps/create/organization/__tests__/OrganizationDetailsStep-test.tsx +++ b/server/sonar-web/src/main/js/apps/create/organization/__tests__/OrganizationDetailsStep-test.tsx @@ -74,7 +74,13 @@ it('should validate', () => { ).resolves.toEqual({}); expect( - instance.handleValidate({ avatar: '', description: '', name: '', key: '', url: '' }) + instance.handleValidate({ + avatar: '', + description: '', + name: '', + key: 'x'.repeat(301), + url: '' + }) ).rejects.toEqual({ key: 'onboarding.create_organization.organization_name.error' }); expect( @@ -82,14 +88,10 @@ it('should validate', () => { ).rejects.toEqual({ avatar: 'onboarding.create_organization.avatar.error' }); expect( - instance.handleValidate({ avatar: '', description: '', name: 'x', key: 'foo', url: '' }) - ).rejects.toEqual({ name: 'onboarding.create_organization.display_name.error' }); - - expect( instance.handleValidate({ avatar: '', description: '', - name: 'x'.repeat(65), + name: 'x'.repeat(301), key: 'foo', url: '' }) diff --git a/server/sonar-web/src/main/js/apps/create/organization/__tests__/__snapshots__/OrganizationDetailsStep-test.tsx.snap b/server/sonar-web/src/main/js/apps/create/organization/__tests__/__snapshots__/OrganizationDetailsStep-test.tsx.snap index c792c9ff872..14f3109b7eb 100644 --- a/server/sonar-web/src/main/js/apps/create/organization/__tests__/__snapshots__/OrganizationDetailsStep-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/create/organization/__tests__/__snapshots__/OrganizationDetailsStep-test.tsx.snap @@ -177,7 +177,9 @@ exports[`should render result 1`] = ` <AlertSuccessIcon className="spacer-right" /> - <strong> + <strong + className="text-limited" + > org </strong> </div> diff --git a/server/sonar-web/src/main/js/apps/organizations/components/OrganizationEdit.tsx b/server/sonar-web/src/main/js/apps/organizations/components/OrganizationEdit.tsx index fa0bb5ca7f2..28e99ee3a3e 100644 --- a/server/sonar-web/src/main/js/apps/organizations/components/OrganizationEdit.tsx +++ b/server/sonar-web/src/main/js/apps/organizations/components/OrganizationEdit.tsx @@ -119,7 +119,7 @@ export class OrganizationEdit extends React.PureComponent<Props, State> { <input disabled={this.state.loading} id="organization-name" - maxLength={64} + maxLength={300} name="name" onChange={e => this.setState({ name: e.target.value })} required={true} diff --git a/server/sonar-web/src/main/js/apps/organizations/components/__tests__/__snapshots__/OrganizationEdit-test.tsx.snap b/server/sonar-web/src/main/js/apps/organizations/components/__tests__/__snapshots__/OrganizationEdit-test.tsx.snap index 054e0314163..63cf648f317 100644 --- a/server/sonar-web/src/main/js/apps/organizations/components/__tests__/__snapshots__/OrganizationEdit-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/organizations/components/__tests__/__snapshots__/OrganizationEdit-test.tsx.snap @@ -40,7 +40,7 @@ exports[`smoke test 1`] = ` <input disabled={false} id="organization-name" - maxLength={64} + maxLength={300} name="name" onChange={[Function]} required={true} @@ -176,7 +176,7 @@ exports[`smoke test 2`] = ` <input disabled={false} id="organization-name" - maxLength={64} + maxLength={300} name="name" onChange={[Function]} required={true} @@ -327,7 +327,7 @@ exports[`smoke test 3`] = ` <input disabled={true} id="organization-name" - maxLength={64} + maxLength={300} name="name" onChange={[Function]} required={true} |