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 6211eb38f5 [INLONG-9354][Dashboard] Data access File sources 
optimization (#9356)
6211eb38f5 is described below

commit 6211eb38f59dba8d14e70e8ad058dc353ae963a9
Author: Lizhen <88174078+bluew...@users.noreply.github.com>
AuthorDate: Thu Nov 30 22:13:13 2023 +0800

    [INLONG-9354][Dashboard] Data access File sources optimization (#9356)
---
 .../src/plugins/sources/defaults/File.ts           | 88 +++++++++++++++++++++-
 inlong-dashboard/src/ui/locales/cn.json            |  8 ++
 inlong-dashboard/src/ui/locales/en.json            |  8 ++
 .../GroupDetail/DataStream/StreamItemModal.tsx     |  1 -
 4 files changed, 100 insertions(+), 5 deletions(-)

diff --git a/inlong-dashboard/src/plugins/sources/defaults/File.ts 
b/inlong-dashboard/src/plugins/sources/defaults/File.ts
index a2d8b95962..e6fbd2248a 100644
--- a/inlong-dashboard/src/plugins/sources/defaults/File.ts
+++ b/inlong-dashboard/src/plugins/sources/defaults/File.ts
@@ -36,7 +36,7 @@ export default class PulsarSource
     type: 'select',
     rules: [{ required: true }],
     props: values => ({
-      disabled: values?.status === 101,
+      disabled: Boolean(values.id),
       showSearch: true,
       allowClear: true,
       filterOption: false,
@@ -89,7 +89,7 @@ export default class PulsarSource
       },
     ],
     props: values => ({
-      disabled: values?.status === 101,
+      disabled: Boolean(values.id),
       showSearch: true,
       allowClear: true,
       filterOption: false,
@@ -125,20 +125,100 @@ export default class PulsarSource
     tooltip: i18n.t('meta.Sources.File.FilePathHelp'),
     rules: [{ required: true }],
     props: values => ({
-      disabled: values?.status === 101,
+      disabled: Boolean(values.id),
     }),
   })
   @ColumnDecorator()
   @I18n('meta.Sources.File.FilePath')
   pattern: string;
 
+  @FieldDecorator({
+    type: 'inputnumber',
+    rules: [{ required: true }],
+    props: values => ({
+      min: 1,
+      max: 100,
+      precision: 0,
+      disabled: Boolean(values.id),
+    }),
+  })
+  @I18n('meta.Sources.File.MaxFileCount')
+  maxFileCount: number;
+
+  @FieldDecorator({
+    type: 'radio',
+    rules: [{ required: true }],
+    initialValue: 'default',
+    props: values => ({
+      disabled: Boolean(values.id),
+      options: [
+        {
+          label: 'Default',
+          value: 'default',
+        },
+        {
+          label: 'Mix',
+          value: 'mix',
+        },
+      ],
+    }),
+  })
+  @I18n('meta.Sources.File.DataContentStyle')
+  dataContentStyle: string;
+
+  @FieldDecorator({
+    type: 'radio',
+    props: values => ({
+      disabled: Boolean(values.id),
+      options: [
+        {
+          label: i18n.t('meta.Sources.File.Cycle.Day'),
+          value: 'D',
+        },
+        {
+          label: i18n.t('meta.Sources.File.Cycle.Hour'),
+          value: 'H',
+        },
+        {
+          label: i18n.t('meta.Sources.File.Cycle.RealTime'),
+          value: 'R',
+        },
+      ],
+    }),
+  })
+  @I18n('meta.Sources.File.Cycle')
+  cycleUnit: string;
+
   @FieldDecorator({
     type: 'input',
     tooltip: i18n.t('meta.Sources.File.TimeOffsetHelp'),
+    rules: [
+      {
+        pattern: /[0-9][mhd]$/,
+        message: i18n.t('meta.Sources.File.TimeOffsetRules'),
+      },
+    ],
     props: values => ({
-      disabled: values?.status === 101,
+      disabled: Boolean(values.id),
     }),
   })
   @I18n('meta.Sources.File.TimeOffset')
   timeOffset: string;
+
+  @FieldDecorator({
+    type: 'select',
+    initialValue: 'GMT+8:00',
+    props: values => ({
+      disabled: Boolean(values.id),
+      options: [
+        0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, -1, -2, -3, -4, -5, -6, 
-7, -8, -9, -10, -11,
+        -12,
+      ].map(item => ({
+        label: Math.sign(item) === 1 || Math.sign(item) === 0 ? 
`GMT+${item}:00` : `GMT${item}:00`,
+        value: Math.sign(item) === 1 || Math.sign(item) === 0 ? 
`GMT+${item}:00` : `GMT${item}:00`,
+      })),
+    }),
+  })
+  @I18n('meta.Sources.File.TimeZone')
+  timeZone: string;
 }
diff --git a/inlong-dashboard/src/ui/locales/cn.json 
b/inlong-dashboard/src/ui/locales/cn.json
index ce759a3f1e..1f7eefa752 100644
--- a/inlong-dashboard/src/ui/locales/cn.json
+++ b/inlong-dashboard/src/ui/locales/cn.json
@@ -33,6 +33,14 @@
   "meta.Sources.File.IpRule": "请输入正确的IP地址",
   "meta.Sources.File.TimeOffset": "时间偏移量",
   "meta.Sources.File.TimeOffsetHelp": 
"从文件的某个时间开始采集,'1m'表示1分钟之后,'-1m'表示1分钟之前,支持m(分钟),h(小时),d(天),空则从当前时间开始采集",
+  "meta.Sources.File.TimeOffsetRules": "只能包含数字和字母 m、h、d",
+  "meta.Sources.File.MaxFileCount": "最大文件数量",
+  "meta.Sources.File.DataContentStyle": "数据内容样式",
+  "meta.Sources.File.Cycle": "周期",
+  "meta.Sources.File.Cycle.Day": "天",
+  "meta.Sources.File.Cycle.Hour": "小时",
+  "meta.Sources.File.Cycle.RealTime": "实时",
+  "meta.Sources.File.TimeZone": "时区",
   "meta.Sources.Db.Server": "服务器地址",
   "meta.Sources.Db.Port": "服务器端口",
   "meta.Sources.Db.ServerTimezone": "服务器时区",
diff --git a/inlong-dashboard/src/ui/locales/en.json 
b/inlong-dashboard/src/ui/locales/en.json
index b17f3c54b3..68875e30fe 100644
--- a/inlong-dashboard/src/ui/locales/en.json
+++ b/inlong-dashboard/src/ui/locales/en.json
@@ -33,6 +33,14 @@
   "meta.Sources.File.IpRule": "Please enter the IP address correctly",
   "meta.Sources.File.TimeOffset": "Time offset",
   "meta.Sources.File.TimeOffsetHelp": "The file will be collected from a 
certain time,' 1m' means 1 minute later,' -1m' means 1 minute before, and 
m(minute), h(hour), d(day) are supported. If it is empty, the file will be 
collected from the current time",
+  "meta.Sources.File.TimeOffsetRules": "Can only contain numbers and letters 
m, h, d",
+  "meta.Sources.File.MaxFileCount": "Max file count",
+  "meta.Sources.File.DataContentStyle": "Data content style",
+  "meta.Sources.File.Cycle": "Cycle",
+  "meta.Sources.File.Cycle.Day": "Day",
+  "meta.Sources.File.Cycle.Hour": "Hour",
+  "meta.Sources.File.Cycle.RealTime": "Real time",
+  "meta.Sources.File.TimeZone": "Time zone",
   "meta.Sources.Db.Server": "Server",
   "meta.Sources.Db.Port": "Port",
   "meta.Sources.Db.ServerTimezone": "Timezone",
diff --git 
a/inlong-dashboard/src/ui/pages/GroupDetail/DataStream/StreamItemModal.tsx 
b/inlong-dashboard/src/ui/pages/GroupDetail/DataStream/StreamItemModal.tsx
index 11be3693e8..b7b9c4d0d4 100644
--- a/inlong-dashboard/src/ui/pages/GroupDetail/DataStream/StreamItemModal.tsx
+++ b/inlong-dashboard/src/ui/pages/GroupDetail/DataStream/StreamItemModal.tsx
@@ -109,7 +109,6 @@ const Comp: React.FC<Props> = ({ inlongGroupId, 
inlongStreamId, mqType, ...modal
         type: EditableTable,
         label: i18n.t('meta.Stream.PredefinedFields'),
         name: 'predefinedFields',
-        visible: mqType === 'PULSAR',
         isPro: true,
         initialValue: [],
         props: values => ({

Reply via email to