From d849d65e78f2015229a062fe374021ef72107aba Mon Sep 17 00:00:00 2001 From: Zhaoxinxin <107842350+Liam-Zhao@users.noreply.github.com> Date: Thu, 13 Jun 2024 20:08:56 +0800 Subject: [PATCH] feat: Change the Cluster parameter seed Peer Load Limit to 0-50000 (#376) * feat: Change the cluster parameter seed Peer Load Limit to 0-50000 Signed-off-by: zhaoxinxin <1186037180@qq.com> * feat: Change the cluster parameter seed Peer Load Limit to 0-50000 Signed-off-by: zhaoxinxin <1186037180@qq.com> --------- Signed-off-by: zhaoxinxin <1186037180@qq.com> --- cypress/e2e/clusters/create-cluster.cy.ts | 5 +++-- cypress/e2e/clusters/update-cluster.cy.ts | 5 +++-- src/components/clusters/edit.tsx | 4 ++-- src/components/clusters/new.tsx | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/cypress/e2e/clusters/create-cluster.cy.ts b/cypress/e2e/clusters/create-cluster.cy.ts index 1a9d249a..f775d4d0 100644 --- a/cypress/e2e/clusters/create-cluster.cy.ts +++ b/cypress/e2e/clusters/create-cluster.cy.ts @@ -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(); diff --git a/cypress/e2e/clusters/update-cluster.cy.ts b/cypress/e2e/clusters/update-cluster.cy.ts index 56fe8e59..992612c3 100644 --- a/cypress/e2e/clusters/update-cluster.cy.ts +++ b/cypress/e2e/clusters/update-cluster.cy.ts @@ -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(); diff --git a/src/components/clusters/edit.tsx b/src/components/clusters/edit.tsx index b6143371..8052fb0a 100644 --- a/src/components/clusters/edit.tsx +++ b/src/components/clusters/edit.tsx @@ -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) => { @@ -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); }, }, diff --git a/src/components/clusters/new.tsx b/src/components/clusters/new.tsx index 50c57c58..73600e5c 100644 --- a/src/components/clusters/new.tsx +++ b/src/components/clusters/new.tsx @@ -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) => { @@ -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); }, },