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/10 13:45:35 UTC
[inlong] 02/04: [INLONG-6493][Dashboard] After the Stream is configured successfully, some parameters cannot be modified (#6494)
This is an automated email from the ASF dual-hosted git repository.
dockerzhang pushed a commit to branch branch-1.4
in repository https://gitbox.apache.org/repos/asf/inlong.git
commit 80ae93733927d1265947e264578076d644439971
Author: Daniel <le...@apache.org>
AuthorDate: Thu Nov 10 15:10:01 2022 +0800
[INLONG-6493][Dashboard] After the Stream is configured successfully, some parameters cannot be modified (#6494)
---
.../src/metas/streams/common/StreamDefaultInfo.ts | 35 ++++++++++++++--------
.../GroupDetail/DataStream/StreamItemModal.tsx | 14 ++-------
2 files changed, 25 insertions(+), 24 deletions(-)
diff --git a/inlong-dashboard/src/metas/streams/common/StreamDefaultInfo.ts b/inlong-dashboard/src/metas/streams/common/StreamDefaultInfo.ts
index 773a51b19..fd39a8cc9 100644
--- a/inlong-dashboard/src/metas/streams/common/StreamDefaultInfo.ts
+++ b/inlong-dashboard/src/metas/streams/common/StreamDefaultInfo.ts
@@ -38,9 +38,10 @@ export class StreamDefaultInfo implements DataWithBackend, RenderRow, RenderList
@FieldDecorator({
type: 'input',
- props: {
- maxLength: 32,
- },
+ props: values => ({
+ disabled: Boolean(values?.status),
+ maxLength: 64,
+ }),
rules: [
{ required: true },
{
@@ -97,7 +98,8 @@ export class StreamDefaultInfo implements DataWithBackend, RenderRow, RenderList
type: 'radio',
initialValue: 'CSV',
tooltip: i18n.t('meta.Stream.DataTypeHelp'),
- props: {
+ props: values => ({
+ disabled: [110, 130].includes(values?.status),
options: [
{
label: 'CSV',
@@ -108,7 +110,7 @@ export class StreamDefaultInfo implements DataWithBackend, RenderRow, RenderList
value: 'RAW_CSV',
},
],
- },
+ }),
rules: [{ required: true }],
})
@I18n('meta.Stream.DataType')
@@ -117,7 +119,8 @@ export class StreamDefaultInfo implements DataWithBackend, RenderRow, RenderList
@FieldDecorator({
type: 'radio',
initialValue: 'UTF-8',
- props: {
+ props: values => ({
+ disabled: [110, 130].includes(values?.status),
options: [
{
label: 'UTF-8',
@@ -128,7 +131,7 @@ export class StreamDefaultInfo implements DataWithBackend, RenderRow, RenderList
value: 'GBK',
},
],
- },
+ }),
rules: [{ required: true }],
})
@I18n('meta.Stream.DataEncoding')
@@ -137,7 +140,8 @@ export class StreamDefaultInfo implements DataWithBackend, RenderRow, RenderList
@FieldDecorator({
type: 'select',
initialValue: '124',
- props: {
+ props: values => ({
+ disabled: [110, 130].includes(values?.status),
dropdownMatchSelectWidth: false,
options: [
{
@@ -170,7 +174,7 @@ export class StreamDefaultInfo implements DataWithBackend, RenderRow, RenderList
placeholder: 'ASCII',
},
style: { width: 100 },
- },
+ }),
rules: [
{
required: true,
@@ -186,8 +190,9 @@ export class StreamDefaultInfo implements DataWithBackend, RenderRow, RenderList
@FieldDecorator({
type: EditableTable,
- props: {
+ props: values => ({
size: 'small',
+ canDelete: record => !(record.id && [110, 130].includes(values?.status)),
columns: [
{
title: i18n.t('meta.Stream.FieldName'),
@@ -199,15 +204,19 @@ export class StreamDefaultInfo implements DataWithBackend, RenderRow, RenderList
message: i18n.t('meta.Stream.FieldNameRule'),
},
],
+ props: (text, record) => ({
+ disabled: record.id && [110, 130].includes(values?.status),
+ }),
},
{
title: i18n.t('meta.Stream.FieldType'),
dataIndex: 'fieldType',
type: 'select',
initialValue: sourceFieldsTypes[0].value,
- props: {
+ props: (text, record) => ({
+ disabled: record.id && [110, 130].includes(values?.status),
options: sourceFieldsTypes,
- },
+ }),
rules: [{ required: true }],
},
{
@@ -215,7 +224,7 @@ export class StreamDefaultInfo implements DataWithBackend, RenderRow, RenderList
dataIndex: 'fieldComment',
},
],
- },
+ }),
})
@I18n('meta.Stream.SourceDataField')
rowTypeFields: Record<string, string>[];
diff --git a/inlong-dashboard/src/pages/GroupDetail/DataStream/StreamItemModal.tsx b/inlong-dashboard/src/pages/GroupDetail/DataStream/StreamItemModal.tsx
index 08c4af720..2c78e0e31 100644
--- a/inlong-dashboard/src/pages/GroupDetail/DataStream/StreamItemModal.tsx
+++ b/inlong-dashboard/src/pages/GroupDetail/DataStream/StreamItemModal.tsx
@@ -96,17 +96,8 @@ const Comp: React.FC<Props> = ({ inlongGroupId, inlongStreamId, mqType, ...modal
},
visible: mqType === 'PULSAR',
},
- ].map(item => {
- const obj = { ...item };
- const isCreate = !inlongStreamId;
-
- if (!isCreate && (obj.name === 'inlongStreamId' || obj.name === 'dataType')) {
- obj.type = 'text';
- }
-
- return obj;
- });
- }, [entityFields, mqType, inlongStreamId]);
+ ];
+ }, [entityFields, mqType]);
const { data: savedData, run: getStreamData } = useRequest(
{
@@ -160,6 +151,7 @@ const Comp: React.FC<Props> = ({ inlongGroupId, inlongStreamId, mqType, ...modal
<FormGenerator
labelCol={{ span: 4 }}
wrapperCol={{ span: 20 }}
+ initialValues={inlongStreamId ? savedData : {}}
content={formContent}
form={form}
useMaxWidth