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 dbddbbba0 [INLONG-6493][Dashboard] After the Stream is configured successfully, some parameters cannot be modified (#6494) dbddbbba0 is described below commit dbddbbba08d420ecaaa3bb4a7a9a8c66d42b28f2 Author: Daniel <lee...@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