Commit ba5016e3ba1aed07118259aa70c1ce7413c7a2af

Authored by ww
1 parent 519cbd4d

feat: 实现动作类型的规则节点

Showing 24 changed files with 1020 additions and 81 deletions
... ... @@ -85,6 +85,7 @@
85 85 () => props.value,
86 86 (target) => {
87 87 // const position = unref(editoreRef)?.getCursorPosition();
  88 + if (unref(isFocus)) return;
88 89 unref(editoreRef)?.setValue(getFormatValue(target));
89 90 unref(editoreRef)?.clearSelection();
90 91 // position && unref(editoreRef)?.moveCursorToPosition(position!);
... ...
... ... @@ -228,3 +228,16 @@ export enum MailBodyTypeNameEnum {
228 228 HTML = 'HTML',
229 229 PLAIN_TEXT = 'Plain Text',
230 230 }
  231 +
  232 +// Action Push to edge
  233 +export enum ScopeEnum {
  234 + SERVER_SCOPE = 'SERVER_SCOPE',
  235 + CLIENT_SCOPE = 'CLIENT_SCOPE',
  236 + SHARED_SCOPE = 'SHARED_SCOPE',
  237 +}
  238 +
  239 +export enum ScopeNameEnum {
  240 + SERVER_SCOPE = '服务端属性',
  241 + CLIENT_SCOPE = '客户端属性',
  242 + SHARED_SCOPE = '共享属性',
  243 +}
... ...
... ... @@ -39,12 +39,234 @@ export enum CreateAlarmFieldsEnum {
39 39 export enum CreateAlarmFieldsNameEnum {
40 40 ALARM_DETAILS_BUILD_JS = 'Alarm details builder',
41 41 USE_MESSAGE_ALARM_DATA = 'Use message alarm data',
42   - OVERWRITE_ALARM_DETAILS = 'overwriteAlarmDetails',
  42 + OVERWRITE_ALARM_DETAILS = 'Overwrite alarm details',
43 43 ALARM_TYPE = 'Alarm type',
44 44 SEVERITY = 'Alarm severity pattern',
45 45 PROPAGATE = 'Propagate alarm to related entities',
46 46 RELATION_TYPES = 'Relation types to propagate',
47 47 PROPAGATE_TO_OWNER = 'Propagate alarm to entity owner (Customer or Tenant)',
48 48 PROPAGATE_TO_TENANT = 'Propagate alarm to Tenant',
49   - DYNAMIC_SEVERITY = 'dynamicSeverity',
  49 + DYNAMIC_SEVERITY = 'Use alarm severity pattern',
  50 +}
  51 +
  52 +// Create relation
  53 +export enum CreateRelationFieldsEnum {
  54 + DIRECTION = 'direction',
  55 + ENTITY_TYPE = 'entityType',
  56 + ENTITY_NAME_PATTERN = 'entityNamePattern',
  57 + ENTITY_TYPE_PATTERN = 'entityTypePattern',
  58 + RELATION_TYPE = 'relationType',
  59 + CREATE_ENTITY_IF_NOT_EXISTS = 'createEntityIfNotExists',
  60 + REMOVE_CURRENT_RELATIONS = 'removeCurrentRelations',
  61 + CHANGE_ORIGINATOR_TO_RELATED_ENTITY = 'changeOriginatorToRelatedEntity',
  62 + ENTITY_CACHE_EXPIRATION = 'entityCacheExpiration',
  63 +}
  64 +
  65 +export enum CreateRelationFieldsNameEnum {
  66 + DIRECTION = '方向',
  67 + ENTITY_TYPE = '类型',
  68 + ENTITY_NAME_PATTERN = 'Name pattern',
  69 + ENTITY_TYPE_PATTERN = 'Type pattern',
  70 + RELATION_TYPE = 'Relation type pattern',
  71 + CREATE_ENTITY_IF_NOT_EXISTS = 'Create new entity if not exists',
  72 + REMOVE_CURRENT_RELATIONS = 'Remove current relations',
  73 + CHANGE_ORIGINATOR_TO_RELATED_ENTITY = 'Change originator to related entity',
  74 + ENTITY_CACHE_EXPIRATION = 'Entities cache expiration time(sec)',
  75 +}
  76 +
  77 +// Delay deprecated
  78 +export enum DelayDeprecatedFieldsEnum {
  79 + USE_METADATA_PERIOD_IN_SECONDS_PATTERNS = 'useMetadataPeriodInSecondsPatterns',
  80 + PERIOD_IN_SECONDS = 'periodInSeconds',
  81 + PERIOD_IN_SECONDS_PATTERN = 'periodInSecondsPattern',
  82 + MAX_PENDING_MSGS = 'maxPendingMsgs',
  83 +}
  84 +
  85 +export enum DelayDeprecatedFieldsNameEnum {
  86 + USE_METADATA_PERIOD_IN_SECONDS_PATTERNS = 'Use period in seconds pattern',
  87 + PERIOD_IN_SECONDS = 'Period in seconds',
  88 + PERIOD_IN_SECONDS_PATTERN = 'Period in seconds',
  89 + MAX_PENDING_MSGS = 'Maximum pending messages',
  90 +}
  91 +
  92 +export enum DeleteRelationFieldsEnum {
  93 + DELETE_FOR_SINGLE_ENTITY = 'deleteForSingleEntity',
  94 + DIRECTION = 'direction',
  95 + ENTITY_TYPE = 'entityType',
  96 + ENTITY_NAME_PATTERN = 'entityNamePattern',
  97 + RELATION_TYPE = 'relationType',
  98 + ENTITY_CACHE_EXPIRATION = 'entityCacheExpiration',
  99 +}
  100 +
  101 +export enum DeleteRelationFieldsNameEnum {
  102 + DELETE_FOR_SINGLE_ENTITY = 'Delete relation to specific entity',
  103 + DIRECTION = '方向',
  104 + ENTITY_TYPE = '类型',
  105 + ENTITY_NAME_PATTERN = 'Name pattern',
  106 + RELATION_TYPE = 'Relation type pattern',
  107 + ENTITY_CACHE_EXPIRATION = 'Entities cache expiration time(sec)',
  108 +}
  109 +
  110 +// device profile
  111 +export enum DeviceProfileFieldsEnum {
  112 + PERSIST_ALARM_RULES_STATE = 'persistAlarmRulesState',
  113 + FETCH_ALARM_RULES_STATE_ON_START = 'fetchAlarmRulesStateOnStart',
  114 +}
  115 +
  116 +export enum DeviceProfileFieldsNameEnum {
  117 + PERSIST_ALARM_RULES_STATE = 'Persist state of alarm rules',
  118 + FETCH_ALARM_RULES_STATE_ON_START = 'Fetch state of alarm rules',
  119 +}
  120 +
  121 +// Generator
  122 +export enum GeneratorFieldsEnum {
  123 + MSG_COUNT = 'msgCount',
  124 + PERIOD_IN_SECONDS = 'periodInSeconds',
  125 + JS_SCRIPT = 'jsScript',
  126 + ORIGINATOR_ID = 'originatorId',
  127 + ORIGINATOR_TYPE = 'originatorType',
  128 +}
  129 +
  130 +export enum GeneratorFieldsNameEnum {
  131 + MSG_COUNT = 'Message count(0 - unlimited)',
  132 + PERIOD_IN_SECONDS = 'Period in seconds',
  133 + JS_SCRIPT = 'Generate',
  134 + // ORIGINATOR_ID = 'Originator',
  135 + ORIGINATOR_TYPE = 'Originator',
  136 +}
  137 +
  138 +// Gps geofencing events
  139 +export enum GpsGeofencingEventsFieldsEnum {
  140 + LATITUDE_KEY_NAME = 'latitudeKeyName',
  141 + LONGITUDE_KEY_NAME = 'longitudeKeyName',
  142 + PERIMETER_TYPE = 'perimeterType',
  143 + FETCH_PERIMETER_INFO_FROM_MESSAGE_METADATA = 'fetchPerimeterInfoFromMessageMetadata',
  144 + PERIMETER_KEY_NAME = 'perimeterKeyName',
  145 + CENTER_LATITUDE = 'centerLatitude',
  146 + CENTER_LONGITUDE = 'centerLongitude',
  147 + RANGE = 'range',
  148 + RANGE_UNIT = 'rangeUnit',
  149 + POLYGONS_DEFINITION = 'polygonsDefinition',
  150 + MIN_INSIDE_DURATION = 'minInsideDuration',
  151 + MIN_INSIDE_DURATION_TIME_UNIT = 'minInsideDurationTimeUnit',
  152 + MIN_OUTSIDE_DURATION = 'minOutsideDuration',
  153 + MIN_OUTSIDE_DURATION_TIME_UNIT = 'minOutsideDurationTimeUnit',
  154 +}
  155 +
  156 +export enum GpsGeofencingEventsFieldsNameEnum {
  157 + LATITUDE_KEY_NAME = 'Latitude key name',
  158 + LONGITUDE_KEY_NAME = 'longitude key name',
  159 + PERIMETER_TYPE = 'Perimeter type',
  160 + FETCH_PERIMETER_INFO_FROM_MESSAGE_METADATA = 'Fetch perimeter information from message metadata',
  161 + PERIMETER_KEY_NAME = 'Perimeter key name',
  162 + CENTER_LATITUDE = 'Center Latitude',
  163 + CENTER_LONGITUDE = 'Center Longitude',
  164 + RANGE = 'Range',
  165 + RANGE_UNIT = 'Range units',
  166 + POLYGONS_DEFINITION = 'Polygon definition',
  167 + MIN_INSIDE_DURATION = 'Minimal inside duration',
  168 + MIN_INSIDE_DURATION_TIME_UNIT = 'Minimal inside duration time unit',
  169 + MIN_OUTSIDE_DURATION = 'Minimal outside duration',
  170 + MIN_OUTSIDE_DURATION_TIME_UNIT = 'Minimal outside duration time unit',
  171 +}
  172 +
  173 +// Log
  174 +export enum LogFieldsEnum {
  175 + JS_SCRIPT = 'jsScript',
  176 +}
  177 +
  178 +export enum LogFieldsNameEnum {
  179 + JS_SCRIPT = 'To string',
  180 +}
  181 +
  182 +// Message Count
  183 +export enum MessageCountFieldsEnum {
  184 + INTERVAL = 'interval',
  185 + TELEMETRY_PREFIX = 'telemetryPrefix',
  186 +}
  187 +
  188 +export enum MessageCountFieldsNameEnum {
  189 + INTERVAL = 'Interval in seconds',
  190 + TELEMETRY_PREFIX = 'Output timeseries key prefix',
  191 +}
  192 +
  193 +// Push to edge
  194 +export enum PushToEdgeFieldsEnum {
  195 + SCOPE = 'scope',
  196 +}
  197 +
  198 +export enum PushToEdgeFieldsNameEnum {
  199 + SCOPE = '设备属性范围',
  200 +}
  201 +// Rpc call reply
  202 +export enum RpcCallReplyFieldsEnum {
  203 + REQUEST_ID_META_DATA_ATTRIBUTE = 'requestIdMetaDataAttribute',
  204 +}
  205 +
  206 +export enum RpcCallReplyFieldsNameEnum {
  207 + REQUEST_ID_META_DATA_ATTRIBUTE = 'Request Id Metadata attribute name',
  208 +}
  209 +
  210 +// Rpc call request
  211 +export enum RpcCallRequestFieldsEnum {
  212 + TIMEOUT_IN_SECONDS = 'timeoutInSeconds',
  213 +}
  214 +
  215 +export enum RpcCallRequestFieldsNameEnum {
  216 + TIMEOUT_IN_SECONDS = 'Timeout in seconds',
  217 +}
  218 +
  219 +// Save attribute
  220 +export enum SaveAttributesFieldsEnum {
  221 + NOTIFY_DEVICE = 'notifyDevice',
  222 + SCOPE = 'scope',
  223 +}
  224 +
  225 +export enum SaveAttributesFieldsNameEnum {
  226 + NOTIFY_DEVICE = 'Notify Device',
  227 + SCOPE = '设备属性范围',
  228 +}
  229 +
  230 +// Save event
  231 +export enum SaveEventFieldsEnum {
  232 + CONFIGURATION = 'CONFIGURATION',
  233 +}
  234 +
  235 +export enum SaveEventFieldsNameEnum {
  236 + CONFIGURATION = '配置',
  237 +}
  238 +
  239 +// Save timeseries
  240 +export enum SaveTimeseriesFieldsEnum {
  241 + DEFAULT_TTL = 'defaultTTL',
  242 + SKIP_LATEST_PERSISTENCE = 'skipLatestPersistence',
  243 + USE_SERVER_TS = 'useServerTs',
  244 +}
  245 +
  246 +export enum SaveTimeseriesFieldsNameEnum {
  247 + DEFAULT_TTL = 'Default TTL in seconds',
  248 + SKIP_LATEST_PERSISTENCE = 'Skit latest persistence',
  249 + USE_SERVER_TS = 'Use server ts',
  250 +}
  251 +
  252 +// save to custom table
  253 +export enum SaveToCustomTableFieldsEnum {
  254 + FIELDS_MAPPING = 'fieldsMapping',
  255 + TABLE_NAME = 'tableName',
  256 +}
  257 +
  258 +export enum SaveToCustomTableFieldsNameEnum {
  259 + FIELDS_MAPPING = 'Fields mapping',
  260 + TABLE_NAME = 'Custom table name',
  261 +}
  262 +
  263 +// Unassign from customer
  264 +export enum UnassignFromCustomerFieldsEnum {
  265 + CUSTOMER_NAME_PATTERN = 'customerNamePattern',
  266 + CUSTOMER_CACHE_EXPIRATION = 'customerCacheExpiration',
  267 +}
  268 +
  269 +export enum UnassignFromCustomerFieldsNameEnum {
  270 + CUSTOMER_NAME_PATTERN = 'Customer name pattern',
  271 + CUSTOMER_CACHE_EXPIRATION = 'Customer cache expiration time(sec)',
50 272 }
... ...
... ... @@ -14,8 +14,102 @@ export const formSchemas: FormSchema[] = [
14 14 }),
15 15 },
16 16 {
  17 + field: CreateAlarmFieldsEnum.OVERWRITE_ALARM_DETAILS,
  18 + component: 'Checkbox',
  19 + label: '',
  20 + show: ({ model }) => model[CreateAlarmFieldsEnum.USE_MESSAGE_ALARM_DATA],
  21 + renderComponentContent: () => ({
  22 + default: () => CreateAlarmFieldsNameEnum.OVERWRITE_ALARM_DETAILS,
  23 + }),
  24 + },
  25 + {
17 26 field: CreateAlarmFieldsEnum.ALARM_DETAILS_BUILD_JS,
18 27 component: 'JavascriptEditorWithTestModal',
19 28 label: CreateAlarmFieldsNameEnum.ALARM_DETAILS_BUILD_JS,
  29 + valueField: 'value',
  30 + changeEvent: 'update:value',
  31 + show: ({ model }) =>
  32 + !(
  33 + !model[CreateAlarmFieldsEnum.OVERWRITE_ALARM_DETAILS] &&
  34 + model[CreateAlarmFieldsEnum.USE_MESSAGE_ALARM_DATA]
  35 + ),
  36 + componentProps: {
  37 + javaScriptEditorProps: {
  38 + functionName: 'Details',
  39 + paramsName: ['msg', 'metadata', 'msgType'],
  40 + },
  41 + buttonName: 'Test details function',
  42 + },
  43 + },
  44 + {
  45 + field: CreateAlarmFieldsEnum.ALARM_TYPE,
  46 + component: 'Input',
  47 + label: CreateAlarmFieldsNameEnum.ALARM_TYPE,
  48 + helpMessage: [
  49 + 'Hint: use ${metadataKey} for value from metadata, $[messageKey] for value from message body',
  50 + ],
  51 + show: ({ model }) => !model[CreateAlarmFieldsEnum.USE_MESSAGE_ALARM_DATA],
  52 + componentProps: {
  53 + placeholder: `请输入${CreateAlarmFieldsNameEnum.ALARM_TYPE}`,
  54 + },
  55 + },
  56 + {
  57 + field: CreateAlarmFieldsEnum.DYNAMIC_SEVERITY,
  58 + component: 'Checkbox',
  59 + label: '',
  60 + show: ({ model }) => !model[CreateAlarmFieldsEnum.USE_MESSAGE_ALARM_DATA],
  61 + renderComponentContent: () => ({
  62 + default: () => CreateAlarmFieldsNameEnum.DYNAMIC_SEVERITY,
  63 + }),
  64 + },
  65 + {
  66 + field: CreateAlarmFieldsEnum.SEVERITY,
  67 + component: 'Input',
  68 + label: CreateAlarmFieldsNameEnum.SEVERITY,
  69 + show: ({ model }) => !model[CreateAlarmFieldsEnum.USE_MESSAGE_ALARM_DATA],
  70 + helpMessage: [
  71 + 'Hint: use ${metadataKey} for value from metadata, $[messageKey] for value from message body. Alarm severity should be system (CRITICAL, MAJOR etc.)',
  72 + ],
  73 + componentProps: {
  74 + placeholder: `请输入${CreateAlarmFieldsNameEnum.SEVERITY}`,
  75 + },
  76 + },
  77 + {
  78 + field: CreateAlarmFieldsEnum.PROPAGATE,
  79 + component: 'Checkbox',
  80 + label: '',
  81 + show: ({ model }) => !model[CreateAlarmFieldsEnum.USE_MESSAGE_ALARM_DATA],
  82 + renderComponentContent: () => ({
  83 + default: () => CreateAlarmFieldsNameEnum.PROPAGATE,
  84 + }),
  85 + },
  86 + {
  87 + field: CreateAlarmFieldsEnum.RELATION_TYPES,
  88 + component: 'Select',
  89 + label: CreateAlarmFieldsNameEnum.RELATION_TYPES,
  90 + show: ({ model }) => !model[CreateAlarmFieldsEnum.USE_MESSAGE_ALARM_DATA],
  91 + componentProps: {
  92 + open: false,
  93 + mode: 'tags',
  94 + placeholder: `请输入${CreateAlarmFieldsNameEnum.RELATION_TYPES}`,
  95 + },
  96 + },
  97 + {
  98 + field: CreateAlarmFieldsEnum.PROPAGATE_TO_TENANT,
  99 + component: 'Checkbox',
  100 + label: '',
  101 + show: ({ model }) => !model[CreateAlarmFieldsEnum.USE_MESSAGE_ALARM_DATA],
  102 + renderComponentContent: () => ({
  103 + default: () => CreateAlarmFieldsNameEnum.PROPAGATE_TO_TENANT,
  104 + }),
  105 + },
  106 + {
  107 + field: CreateAlarmFieldsEnum.PROPAGATE_TO_OWNER,
  108 + component: 'Checkbox',
  109 + label: '',
  110 + show: ({ model }) => !model[CreateAlarmFieldsEnum.USE_MESSAGE_ALARM_DATA],
  111 + renderComponentContent: () => ({
  112 + default: () => CreateAlarmFieldsNameEnum.PROPAGATE_TO_OWNER,
  113 + }),
20 114 },
21 115 ];
... ...
1   -import { NodeBindDataFieldEnum, NodeBindDataFieldNameEnum } from '../../../enum/node';
  1 +import {
  2 + DirectionEnum,
  3 + DirectionNameEnum,
  4 + EntityTypeEnum,
  5 + EntityTypeNameEnum,
  6 +} from '../../../enum/form';
  7 +import {
  8 + CreateRelationFieldsEnum,
  9 + CreateRelationFieldsNameEnum,
  10 +} from '../../../enum/formField/action';
2 11 import { FormSchema } from '/@/components/Form';
3 12
4 13 export const formSchemas: FormSchema[] = [
5 14 {
6   - field: NodeBindDataFieldEnum.NAME,
  15 + field: CreateRelationFieldsEnum.DIRECTION,
  16 + component: 'Select',
  17 + label: CreateRelationFieldsNameEnum.DIRECTION,
  18 + required: true,
  19 + componentProps: {
  20 + options: Object.keys(DirectionEnum).map((value) => ({
  21 + label: DirectionNameEnum[value],
  22 + value,
  23 + })),
  24 + getPopupContainer: () => document.body,
  25 + placeholder: `请选择${CreateRelationFieldsNameEnum.DIRECTION}`,
  26 + },
  27 + },
  28 + {
  29 + field: CreateRelationFieldsEnum.ENTITY_TYPE,
  30 + component: 'Select',
  31 + label: CreateRelationFieldsNameEnum.ENTITY_TYPE,
  32 + colProps: { span: 8 },
  33 + required: true,
  34 + componentProps: {
  35 + options: Object.keys(EntityTypeEnum).map((value) => ({
  36 + label: EntityTypeNameEnum[value],
  37 + value,
  38 + })),
  39 + placeholder: `请选择${CreateRelationFieldsNameEnum.ENTITY_TYPE}`,
  40 + },
  41 + },
  42 + {
  43 + field: CreateRelationFieldsEnum.ENTITY_NAME_PATTERN,
  44 + component: 'Input',
  45 + label: CreateRelationFieldsNameEnum.ENTITY_NAME_PATTERN,
  46 + colProps: { span: 8 },
  47 + required: true,
  48 + helpMessage: [
  49 + 'Hint: use ${metadataKey} for value from metadata, $[messageKey] for value from message body',
  50 + ],
  51 + componentProps: {
  52 + placeholder: `请选择${CreateRelationFieldsNameEnum.ENTITY_NAME_PATTERN}`,
  53 + },
  54 + },
  55 + {
  56 + field: CreateRelationFieldsEnum.ENTITY_TYPE_PATTERN,
  57 + component: 'Input',
  58 + label: CreateRelationFieldsNameEnum.ENTITY_TYPE_PATTERN,
  59 + colProps: { span: 8 },
  60 + required: true,
  61 + helpMessage: [
  62 + 'Hint: use ${metadataKey} for value from metadata, $[messageKey] for value from message body',
  63 + ],
  64 + show: ({ model }) => {
  65 + const type = model[CreateRelationFieldsEnum.ENTITY_TYPE];
  66 + return [EntityTypeEnum.ASSET, EntityTypeEnum.DEVICE].includes(type);
  67 + },
  68 + componentProps: {
  69 + placeholder: `请选择${CreateRelationFieldsNameEnum.ENTITY_TYPE_PATTERN}`,
  70 + },
  71 + },
  72 + {
  73 + field: CreateRelationFieldsEnum.RELATION_TYPE,
7 74 component: 'Input',
8   - label: NodeBindDataFieldNameEnum.NAME,
  75 + label: CreateRelationFieldsNameEnum.RELATION_TYPE,
  76 + helpMessage: [
  77 + 'Hint: use ${metadataKey} for value from metadata, $[messageKey] for value from message body',
  78 + ],
  79 + componentProps: {
  80 + placeholder: `请输入${CreateRelationFieldsNameEnum.RELATION_TYPE}`,
  81 + },
  82 + },
  83 + {
  84 + field: CreateRelationFieldsEnum.CREATE_ENTITY_IF_NOT_EXISTS,
  85 + component: 'Checkbox',
  86 + label: '',
  87 + helpMessage: 'Create a new entity set above if it does not exist.',
  88 + show: ({ model }) => {
  89 + const type = model[CreateRelationFieldsEnum.ENTITY_TYPE];
  90 + return [EntityTypeEnum.ASSET, EntityTypeEnum.DEVICE, EntityTypeEnum.CUSTOMER].includes(type);
  91 + },
  92 + renderComponentContent: () => ({
  93 + default: () => CreateRelationFieldsNameEnum.CREATE_ENTITY_IF_NOT_EXISTS,
  94 + }),
  95 + },
  96 + {
  97 + field: CreateRelationFieldsEnum.REMOVE_CURRENT_RELATIONS,
  98 + component: 'Checkbox',
  99 + label: '',
  100 + helpMessage:
  101 + 'Removes current relations from the originator of the incoming message based on direction and type.',
  102 + renderComponentContent: () => ({
  103 + default: () => CreateRelationFieldsNameEnum.REMOVE_CURRENT_RELATIONS,
  104 + }),
  105 + },
  106 + {
  107 + field: CreateRelationFieldsEnum.CHANGE_ORIGINATOR_TO_RELATED_ENTITY,
  108 + component: 'Checkbox',
  109 + label: '',
  110 + helpMessage: 'Used to process submitted message as a message from another entity.',
  111 + renderComponentContent: () => ({
  112 + default: () => CreateRelationFieldsNameEnum.CHANGE_ORIGINATOR_TO_RELATED_ENTITY,
  113 + }),
  114 + },
  115 + {
  116 + field: CreateRelationFieldsEnum.ENTITY_CACHE_EXPIRATION,
  117 + component: 'InputNumber',
  118 + label: CreateRelationFieldsNameEnum.ENTITY_CACHE_EXPIRATION,
  119 + required: true,
  120 + componentProps: {
  121 + min: 0,
  122 + placeholder: `请输入${CreateRelationFieldsNameEnum.ENTITY_CACHE_EXPIRATION}`,
  123 + },
9 124 },
10 125 ];
... ...
1   -import { NodeBindDataFieldEnum, NodeBindDataFieldNameEnum } from '../../../enum/node';
  1 +import {
  2 + DelayDeprecatedFieldsEnum,
  3 + DelayDeprecatedFieldsNameEnum,
  4 +} from '../../../enum/formField/action';
2 5 import { FormSchema } from '/@/components/Form';
3 6
4 7 export const formSchemas: FormSchema[] = [
5 8 {
6   - field: NodeBindDataFieldEnum.NAME,
  9 + field: DelayDeprecatedFieldsEnum.USE_METADATA_PERIOD_IN_SECONDS_PATTERNS,
  10 + label: DelayDeprecatedFieldsNameEnum.USE_METADATA_PERIOD_IN_SECONDS_PATTERNS,
  11 + component: 'Checkbox',
  12 + renderComponentContent: () => ({
  13 + default: () =>
  14 + 'If selected, rule node use period in seconds interval pattern from message metadata or data assuming that intervals are in the seconds.',
  15 + }),
  16 + },
  17 + {
  18 + field: DelayDeprecatedFieldsEnum.PERIOD_IN_SECONDS_PATTERN,
7 19 component: 'Input',
8   - label: NodeBindDataFieldNameEnum.NAME,
  20 + label: DelayDeprecatedFieldsNameEnum.PERIOD_IN_SECONDS_PATTERN,
  21 + required: true,
  22 + show: ({ model }) => model[DelayDeprecatedFieldsEnum.USE_METADATA_PERIOD_IN_SECONDS_PATTERNS],
  23 + componentProps: {
  24 + min: 0,
  25 + placeholder: `请输入${DelayDeprecatedFieldsNameEnum.PERIOD_IN_SECONDS_PATTERN}`,
  26 + },
  27 + },
  28 + {
  29 + field: DelayDeprecatedFieldsEnum.PERIOD_IN_SECONDS,
  30 + component: 'InputNumber',
  31 + label: DelayDeprecatedFieldsNameEnum.PERIOD_IN_SECONDS,
  32 + required: true,
  33 + show: ({ model }) => !model[DelayDeprecatedFieldsEnum.USE_METADATA_PERIOD_IN_SECONDS_PATTERNS],
  34 + componentProps: {
  35 + min: 0,
  36 + placeholder: `请输入${DelayDeprecatedFieldsNameEnum.PERIOD_IN_SECONDS}`,
  37 + },
  38 + },
  39 + {
  40 + field: DelayDeprecatedFieldsEnum.MAX_PENDING_MSGS,
  41 + component: 'InputNumber',
  42 + label: DelayDeprecatedFieldsNameEnum.MAX_PENDING_MSGS,
  43 + required: true,
  44 + componentProps: {
  45 + min: 0,
  46 + placeholder: `请输入${DelayDeprecatedFieldsNameEnum.MAX_PENDING_MSGS}`,
  47 + },
9 48 },
10 49 ];
... ...
1   -import { NodeBindDataFieldEnum, NodeBindDataFieldNameEnum } from '../../../enum/node';
  1 +import { DirectionEnum, DirectionNameEnum } from '../../../enum/form';
  2 +import {
  3 + DeleteRelationFieldsEnum,
  4 + DeleteRelationFieldsNameEnum,
  5 +} from '../../../enum/formField/action';
2 6 import { FormSchema } from '/@/components/Form';
3 7
4 8 export const formSchemas: FormSchema[] = [
5 9 {
6   - field: NodeBindDataFieldEnum.NAME,
  10 + field: DeleteRelationFieldsEnum.DELETE_FOR_SINGLE_ENTITY,
  11 + component: 'Checkbox',
  12 + label: DeleteRelationFieldsNameEnum.DELETE_FOR_SINGLE_ENTITY,
  13 + renderComponentContent: () => ({
  14 + default: () =>
  15 + 'Deletes relation from the originator of the incoming message to the specified entity or list of entities based on direction and type.',
  16 + }),
  17 + },
  18 + {
  19 + field: DeleteRelationFieldsEnum.DIRECTION,
  20 + component: 'Select',
  21 + label: DeleteRelationFieldsNameEnum.DIRECTION,
  22 + required: true,
  23 + colProps: { span: 12 },
  24 + show: ({ model }) => model[DeleteRelationFieldsEnum.DELETE_FOR_SINGLE_ENTITY],
  25 + componentProps: {
  26 + options: Object.keys(DirectionEnum).map((value) => ({
  27 + label: DirectionNameEnum[value],
  28 + value,
  29 + })),
  30 + getPopupContainer: () => document.body,
  31 + placeholder: `请选择${DeleteRelationFieldsNameEnum.DELETE_FOR_SINGLE_ENTITY}`,
  32 + },
  33 + },
  34 + {
  35 + field: DeleteRelationFieldsEnum.ENTITY_NAME_PATTERN,
7 36 component: 'Input',
8   - label: NodeBindDataFieldNameEnum.NAME,
  37 + label: DeleteRelationFieldsNameEnum.ENTITY_NAME_PATTERN,
  38 + required: true,
  39 + colProps: { span: 12 },
  40 + show: ({ model }) => model[DeleteRelationFieldsEnum.DELETE_FOR_SINGLE_ENTITY],
  41 + helpMessage: [
  42 + 'Hint: use ${metadataKey} for value from metadata, $[messageKey] for value from message body',
  43 + ],
  44 + componentProps: {
  45 + placeholder: `请输入${DeleteRelationFieldsNameEnum.ENTITY_NAME_PATTERN}`,
  46 + },
  47 + },
  48 + {
  49 + field: DeleteRelationFieldsEnum.RELATION_TYPE,
  50 + component: 'Input',
  51 + label: DeleteRelationFieldsNameEnum.RELATION_TYPE,
  52 + required: true,
  53 + helpMessage: [
  54 + 'Hint: use ${metadataKey} for value from metadata, $[messageKey] for value from message body',
  55 + ],
  56 + componentProps: {
  57 + placeholder: `请输入${DeleteRelationFieldsNameEnum.RELATION_TYPE}`,
  58 + },
  59 + },
  60 + {
  61 + field: DeleteRelationFieldsEnum.ENTITY_CACHE_EXPIRATION,
  62 + component: 'InputNumber',
  63 + label: DeleteRelationFieldsNameEnum.ENTITY_CACHE_EXPIRATION,
  64 + required: true,
  65 + helpMessage: [
  66 + 'Specifies maximum time interval allowed to store found entity records. 0 value means that records will never expire.',
  67 + ],
  68 + componentProps: {
  69 + min: 0,
  70 + placeholder: `请输入${DeleteRelationFieldsNameEnum.DELETE_FOR_SINGLE_ENTITY}`,
  71 + },
9 72 },
10 73 ];
... ...
1   -import { NodeBindDataFieldEnum, NodeBindDataFieldNameEnum } from '../../../enum/node';
  1 +import {
  2 + DeviceProfileFieldsEnum,
  3 + DeviceProfileFieldsNameEnum,
  4 +} from '../../../enum/formField/action';
2 5 import { FormSchema } from '/@/components/Form';
3 6
4 7 export const formSchemas: FormSchema[] = [
5 8 {
6   - field: NodeBindDataFieldEnum.NAME,
7   - component: 'Input',
8   - label: NodeBindDataFieldNameEnum.NAME,
  9 + field: DeviceProfileFieldsEnum.PERSIST_ALARM_RULES_STATE,
  10 + component: 'Checkbox',
  11 + label: '',
  12 + renderComponentContent: () => ({
  13 + default: () => DeviceProfileFieldsNameEnum.PERSIST_ALARM_RULES_STATE,
  14 + }),
  15 + },
  16 + {
  17 + field: DeviceProfileFieldsEnum.FETCH_ALARM_RULES_STATE_ON_START,
  18 + component: 'Checkbox',
  19 + label: '',
  20 + renderComponentContent: () => ({
  21 + default: () => DeviceProfileFieldsNameEnum.FETCH_ALARM_RULES_STATE_ON_START,
  22 + }),
9 23 },
10 24 ];
... ...
1   -import { NodeBindDataFieldEnum, NodeBindDataFieldNameEnum } from '../../../enum/node';
2   -import { FormSchema } from '/@/components/Form';
  1 +import { EntityTypeEnum, EntityTypeNameEnum } from '../../../enum/form';
  2 +import { GeneratorFieldsEnum, GeneratorFieldsNameEnum } from '../../../enum/formField/action';
  3 +import { JavascriptEditorWithTestModal } from '../../../src/components/JavaScriptFilterModal';
  4 +import { FormSchema, useComponentRegister } from '/@/components/Form';
  5 +
  6 +useComponentRegister('JavascriptEditorWithTestModal', JavascriptEditorWithTestModal);
3 7
4 8 export const formSchemas: FormSchema[] = [
5 9 {
6   - field: NodeBindDataFieldEnum.NAME,
7   - component: 'Input',
8   - label: NodeBindDataFieldNameEnum.NAME,
  10 + field: GeneratorFieldsEnum.MSG_COUNT,
  11 + component: 'InputNumber',
  12 + label: GeneratorFieldsNameEnum.MSG_COUNT,
  13 + required: true,
  14 + componentProps: {
  15 + min: 0,
  16 + placeholder: `请输入${GeneratorFieldsNameEnum.MSG_COUNT}`,
  17 + },
  18 + },
  19 + {
  20 + field: GeneratorFieldsEnum.PERIOD_IN_SECONDS,
  21 + component: 'InputNumber',
  22 + label: GeneratorFieldsNameEnum.PERIOD_IN_SECONDS,
  23 + required: true,
  24 + componentProps: {
  25 + min: 0,
  26 + placeholder: `请输入${GeneratorFieldsNameEnum.PERIOD_IN_SECONDS}`,
  27 + },
  28 + },
  29 + {
  30 + field: GeneratorFieldsEnum.ORIGINATOR_TYPE,
  31 + component: 'Select',
  32 + label: GeneratorFieldsNameEnum.ORIGINATOR_TYPE,
  33 + colProps: { span: 8 },
  34 + componentProps: {
  35 + options: Object.keys(EntityTypeEnum).map((value) => ({
  36 + label: EntityTypeNameEnum[value],
  37 + value,
  38 + })),
  39 + placeholder: `请选择${GeneratorFieldsNameEnum.ORIGINATOR_TYPE}`,
  40 + },
  41 + },
  42 + {
  43 + field: GeneratorFieldsEnum.ORIGINATOR_ID,
  44 + component: 'Select',
  45 + label: GeneratorFieldsNameEnum.ORIGINATOR_TYPE,
  46 + colProps: { span: 16 },
  47 + },
  48 + {
  49 + field: GeneratorFieldsEnum.JS_SCRIPT,
  50 + component: 'JavascriptEditorWithTestModal',
  51 + label: GeneratorFieldsNameEnum.JS_SCRIPT,
  52 + valueField: 'value',
  53 + changeEvent: 'update:value',
  54 + componentProps: {
  55 + javaScriptEditorProps: {
  56 + functionName: 'Generate',
  57 + paramsName: ['prevMsg', 'prevMetadata', 'prevMsgType'],
  58 + },
  59 + buttonName: 'Test generator function',
  60 + },
9 61 },
10 62 ];
... ...
1   -import { NodeBindDataFieldEnum, NodeBindDataFieldNameEnum } from '../../../enum/node';
  1 +import { PerimeterTypeEnum, RangeUtilEnum, RangeUtilNameEnum } from '../../../enum/form';
  2 +import {
  3 + GpsGeofencingEventsFieldsEnum,
  4 + GpsGeofencingEventsFieldsNameEnum,
  5 +} from '../../../enum/formField/action';
2 6 import { FormSchema } from '/@/components/Form';
3 7
4 8 export const formSchemas: FormSchema[] = [
5 9 {
6   - field: NodeBindDataFieldEnum.NAME,
  10 + field: GpsGeofencingEventsFieldsEnum.LATITUDE_KEY_NAME,
7 11 component: 'Input',
8   - label: NodeBindDataFieldNameEnum.NAME,
  12 + label: GpsGeofencingEventsFieldsNameEnum.LATITUDE_KEY_NAME,
  13 + required: true,
  14 + componentProps: {
  15 + placeholder: `请输入${GpsGeofencingEventsFieldsNameEnum.LATITUDE_KEY_NAME}`,
  16 + },
  17 + },
  18 + {
  19 + field: GpsGeofencingEventsFieldsEnum.LONGITUDE_KEY_NAME,
  20 + component: 'Input',
  21 + label: GpsGeofencingEventsFieldsNameEnum.LONGITUDE_KEY_NAME,
  22 + required: true,
  23 + componentProps: {
  24 + placeholder: `请输入${GpsGeofencingEventsFieldsNameEnum.LONGITUDE_KEY_NAME}`,
  25 + },
  26 + },
  27 + {
  28 + field: GpsGeofencingEventsFieldsEnum.PERIMETER_TYPE,
  29 + component: 'Select',
  30 + label: GpsGeofencingEventsFieldsNameEnum.PERIMETER_TYPE,
  31 + required: true,
  32 + componentProps: {
  33 + options: Object.keys(PerimeterTypeEnum).map((value) => ({ label: value, value })),
  34 + placeholder: `请选择${GpsGeofencingEventsFieldsNameEnum.PERIMETER_TYPE}`,
  35 + },
  36 + },
  37 + {
  38 + field: GpsGeofencingEventsFieldsEnum.FETCH_PERIMETER_INFO_FROM_MESSAGE_METADATA,
  39 + component: 'Checkbox',
  40 + label: '',
  41 + renderComponentContent: () => ({
  42 + default: () => GpsGeofencingEventsFieldsNameEnum.FETCH_PERIMETER_INFO_FROM_MESSAGE_METADATA,
  43 + }),
  44 + },
  45 + {
  46 + field: GpsGeofencingEventsFieldsEnum.PERIMETER_KEY_NAME,
  47 + component: 'Input',
  48 + label: GpsGeofencingEventsFieldsNameEnum.PERIMETER_KEY_NAME,
  49 + required: true,
  50 + show: ({ model }) =>
  51 + model[GpsGeofencingEventsFieldsEnum.PERIMETER_TYPE] === PerimeterTypeEnum.POLYGON &&
  52 + model[GpsGeofencingEventsFieldsEnum.FETCH_PERIMETER_INFO_FROM_MESSAGE_METADATA],
  53 + componentProps: {
  54 + placeholder: `请输入${GpsGeofencingEventsFieldsNameEnum.PERIMETER_KEY_NAME}`,
  55 + },
  56 + },
  57 + {
  58 + field: GpsGeofencingEventsFieldsEnum.POLYGONS_DEFINITION,
  59 + component: 'Input',
  60 + label: GpsGeofencingEventsFieldsNameEnum.POLYGONS_DEFINITION,
  61 + helpMessage:
  62 + 'Please, use the following format for manual definition of polygon: [[lat1,lon1],[lat2,lon2], ... ,[latN,lonN]].',
  63 + required: true,
  64 + show: ({ model }) =>
  65 + model[GpsGeofencingEventsFieldsEnum.PERIMETER_TYPE] === PerimeterTypeEnum.POLYGON &&
  66 + !model[GpsGeofencingEventsFieldsEnum.FETCH_PERIMETER_INFO_FROM_MESSAGE_METADATA],
  67 + componentProps: {
  68 + placeholder: `请输入${GpsGeofencingEventsFieldsNameEnum.POLYGONS_DEFINITION}`,
  69 + },
  70 + },
  71 + {
  72 + field: GpsGeofencingEventsFieldsEnum.CENTER_LATITUDE,
  73 + component: 'InputNumber',
  74 + label: GpsGeofencingEventsFieldsNameEnum.CENTER_LATITUDE,
  75 + colProps: { span: 12 },
  76 + required: true,
  77 + show: ({ model }) =>
  78 + model[GpsGeofencingEventsFieldsEnum.PERIMETER_TYPE] === PerimeterTypeEnum.CIRCLE &&
  79 + !model[GpsGeofencingEventsFieldsEnum.FETCH_PERIMETER_INFO_FROM_MESSAGE_METADATA],
  80 + componentProps: {
  81 + placeholder: `请输入${GpsGeofencingEventsFieldsNameEnum.CENTER_LATITUDE}`,
  82 + },
  83 + },
  84 + {
  85 + field: GpsGeofencingEventsFieldsEnum.CENTER_LONGITUDE,
  86 + component: 'InputNumber',
  87 + label: GpsGeofencingEventsFieldsNameEnum.CENTER_LONGITUDE,
  88 + colProps: { span: 12 },
  89 + show: ({ model }) =>
  90 + model[GpsGeofencingEventsFieldsEnum.PERIMETER_TYPE] === PerimeterTypeEnum.CIRCLE &&
  91 + !model[GpsGeofencingEventsFieldsEnum.FETCH_PERIMETER_INFO_FROM_MESSAGE_METADATA],
  92 + componentProps: {
  93 + placeholder: `请输入${GpsGeofencingEventsFieldsNameEnum.CENTER_LONGITUDE}`,
  94 + },
  95 + },
  96 + {
  97 + field: GpsGeofencingEventsFieldsEnum.RANGE,
  98 + component: 'InputNumber',
  99 + label: GpsGeofencingEventsFieldsNameEnum.RANGE,
  100 + colProps: { span: 12 },
  101 + required: true,
  102 + show: ({ model }) =>
  103 + model[GpsGeofencingEventsFieldsEnum.PERIMETER_TYPE] === PerimeterTypeEnum.CIRCLE &&
  104 + !model[GpsGeofencingEventsFieldsEnum.FETCH_PERIMETER_INFO_FROM_MESSAGE_METADATA],
  105 + componentProps: {
  106 + placeholder: `请输入${GpsGeofencingEventsFieldsNameEnum.RANGE}`,
  107 + },
  108 + },
  109 + {
  110 + field: GpsGeofencingEventsFieldsEnum.RANGE_UNIT,
  111 + component: 'Select',
  112 + label: GpsGeofencingEventsFieldsNameEnum.RANGE_UNIT,
  113 + colProps: { span: 12 },
  114 + required: true,
  115 + show: ({ model }) =>
  116 + model[GpsGeofencingEventsFieldsEnum.PERIMETER_TYPE] === PerimeterTypeEnum.CIRCLE &&
  117 + !model[GpsGeofencingEventsFieldsEnum.FETCH_PERIMETER_INFO_FROM_MESSAGE_METADATA],
  118 + componentProps: {
  119 + options: Object.keys(RangeUtilEnum).map((value) => ({
  120 + label: RangeUtilNameEnum[value],
  121 + value,
  122 + })),
  123 + getPopupContainer: () => document.body,
  124 + placeholder: `请选择${GpsGeofencingEventsFieldsNameEnum.RANGE_UNIT}`,
  125 + },
  126 + },
  127 + {
  128 + field: GpsGeofencingEventsFieldsEnum.MIN_INSIDE_DURATION,
  129 + component: 'InputNumber',
  130 + label: GpsGeofencingEventsFieldsNameEnum.MIN_INSIDE_DURATION,
  131 + colProps: { span: 12 },
  132 + required: true,
  133 + componentProps: {
  134 + min: 1,
  135 + max: 2147483647,
  136 + placeholder: `请输入${GpsGeofencingEventsFieldsNameEnum.MIN_INSIDE_DURATION}`,
  137 + },
  138 + },
  139 + {
  140 + field: GpsGeofencingEventsFieldsEnum.MIN_INSIDE_DURATION_TIME_UNIT,
  141 + component: 'Select',
  142 + label: GpsGeofencingEventsFieldsNameEnum.MIN_INSIDE_DURATION_TIME_UNIT,
  143 + colProps: { span: 12 },
  144 + required: true,
  145 + componentProps: {
  146 + options: Object.keys(RangeUtilEnum).map((value) => ({
  147 + label: RangeUtilNameEnum[value],
  148 + value,
  149 + })),
  150 + getPopupContainer: () => document.body,
  151 + placeholder: `请输入${GpsGeofencingEventsFieldsNameEnum.MIN_INSIDE_DURATION_TIME_UNIT}`,
  152 + },
  153 + },
  154 + {
  155 + field: GpsGeofencingEventsFieldsEnum.MIN_OUTSIDE_DURATION,
  156 + component: 'InputNumber',
  157 + label: GpsGeofencingEventsFieldsNameEnum.MIN_OUTSIDE_DURATION,
  158 + colProps: { span: 12 },
  159 + required: true,
  160 + componentProps: {
  161 + min: 1,
  162 + max: 2147483647,
  163 + placeholder: `请输入${GpsGeofencingEventsFieldsNameEnum.MIN_OUTSIDE_DURATION}`,
  164 + },
  165 + },
  166 + {
  167 + field: GpsGeofencingEventsFieldsEnum.MIN_OUTSIDE_DURATION_TIME_UNIT,
  168 + component: 'Select',
  169 + label: GpsGeofencingEventsFieldsNameEnum.MIN_OUTSIDE_DURATION_TIME_UNIT,
  170 + colProps: { span: 12 },
  171 + required: true,
  172 + componentProps: {
  173 + options: Object.keys(RangeUtilEnum).map((value) => ({
  174 + label: RangeUtilNameEnum[value],
  175 + value,
  176 + })),
  177 + getPopupContainer: () => document.body,
  178 + placeholder: `请输入${GpsGeofencingEventsFieldsNameEnum.MIN_OUTSIDE_DURATION_TIME_UNIT}`,
  179 + },
9 180 },
10 181 ];
... ...
1   -import { NodeBindDataFieldEnum, NodeBindDataFieldNameEnum } from '../../../enum/node';
2   -import { FormSchema } from '/@/components/Form';
  1 +import { LogFieldsEnum, LogFieldsNameEnum } from '../../../enum/formField/action';
  2 +import { JavascriptEditorWithTestModal } from '../../../src/components/JavaScriptFilterModal';
  3 +import { FormSchema, useComponentRegister } from '/@/components/Form';
  4 +
  5 +useComponentRegister('JavascriptEditorWithTestModal', JavascriptEditorWithTestModal);
3 6
4 7 export const formSchemas: FormSchema[] = [
5 8 {
6   - field: NodeBindDataFieldEnum.NAME,
7   - component: 'Input',
8   - label: NodeBindDataFieldNameEnum.NAME,
  9 + field: LogFieldsEnum.JS_SCRIPT,
  10 + component: 'JavascriptEditorWithTestModal',
  11 + label: LogFieldsNameEnum.JS_SCRIPT,
  12 + valueField: 'value',
  13 + changeEvent: 'update:value',
  14 + componentProps: {
  15 + javaScriptEditorProps: {
  16 + functionName: 'ToString',
  17 + paramsName: ['msg', 'metadata', 'msgType'],
  18 + },
  19 + buttonName: 'Test to string function',
  20 + },
9 21 },
10 22 ];
... ...
1   -import { NodeBindDataFieldEnum, NodeBindDataFieldNameEnum } from '../../../enum/node';
  1 +import { MessageCountFieldsEnum, MessageCountFieldsNameEnum } from '../../../enum/formField/action';
2 2 import { FormSchema } from '/@/components/Form';
3 3
4 4 export const formSchemas: FormSchema[] = [
5 5 {
6   - field: NodeBindDataFieldEnum.NAME,
  6 + field: MessageCountFieldsEnum.INTERVAL,
  7 + component: 'InputNumber',
  8 + label: MessageCountFieldsNameEnum.INTERVAL,
  9 + required: true,
  10 + componentProps: {
  11 + step: 1,
  12 + precision: 0,
  13 + placeholder: `请输入${MessageCountFieldsNameEnum.INTERVAL}`,
  14 + },
  15 + },
  16 + {
  17 + field: MessageCountFieldsEnum.TELEMETRY_PREFIX,
7 18 component: 'Input',
8   - label: NodeBindDataFieldNameEnum.NAME,
  19 + label: MessageCountFieldsNameEnum.TELEMETRY_PREFIX,
  20 + required: true,
  21 + componentProps: {
  22 + placeholder: `请输入${MessageCountFieldsNameEnum.TELEMETRY_PREFIX}`,
  23 + },
9 24 },
10 25 ];
... ...
1   -import { NodeBindDataFieldEnum, NodeBindDataFieldNameEnum } from '../../../enum/node';
  1 +import { ScopeEnum, ScopeNameEnum } from '../../../enum/form';
  2 +import { PushToEdgeFieldsEnum, PushToEdgeFieldsNameEnum } from '../../../enum/formField/action';
2 3 import { FormSchema } from '/@/components/Form';
3 4
4 5 export const formSchemas: FormSchema[] = [
5 6 {
6   - field: NodeBindDataFieldEnum.NAME,
7   - component: 'Input',
8   - label: NodeBindDataFieldNameEnum.NAME,
  7 + field: PushToEdgeFieldsEnum.SCOPE,
  8 + component: 'Select',
  9 + label: PushToEdgeFieldsNameEnum.SCOPE,
  10 + required: true,
  11 + componentProps: {
  12 + options: Object.keys(ScopeEnum).map((value) => ({ label: ScopeNameEnum[value], value })),
  13 + getPopupContainer: () => document.body,
  14 + placeholder: `请选择${PushToEdgeFieldsNameEnum.SCOPE}`,
  15 + },
9 16 },
10 17 ];
... ...
1   -import { NodeBindDataFieldEnum, NodeBindDataFieldNameEnum } from '../../../enum/node';
  1 +import { RpcCallReplyFieldsEnum, RpcCallReplyFieldsNameEnum } from '../../../enum/formField/action';
2 2 import { FormSchema } from '/@/components/Form';
3 3
4 4 export const formSchemas: FormSchema[] = [
5 5 {
6   - field: NodeBindDataFieldEnum.NAME,
  6 + field: RpcCallReplyFieldsEnum.REQUEST_ID_META_DATA_ATTRIBUTE,
7 7 component: 'Input',
8   - label: NodeBindDataFieldNameEnum.NAME,
  8 + label: RpcCallReplyFieldsNameEnum.REQUEST_ID_META_DATA_ATTRIBUTE,
  9 + componentProps: {
  10 + placeholder: `请输入${RpcCallReplyFieldsNameEnum.REQUEST_ID_META_DATA_ATTRIBUTE}`,
  11 + },
9 12 },
10 13 ];
... ...
1   -import { NodeBindDataFieldEnum, NodeBindDataFieldNameEnum } from '../../../enum/node';
  1 +import {
  2 + RpcCallRequestFieldsEnum,
  3 + RpcCallRequestFieldsNameEnum,
  4 +} from '../../../enum/formField/action';
2 5 import { FormSchema } from '/@/components/Form';
3 6
4 7 export const formSchemas: FormSchema[] = [
5 8 {
6   - field: NodeBindDataFieldEnum.NAME,
7   - component: 'Input',
8   - label: NodeBindDataFieldNameEnum.NAME,
  9 + field: RpcCallRequestFieldsEnum.TIMEOUT_IN_SECONDS,
  10 + component: 'InputNumber',
  11 + label: RpcCallRequestFieldsNameEnum.TIMEOUT_IN_SECONDS,
  12 + required: true,
  13 + componentProps: {
  14 + min: 0,
  15 + placeholder: `请输入${RpcCallRequestFieldsNameEnum.TIMEOUT_IN_SECONDS}`,
  16 + },
9 17 },
10 18 ];
... ...
1   -import { NodeBindDataFieldEnum, NodeBindDataFieldNameEnum } from '../../../enum/node';
  1 +import { ScopeEnum, ScopeNameEnum } from '../../../enum/form';
  2 +import {
  3 + SaveAttributesFieldsEnum,
  4 + SaveAttributesFieldsNameEnum,
  5 +} from '../../../enum/formField/action';
2 6 import { FormSchema } from '/@/components/Form';
3 7
4 8 export const formSchemas: FormSchema[] = [
5 9 {
6   - field: NodeBindDataFieldEnum.NAME,
7   - component: 'Input',
8   - label: NodeBindDataFieldNameEnum.NAME,
  10 + field: SaveAttributesFieldsEnum.SCOPE,
  11 + component: 'Select',
  12 + label: SaveAttributesFieldsNameEnum.SCOPE,
  13 + required: true,
  14 + componentProps: {
  15 + options: Object.keys(ScopeEnum).map((value) => ({ label: ScopeNameEnum[value], value })),
  16 + getPopupContainer: () => document.body,
  17 + placeholder: `请选择${SaveAttributesFieldsNameEnum.SCOPE}`,
  18 + },
  19 + },
  20 + {
  21 + field: SaveAttributesFieldsEnum.NOTIFY_DEVICE,
  22 + component: 'Checkbox',
  23 + label: SaveAttributesFieldsNameEnum.NOTIFY_DEVICE,
  24 + renderComponentContent: () => ({
  25 + default: () =>
  26 + 'If the message arrives from the device, we will push it back to the device by default.',
  27 + }),
9 28 },
10 29 ];
... ...
1   -import { NodeBindDataFieldEnum, NodeBindDataFieldNameEnum } from '../../../enum/node';
  1 +import { SaveEventFieldsEnum, SaveEventFieldsNameEnum } from '../../../enum/formField/action';
2 2 import { FormSchema } from '/@/components/Form';
3 3
4 4 export const formSchemas: FormSchema[] = [
5 5 {
6   - field: NodeBindDataFieldEnum.NAME,
7   - component: 'Input',
8   - label: NodeBindDataFieldNameEnum.NAME,
  6 + field: SaveEventFieldsEnum.CONFIGURATION,
  7 + component: 'JSONEditor',
  8 + label: SaveEventFieldsNameEnum.CONFIGURATION,
  9 + valueField: 'value',
  10 + changeEvent: 'update:value',
9 11 },
10 12 ];
... ...
... ... @@ -3,6 +3,8 @@
3 3 import { BasicForm, useForm } from '/@/components/Form';
4 4 import { formSchemas } from './create.config';
5 5 import { NodeData } from '../../../types/node';
  6 + import { SaveEventFieldsEnum } from '../../../enum/formField/action';
  7 + import { useJsonParse } from '/@/hooks/business/useJsonParse';
6 8
7 9 defineProps<{
8 10 config: NodeData;
... ... @@ -16,12 +18,12 @@
16 18 const getValue: CreateModalDefineExposeType['getFieldsValue'] = async () => {
17 19 await validate();
18 20 const value = getFieldsValue() || {};
19   - return value;
  21 + return useJsonParse(value?.[SaveEventFieldsEnum.CONFIGURATION]).value || {};
20 22 };
21 23
22 24 const setValue: CreateModalDefineExposeType['setFieldsValue'] = (value) => {
23 25 resetFields();
24   - setFieldsValue(value);
  26 + setFieldsValue({ [SaveEventFieldsEnum.CONFIGURATION]: JSON.stringify(value, null, 2) });
25 27 };
26 28
27 29 defineExpose({
... ...
1   -import { NodeBindDataFieldEnum, NodeBindDataFieldNameEnum } from '../../../enum/node';
  1 +import {
  2 + SaveTimeseriesFieldsEnum,
  3 + SaveTimeseriesFieldsNameEnum,
  4 +} from '../../../enum/formField/action';
2 5 import { FormSchema } from '/@/components/Form';
3 6
4 7 export const formSchemas: FormSchema[] = [
5 8 {
6   - field: NodeBindDataFieldEnum.NAME,
7   - component: 'Input',
8   - label: NodeBindDataFieldNameEnum.NAME,
  9 + field: SaveTimeseriesFieldsEnum.DEFAULT_TTL,
  10 + component: 'InputNumber',
  11 + label: SaveTimeseriesFieldsNameEnum.DEFAULT_TTL,
  12 + required: true,
  13 + componentProps: {
  14 + min: 0,
  15 + placeholder: `请输入${SaveTimeseriesFieldsNameEnum.DEFAULT_TTL}`,
  16 + },
  17 + },
  18 + {
  19 + field: SaveTimeseriesFieldsEnum.SKIP_LATEST_PERSISTENCE,
  20 + component: 'Checkbox',
  21 + label: '',
  22 + renderComponentContent: () => ({
  23 + default: () => SaveTimeseriesFieldsNameEnum.DEFAULT_TTL,
  24 + }),
  25 + },
  26 + {
  27 + field: SaveTimeseriesFieldsEnum.USE_SERVER_TS,
  28 + component: 'Checkbox',
  29 + label: SaveTimeseriesFieldsNameEnum.USE_SERVER_TS,
  30 + renderComponentContent: () => ({
  31 + default: () =>
  32 + 'Enable this setting to use the timestamp of the message processing instead of the timestamp from the message. Useful for all sorts of sequential processing if you merge messages from multiple sources (devices, assets, etc).',
  33 + }),
9 34 },
10 35 ];
... ...
1   -import { NodeBindDataFieldEnum, NodeBindDataFieldNameEnum } from '../../../enum/node';
2   -import { FormSchema } from '/@/components/Form';
  1 +import {
  2 + SaveToCustomTableFieldsEnum,
  3 + SaveToCustomTableFieldsNameEnum,
  4 +} from '../../../enum/formField/action';
  5 +import { AttributeConfiguration } from '../../../src/components/AttributeConfiguration';
  6 +import { FormSchema, useComponentRegister } from '/@/components/Form';
  7 +import { isObject } from '/@/utils/is';
3 8
  9 +useComponentRegister('AttributeConfiguration', AttributeConfiguration);
4 10 export const formSchemas: FormSchema[] = [
5 11 {
6   - field: NodeBindDataFieldEnum.NAME,
  12 + field: SaveToCustomTableFieldsEnum.TABLE_NAME,
7 13 component: 'Input',
8   - label: NodeBindDataFieldNameEnum.NAME,
  14 + label: SaveToCustomTableFieldsNameEnum.TABLE_NAME,
  15 + required: true,
  16 + componentProps: {
  17 + placeholder: `请输入${SaveToCustomTableFieldsEnum.TABLE_NAME}`,
  18 + },
  19 + },
  20 + {
  21 + field: SaveToCustomTableFieldsEnum.FIELDS_MAPPING,
  22 + component: 'AttributeConfiguration',
  23 + label: SaveToCustomTableFieldsNameEnum.FIELDS_MAPPING,
  24 + required: true,
  25 + valueField: 'value',
  26 + changeEvent: 'update:value',
  27 + rules: [
  28 + {
  29 + required: true,
  30 + validator(_rule, value) {
  31 + console.log(value);
  32 + if (!isObject(value) || !Object.keys(value).length)
  33 + return Promise.reject('至少应该指定一个字段映射。');
  34 + return Promise.resolve();
  35 + },
  36 + },
  37 + ],
  38 + slot: SaveToCustomTableFieldsEnum.FIELDS_MAPPING,
9 39 },
10 40 ];
... ...
... ... @@ -3,11 +3,16 @@
3 3 import { BasicForm, useForm } from '/@/components/Form';
4 4 import { formSchemas } from './create.config';
5 5 import { NodeData } from '../../../types/node';
  6 + import { AttributeConfiguration } from '../../../src/components/AttributeConfiguration';
  7 + import { ref, unref } from 'vue';
  8 + import { SaveToCustomTableFieldsEnum } from '../../../enum/formField/action';
6 9
7 10 defineProps<{
8 11 config: NodeData;
9 12 }>();
10 13
  14 + const attributeConfigurationElRef = ref<Nullable<InstanceType<typeof AttributeConfiguration>>>();
  15 +
11 16 const [register, { validate, getFieldsValue, setFieldsValue, resetFields }] = useForm({
12 17 schemas: formSchemas,
13 18 showActionButtonGroup: false,
... ... @@ -15,13 +20,21 @@
15 20
16 21 const getValue: CreateModalDefineExposeType['getFieldsValue'] = async () => {
17 22 await validate();
  23 + await unref(attributeConfigurationElRef)?.validate();
18 24 const value = getFieldsValue() || {};
19   - return value;
  25 + const fieldsValue = unref(attributeConfigurationElRef)?.getFieldsValue();
  26 + return {
  27 + [SaveToCustomTableFieldsEnum.TABLE_NAME]: value?.[SaveToCustomTableFieldsEnum.TABLE_NAME],
  28 + [SaveToCustomTableFieldsEnum.FIELDS_MAPPING]: fieldsValue,
  29 + };
20 30 };
21 31
22 32 const setValue: CreateModalDefineExposeType['setFieldsValue'] = (value) => {
23 33 resetFields();
24 34 setFieldsValue(value);
  35 + unref(attributeConfigurationElRef)?.setFieldsValue(
  36 + value?.[SaveToCustomTableFieldsEnum.FIELDS_MAPPING]
  37 + );
25 38 };
26 39
27 40 defineExpose({
... ... @@ -31,5 +44,14 @@
31 44 </script>
32 45
33 46 <template>
34   - <BasicForm @register="register" />
  47 + <BasicForm @register="register">
  48 + <template #fieldsMapping="{ field, model }">
  49 + <AttributeConfiguration
  50 + ref="attributeConfigurationElRef"
  51 + v-model:value="model[field]"
  52 + keyLabel="Message field"
  53 + valueLabel="Table column"
  54 + />
  55 + </template>
  56 + </BasicForm>
35 57 </template>
... ...
1   -import { NodeBindDataFieldEnum, NodeBindDataFieldNameEnum } from '../../../enum/node';
2 1 import { FormSchema } from '/@/components/Form';
3 2
4   -export const formSchemas: FormSchema[] = [
5   - {
6   - field: NodeBindDataFieldEnum.NAME,
7   - component: 'Input',
8   - label: NodeBindDataFieldNameEnum.NAME,
9   - },
10   -];
  3 +export const formSchemas: FormSchema[] = [];
... ...
1   -import { NodeBindDataFieldEnum, NodeBindDataFieldNameEnum } from '../../../enum/node';
2 1 import { FormSchema } from '/@/components/Form';
3 2
4   -export const formSchemas: FormSchema[] = [
5   - {
6   - field: NodeBindDataFieldEnum.NAME,
7   - component: 'Input',
8   - label: NodeBindDataFieldNameEnum.NAME,
9   - },
10   -];
  3 +export const formSchemas: FormSchema[] = [];
... ...
1   -import { NodeBindDataFieldEnum, NodeBindDataFieldNameEnum } from '../../../enum/node';
  1 +import {
  2 + UnassignFromCustomerFieldsEnum,
  3 + UnassignFromCustomerFieldsNameEnum,
  4 +} from '../../../enum/formField/action';
  5 +
2 6 import { FormSchema } from '/@/components/Form';
3 7
4 8 export const formSchemas: FormSchema[] = [
5 9 {
6   - field: NodeBindDataFieldEnum.NAME,
  10 + field: UnassignFromCustomerFieldsEnum.CUSTOMER_NAME_PATTERN,
  11 + label: UnassignFromCustomerFieldsNameEnum.CUSTOMER_NAME_PATTERN,
7 12 component: 'Input',
8   - label: NodeBindDataFieldNameEnum.NAME,
  13 + required: true,
  14 + helpMessage: [
  15 + 'Hint: use ${metadataKey} for value from metadata, $[messageKey] for value from message body',
  16 + ],
  17 + componentProps: {
  18 + placeholder: `请输入${UnassignFromCustomerFieldsNameEnum.CUSTOMER_NAME_PATTERN}`,
  19 + },
  20 + },
  21 + {
  22 + field: UnassignFromCustomerFieldsEnum.CUSTOMER_CACHE_EXPIRATION,
  23 + component: 'InputNumber',
  24 + label: UnassignFromCustomerFieldsNameEnum.CUSTOMER_CACHE_EXPIRATION,
  25 + required: true,
  26 + helpMessage: [
  27 + 'Specifies maximum time interval allowed to store found customer records. 0 value means that records will never expire.',
  28 + ],
  29 + componentProps: {
  30 + min: 0,
  31 + placeholder: `请输入${UnassignFromCustomerFieldsNameEnum.CUSTOMER_CACHE_EXPIRATION}`,
  32 + },
9 33 },
10 34 ];
... ...