You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by do...@apache.org on 2022/11/29 02:25:54 UTC

[inlong] branch master updated: [INLONG-6651][Dashboard] Add settings for data report type (#6653)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new ab87fe3e5 [INLONG-6651][Dashboard] Add settings for data report type (#6653)
ab87fe3e5 is described below

commit ab87fe3e5736ce241cf339fc86021ce3caf3998b
Author: Daniel <le...@apache.org>
AuthorDate: Tue Nov 29 10:25:48 2022 +0800

    [INLONG-6651][Dashboard] Add settings for data report type (#6653)
---
 .../src/components/Layout/NavWidget/index.tsx      | 47 +++++++++++-----------
 inlong-dashboard/src/locales/cn.json               |  4 ++
 inlong-dashboard/src/locales/en.json               |  4 ++
 .../src/metas/groups/common/GroupDefaultInfo.ts    | 24 +++++++++++
 .../src/pages/GroupDetail/Info/config.tsx          | 29 +++++++------
 .../src/pages/ProcessDetail/GroupConfig.tsx        |  1 +
 6 files changed, 74 insertions(+), 35 deletions(-)

diff --git a/inlong-dashboard/src/components/Layout/NavWidget/index.tsx b/inlong-dashboard/src/components/Layout/NavWidget/index.tsx
index 83c1298ee..8e6d7903d 100644
--- a/inlong-dashboard/src/components/Layout/NavWidget/index.tsx
+++ b/inlong-dashboard/src/components/Layout/NavWidget/index.tsx
@@ -19,10 +19,10 @@
 
 import React, { useState } from 'react';
 import { Dropdown, Menu } from 'antd';
-import { useSelector, useRequest } from '@/hooks';
+import { useSelector } from '@/hooks';
 import { State } from '@/models';
 import { useTranslation } from 'react-i18next';
-// import { FileTextOutlined } from '@/components/Icons';
+import request from '@/utils/request';
 import LocaleSelect from './LocaleSelect';
 import styles from './index.module.less';
 import PasswordModal from './PasswordModal';
@@ -40,34 +40,35 @@ const Comp: React.FC = () => {
     visible: false,
   });
 
-  const { run: runLogout } = useRequest('/anno/logout', {
-    manual: true,
-    onSuccess: () => (window.location.href = '/'),
-  });
+  const runLogout = async () => {
+    await request('/anno/logout');
+    window.location.href = '/';
+  };
 
-  const menu = (
-    <Menu>
-      <Menu.Item onClick={() => setKeyModal({ visible: true })}>
-        {t('components.Layout.NavWidget.PersonalKey')}
-      </Menu.Item>
-      <Menu.Item onClick={() => setCreateModal({ visible: true })}>
-        {t('components.Layout.NavWidget.EditPassword')}
-      </Menu.Item>
-      <Menu.Item onClick={runLogout}>{t('components.Layout.NavWidget.Logout')}</Menu.Item>
-    </Menu>
-  );
+  const menuItems = [
+    {
+      label: t('components.Layout.NavWidget.PersonalKey'),
+      key: 'mykey',
+      onClick: () => setKeyModal({ visible: true }),
+    },
+    {
+      label: t('components.Layout.NavWidget.EditPassword'),
+      key: 'password',
+      onClick: () => setCreateModal({ visible: true }),
+    },
+    {
+      label: t('components.Layout.NavWidget.Logout'),
+      key: 'logout',
+      onClick: runLogout,
+    },
+  ];
 
   return (
     <div style={{ marginRight: '20px' }}>
       <span className={styles.iconToolBar}>
-        {/* <Tooltip placement="bottom">
-          <a href="http://localhost" target="_blank" rel="noopener noreferrer">
-            <FileTextOutlined />
-          </a>
-        </Tooltip> */}
         <LocaleSelect />
       </span>
-      <Dropdown overlay={menu} placement="bottomLeft">
+      <Dropdown overlay={<Menu items={menuItems} />} placement="bottomLeft">
         <span>{userName}</span>
       </Dropdown>
       <PasswordModal
diff --git a/inlong-dashboard/src/locales/cn.json b/inlong-dashboard/src/locales/cn.json
index ec529067c..68da01b58 100644
--- a/inlong-dashboard/src/locales/cn.json
+++ b/inlong-dashboard/src/locales/cn.json
@@ -247,6 +247,10 @@
   "meta.Group.InlongGroupOwners": "责任人",
   "meta.Group.InlongGroupOwnersExtra": "责任人,可查看、修改数据流组信息",
   "meta.Group.InlongGroupIntroduction": "描述",
+  "meta.Group.DataReportType": "数据上报",
+  "meta.Group.DataReportType.DataProxyWithSource": "发往DataProxy,待DataProxy接收到数据后再响应",
+  "meta.Group.DataReportType.DataProxyWithSink": "发往DataProxy,待DataProxy发送出数据后再响应",
+  "meta.Group.DataReportType.MQ": "发往MQ,待MQ接收到数据后再响应",
   "meta.Group.MQType": "MQ类型",
   "meta.Group.Pulsar.QueueModule": "队列模型",
   "meta.Group.Pulsar.Parallel": "并行",
diff --git a/inlong-dashboard/src/locales/en.json b/inlong-dashboard/src/locales/en.json
index 837db9da2..de4b9eea8 100644
--- a/inlong-dashboard/src/locales/en.json
+++ b/inlong-dashboard/src/locales/en.json
@@ -247,6 +247,10 @@
   "meta.Group.InlongGroupOwners": "Inlong Group Owners",
   "meta.Group.InlongGroupOwnersExtra": "Can view, modify group info",
   "meta.Group.InlongGroupIntroduction": "Description",
+  "meta.Group.DataReportType": "ReportDataTo",
+  "meta.Group.DataReportType.DataProxyWithSource": "Report to DataProxy and respond when the DataProxy received data",
+  "meta.Group.DataReportType.DataProxyWithSink": "Report to DataProxy and respond after DataProxy sends data",
+  "meta.Group.DataReportType.MQ": "Report to MQ and respond when the MQ received data",
   "meta.Group.MQType": "MQ Type",
   "meta.Group.Pulsar.QueueModule": "Queue Module",
   "meta.Group.Pulsar.Parallel": "Parallel",
diff --git a/inlong-dashboard/src/metas/groups/common/GroupDefaultInfo.ts b/inlong-dashboard/src/metas/groups/common/GroupDefaultInfo.ts
index 892cb9e18..55108cf3e 100644
--- a/inlong-dashboard/src/metas/groups/common/GroupDefaultInfo.ts
+++ b/inlong-dashboard/src/metas/groups/common/GroupDefaultInfo.ts
@@ -85,6 +85,30 @@ export class GroupDefaultInfo implements DataWithBackend, RenderRow, RenderList
   @I18n('meta.Group.InlongGroupIntroduction')
   description: string;
 
+  @FieldDecorator({
+    type: 'select',
+    initialValue: 0,
+    rules: [{ required: true }],
+    props: {
+      options: [
+        {
+          label: i18n.t('meta.Group.DataReportType.DataProxyWithSource'),
+          value: 0,
+        },
+        {
+          label: i18n.t('meta.Group.DataReportType.DataProxyWithSink'),
+          value: 1,
+        },
+        {
+          label: i18n.t('meta.Group.DataReportType.MQ'),
+          value: 2,
+        },
+      ],
+    },
+  })
+  @I18n('meta.Group.DataReportType')
+  dataReportType: string;
+
   @FieldDecorator({
     type: 'radio',
     initialValue: defaultValue,
diff --git a/inlong-dashboard/src/pages/GroupDetail/Info/config.tsx b/inlong-dashboard/src/pages/GroupDetail/Info/config.tsx
index 4a423f3ab..59634c38f 100644
--- a/inlong-dashboard/src/pages/GroupDetail/Info/config.tsx
+++ b/inlong-dashboard/src/pages/GroupDetail/Info/config.tsx
@@ -44,18 +44,22 @@ export const useFormContent = ({ mqType, editing, isCreate, isUpdate }) => {
         }
         return item;
       })
-    : fields.map(item => ({
-        ...item,
-        type: transType(editing, item),
-        suffix:
-          typeof item.suffix === 'object' && !editing
-            ? {
-                ...item.suffix,
-                type: 'text',
-              }
-            : item.suffix,
-        extra: null,
-      }));
+    : fields.map(item => {
+        const t = transType(editing, item);
+        return {
+          ...item,
+          type: t,
+          suffix:
+            typeof item.suffix === 'object' && !editing
+              ? {
+                  ...item.suffix,
+                  type: 'text',
+                }
+              : item.suffix,
+          extra: null,
+          rules: t === 'text' ? undefined : item.rules,
+        };
+      });
 };
 
 function transType(editing: boolean, conf) {
@@ -65,6 +69,7 @@ function transType(editing: boolean, conf) {
         'name',
         'description',
         'inCharges',
+        'dataReportType',
         'ensemble',
         'writeQuorum',
         'ackQuorum',
diff --git a/inlong-dashboard/src/pages/ProcessDetail/GroupConfig.tsx b/inlong-dashboard/src/pages/ProcessDetail/GroupConfig.tsx
index 14a493d53..c0c81d20a 100644
--- a/inlong-dashboard/src/pages/ProcessDetail/GroupConfig.tsx
+++ b/inlong-dashboard/src/pages/ProcessDetail/GroupConfig.tsx
@@ -33,6 +33,7 @@ export const useGroupFormContent = ({ mqType = '', isFinished, isViwer }) => {
     const obj = { ...item };
 
     const canEditSet = new Set([
+      'dataReportType',
       'ensemble',
       'writeQuorum',
       'ackQuorum',