You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by le...@apache.org on 2022/08/08 06:33:33 UTC

[inlong] branch master updated: [INLONG-5391][Dashboard] Unified consumption creation/management logic (#5392)

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

leezng 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 e7b0170f5 [INLONG-5391][Dashboard] Unified consumption creation/management logic (#5392)
e7b0170f5 is described below

commit e7b0170f5e0410efeed877eb93a2705647940b95
Author: Daniel <le...@outlook.com>
AuthorDate: Mon Aug 8 14:33:29 2022 +0800

    [INLONG-5391][Dashboard] Unified consumption creation/management logic (#5392)
---
 .../ConsumeHelper/FieldsConfig/basicFields.tsx         |  4 ++--
 .../src/pages/ApprovalDetail/ConsumeConfig.tsx         | 11 +++--------
 inlong-dashboard/src/pages/ConsumeDashboard/config.tsx |  8 ++++----
 .../src/pages/ConsumeDetail/Info/config.tsx            | 18 ++----------------
 .../src/pages/ConsumeDetail/Info/index.tsx             |  2 +-
 inlong-dashboard/src/pages/ConsumeDetail/index.tsx     | 10 ++++++----
 6 files changed, 18 insertions(+), 35 deletions(-)

diff --git a/inlong-dashboard/src/components/ConsumeHelper/FieldsConfig/basicFields.tsx b/inlong-dashboard/src/components/ConsumeHelper/FieldsConfig/basicFields.tsx
index 766eb1e86..316c8cf7d 100644
--- a/inlong-dashboard/src/components/ConsumeHelper/FieldsConfig/basicFields.tsx
+++ b/inlong-dashboard/src/components/ConsumeHelper/FieldsConfig/basicFields.tsx
@@ -32,8 +32,8 @@ export default (
     {
       type: 'input',
       label: i18n.t('components.ConsumeHelper.FieldsConfig.basicFields.ConsumerGroupName'),
-      name: 'consumerGroupName',
-      initialValue: currentValues.consumerGroupName,
+      name: 'consumerGroup',
+      initialValue: currentValues.consumerGroup,
       extra: i18n.t('components.ConsumeHelper.FieldsConfig.basicFields.ConsumerGroupNameRules'),
       rules: [
         { required: true },
diff --git a/inlong-dashboard/src/pages/ApprovalDetail/ConsumeConfig.tsx b/inlong-dashboard/src/pages/ApprovalDetail/ConsumeConfig.tsx
index 5a85eee0b..3f06474dc 100644
--- a/inlong-dashboard/src/pages/ApprovalDetail/ConsumeConfig.tsx
+++ b/inlong-dashboard/src/pages/ApprovalDetail/ConsumeConfig.tsx
@@ -25,12 +25,7 @@ import { genBasicFields } from '@/components/ConsumeHelper';
 const getConsumerContent = initialValues => {
   return genBasicFields(
     [
-      {
-        type: 'text',
-        label: i18n.t('pages.ApprovalDetail.ConsumeConfig.ConsumerGroup'),
-        name: 'consumerGroupId',
-        initialValue: initialValues.consumerGroupId,
-      },
+      'consumerGroup',
       'inCharges',
       'masterUrl',
       'inlongGroupId',
@@ -88,8 +83,8 @@ export const getFormContent = (
           {
             type: 'input',
             label: i18n.t('pages.ApprovalDetail.ConsumeConfig.ConsumerGroup'),
-            name: ['form', 'consumerGroupId'],
-            initialValue: formData.consumptionInfo?.consumerGroupId,
+            name: ['form', 'consumerGroup'],
+            initialValue: formData.consumptionInfo?.consumerGroup,
             rules: [{ required: true }],
             props: {
               disabled: isFinished,
diff --git a/inlong-dashboard/src/pages/ConsumeDashboard/config.tsx b/inlong-dashboard/src/pages/ConsumeDashboard/config.tsx
index dddbd6369..f362598fc 100644
--- a/inlong-dashboard/src/pages/ConsumeDashboard/config.tsx
+++ b/inlong-dashboard/src/pages/ConsumeDashboard/config.tsx
@@ -72,7 +72,7 @@ export const getFilterFormContent = defaultValues =>
     {
       type: 'select',
       label: i18n.t('pages.ConsumeDashboard.config.OperatingStatus'),
-      name: 'lastConsumerStatus',
+      name: 'lastConsumptionStatus',
       initialValue: defaultValues.lastConsumerStatusList,
       props: {
         dropdownMatchSelectWidth: false,
@@ -110,7 +110,7 @@ export const getColumns = ({ onDelete }) => {
     },
     {
       title: i18n.t('pages.ConsumeDashboard.config.ConsumerGroup'),
-      dataIndex: 'consumerGroupId',
+      dataIndex: 'consumerGroup',
       width: 180,
     },
     {
@@ -124,7 +124,7 @@ export const getColumns = ({ onDelete }) => {
     },
     {
       title: i18n.t('pages.ConsumeDashboard.config.RecentConsumptionTime'),
-      dataIndex: 'lastConsumerTime',
+      dataIndex: 'lastConsumptionTime',
       render: text => text && timestampFormat(text),
     },
     {
@@ -135,7 +135,7 @@ export const getColumns = ({ onDelete }) => {
     },
     {
       title: i18n.t('pages.ConsumeDashboard.config.OperatingStatus'),
-      dataIndex: 'lastConsumerStatus',
+      dataIndex: 'lastConsumptionStatus',
       render: text => text && genLastConsumerStatusTag(text),
       width: 120,
     },
diff --git a/inlong-dashboard/src/pages/ConsumeDetail/Info/config.tsx b/inlong-dashboard/src/pages/ConsumeDetail/Info/config.tsx
index e4cfd04d9..e14f557cf 100644
--- a/inlong-dashboard/src/pages/ConsumeDetail/Info/config.tsx
+++ b/inlong-dashboard/src/pages/ConsumeDetail/Info/config.tsx
@@ -18,17 +18,10 @@
  */
 
 import { genBasicFields } from '@/components/ConsumeHelper';
-import i18n from '@/i18n';
 
 export const getFormContent = ({ editing, initialValues, isCreate }) => {
   const keys = [
-    !isCreate && {
-      type: 'text',
-      label: i18n.t('pages.ConsumeDetail.Info.config.ConsumerGroupID'),
-      name: 'consumerGroupId',
-      rules: [{ required: true }],
-    },
-    'consumerGroupName',
+    'consumerGroup',
     'inCharges',
     !isCreate && 'masterUrl',
     'inlongGroupId',
@@ -62,14 +55,7 @@ export const getFormContent = ({ editing, initialValues, isCreate }) => {
 function transType(editing: boolean, conf, initialValues) {
   const arr = [
     {
-      name: [
-        'consumerGroupId',
-        'consumerGroupName',
-        'inlongGroupId',
-        'topic',
-        'filterEnabled',
-        'inlongStreamId',
-      ],
+      name: ['consumerGroup', 'inlongGroupId', 'topic', 'filterEnabled', 'inlongStreamId'],
       as: 'text',
       active: true,
     },
diff --git a/inlong-dashboard/src/pages/ConsumeDetail/Info/index.tsx b/inlong-dashboard/src/pages/ConsumeDetail/Info/index.tsx
index b0d05dd04..bbef743f2 100644
--- a/inlong-dashboard/src/pages/ConsumeDetail/Info/index.tsx
+++ b/inlong-dashboard/src/pages/ConsumeDetail/Info/index.tsx
@@ -63,7 +63,7 @@ const Comp = ({ id, readonly, isCreate }: Props, ref) => {
     const submitData = {
       ...values,
       inCharges: values.inCharges.join(','),
-      consumerGroupId: values.consumerGroupName || data?.consumerGroupId,
+      consumerGroup: values.consumerGroup || data?.consumerGroup,
       topic: Array.isArray(values.topic) ? values.topic.join(',') : values.topic,
       version: data?.version,
       mqExtInfo: {
diff --git a/inlong-dashboard/src/pages/ConsumeDetail/index.tsx b/inlong-dashboard/src/pages/ConsumeDetail/index.tsx
index 0af00ef80..a03be3943 100644
--- a/inlong-dashboard/src/pages/ConsumeDetail/index.tsx
+++ b/inlong-dashboard/src/pages/ConsumeDetail/index.tsx
@@ -69,15 +69,17 @@ const Comp: React.FC = () => {
         history.push({
           search: `?id=${result}&step=1`,
         });
+        return result;
       }
+      return id;
     } finally {
       setConfirmLoading(false);
     }
   };
 
-  const onSubmit = async () => {
+  const onSubmit = async _id => {
     await request({
-      url: `/consumption/startProcess/${id}`,
+      url: `/consumption/startProcess/${_id}`,
       method: 'POST',
       data,
     });
@@ -108,8 +110,8 @@ const Comp: React.FC = () => {
         <Button
           type="primary"
           onClick={async () => {
-            await onOk(current);
-            await onSubmit();
+            const id = await onOk(current);
+            await onSubmit(id);
           }}
         >
           {t('pages.ConsumeCreate.Submit')}