Skip to content

Commit

Permalink
[INLONG-9505][Dashboard] Pulsar source parameter optimization (#9506)
Browse files Browse the repository at this point in the history
  • Loading branch information
bluewang authored Dec 27, 2023
1 parent 9d745b8 commit f2b574f
Show file tree
Hide file tree
Showing 16 changed files with 163 additions and 45 deletions.
26 changes: 22 additions & 4 deletions inlong-dashboard/src/plugins/sources/common/SourceDefaultInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,16 @@ import { sources, defaultValue } from '..';
import i18n from '@/i18n';

const { I18nMap, I18n } = DataWithBackend;
const { FieldList, FieldDecorator, SyncField, SyncFieldSet, SyncMoveDbField, SyncMoveDbFieldSet } =
RenderRow;
const {
FieldList,
FieldDecorator,
SyncField,
SyncFieldSet,
SyncMoveDbField,
SyncMoveDbFieldSet,
IngestionField,
IngestionFieldSet,
} = RenderRow;
const { ColumnList, ColumnDecorator } = RenderList;

export class SourceDefaultInfo implements DataWithBackend, RenderRow, RenderList {
Expand All @@ -37,6 +45,7 @@ export class SourceDefaultInfo implements DataWithBackend, RenderRow, RenderList
static ColumnList = ColumnList;
static SyncFieldSet = SyncFieldSet;
static SyncMoveDbFieldSet = SyncMoveDbFieldSet;
static IngestionFieldSet = IngestionFieldSet;

readonly id: number;

Expand All @@ -46,6 +55,7 @@ export class SourceDefaultInfo implements DataWithBackend, RenderRow, RenderList
hidden: true,
})
@SyncField()
@IngestionField()
@SyncMoveDbField()
@I18n('inlongGroupId')
readonly inlongGroupId: string;
Expand All @@ -55,6 +65,7 @@ export class SourceDefaultInfo implements DataWithBackend, RenderRow, RenderList
hidden: true,
})
@SyncField()
@IngestionField()
@SyncMoveDbField()
@I18n('inlongStreamId')
readonly inlongStreamId: string;
Expand All @@ -79,6 +90,7 @@ export class SourceDefaultInfo implements DataWithBackend, RenderRow, RenderList
render: type => sources.find(c => c.value === type)?.label || type,
})
@SyncField()
@IngestionField()
@SyncMoveDbField()
@I18n('meta.Sources.Type')
sourceType: string;
Expand All @@ -100,6 +112,7 @@ export class SourceDefaultInfo implements DataWithBackend, RenderRow, RenderList
})
@ColumnDecorator()
@SyncField()
@IngestionField()
@SyncMoveDbField()
@I18n('meta.Sources.Name')
sourceName: string;
Expand All @@ -117,15 +130,18 @@ export class SourceDefaultInfo implements DataWithBackend, RenderRow, RenderList
render: text => genStatusTag(text),
})
@SyncField()
@IngestionField()
@SyncMoveDbField()
@I18n('basic.Status')
readonly status: string;

@ColumnDecorator()
@IngestionField()
@I18n('basic.Creator')
readonly creator: string;

@ColumnDecorator()
@IngestionField()
@I18n('basic.Modifier')
readonly modifier: string;

Expand Down Expand Up @@ -181,7 +197,8 @@ export class SourceDefaultInfo implements DataWithBackend, RenderRow, RenderList

renderRow() {
const constructor = this.constructor as typeof SourceDefaultInfo;
constructor.FieldList.map(item => {
const { FieldList, IngestionFieldSet } = constructor;
return FieldList.filter(item => {
if (item.name === 'sourceType') {
item.props = values => ({
disabled: Boolean(values.id),
Expand All @@ -195,8 +212,9 @@ export class SourceDefaultInfo implements DataWithBackend, RenderRow, RenderList
})),
});
}
return IngestionFieldSet.has(item.name as string);
});
return constructor.FieldList;
// return constructor.FieldList;
}

renderList() {
Expand Down
11 changes: 10 additions & 1 deletion inlong-dashboard/src/plugins/sources/defaults/File.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import rulesPattern from '@/core/utils/pattern';
import { SourceInfo } from '../common/SourceInfo';

const { I18n } = DataWithBackend;
const { FieldDecorator } = RenderRow;
const { FieldDecorator, IngestionField } = RenderRow;
const { ColumnDecorator } = RenderList;

export default class PulsarSource
Expand Down Expand Up @@ -69,6 +69,7 @@ export default class PulsarSource
}),
})
@ColumnDecorator()
@IngestionField()
@I18n('meta.Sources.File.ClusterName')
inlongClusterName: string;

Expand All @@ -77,6 +78,7 @@ export default class PulsarSource
hidden: true,
})
@I18n('clusterId')
@IngestionField()
clusterId: number;

@FieldDecorator({
Expand Down Expand Up @@ -117,6 +119,7 @@ export default class PulsarSource
}),
})
@ColumnDecorator()
@IngestionField()
@I18n('meta.Sources.File.DataSourceIP')
agentIp: string;

Expand All @@ -129,6 +132,7 @@ export default class PulsarSource
}),
})
@ColumnDecorator()
@IngestionField()
@I18n('meta.Sources.File.FilePath')
pattern: string;

Expand All @@ -142,6 +146,7 @@ export default class PulsarSource
disabled: Boolean(values.id),
}),
})
@IngestionField()
@I18n('meta.Sources.File.MaxFileCount')
maxFileCount: number;

Expand All @@ -163,6 +168,7 @@ export default class PulsarSource
],
}),
})
@IngestionField()
@I18n('meta.Sources.File.DataContentStyle')
dataContentStyle: string;

Expand All @@ -186,6 +192,7 @@ export default class PulsarSource
],
}),
})
@IngestionField()
@I18n('meta.Sources.File.Cycle')
cycleUnit: string;

Expand All @@ -202,6 +209,7 @@ export default class PulsarSource
disabled: Boolean(values.id),
}),
})
@IngestionField()
@I18n('meta.Sources.File.TimeOffset')
timeOffset: string;

Expand All @@ -219,6 +227,7 @@ export default class PulsarSource
})),
}),
})
@IngestionField()
@I18n('meta.Sources.File.TimeZone')
timeZone: string;
}
9 changes: 8 additions & 1 deletion inlong-dashboard/src/plugins/sources/defaults/Hudi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import i18n from '@/i18n';
import EditableTable from '@/ui/components/EditableTable';

const { I18n } = DataWithBackend;
const { FieldDecorator, SyncField } = RenderRow;
const { FieldDecorator, SyncField, IngestionField } = RenderRow;
const { ColumnDecorator } = RenderList;

export default class HudiSource
Expand All @@ -41,6 +41,7 @@ export default class HudiSource
})
@ColumnDecorator()
@SyncField()
@IngestionField()
@I18n('meta.Sources.Hudi.DbName')
dbName: string;

Expand All @@ -53,6 +54,7 @@ export default class HudiSource
})
@ColumnDecorator()
@SyncField()
@IngestionField()
@I18n('meta.Sources.Hudi.TableName')
tableName: string;

Expand All @@ -66,6 +68,7 @@ export default class HudiSource
})
@ColumnDecorator()
@SyncField()
@IngestionField()
@I18n('Catalog URI')
catalogUri: string;

Expand All @@ -79,6 +82,7 @@ export default class HudiSource
})
@ColumnDecorator()
@SyncField()
@IngestionField()
@I18n('meta.Sources.Hudi.Warehouse')
warehouse: string;

Expand All @@ -103,6 +107,7 @@ export default class HudiSource
})
@ColumnDecorator()
@SyncField()
@IngestionField()
@I18n('meta.Sources.Hudi.ReadStreamingSkipCompaction')
readStreamingSkipCompaction: boolean;

Expand All @@ -117,6 +122,7 @@ export default class HudiSource
})
@ColumnDecorator()
@SyncField()
@IngestionField()
@I18n('meta.Sources.Hudi.ReadStartCommit')
readStartCommit: string;

Expand Down Expand Up @@ -147,6 +153,7 @@ export default class HudiSource
})
@ColumnDecorator()
@SyncField()
@IngestionField()
@I18n('meta.Sources.Hudi.ExtList')
extList: string;
}
7 changes: 6 additions & 1 deletion inlong-dashboard/src/plugins/sources/defaults/Iceberg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import i18n from '@/i18n';
import { SourceInfo } from '../common/SourceInfo';

const { I18n } = DataWithBackend;
const { FieldDecorator, SyncField } = RenderRow;
const { FieldDecorator, SyncField, IngestionField } = RenderRow;
const { ColumnDecorator } = RenderList;

export default class IcebergSource
Expand All @@ -39,6 +39,7 @@ export default class IcebergSource
}),
})
@SyncField()
@IngestionField()
@ColumnDecorator()
@I18n('meta.Sources.Iceberg.Database')
database: number;
Expand All @@ -51,6 +52,7 @@ export default class IcebergSource
}),
})
@SyncField()
@IngestionField()
@I18n('meta.Sources.Iceberg.TableName')
tableName: string;

Expand All @@ -62,6 +64,7 @@ export default class IcebergSource
}),
})
@SyncField()
@IngestionField()
@I18n('meta.Sources.Iceberg.PrimaryKey')
primaryKey: string;

Expand All @@ -73,6 +76,7 @@ export default class IcebergSource
}),
})
@SyncField()
@IngestionField()
@ColumnDecorator()
@I18n('Catalog URI')
uri: string;
Expand All @@ -84,6 +88,7 @@ export default class IcebergSource
}),
})
@SyncField()
@IngestionField()
@I18n('meta.Sources.Iceberg.Warehouse')
warehouse: string;
}
9 changes: 8 additions & 1 deletion inlong-dashboard/src/plugins/sources/defaults/MQTT.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { RenderList } from '@/plugins/RenderList';
import { SourceInfo } from '../common/SourceInfo';

const { I18n } = DataWithBackend;
const { FieldDecorator, SyncField } = RenderRow;
const { FieldDecorator, SyncField, IngestionField } = RenderRow;

export default class MQTTSource
extends SourceInfo
Expand All @@ -38,6 +38,7 @@ export default class MQTTSource
}),
})
@SyncField()
@IngestionField()
@I18n('Server URI')
serverURI: string;

Expand All @@ -49,6 +50,7 @@ export default class MQTTSource
}),
})
@SyncField()
@IngestionField()
@I18n('meta.Sources.MQTT.Username')
username: string;

Expand All @@ -60,6 +62,7 @@ export default class MQTTSource
}),
})
@SyncField()
@IngestionField()
@I18n('meta.Sources.MQTT.Password')
password: string;

Expand All @@ -71,6 +74,7 @@ export default class MQTTSource
}),
})
@SyncField()
@IngestionField()
@I18n('Topic')
topic: string;

Expand All @@ -82,6 +86,7 @@ export default class MQTTSource
}),
})
@SyncField()
@IngestionField()
@I18n('Client ID')
clientId: string;

Expand All @@ -95,6 +100,7 @@ export default class MQTTSource
}),
})
@SyncField()
@IngestionField()
@I18n('QoS')
qos: number;

Expand All @@ -105,6 +111,7 @@ export default class MQTTSource
}),
})
@SyncField()
@IngestionField()
@I18n('meta.Sources.MQTT.MqttVersion')
mqttVersion: string;
}
Loading

0 comments on commit f2b574f

Please sign in to comment.