Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add the service page upstream select option #1633

Merged
merged 27 commits into from
May 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
78199c5
feat: add the service page upstream select option
stu01509 Mar 20, 2021
6749ff0
test: fix the upstream option ci
stu01509 Mar 20, 2021
bf39e42
Merge branch 'master' into fix-#1616-add-upstream-option
stu01509 Mar 22, 2021
5cc80e6
Merge remote-tracking branch 'upstream/master' into fix-#1616-add-ups…
stu01509 Mar 23, 2021
d47b446
Merge branch 'fix-#1616-add-upstream-option' of github.com:stu01509/a…
stu01509 Mar 23, 2021
59a97c4
Merge remote-tracking branch 'upstream/master' into fix-#1616-add-ups…
stu01509 Mar 24, 2021
7abb013
feat: add the service page upstream select option
stu01509 Mar 26, 2021
cc181b0
feat: adjust the option value field
stu01509 Mar 26, 2021
125518a
test: fix the select option test case
stu01509 Mar 27, 2021
75fb1b5
test: fix the select option test case
stu01509 Mar 28, 2021
3d94310
Merge remote-tracking branch 'upstream/master' into fix-#1616-add-ups…
stu01509 Apr 2, 2021
68ad8ac
test: fix ci error
stu01509 Apr 2, 2021
b535182
Merge remote-tracking branch 'upstream/master' into fix-#1616-add-ups…
stu01509 Apr 6, 2021
5e9fc28
fix: fix create service with None upstream error
stu01509 Apr 6, 2021
169fcf3
test: fix the select option test case
stu01509 Apr 8, 2021
a0a72a5
Merge branch 'master' into fix-#1616-add-upstream-option
stu01509 Apr 8, 2021
b4a55d5
test: fix ci error
stu01509 Apr 9, 2021
90c6796
Merge branch 'fix-#1616-add-upstream-option' of github.com:stu01509/a…
stu01509 Apr 9, 2021
41a4b61
Merge remote-tracking branch 'upstream/master' into fix-#1616-add-ups…
stu01509 Apr 13, 2021
f5f1a8d
feat: add the service page upstream select option
stu01509 Apr 13, 2021
aeb72f9
feat: add the service page upstream select option
stu01509 Apr 13, 2021
53f6159
Merge remote-tracking branch 'upstream/master' into fix-#1616-add-ups…
stu01509 Apr 24, 2021
bfd1f7f
test: fix ci error
stu01509 Apr 24, 2021
a9a401e
test: fix ci error
stu01509 Apr 24, 2021
0fe93b2
feat: change the en-US locales
stu01509 Apr 24, 2021
c9ae7ed
Merge remote-tracking branch 'upstream/master' into fix-#1616-add-ups…
stu01509 Apr 28, 2021
cfe100c
fix: create service when select upstream None error
stu01509 Apr 28, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand Down
11 changes: 5 additions & 6 deletions web/src/pages/Service/Create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 || {});
});
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion web/src/pages/Service/components/Step1.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const Step1: React.FC<ServiceModule.Step1PassProps> = ({
</Form>
<UpstreamForm
ref={upstreamRef}
required
required={false}
form={upstreamForm}
disabled={disabled}
list={list}
Expand Down
2 changes: 2 additions & 0 deletions web/src/pages/Upstream/locales/en-US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.none': 'None',
'page.upstream.step.backend.server.domain.or.ip': 'Backend Server Host/IP',
'page.upstream.form.item-label.node.domain.or.ip': 'Targets',
'page.upstream.step.input.domain.name.or.ip': 'Please enter domain or IP',
'page.upstream.step.valid.domain.name.or.ip': 'Please enter valid a domain or IP',
Expand Down
2 changes: 2 additions & 0 deletions web/src/pages/Upstream/locales/zh-CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
export default {
'page.upstream.step.select.upstream': '选择上游服务',
'page.upstream.step.select.upstream.select.option': '手动填写',
'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': '目标节点',
'page.upstream.step.input.domain.name.or.ip': '请输入域名或 IP',
'page.upstream.step.domain.name.or.ip': '主机名或 IP',
Expand Down