diff --git a/web/cypress/integration/route/create-route-with-limit-count-plugin-form.spec.js b/web/cypress/integration/route/create-route-with-limit-count-plugin-form.spec.js index e2a2ad47df..1dad2aa90d 100644 --- a/web/cypress/integration/route/create-route-with-limit-count-plugin-form.spec.js +++ b/web/cypress/integration/route/create-route-with-limit-count-plugin-form.spec.js @@ -35,6 +35,7 @@ context('Create and delete route with limit-count form', () => { redis_timeout: '#time_window', key: '#key', rejected_code: '#rejected_code', + rejected_msg: '#rejected_msg', policy: '#policy', group: '#group', redis_host: '#redis_host', @@ -52,6 +53,7 @@ context('Create and delete route with limit-count form', () => { submitSuccess: 'Submit Successfully', port: '80', weight: 1, + rejected_msg: 'Requests are too frequent, please try again later.', redisClusterName: 'Please Enter redis_cluster_name', redisClusterNode: 'Please Enter redis_cluster_node', }; @@ -86,6 +88,7 @@ context('Create and delete route with limit-count form', () => { cy.get(selector.count).type(1); cy.get(selector.time_window).type(1); cy.get(selector.rejected_code).type(500); + cy.get(selector.rejected_msg).type(data.rejected_msg); cy.get(selector.group).type('test_group'); cy.get(selector.drawer).within(() => { cy.contains('Submit').click({ diff --git a/web/cypress/integration/route/create-route-with-search-service-and-set-priority.spec.js b/web/cypress/integration/route/create-route-with-search-service-and-set-priority.spec.js index 93c51cfb94..4e7a96e29d 100644 --- a/web/cypress/integration/route/create-route-with-search-service-and-set-priority.spec.js +++ b/web/cypress/integration/route/create-route-with-search-service-and-set-priority.spec.js @@ -32,7 +32,6 @@ context('Create Route with search service name', () => { serviceSelector: '[title="None"]', upstreamSelector: '#upstream_id', deleteAlert: '.ant-modal-body', - drawer: '.ant-drawer-content', }; const data = { @@ -52,7 +51,7 @@ context('Create Route with search service name', () => { deleteRouteSuccess: 'Delete Route Successfully', routeName: 'route_test1', searchServiceName: 'service_test2', - upstreamName: 'None', + upstreamName: 'None (Only available when binding the service)', }; beforeEach(() => { @@ -101,12 +100,15 @@ context('Create Route with search service name', () => { // set name cy.get(selector.name).type(data.routeName); - cy.get(selector.serviceSelector).type(data.serviceName2 + '\n'); + cy.get(selector.serviceSelector).type(`${data.serviceName2}\n`); // set priority cy.get(selector.priority).type(data.priority); cy.contains('Next').click(); // select upstream with None - cy.get(selector.upstreamSelector).type(data.upstreamName + '\n'); + cy.get('.ant-select-selector') + .find(selector.upstreamSelector) + .type(`${data.upstreamName}\n`, { force: true }); + cy.contains('Next').click(); cy.contains('Next').click(); cy.contains('Submit').click(); @@ -117,7 +119,7 @@ context('Create Route with search service name', () => { let serviceUuid = ''; cy.visit('/'); cy.contains('Service').click(); - cy.get(selector.name).type(data.serviceName2 + '\n'); + cy.get(selector.name).type(`${data.serviceName2}\n`); cy.contains(data.serviceName2) .siblings() .first() @@ -126,7 +128,7 @@ context('Create Route with search service name', () => { }); cy.visit('/'); cy.contains('Route').click(); - cy.get(selector.name).type(data.routeName + '\n'); + cy.get(selector.name).type(`${data.routeName}\n`); cy.contains(data.routeName).siblings().contains('More').click(); cy.contains('View').click(); cy.get(selector.drawer).should('be.visible'); @@ -139,7 +141,7 @@ context('Create Route with search service name', () => { it('should delete the route and services', function () { cy.visit('/'); cy.contains('Route').click(); - cy.get(selector.name).type(data.routeName + '\n'); + cy.get(selector.name).type(`${data.routeName}\n`); cy.contains(data.routeName).siblings().contains('More').click(); cy.contains('Delete').click(); cy.get(selector.deleteAlert) diff --git a/web/src/components/Plugin/UI/limit-count.tsx b/web/src/components/Plugin/UI/limit-count.tsx index 51ecd535d8..15eb59553d 100644 --- a/web/src/components/Plugin/UI/limit-count.tsx +++ b/web/src/components/Plugin/UI/limit-count.tsx @@ -305,6 +305,13 @@ const LimitCount: React.FC = ({ form, schema }) => { max={properties.rejected_code.maximum} /> + + + = forwardRef( }, ref, ) => { + const location = useLocation(); const { formatMessage } = useIntl(); const [readonly, setReadonly] = useState(false); const [hiddenForm, setHiddenForm] = useState(false); @@ -281,7 +282,13 @@ const UpstreamForm: React.FC = forwardRef( }; return ( -
+ {showSelector && ( = ({ onChange, list = [], disabled, required }) => { const { formatMessage } = useIntl(); + const location = useLocation(); return ( = ({ onChange, list = [], disabled, requ {[ { - name: formatMessage({ id: 'page.upstream.step.select.upstream.select.option' }), + name: formatMessage({ + id: `page.upstream.step.select.upstream.select.option${ + !required && location.pathname === '/routes/create' ? '.serviceSelected' : '' + }`, + }), id: 'Custom', }, ...list, diff --git a/web/src/components/Upstream/locales/en-US.ts b/web/src/components/Upstream/locales/en-US.ts index b449349768..8dcf67b058 100644 --- a/web/src/components/Upstream/locales/en-US.ts +++ b/web/src/components/Upstream/locales/en-US.ts @@ -147,7 +147,7 @@ export default { 'component.upstream.fields.checks.passive.unhealthy.timeouts.tooltip': 'Number of timeouts in proxied traffic to consider a target unhealthy, as observed by passive health checks.', - 'component.upstream.other.none': 'None', + 'component.upstream.other.none': 'None (Only available when binding the service)', 'component.upstream.other.pass_host-with-multiple-nodes.title': 'Please check the target node configuration', 'component.upstream.other.pass_host-with-multiple-nodes': diff --git a/web/src/pages/Upstream/locales/en-US.ts b/web/src/pages/Upstream/locales/en-US.ts index 14e811fd11..7219b36bfb 100644 --- a/web/src/pages/Upstream/locales/en-US.ts +++ b/web/src/pages/Upstream/locales/en-US.ts @@ -17,6 +17,8 @@ export default { 'page.upstream.step.select.upstream': 'Select Upstream', 'page.upstream.step.select.upstream.select.option': 'Custom', + 'page.upstream.step.select.upstream.select.option.serviceSelected': + 'Custom (The current configuration will override the bound service)', 'page.upstream.step.select.upstream.select.none': 'None', 'page.upstream.step.backend.server.domain.or.ip': 'Backend Server Host/IP', 'page.upstream.form.item-label.node.domain.or.ip': 'Targets', diff --git a/web/src/pages/Upstream/locales/zh-CN.ts b/web/src/pages/Upstream/locales/zh-CN.ts index 3bd84ebb1d..c91cbca0d9 100644 --- a/web/src/pages/Upstream/locales/zh-CN.ts +++ b/web/src/pages/Upstream/locales/zh-CN.ts @@ -17,6 +17,8 @@ export default { 'page.upstream.step.select.upstream': '选择上游服务', 'page.upstream.step.select.upstream.select.option': '手动填写', + 'page.upstream.step.select.upstream.select.option.serviceSelected': + '手动填写(当前配置将会覆盖已绑定的服务)', 'page.upstream.step.select.upstream.select.none': '无', 'page.upstream.step.backend.server.domain.or.ip': '后端服务域名或 IP', 'page.upstream.form.item-label.node.domain.or.ip': '目标节点',