Skip to content

Commit

Permalink
[INLONG-8956][Dashboard] Stream and Sink editable state optimization (a…
Browse files Browse the repository at this point in the history
  • Loading branch information
bluewang authored Sep 21, 2023
1 parent d38d809 commit dfadbce
Show file tree
Hide file tree
Showing 27 changed files with 252 additions and 245 deletions.
50 changes: 25 additions & 25 deletions inlong-dashboard/src/plugins/sinks/defaults/ClickHouse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export default class ClickHouseSink
type: 'input',
rules: [{ required: true }],
props: values => ({
disabled: [110, 130].includes(values?.status),
disabled: [110].includes(values?.status),
}),
})
@ColumnDecorator()
Expand All @@ -65,7 +65,7 @@ export default class ClickHouseSink
type: 'input',
rules: [{ required: true }],
props: values => ({
disabled: [110, 130].includes(values?.status),
disabled: [110].includes(values?.status),
}),
})
@ColumnDecorator()
Expand All @@ -79,7 +79,7 @@ export default class ClickHouseSink
initialValue: 1,
tooltip: i18n.t('meta.Sinks.EnableCreateResourceHelp'),
props: values => ({
disabled: [110, 130].includes(values?.status),
disabled: [110].includes(values?.status),
options: [
{
label: i18n.t('basic.Yes'),
Expand All @@ -99,7 +99,7 @@ export default class ClickHouseSink
type: NodeSelect,
rules: [{ required: true }],
props: values => ({
disabled: [110, 130].includes(values?.status),
disabled: [110].includes(values?.status),
nodeType: 'CLICKHOUSE',
}),
})
Expand All @@ -112,7 +112,7 @@ export default class ClickHouseSink
type: 'inputnumber',
initialValue: 1,
props: values => ({
disabled: [110, 130].includes(values?.status),
disabled: [110].includes(values?.status),
min: 1,
}),
rules: [{ required: true }],
Expand All @@ -126,7 +126,7 @@ export default class ClickHouseSink
type: 'inputnumber',
initialValue: 1000,
props: values => ({
disabled: [110, 130].includes(values?.status),
disabled: [110].includes(values?.status),
min: 1,
}),
rules: [{ required: true }],
Expand All @@ -140,7 +140,7 @@ export default class ClickHouseSink
type: 'inputnumber',
initialValue: 3,
props: values => ({
disabled: [110, 130].includes(values?.status),
disabled: [110].includes(values?.status),
min: 1,
}),
rules: [{ required: true }],
Expand All @@ -154,7 +154,7 @@ export default class ClickHouseSink
type: 'radio',
initialValue: 0,
props: values => ({
disabled: [110, 130].includes(values?.status),
disabled: [110].includes(values?.status),
options: [
{
label: i18n.t('meta.Sinks.ClickHouse.Yes'),
Expand All @@ -177,7 +177,7 @@ export default class ClickHouseSink
initialValue: 'BALANCE',
rules: [{ required: true }],
props: values => ({
disabled: [110, 130].includes(values?.status),
disabled: [110].includes(values?.status),
options: [
{
label: 'BALANCE',
Expand All @@ -204,7 +204,7 @@ export default class ClickHouseSink
rules: [{ required: true }],
visible: values => values.isDistributed && values.partitionStrategy === 'HASH',
props: values => ({
disabled: [110, 130].includes(values?.status),
disabled: [110].includes(values?.status),
}),
})
@I18n('meta.Sinks.ClickHouse.PartitionFields')
Expand All @@ -216,7 +216,7 @@ export default class ClickHouseSink
initialValue: 'Log',
rules: [{ required: true }],
props: values => ({
disabled: [110, 130].includes(values?.status),
disabled: [110].includes(values?.status),
options: [
{
label: 'Log',
Expand All @@ -240,7 +240,7 @@ export default class ClickHouseSink
@FieldDecorator({
type: 'input',
props: values => ({
disabled: [110, 130].includes(values?.status),
disabled: [110].includes(values?.status),
}),
})
@I18n('meta.Sinks.ClickHouse.OrderBy')
Expand All @@ -249,7 +249,7 @@ export default class ClickHouseSink
@FieldDecorator({
type: 'input',
props: values => ({
disabled: [110, 130].includes(values?.status),
disabled: [110].includes(values?.status),
}),
})
@I18n('meta.Sinks.ClickHouse.PartitionBy')
Expand All @@ -259,7 +259,7 @@ export default class ClickHouseSink
@FieldDecorator({
type: 'input',
props: values => ({
disabled: [110, 130].includes(values?.status),
disabled: [110].includes(values?.status),
}),
})
@I18n('meta.Sinks.ClickHouse.PrimaryKey')
Expand All @@ -269,7 +269,7 @@ export default class ClickHouseSink
@FieldDecorator({
type: 'input',
props: values => ({
disabled: [110, 130].includes(values?.status),
disabled: [110].includes(values?.status),
}),
})
@I18n('meta.Sinks.ClickHouse.Cluster')
Expand All @@ -283,7 +283,7 @@ export default class ClickHouseSink
type: 'select',
name: 'ttlUnit',
props: values => ({
disabled: [110, 130].includes(values?.status),
disabled: [110].includes(values?.status),
options: [
{
label: 'Second',
Expand Down Expand Up @@ -323,7 +323,7 @@ export default class ClickHouseSink
props: values => ({
min: 1,
precision: 0,
disabled: [110, 130].includes(values?.status),
disabled: [110].includes(values?.status),
}),
})
@I18n('Time To Live')
Expand All @@ -334,7 +334,7 @@ export default class ClickHouseSink
type: EditableTable,
props: values => ({
size: 'small',
editing: ![110, 130].includes(values?.status),
editing: ![110].includes(values?.status),
columns: getFieldListColumns(values),
canBatchAdd: true,
upsertByFieldKey: true,
Expand All @@ -357,7 +357,7 @@ const getFieldListColumns = sinkValues => {
},
],
props: (text, record, idx, isNew) => ({
disabled: [110, 130].includes(sinkValues?.status as number) && !isNew,
disabled: [110].includes(sinkValues?.status as number) && !isNew,
}),
},
{
Expand All @@ -366,7 +366,7 @@ const getFieldListColumns = sinkValues => {
initialValue: clickHouseTargetTypes[0].value,
type: 'select',
props: (text, record, idx, isNew) => ({
disabled: [110, 130].includes(sinkValues?.status as number) && !isNew,
disabled: [110].includes(sinkValues?.status as number) && !isNew,
options: clickHouseTargetTypes,
}),
rules: [{ required: true, message: `${i18n.t('meta.Sinks.FieldTypeMessage')}` }],
Expand All @@ -376,7 +376,7 @@ const getFieldListColumns = sinkValues => {
dataIndex: 'defaultType',
type: 'autocomplete',
props: (text, record, idx, isNew) => ({
disabled: [110, 130].includes(sinkValues?.status as number) && !isNew,
disabled: [110].includes(sinkValues?.status as number) && !isNew,
options: ['DEFAULT', 'EPHEMERAL', 'MATERIALIZED', 'ALIAS'].map(item => ({
label: item,
value: item,
Expand All @@ -388,7 +388,7 @@ const getFieldListColumns = sinkValues => {
dataIndex: 'defaultExpr',
type: 'input',
props: (text, record, idx, isNew) => ({
disabled: [110, 130].includes(sinkValues?.status as number) && !isNew,
disabled: [110].includes(sinkValues?.status as number) && !isNew,
}),
visible: (text, record) =>
['DEFAULT', 'EPHEMERAL', 'MATERIALIZED', 'ALIAS'].includes(record.defaultType as string),
Expand All @@ -397,21 +397,21 @@ const getFieldListColumns = sinkValues => {
title: i18n.t('meta.Sinks.ClickHouse.CompressionCode'),
dataIndex: 'compressionCode',
props: (text, record, idx, isNew) => ({
disabled: [110, 130].includes(sinkValues?.status as number) && !isNew,
disabled: [110].includes(sinkValues?.status as number) && !isNew,
}),
},
{
title: i18n.t('meta.Sinks.ClickHouse.TtlExpr'),
dataIndex: 'ttlExpr',
props: (text, record, idx, isNew) => ({
disabled: [110, 130].includes(sinkValues?.status as number) && !isNew,
disabled: [110].includes(sinkValues?.status as number) && !isNew,
}),
},
{
title: `ClickHouse${i18n.t('meta.Sinks.ClickHouse.FieldDescription')}`,
dataIndex: 'fieldComment',
props: (text, record, idx, isNew) => ({
disabled: [110, 130].includes(sinkValues?.status as number) && !isNew,
disabled: [110].includes(sinkValues?.status as number) && !isNew,
}),
},
];
Expand Down
16 changes: 8 additions & 8 deletions inlong-dashboard/src/plugins/sinks/defaults/Cls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default class ClsSink extends SinkInfo implements DataWithBackend, Render
type: 'input',
rules: [{ required: true }],
props: values => ({
disabled: [110, 130].includes(values?.status),
disabled: [110].includes(values?.status),
}),
})
@ColumnDecorator()
Expand All @@ -52,7 +52,7 @@ export default class ClsSink extends SinkInfo implements DataWithBackend, Render
type: 'input',
rules: [{ required: true }],
props: values => ({
disabled: [110, 130].includes(values?.status),
disabled: [110].includes(values?.status),
}),
})
@ColumnDecorator()
Expand All @@ -64,7 +64,7 @@ export default class ClsSink extends SinkInfo implements DataWithBackend, Render
type: 'input',
rules: [{ required: true }],
props: values => ({
disabled: [110, 130].includes(values?.status),
disabled: [110].includes(values?.status),
}),
})
@ColumnDecorator()
Expand All @@ -76,7 +76,7 @@ export default class ClsSink extends SinkInfo implements DataWithBackend, Render
type: 'select',
rules: [{ required: true }],
props: values => ({
disabled: [110, 130].includes(values?.status),
disabled: [110].includes(values?.status),
options: [
{
label: i18n.t('meta.Sinks.Cls.SaveTime.Week'),
Expand Down Expand Up @@ -105,7 +105,7 @@ export default class ClsSink extends SinkInfo implements DataWithBackend, Render
type: NodeSelect,
rules: [{ required: true }],
props: values => ({
disabled: [110, 130].includes(values?.status),
disabled: [110].includes(values?.status),
nodeType: 'CLS',
}),
})
Expand All @@ -118,7 +118,7 @@ export default class ClsSink extends SinkInfo implements DataWithBackend, Render
type: EditableTable,
props: values => ({
size: 'small',
canDelete: ![110, 130].includes(values?.status),
canDelete: ![110].includes(values?.status),
columns: getFieldListColumns(values),
canBatchAdd: true,
upsertByFieldKey: true,
Expand All @@ -142,7 +142,7 @@ const getFieldListColumns = sinkValues => {
},
],
props: (text, record, idx, isNew) => ({
disabled: [110, 130].includes(sinkValues?.status as number) && !isNew,
disabled: [110].includes(sinkValues?.status as number) && !isNew,
}),
},
{
Expand All @@ -152,7 +152,7 @@ const getFieldListColumns = sinkValues => {
type: 'select',
props: (text, record, idx, isNew) => ({
options: targetTypes,
disabled: [110, 130].includes(sinkValues?.status as number) && !isNew,
disabled: [110].includes(sinkValues?.status as number) && !isNew,
}),
rules: [{ required: true, message: `${i18n.t('meta.Sinks.FieldTypeMessage')}` }],
},
Expand Down
Loading

0 comments on commit dfadbce

Please sign in to comment.