This is an automated email from the ASF dual-hosted git repository.

healchow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-inlong.git


The following commit(s) were added to refs/heads/master by this push:
     new e5bcffa  [INLONG-2225] Audit module support i18n (#2226)
e5bcffa is described below

commit e5bcffafce6da3587c5d537f1f9c91e5812a09f3
Author: Daniel <[email protected]>
AuthorDate: Thu Jan 20 16:07:47 2022 +0800

    [INLONG-2225] Audit module support i18n (#2226)
---
 inlong-dashboard/src/locales/cn.json               |  8 +++
 inlong-dashboard/src/locales/en.json               |  8 +++
 .../src/pages/AccessDetail/Audit/config.tsx        | 67 +++++++---------------
 .../src/pages/AccessDetail/Audit/index.tsx         | 39 -------------
 4 files changed, 36 insertions(+), 86 deletions(-)

diff --git a/inlong-dashboard/src/locales/cn.json 
b/inlong-dashboard/src/locales/cn.json
index f3b0925..49b2be4 100644
--- a/inlong-dashboard/src/locales/cn.json
+++ b/inlong-dashboard/src/locales/cn.json
@@ -217,6 +217,14 @@
   "pages.AccessDetail.DataSources": "数据源",
   "pages.AccessDetail.DataStorages": "流向",
   "pages.AccessDetail.BusinessDetail": "Group 详情",
+  "pages.AccessDetail.Audit": "审计",
+  "pages.AccessDetail.Audit.DataStream": "数据流",
+  "pages.AccessDetail.Audit.Date": "日期",
+  "pages.AccessDetail.Audit.AuditIds": "展示内容",
+  "pages.AccessDetail.Audit.Search": "查询",
+  "pages.AccessDetail.Audit.Time": "时间",
+  "pages.AccessDetail.Audit.Receive": "接收成功",
+  "pages.AccessDetail.Audit.Send": "发送成功",
   "pages.ApprovalDetail.AccessConfig.DataStorages": "流向",
   "pages.ApprovalDetail.AccessConfig.ApprovalInformation": "审批信息",
   "pages.ApprovalDetail.AccessConfig.DataFlowInformation": "数据流信息",
diff --git a/inlong-dashboard/src/locales/en.json 
b/inlong-dashboard/src/locales/en.json
index 600b0d5..f696c92 100644
--- a/inlong-dashboard/src/locales/en.json
+++ b/inlong-dashboard/src/locales/en.json
@@ -217,6 +217,14 @@
   "pages.AccessDetail.DataSources": "DataSources",
   "pages.AccessDetail.DataStorages": "DataStorages",
   "pages.AccessDetail.BusinessDetail": "GroupDetail",
+  "pages.AccessDetail.Audit": "Audit",
+  "pages.AccessDetail.Audit.DataStream": "DataStream",
+  "pages.AccessDetail.Audit.Date": "Date",
+  "pages.AccessDetail.Audit.AuditIds": "Contents",
+  "pages.AccessDetail.Audit.Search": "Search",
+  "pages.AccessDetail.Audit.Time": "Time",
+  "pages.AccessDetail.Audit.Receive": "Receive",
+  "pages.AccessDetail.Audit.Send": "Send",
   "pages.ApprovalDetail.AccessConfig.DataStorages": "DataStorages",
   "pages.ApprovalDetail.AccessConfig.ApprovalInformation": "Approval 
information",
   "pages.ApprovalDetail.AccessConfig.DataFlowInformation": "Data stream 
information",
diff --git a/inlong-dashboard/src/pages/AccessDetail/Audit/config.tsx 
b/inlong-dashboard/src/pages/AccessDetail/Audit/config.tsx
index 8281461..f87163c 100644
--- a/inlong-dashboard/src/pages/AccessDetail/Audit/config.tsx
+++ b/inlong-dashboard/src/pages/AccessDetail/Audit/config.tsx
@@ -20,49 +20,23 @@
 import React from 'react';
 import { Button } from 'antd';
 import dayjs from 'dayjs';
+import i18n from '@/i18n';
 
-export const auditList = [
-  {
-    label: 'InLongApi接收成功',
-    value: 1,
-  },
-  {
-    label: 'InLongApi发送成功',
-    value: 2,
-  },
-  {
-    label: 'InLongAgent接收成功',
-    value: 3,
-  },
-  {
-    label: 'InLongAgent发送成功',
-    value: 4,
-  },
-  {
-    label: 'InLongDataProxy接收成功',
-    value: 5,
-  },
-  {
-    label: 'InLongDataProxy发送成功',
-    value: 6,
-  },
-  {
-    label: 'InLong分发服务1接收成功',
-    value: 7,
-  },
-  {
-    label: 'InLong分发服务1发送成功',
-    value: 8,
-  },
-  {
-    label: 'InLong分发服务2接收成功',
-    value: 9,
-  },
-  {
-    label: 'InLong分发服务2发送成功',
-    value: 10,
+export const auditList = ['InLong Api', 'InLong Agent', 'InLong DataProxy', 
'Inlong Sort'].reduce(
+  (acc, item, index) => {
+    return acc.concat([
+      {
+        label: `${item} ${i18n.t('pages.AccessDetail.Audit.Receive')}`,
+        value: index * 2,
+      },
+      {
+        label: `${item} ${i18n.t('pages.AccessDetail.Audit.Send')}`,
+        value: index * 2 + 1,
+      },
+    ]);
   },
-];
+  [],
+);
 
 const auditMap = auditList.reduce(
   (acc, cur) => ({
@@ -125,9 +99,8 @@ export const toTableData = source => {
 export const getFormContent = (inlongGroupId, initialValues, onSearch) => [
   {
     type: 'select',
-    label: '数据流',
+    label: i18n.t('pages.AccessDetail.Audit.DataStream'),
     name: 'inlongStreamId',
-
     props: {
       options: {
         requestService: {
@@ -151,7 +124,7 @@ export const getFormContent = (inlongGroupId, 
initialValues, onSearch) => [
   },
   {
     type: 'datepicker',
-    label: '查询日期',
+    label: i18n.t('pages.AccessDetail.Audit.Date'),
     name: 'dt',
     initialValue: dayjs(initialValues.dt),
     props: {
@@ -161,7 +134,7 @@ export const getFormContent = (inlongGroupId, 
initialValues, onSearch) => [
   },
   {
     type: 'select',
-    label: '展示内容',
+    label: i18n.t('pages.AccessDetail.Audit.AuditIds'),
     name: 'auditIds',
     initialValue: initialValues.auditIds,
     props: {
@@ -174,7 +147,7 @@ export const getFormContent = (inlongGroupId, 
initialValues, onSearch) => [
   {
     type: (
       <Button type="primary" onClick={onSearch}>
-        查询
+        {i18n.t('pages.AccessDetail.Audit.Search')}
       </Button>
     ),
   },
@@ -187,7 +160,7 @@ export const getTableColumns = source => {
   }));
   return [
     {
-      title: '时间',
+      title: i18n.t('pages.AccessDetail.Audit.Time'),
       dataIndex: 'logTs',
     },
   ].concat(data);
diff --git a/inlong-dashboard/src/pages/AccessDetail/Audit/index.tsx 
b/inlong-dashboard/src/pages/AccessDetail/Audit/index.tsx
index 1bcd38a..582a36f 100644
--- a/inlong-dashboard/src/pages/AccessDetail/Audit/index.tsx
+++ b/inlong-dashboard/src/pages/AccessDetail/Audit/index.tsx
@@ -21,7 +21,6 @@ import React, { useState } from 'react';
 import FormGenerator, { useForm } from '@/components/FormGenerator';
 import HighTable from '@/components/HighTable';
 import { useRequest } from '@/hooks';
-import { useTranslation } from 'react-i18next';
 import { timestampFormat } from '@/utils';
 import Charts from '@/components/Charts';
 import { CommonInterface } from '../common';
@@ -30,8 +29,6 @@ import { getFormContent, toChartData, toTableData, 
getTableColumns, auditList }
 type Props = CommonInterface;
 
 const Comp: React.FC<Props> = ({ inlongGroupId }) => {
-  const { t } = useTranslation();
-
   const [form] = useForm();
 
   const [query, setQuery] = useState({
@@ -40,42 +37,6 @@ const Comp: React.FC<Props> = ({ inlongGroupId }) => {
     dt: +new Date(),
   });
 
-  // const test = [
-  //   {
-  //     auditId: 1,
-  //     auditSet: [
-  //       {
-  //         logTs: '2022-01-01',
-  //         count: 123,
-  //       },
-  //       {
-  //         logTs: '2022-01-02',
-  //         count: 83,
-  //       },
-  //       {
-  //         logTs: '2022-01-03',
-  //         count: 126,
-  //       },
-  //     ],
-  //   },
-  //   {
-  //     auditId: 2,
-  //     auditSet: [
-  //       {
-  //         logTs: '2022-01-01',
-  //         count: 153,
-  //       },
-  //       {
-  //         logTs: '2022-01-02',
-  //         count: 101,
-  //       },
-  //       {
-  //         logTs: '2022-01-03',
-  //         count: 121,
-  //       },
-  //     ],
-  //   },
-  // ];
   const { data = [], run } = useRequest(
     {
       url: '/audit/list',

Reply via email to