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: can not manual input in upstream #1124

Merged
merged 5 commits into from
Dec 25, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,7 @@ context('Create and Delete Route', () => {

// go to step2
cy.contains('Next').click();
cy.wait(400);
cy.get('#nodes_0_host').type('12.12.12.12', {
timeout: 5000
});
cy.get('#nodes_0_host').type('12.12.12.12')

// go to step3
cy.contains('Next').click();
Expand Down
6 changes: 2 additions & 4 deletions web/src/components/Upstream/UpstreamForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -566,9 +566,9 @@ const UpstreamForm: React.FC<Props> = forwardRef(
>
{showSelector && (
<Form.Item label="选择上游" name="upstream_id" shouldUpdate={(prev, next) => {
setReadonly(Boolean(next.upstream_id));
if (prev.upstream_id !== next.upstream_id) {
const id = next.upstream_id;
setReadonly(Boolean(id));
if (id) {
form.setFieldsValue(list.find((item) => item.id === id));
form.setFieldsValue({
Expand Down Expand Up @@ -609,9 +609,7 @@ const UpstreamForm: React.FC<Props> = forwardRef(
return null;
}}
</Form.Item>

<NodeList />

{NodeList()}
<Form.Item
label={formatMessage({ id: 'upstream.step.pass-host' })}
name="pass_host"
Expand Down
1 change: 1 addition & 0 deletions web/src/components/Upstream/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* limitations under the License.
*/
export const DEFAULT_UPSTREAM = {
upstream_id: '',
nodes: [{ host: '', port: 80, weight: 1 }],
type: 'roundrobin',
timeout: {
Expand Down