Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
juzhiyuan committed Oct 27, 2020
1 parent 5afc139 commit ea9aba4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/pages/Upstream/transform.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { pickBy, identity, omit } from 'lodash';
import { pickBy, identity, omit, pick } from 'lodash';

/*
* Licensed to the Apache Software Foundation (ASF) under one or more
Expand Down Expand Up @@ -62,6 +62,10 @@ export const transformRequest = (
}

if (nodes) {
// NOTE: https://github.com/ant-design/ant-design/issues/27396
data.nodes = data.nodes?.map((item) => {
return pick(item, ['host', 'port', 'weight']);
});
return data;
}

Expand Down
4 changes: 2 additions & 2 deletions src/pages/Upstream/typing.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/
declare namespace UpstreamModule {
type Node = Record<string, number>;
type Node = Record<string, number | string>;
type Type = 'roundrobin' | 'chash' | 'ewma';

type Timeout = Record<'connect' | 'send' | 'read', number>;
Expand Down Expand Up @@ -66,7 +66,7 @@ declare namespace UpstreamModule {
id: string;
upstream_id: string;
type: Type;
nodes?: Node;
nodes?: Node[];
k8s_deployment_info?: K8SDeploymentInfo;
hash_on?: 'vars' | 'header' | 'cookie' | 'consumer';
key?: string;
Expand Down

0 comments on commit ea9aba4

Please sign in to comment.