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/03/28 14:46:15 UTC
[incubator-inlong] branch master updated: [INLONG-3394][Dashboard] Remove the stream owner parameter and manage it uniformly by group (#3395)
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/incubator-inlong.git
The following commit(s) were added to refs/heads/master by this push:
new e4a01de [INLONG-3394][Dashboard] Remove the stream owner parameter and manage it uniformly by group (#3395)
e4a01de is described below
commit e4a01ded671e3e043082e16e0e5fbeafd853df3a
Author: Daniel <le...@outlook.com>
AuthorDate: Mon Mar 28 22:46:11 2022 +0800
[INLONG-3394][Dashboard] Remove the stream owner parameter and manage it uniformly by group (#3395)
---
.../AccessHelper/FieldsConfig/dataFields.tsx | 13 --
.../src/pages/AccessCreate/DataStream/config.tsx | 1 -
.../src/pages/AccessCreate/DataStream/helper.ts | 2 -
.../src/pages/AccessCreate/DataStream/index.tsx | 140 ++++++++---------
.../AccessDetail/DataStream/StreamItemModal.tsx | 1 -
.../src/pages/AccessDetail/DataStream/config.tsx | 3 -
.../src/pages/AccessDetail/DataStream/index.tsx | 169 ++++++++++-----------
7 files changed, 149 insertions(+), 180 deletions(-)
diff --git a/inlong-dashboard/src/components/AccessHelper/FieldsConfig/dataFields.tsx b/inlong-dashboard/src/components/AccessHelper/FieldsConfig/dataFields.tsx
index 24787cf..9f14609 100644
--- a/inlong-dashboard/src/components/AccessHelper/FieldsConfig/dataFields.tsx
+++ b/inlong-dashboard/src/components/AccessHelper/FieldsConfig/dataFields.tsx
@@ -20,7 +20,6 @@
import React from 'react';
import { FormItemProps } from '@/components/FormGenerator';
import { pickObjectArray } from '@/utils';
-import StaffSelect from '@/components/StaffSelect';
import DataSourcesEditor from '../DataSourcesEditor';
import DataStorageEditor from '../DataStorageEditor/Editor';
import EditableTable from '@/components/EditableTable';
@@ -80,18 +79,6 @@ export default (
rules: [{ required: false }],
},
{
- type: <StaffSelect mode="multiple" currentUserClosable={false} />,
- label: i18n.t('components.AccessHelper.FieldsConfig.dataFields.DataStreamOwners'),
- name: 'inCharges',
- initialValue: currentValues.inCharges,
- extra: i18n.t('components.AccessHelper.FieldsConfig.dataFields.DataStreamOwnerHelp'),
- rules: [
- {
- required: true,
- },
- ],
- },
- {
type: 'textarea',
label: i18n.t('components.AccessHelper.FieldsConfig.dataFields.DataFlowIntroduction'),
name: 'description',
diff --git a/inlong-dashboard/src/pages/AccessCreate/DataStream/config.tsx b/inlong-dashboard/src/pages/AccessCreate/DataStream/config.tsx
index a3e6967..d7a980a 100644
--- a/inlong-dashboard/src/pages/AccessCreate/DataStream/config.tsx
+++ b/inlong-dashboard/src/pages/AccessCreate/DataStream/config.tsx
@@ -40,7 +40,6 @@ export const genFormContent = (currentValues, inlongGroupId, middlewareType) =>
},
'inlongStreamId',
'name',
- 'inCharges',
'description',
{
type: (
diff --git a/inlong-dashboard/src/pages/AccessCreate/DataStream/helper.ts b/inlong-dashboard/src/pages/AccessCreate/DataStream/helper.ts
index 3adb533..f8a5871 100644
--- a/inlong-dashboard/src/pages/AccessCreate/DataStream/helper.ts
+++ b/inlong-dashboard/src/pages/AccessCreate/DataStream/helper.ts
@@ -67,7 +67,6 @@ export const valuesToData = (values, inlongGroupId) => {
...rest,
inlongGroupId,
inlongStreamId,
- inCharges: rest.inCharges?.join(','),
dataSourceType,
};
@@ -110,7 +109,6 @@ export const dataToValues = data => {
...output,
...fieldList,
...streamInfo,
- inCharges: streamInfo.inCharges?.split(','),
};
return output;
diff --git a/inlong-dashboard/src/pages/AccessCreate/DataStream/index.tsx b/inlong-dashboard/src/pages/AccessCreate/DataStream/index.tsx
index d110767..78f0e37 100644
--- a/inlong-dashboard/src/pages/AccessCreate/DataStream/index.tsx
+++ b/inlong-dashboard/src/pages/AccessCreate/DataStream/index.tsx
@@ -21,9 +21,8 @@ import React, { useState, useEffect, useImperativeHandle, forwardRef } from 'rea
import { Form, Collapse, Button, Space } from 'antd';
import { useTranslation } from 'react-i18next';
import { FormItemContent } from '@/components/FormGenerator';
-import { useRequest, useSelector } from '@/hooks';
+import { useRequest } from '@/hooks';
import request from '@/utils/request';
-import { State } from '@/models';
import { genFormContent } from './config';
import { valuesToData, dataToValues } from './helper';
@@ -37,8 +36,6 @@ const Comp = ({ inlongGroupId, middlewareType }: Props, ref) => {
const { t } = useTranslation();
- const userName = useSelector<State, State['userName']>(state => state.userName);
-
const [activeKey, setActiveKey] = useState('0');
const [realTimeValues, setRealTimeValues] = useState({ list: [] });
@@ -104,77 +101,74 @@ const Comp = ({ inlongGroupId, middlewareType }: Props, ref) => {
);
return (
- userName && (
- <Form
- form={form}
- name="dataSourcesForm"
- labelAlign="left"
- labelCol={{ xs: 6, sm: 4 }}
- wrapperCol={{ xs: 18, sm: 20 }}
- onValuesChange={(c, v) => setRealTimeValues(v)}
- >
- <Form.List name="list" initialValue={[{}]}>
- {(fields, { add, remove }) => (
- <>
- <Space style={{ marginBottom: 20 }}>
- <Button
- type="primary"
- onClick={async () => {
- await add();
- setActiveKey(fields.length.toString());
+ <Form
+ form={form}
+ name="dataSourcesForm"
+ labelAlign="left"
+ labelCol={{ xs: 6, sm: 4 }}
+ wrapperCol={{ xs: 18, sm: 20 }}
+ onValuesChange={(c, v) => setRealTimeValues(v)}
+ >
+ <Form.List name="list" initialValue={[{}]}>
+ {(fields, { add, remove }) => (
+ <>
+ <Space style={{ marginBottom: 20 }}>
+ <Button
+ type="primary"
+ onClick={async () => {
+ await add();
+ setActiveKey(fields.length.toString());
+ }}
+ >
+ {t('basic.Create')}
+ </Button>
+ </Space>
+
+ <Collapse
+ accordion
+ activeKey={activeKey}
+ onChange={key => setActiveKey(key as any)}
+ style={{ backgroundColor: 'transparent', border: 'none' }}
+ >
+ {fields.map((field, index, arr) => (
+ <Collapse.Panel
+ header={`#${index + 1}`}
+ key={index.toString()}
+ extra={genExtra(field, remove, index, arr.length)}
+ style={{
+ marginBottom: 10,
+ border: '1px solid #e5e5e5',
+ backgroundColor: '#f6f7fb',
}}
>
- {t('basic.Create')}
- </Button>
- </Space>
-
- <Collapse
- accordion
- activeKey={activeKey}
- onChange={key => setActiveKey(key as any)}
- style={{ backgroundColor: 'transparent', border: 'none' }}
- >
- {fields.map((field, index, arr) => (
- <Collapse.Panel
- header={`#${index + 1}`}
- key={index.toString()}
- extra={genExtra(field, remove, index, arr.length)}
- style={{
- marginBottom: 10,
- border: '1px solid #e5e5e5',
- backgroundColor: '#f6f7fb',
- }}
- >
- <FormItemContent
- values={realTimeValues.list?.[index]}
- content={genFormContent(
- {
- ...realTimeValues.list?.[index],
- inCharges: [userName],
- },
- inlongGroupId,
- middlewareType,
- ).map(item => {
- const obj = { ...item } as any;
- if (obj.name) {
- obj.name = [field.name, obj.name];
- obj.fieldKey = [field.fieldKey, obj.name];
- }
- if (obj.suffix && obj.suffix.name) {
- obj.suffix.name = [field.name, obj.suffix.name];
- obj.suffix.fieldKey = [field.fieldKey, obj.suffix.name];
- }
- return obj;
- })}
- />
- </Collapse.Panel>
- ))}
- </Collapse>
- </>
- )}
- </Form.List>
- </Form>
- )
+ <FormItemContent
+ values={realTimeValues.list?.[index]}
+ content={genFormContent(
+ {
+ ...realTimeValues.list?.[index],
+ },
+ inlongGroupId,
+ middlewareType,
+ ).map(item => {
+ const obj = { ...item } as any;
+ if (obj.name) {
+ obj.name = [field.name, obj.name];
+ obj.fieldKey = [field.fieldKey, obj.name];
+ }
+ if (obj.suffix && obj.suffix.name) {
+ obj.suffix.name = [field.name, obj.suffix.name];
+ obj.suffix.fieldKey = [field.fieldKey, obj.suffix.name];
+ }
+ return obj;
+ })}
+ />
+ </Collapse.Panel>
+ ))}
+ </Collapse>
+ </>
+ )}
+ </Form.List>
+ </Form>
);
};
diff --git a/inlong-dashboard/src/pages/AccessDetail/DataStream/StreamItemModal.tsx b/inlong-dashboard/src/pages/AccessDetail/DataStream/StreamItemModal.tsx
index 57757d9..b734550 100644
--- a/inlong-dashboard/src/pages/AccessDetail/DataStream/StreamItemModal.tsx
+++ b/inlong-dashboard/src/pages/AccessDetail/DataStream/StreamItemModal.tsx
@@ -51,7 +51,6 @@ export const genFormContent = (currentValues, inlongGroupId, middlewareType) =>
},
'inlongStreamId',
'name',
- 'inCharges',
'description',
{
type: (
diff --git a/inlong-dashboard/src/pages/AccessDetail/DataStream/config.tsx b/inlong-dashboard/src/pages/AccessDetail/DataStream/config.tsx
index 83e7d0b..5745a9c 100644
--- a/inlong-dashboard/src/pages/AccessDetail/DataStream/config.tsx
+++ b/inlong-dashboard/src/pages/AccessDetail/DataStream/config.tsx
@@ -100,7 +100,6 @@ export const genFormContent = (
visible: middlewareType === 'PULSAR' && editingId !== true,
},
'name',
- 'inCharges',
'description',
{
type: (
@@ -172,8 +171,6 @@ export const genFormContent = (
if (typeof obj.type === 'string') {
obj.type = 'text';
obj.props = { options: obj.props?.options };
- } else if (obj.name === 'inCharges') {
- obj.type = <span>{currentValues?.inCharges?.join(', ')}</span>;
}
if ((obj.suffix as any)?.type) {
diff --git a/inlong-dashboard/src/pages/AccessDetail/DataStream/index.tsx b/inlong-dashboard/src/pages/AccessDetail/DataStream/index.tsx
index 175aa8a..af29d95 100644
--- a/inlong-dashboard/src/pages/AccessDetail/DataStream/index.tsx
+++ b/inlong-dashboard/src/pages/AccessDetail/DataStream/index.tsx
@@ -22,8 +22,7 @@ import ReactDom from 'react-dom';
import { Form, Collapse, Button, Empty, Modal, Space, message } from 'antd';
import FormGenerator, { FormItemContent } from '@/components/FormGenerator';
import { defaultSize } from '@/configs/pagination';
-import { useRequest, useSelector } from '@/hooks';
-import { State } from '@/models';
+import { useRequest } from '@/hooks';
import request from '@/utils/request';
import { useTranslation } from 'react-i18next';
import { dataToValues, valuesToData } from '@/pages/AccessCreate/DataStream/helper';
@@ -41,8 +40,6 @@ const Comp: React.FC<Props> = ({ inlongGroupId, readonly, middlewareType }) => {
const [form] = Form.useForm();
- const userName = useSelector<State, State['userName']>(state => state.userName);
-
const [activeKey, setActiveKey] = useState('0');
const [options, setOptions] = useState({
@@ -229,91 +226,89 @@ const Comp: React.FC<Props> = ({ inlongGroupId, readonly, middlewareType }) => {
<div ref={topRightRef}></div>
</div>
- {userName && (
- <Form
- form={form}
- labelAlign="left"
- labelCol={{ xs: 6, sm: 4 }}
- wrapperCol={{ xs: 18, sm: 20 }}
- onValuesChange={(c, v) => setRealTimeValues(v)}
- >
- <Form.List name="list" initialValue={data.list}>
- {(fields, { add }) => (
- <>
- {topRightRef.current &&
- !readonly &&
- ReactDom.createPortal(
- <Space>
- <Button
- type="primary"
- disabled={!!editingId}
- onClick={async () => {
- setEditingId(true);
- await add({}, 0);
- setTimeout(() => {
- setRealTimeValues(form.getFieldsValue());
- const newActiveKey = Math.max(...fields.map(item => item.key)) + 1 + '';
- setActiveKey(newActiveKey);
- }, 0);
- mutate({ list: [{}].concat(data.list), total: data.list.length + 1 });
- }}
- >
- {t('pages.AccessDetail.DataStream.CreateDataStream')}
- </Button>
- </Space>,
- topRightRef.current,
- )}
+ <Form
+ form={form}
+ labelAlign="left"
+ labelCol={{ xs: 6, sm: 4 }}
+ wrapperCol={{ xs: 18, sm: 20 }}
+ onValuesChange={(c, v) => setRealTimeValues(v)}
+ >
+ <Form.List name="list" initialValue={data.list}>
+ {(fields, { add }) => (
+ <>
+ {topRightRef.current &&
+ !readonly &&
+ ReactDom.createPortal(
+ <Space>
+ <Button
+ type="primary"
+ disabled={!!editingId}
+ onClick={async () => {
+ setEditingId(true);
+ await add({}, 0);
+ setTimeout(() => {
+ setRealTimeValues(form.getFieldsValue());
+ const newActiveKey = Math.max(...fields.map(item => item.key)) + 1 + '';
+ setActiveKey(newActiveKey);
+ }, 0);
+ mutate({ list: [{}].concat(data.list), total: data.list.length + 1 });
+ }}
+ >
+ {t('pages.AccessDetail.DataStream.CreateDataStream')}
+ </Button>
+ </Space>,
+ topRightRef.current,
+ )}
- {fields.length ? (
- <Collapse
- accordion
- activeKey={activeKey}
- onChange={key => setActiveKey(key as any)}
- style={{ backgroundColor: 'transparent', border: 'none' }}
- >
- {fields.map((field, index) => (
- <Collapse.Panel
- header={genHeader(data?.list?.[index], index)}
- key={field.key.toString()}
- style={{
- marginBottom: 10,
- border: '1px solid #e5e5e5',
- backgroundColor: '#f6f7fb',
- }}
- >
- <FormItemContent
- values={realTimeValues.list?.[index]}
- content={genFormContent(
- editingId,
- { ...realTimeValues.list?.[index], inCharges: [userName] },
- inlongGroupId,
- readonly,
- middlewareType,
- ).map(item => {
- const obj = { ...item } as any;
- if (obj.name) {
- obj.name = [field.name, obj.name];
- obj.fieldKey = [field.fieldKey, obj.name];
- }
- if (obj.suffix && obj.suffix.name) {
- obj.suffix.name = [field.name, obj.suffix.name];
- obj.suffix.fieldKey = [field.fieldKey, obj.suffix.name];
- }
+ {fields.length ? (
+ <Collapse
+ accordion
+ activeKey={activeKey}
+ onChange={key => setActiveKey(key as any)}
+ style={{ backgroundColor: 'transparent', border: 'none' }}
+ >
+ {fields.map((field, index) => (
+ <Collapse.Panel
+ header={genHeader(data?.list?.[index], index)}
+ key={field.key.toString()}
+ style={{
+ marginBottom: 10,
+ border: '1px solid #e5e5e5',
+ backgroundColor: '#f6f7fb',
+ }}
+ >
+ <FormItemContent
+ values={realTimeValues.list?.[index]}
+ content={genFormContent(
+ editingId,
+ { ...realTimeValues.list?.[index] },
+ inlongGroupId,
+ readonly,
+ middlewareType,
+ ).map(item => {
+ const obj = { ...item } as any;
+ if (obj.name) {
+ obj.name = [field.name, obj.name];
+ obj.fieldKey = [field.fieldKey, obj.name];
+ }
+ if (obj.suffix && obj.suffix.name) {
+ obj.suffix.name = [field.name, obj.suffix.name];
+ obj.suffix.fieldKey = [field.fieldKey, obj.suffix.name];
+ }
- return obj;
- })}
- />
- </Collapse.Panel>
- ))}
- </Collapse>
- ) : (
- <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
- )}
- </>
- )}
- </Form.List>
- </Form>
- )}
+ return obj;
+ })}
+ />
+ </Collapse.Panel>
+ ))}
+ </Collapse>
+ ) : (
+ <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
+ )}
+ </>
+ )}
+ </Form.List>
+ </Form>
<StreamItemModal
{...streamItemModal}