diff --git a/web/cypress/integration/route/can-skip-upstream-when-select-service-id.spec.js b/web/cypress/integration/route/can-skip-upstream-when-select-service-id.spec.js index aeb5118bee..72f995470e 100644 --- a/web/cypress/integration/route/can-skip-upstream-when-select-service-id.spec.js +++ b/web/cypress/integration/route/can-skip-upstream-when-select-service-id.spec.js @@ -75,7 +75,7 @@ context('Can select service_id skip upstream in route', () => { cy.get(this.domSelector.input).should('be.disabled'); cy.contains(this.data.upstreamName).click(); - cy.contains('None').click(); + cy.contains('None').click({ force: true }); cy.contains('Next').click(); cy.contains('Next').click(); cy.contains('Submit').click(); @@ -91,9 +91,6 @@ context('Can select service_id skip upstream in route', () => { cy.contains(this.data.routeName).siblings().contains('Configure').click(); cy.get(this.domSelector.serviceSelector).click(); cy.contains('None').click(); - cy.get(this.domSelector.notification).should('contain', 'Please check the configuration of binding service'); - cy.get(this.domSelector.notificationCloseIcon).click(); - cy.contains('Next').click(); cy.wait(500); cy.get('[data-cy=upstream_selector]').click(); diff --git a/web/src/pages/Service/Create.tsx b/web/src/pages/Service/Create.tsx index ab977a904c..04ad579163 100644 --- a/web/src/pages/Service/Create.tsx +++ b/web/src/pages/Service/Create.tsx @@ -51,10 +51,12 @@ const Page: React.FC = (props) => { fetchItem(serviceId).then(({ data }) => { if (data.upstream_id) { upstreamForm.setFieldsValue({ upstream_id: data.upstream_id }) - } - if (data.upstream) { + } else if (data.upstream) { upstreamForm.setFieldsValue(convertToFormData(data.upstream)) + } else { + upstreamForm.setFieldsValue({ upstream_id: 'None' }) } + form.setFieldsValue(omit(data, ['upstream_id', 'upstream', 'plugins'])); setPlugins(data.plugins || {}); }); @@ -68,10 +70,7 @@ const Page: React.FC = (props) => { }; const upstreamFormData = upstreamRef.current?.getData(); - if (!upstreamFormData) { - return - } - if (!upstreamFormData.upstream_id) { + if (!upstreamFormData?.upstream_id) { data.upstream = upstreamFormData; } else { data.upstream_id = upstreamFormData.upstream_id; diff --git a/web/src/pages/Service/components/Step1.tsx b/web/src/pages/Service/components/Step1.tsx index 3817456fc9..0577e69d59 100644 --- a/web/src/pages/Service/components/Step1.tsx +++ b/web/src/pages/Service/components/Step1.tsx @@ -59,7 +59,7 @@ const Step1: React.FC = ({