# fix 722 (#733) dev-change-ui2antd
authortzr164 <tzr164@163.com>
Thu, 15 Apr 2021 06:26:26 +0000 (14:26 +0800)
committerGitHub <noreply@github.com>
Thu, 15 Apr 2021 06:26:26 +0000 (14:26 +0800)
dubbo-admin-ui-antd/config/routes.ts
dubbo-admin-ui-antd/src/locales/en-US/menu.ts
dubbo-admin-ui-antd/src/locales/en-US/pages.ts
dubbo-admin-ui-antd/src/locales/zh-CN/menu.ts
dubbo-admin-ui-antd/src/locales/zh-CN/pages.ts
dubbo-admin-ui-antd/src/pages/Service/data.d.ts [new file with mode: 0644]
dubbo-admin-ui-antd/src/pages/Service/index.tsx
dubbo-admin-ui-antd/src/pages/Service/service.ts [new file with mode: 0644]

index dac54a5a1b91668529842fd116adcdac06282dc6..a84c2a50ae64dba3561df08fbf3feaa597ab7981 100644 (file)
@@ -21,13 +21,9 @@ export default [
       },
       {
         path: '/service',
-        routes:[
-          {
-            name: 'service',
-            path: '/service',
-            component: './Service'
-          }
-        ]
+        name: 'service',
+        icon:'SearchOutlined',
+        component: './Service'
       },
       {
         path: '/user',
index a407cc2b98fb825ef00e33989728835b2769efdd..0d9262e56d8dbc4435133172b0b8bde91a93ba2c 100644 (file)
@@ -65,5 +65,5 @@ export default {
   'menu.editor.flow': 'Flow Editor',
   'menu.editor.mind': 'Mind Editor',
   'menu.editor.koni': 'Koni Editor',
-  'menu.service':'menu'
+  'menu.service':'search service'
 };
index f8aedbf28cf62f45ee48c6af61a4ee91c99e69f1..94b5cdcdb6129cdedf52109b7ba37836e74b02c6 100644 (file)
@@ -83,4 +83,12 @@ export default {
   'pages.searchTable.batchDeletion': 'bacth deletion',
   'pages.searchTable.batchApproval': 'batch approval',
   'pages.header.search.placeholder':'Search service name',
+  'pages.service.title':'search service',
+  'pages.service.searchresult.table.title':'search result',
+  'pages.service.searchresult.column.servicename':'name',
+  'pages.service.searchresult.column.servicename.tip':'service name is unique',
+  'pages.service.searchresult.column.groupname':'group',
+  'pages.service.searchresult.column.version':'version',
+  'pages.service.searchresult.column.appname':'name',
+  'pages.common.button.detail':'detail',
 };
index 3181da661e4b41ff2497f73c6873fab637402022..e13f3d5661ae3035ed48501b27bd7883e67ee622 100644 (file)
@@ -65,5 +65,5 @@ export default {
   'menu.editor.flow': '流程编辑器',
   'menu.editor.mind': '脑图编辑器',
   'menu.editor.koni': '拓扑编辑器',
-  'menu.service':'菜单'
+  'menu.service':'服务查询',
 };
index 4d2f0e50f8f97c0f2579b9864f69b43ab79f5700..875423aa5d9698a8fc9f957faf4a03326f88cbef 100644 (file)
@@ -80,4 +80,12 @@ export default {
   'pages.searchTable.batchDeletion': '批量删除',
   'pages.searchTable.batchApproval': '批量审批',
   'pages.header.search.placeholder':'服务查询',
+  'pages.service.title':'查询服务',
+  'pages.service.searchresult.table.title':'查询结果',
+  'pages.service.searchresult.column.servicename':'服务名',
+  'pages.service.searchresult.column.servicename.tip':'服务名称是唯一的 key',
+  'pages.service.searchresult.column.groupname':'组名',
+  'pages.service.searchresult.column.version':'版本',
+  'pages.service.searchresult.column.appname':'应用名',
+  'pages.common.button.detail':'详情',
 };
diff --git a/dubbo-admin-ui-antd/src/pages/Service/data.d.ts b/dubbo-admin-ui-antd/src/pages/Service/data.d.ts
new file mode 100644 (file)
index 0000000..3ae3a74
--- /dev/null
@@ -0,0 +1,37 @@
+export type TableListItem = {
+  key: number;
+  disabled?: boolean;
+  desc: string;
+  callNo: number;
+  status: number;
+  progress: number;
+  service?: string;
+  appName?: string;
+  group?: string;
+  version?: string;
+};
+
+export type TableListPagination = {
+  total: number;
+  size: number;
+  page: number;
+};
+
+export type TableListData = {
+  list: TableListItem[];
+  pagination: Partial<TableListPagination>;
+};
+
+export type TableListParams = {
+  status?: string;
+  service?: string;
+  appName?: string;
+  group?: string;
+  version?: string;
+  filter?: string;
+  pattern?: string;
+  desc?: string;
+  size?: number;
+  page?: number;
+  sorter?: Record<string, any>;
+};
index e82edb0fd1b550f63bc7a5ce5e4b5ca0ded3f62a..58e8075e865274dfd98f4607d09ed125cf57c993 100644 (file)
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+import { Button, message, Input, Drawer } from 'antd';
+import React, { useState, useRef } from 'react';
+import { useIntl, FormattedMessage } from 'umi';
+import { PageContainer, FooterToolbar } from '@ant-design/pro-layout';
+import type { ProColumns, ActionType } from '@ant-design/pro-table';
+import ProTable from '@ant-design/pro-table';
+import type { TableListItem } from './data.d';
+import { queryService} from './service';
+import {NodeExpandOutlined} from '@ant-design/icons'
 
-import React, { useState } from 'react';
+const Service: React.FC = () => {
 
-const Service:React.FC = () => {
-  return (<div>service</div>);
-}
+  const actionRef = useRef<ActionType>();
+  /** 国际化配置 */
+  const intl = useIntl();
+
+  /** 查询列表 */
+  const fetchServiceList = async (params:any)=>{
+
+    let param = {};
+    param.page = params.current - 1;
+    param.size = params.pageSize;
+    param.pattern = 'service';
+    if(params.service){
+      param.filter = params.service;
+    }else{
+      param.filter = '*';
+    }
+
+    let serviceResponseData = await queryService(param);
+    return {data:serviceResponseData.content,success:true,total:serviceResponseData.totalElements};
+  }
+
+
+  const columns: ProColumns<TableListItem>[] = [
+    {
+      title: (
+        <FormattedMessage
+          id="pages.service.searchresult.column.servicename"
+          defaultMessage="服务名"
+        />
+      ),
+      dataIndex: 'service',
+      tip:'服务名称是唯一的 key'
+    },
+    {
+      title: <FormattedMessage id="pages.service.searchresult.column.groupname" defaultMessage="组名" />,
+      dataIndex: 'group',
+      valueType: 'textarea',
+      search:false
+    },
+    {
+      title: <FormattedMessage id="pages.service.searchresult.column.version" defaultMessage="版本" />,
+      dataIndex: 'version',
+      hideInForm: true,
+      search:false
+    },
+    {
+      title: <FormattedMessage id="pages.service.searchresult.column.appname" defaultMessage="应用名" />,
+      dataIndex: 'appName',
+      hideInForm: true,
+      search:false
+    },
+    {
+      title: <FormattedMessage id="pages.searchTable.titleOption" defaultMessage="操作" />,
+      dataIndex: 'option',
+      valueType: 'option',
+      render: (_, record) => [
+        <Button type="primary" icon={<NodeExpandOutlined />}>
+          <FormattedMessage id="pages.common.button.detail" defaultMessage="详情" />
+        </Button>
+      ],
+    },
+  ];
+
+  return (
+    <PageContainer title={intl.formatMessage({
+      id: 'pages.service.title',
+      defaultMessage: '查询服务',
+    })}>
+      <ProTable<TableListItem>
+        headerTitle={intl.formatMessage({
+          id: 'pages.service.searchresult.table.title',
+          defaultMessage: '查询服务',
+        })}
+        actionRef={actionRef}
+        rowKey={(item,index)=>{
+          return item.service?(item.service+index):index+'';
+        }}
+        search={{
+          labelWidth: 120,
+          collapseRender:false
+        }}
+        request={(params, sorter, filter) =>fetchServiceList({ ...params, sorter,filter})}
+        columns={columns}
+      />
+    </PageContainer>
+  );
+};
 
 export default Service;
diff --git a/dubbo-admin-ui-antd/src/pages/Service/service.ts b/dubbo-admin-ui-antd/src/pages/Service/service.ts
new file mode 100644 (file)
index 0000000..2797857
--- /dev/null
@@ -0,0 +1,8 @@
+import { request } from 'umi';
+import type { TableListParams} from './data.d';
+
+export async function queryService(params?: TableListParams) {
+  return request('/service', {
+    params,
+  });
+}