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

fix: editing a Service, the upstream info will be lost. #1347

Merged
merged 3 commits into from
Jan 24, 2021
Merged
Changes from 1 commit
Commits
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
18 changes: 8 additions & 10 deletions web/src/pages/Service/Create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ const Page: React.FC = (props) => {
};

const upstreamFormData = upstreamRef.current?.getData();
if (upstreamFormData.upstream_id === '') {
data.upstream = omit(upstreamFormData, ['upstream_id']);
if (!upstreamFormData.upstream_id) {
juzhiyuan marked this conversation as resolved.
Show resolved Hide resolved
data.upstream = upstreamFormData;
} else {
data.upstream_id = upstreamFormData.upstream_id;
}
Expand All @@ -81,13 +81,12 @@ const Page: React.FC = (props) => {
(serviceId ? update(serviceId, data) : create(data))
.then(() => {
notification.success({
message: `${
serviceId
message: `${serviceId
? formatMessage({ id: 'component.global.edit' })
: formatMessage({ id: 'component.global.create' })
} ${formatMessage({ id: 'menu.service' })} ${formatMessage({
id: 'component.status.success',
})}`,
} ${formatMessage({ id: 'menu.service' })} ${formatMessage({
juzhiyuan marked this conversation as resolved.
Show resolved Hide resolved
id: 'component.status.success',
})}`,
});
history.push('/service/list');
})
Expand Down Expand Up @@ -115,11 +114,10 @@ const Page: React.FC = (props) => {
return (
<>
<PageHeaderWrapper
title={`${
(props as any).match.params.rid
title={`${(props as any).match.params.rid
? formatMessage({ id: 'component.global.edit' })
: formatMessage({ id: 'component.global.create' })
} ${formatMessage({ id: 'menu.service' })}`}
} ${formatMessage({ id: 'menu.service' })}`}
>
<Card bordered={false}>
<Steps current={step - 1} style={{ marginBottom: '25px' }}>
Expand Down