Skip to content

Commit

Permalink
feat: Change the Cluster parameter seed Peer Load Limit to 0-50000 (#376
Browse files Browse the repository at this point in the history
)

* feat: Change the cluster parameter seed Peer Load Limit to 0-50000

Signed-off-by: zhaoxinxin <[email protected]>

* feat: Change the cluster parameter seed Peer Load Limit to 0-50000

Signed-off-by: zhaoxinxin <[email protected]>

---------

Signed-off-by: zhaoxinxin <[email protected]>
  • Loading branch information
Liam-Zhao authored Jun 13, 2024
1 parent c3c0e40 commit d849d65
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
5 changes: 3 additions & 2 deletions cypress/e2e/clusters/create-cluster.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,10 +347,11 @@ describe('Create cluster', () => {
cy.get('#name').type('cluster-12');

// Should display seed peer load limit the validation error message.
cy.get('#seedPeerLoadLimit').type('5000');
cy.get('#seedPeerLoadLimit').clear();
cy.get('#seedPeerLoadLimit').type('50001');
cy.get('#seedPeerLoadLimit-helper-text')
.should('be.visible')
.and('contain', `Fill in the number, the length is 0-5000.`);
.and('contain', `Fill in the number, the length is 0-50000.`);
cy.get('#save').click();
cy.url().should('include', '/clusters/new');
cy.get('#seedPeerLoadLimit').clear();
Expand Down
5 changes: 3 additions & 2 deletions cypress/e2e/clusters/update-cluster.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -390,12 +390,13 @@ describe('Update cluster', () => {

it('try to verify config', () => {
// Should display seed peer load limit the validation error message.
cy.get('#seedPeerLoadLimit').type('5000');
cy.get('#seedPeerLoadLimit').clear();
cy.get('#seedPeerLoadLimit').type('50001');

// Show verification error message.
cy.get('#seedPeerLoadLimit-helper-text')
.should('be.visible')
.and('contain', `Fill in the number, the length is 0-5000.`);
.and('contain', `Fill in the number, the length is 0-50000.`);

// Submit form when validation fails.
cy.get('#save').click();
Expand Down
4 changes: 2 additions & 2 deletions src/components/clusters/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ export default function EditCluster() {
autoComplete: 'family-name',
placeholder: 'Please enter Seed Peer load limit',
value: seed_peer_cluster_config?.load_limit,
helperText: seedPeerLoadLimitError ? 'Fill in the number, the length is 0-5000.' : '',
helperText: seedPeerLoadLimitError ? 'Fill in the number, the length is 0-50000.' : '',
error: seedPeerLoadLimitError,

onChange: (e: any) => {
Expand All @@ -393,7 +393,7 @@ export default function EditCluster() {
setError: setSeedPeerLoadLimitError,

validate: (value: string) => {
const reg = /^\+?(\d|[1-4]\d{1,3}|[5-9]\d{1,2}|5000)(\.\d*)?$/;
const reg = /^(?:[0-9]|[1-9][0-9]{1,3}|[1-4][0-9]{4}|50000)$/;
return reg.test(value);
},
},
Expand Down
4 changes: 2 additions & 2 deletions src/components/clusters/new.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ export default function NewCluster() {
autoComplete: 'family-name',
placeholder: 'Please enter Seed Peer load limit',
defaultValue: 300,
helperText: seedPeerLoadLimitError ? 'Fill in the number, the length is 0-5000.' : '',
helperText: seedPeerLoadLimitError ? 'Fill in the number, the length is 0-50000.' : '',
error: seedPeerLoadLimitError,

onChange: (e: any) => {
Expand All @@ -359,7 +359,7 @@ export default function NewCluster() {
setError: setSeedPeerLoadLimitError,

validate: (value: string) => {
const reg = /^\+?(\d|[1-4]\d{1,3}|[5-9]\d{1,2}|5000)(\.\d*)?$/;
const reg = /^(?:[0-9]|[1-9][0-9]{1,3}|[1-4][0-9]{4}|50000)$/;
return reg.test(value);
},
},
Expand Down

0 comments on commit d849d65

Please sign in to comment.