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/inlong.git
The following commit(s) were added to refs/heads/master by this push:
new a2ea4ce0e2 [INLONG-8350][Dashboard] Dashboard plugin support light
(#8351)
a2ea4ce0e2 is described below
commit a2ea4ce0e233abd07a919ebd8fa064eb31be7be9
Author: Daniel <[email protected]>
AuthorDate: Wed Jun 28 20:48:57 2023 +0800
[INLONG-8350][Dashboard] Dashboard plugin support light (#8351)
---
inlong-dashboard/src/plugins/RenderRow.ts | 7 +++++++
inlong-dashboard/src/plugins/sinks/common/SinkDefaultInfo.ts | 10 +++++++++-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/inlong-dashboard/src/plugins/RenderRow.ts
b/inlong-dashboard/src/plugins/RenderRow.ts
index 91872c1881..7a5cf5e135 100644
--- a/inlong-dashboard/src/plugins/RenderRow.ts
+++ b/inlong-dashboard/src/plugins/RenderRow.ts
@@ -22,6 +22,7 @@ import merge from 'lodash/merge';
export abstract class RenderRow {
static FieldList: FieldItemType[] = [];
+ static LightFieldSet = new Set<string>();
static FieldDecorator(config: FieldItemType): PropertyDecorator {
return (target: any, propertyKey: string) => {
@@ -46,6 +47,12 @@ export abstract class RenderRow {
};
}
+ static LightField(): PropertyDecorator {
+ return (target: any, propertyKey: string) => {
+ target.constructor.LightFieldSet.add(propertyKey);
+ };
+ }
+
abstract renderRow(fields?: FieldItemType[]): FieldItemType[];
}
diff --git a/inlong-dashboard/src/plugins/sinks/common/SinkDefaultInfo.ts
b/inlong-dashboard/src/plugins/sinks/common/SinkDefaultInfo.ts
index d64591f6d9..689e203963 100644
--- a/inlong-dashboard/src/plugins/sinks/common/SinkDefaultInfo.ts
+++ b/inlong-dashboard/src/plugins/sinks/common/SinkDefaultInfo.ts
@@ -26,13 +26,14 @@ import { statusList, genStatusTag } from './status';
import { sinks, defaultValue } from '..';
const { I18nMap, I18n } = DataWithBackend;
-const { FieldList, FieldDecorator } = RenderRow;
+const { FieldList, FieldDecorator, LightField, LightFieldSet } = RenderRow;
const { ColumnList, ColumnDecorator } = RenderList;
export class SinkDefaultInfo implements DataWithBackend, RenderRow, RenderList
{
static I18nMap = I18nMap;
static FieldList = FieldList;
static ColumnList = ColumnList;
+ static LightFieldSet = LightFieldSet;
readonly id: number;
@@ -71,6 +72,7 @@ export class SinkDefaultInfo implements DataWithBackend,
RenderRow, RenderList {
@ColumnDecorator({
render: type => sinks.find(c => c.value === type)?.label || type,
})
+ @LightField()
@I18n('meta.Sinks.SinkType')
sinkType: string;
@@ -136,6 +138,12 @@ export class SinkDefaultInfo implements DataWithBackend,
RenderRow, RenderList {
return data;
}
+ renderLightRow() {
+ const constructor = this.constructor as typeof SinkDefaultInfo;
+ const { FieldList, LightFieldSet } = constructor;
+ return FieldList.filter(item => LightFieldSet.has(item.name as string));
+ }
+
renderRow() {
const constructor = this.constructor as typeof SinkDefaultInfo;
return constructor.FieldList;