You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by ju...@apache.org on 2020/11/09 10:56:06 UTC
[apisix-dashboard] 01/01: feat: convert uri to uris
This is an automated email from the ASF dual-hosted git repository.
juzhiyuan pushed a commit to branch feat-default-values2
in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git
commit 30d3f8700861e4293b404280e28f54d789a5a0ab
Author: juzhiyuan <ju...@apache.org>
AuthorDate: Mon Nov 9 18:55:51 2020 +0800
feat: convert uri to uris
---
web/src/pages/Route/List.tsx | 28 ++++++++++++++++------------
web/src/pages/Route/transform.ts | 6 +++---
web/src/pages/Route/typing.d.ts | 4 ++++
3 files changed, 23 insertions(+), 15 deletions(-)
diff --git a/web/src/pages/Route/List.tsx b/web/src/pages/Route/List.tsx
index 1f28653..af2c3b3 100644
--- a/web/src/pages/Route/List.tsx
+++ b/web/src/pages/Route/List.tsx
@@ -35,24 +35,28 @@ const Page: React.FC = () => {
},
{
title: formatMessage({ id: 'page.route.domainName' }),
- dataIndex: 'hosts',
hideInSearch: true,
- render: (_, record) =>
- (record.hosts || []).map((host) => (
- <Tag key={host} color="geekblue">
- {host}
+ render: (_, record) => {
+ const list = record.hosts || (record.host && [record.host]) || [];
+
+ return list.map((item) => (
+ <Tag key={item} color="geekblue">
+ {item}
</Tag>
- )),
+ ));
+ },
},
{
title: formatMessage({ id: 'page.route.path' }),
- dataIndex: 'uri',
- render: (_, record) =>
- record.uris?.map((uri) => (
- <Tag key={uri} color="geekblue">
- {uri}
+ render: (_, record) => {
+ const list = record.uris || (record.uri && [record.uri]) || [];
+
+ return list.map((item) => (
+ <Tag key={item} color="geekblue">
+ {item}
</Tag>
- )),
+ ));
+ },
},
{
title: formatMessage({ id: 'component.global.description' }),
diff --git a/web/src/pages/Route/transform.ts b/web/src/pages/Route/transform.ts
index 1894ed3..69ac7d9 100644
--- a/web/src/pages/Route/transform.ts
+++ b/web/src/pages/Route/transform.ts
@@ -130,13 +130,13 @@ export const transformUpstreamNodes = (
};
export const transformRouteData = (data: RouteModule.Body) => {
- const { name, desc, methods, uris, hosts, vars, status, upstream, upstream_id } = data;
+ const { name, desc, methods, uris, uri, hosts, host, vars, status, upstream, upstream_id } = data;
const form1Data: Partial<RouteModule.Form1Data> = {
name,
desc,
status,
- hosts: (hosts || []).filter(Boolean).length === 0 ? [''] : hosts,
- uris,
+ hosts: hosts || (host && [host]) || [''],
+ uris: uris || (uri && [uri]) || [],
methods,
};
diff --git a/web/src/pages/Route/typing.d.ts b/web/src/pages/Route/typing.d.ts
index 03d6df1..3dc2864 100644
--- a/web/src/pages/Route/typing.d.ts
+++ b/web/src/pages/Route/typing.d.ts
@@ -75,7 +75,9 @@ declare namespace RouteModule {
desc: string;
priority?: number;
methods: HttpMethod[];
+ uri?: string;
uris: string[];
+ host?: string;
hosts: string[];
vars: [string, Operator, string][];
upstream: {
@@ -262,6 +264,8 @@ declare namespace RouteModule {
};
uri: string;
uris?: string[];
+ host: string;
+ hosts?: string[];
create_time: number;
update_time: number;
};