index.ts 1.45 KB
import { EnrichmentCategoryComponentEnum } from '../../../enum/category';
import { useCreateNodeKey } from '../../../hook/useCreateNodeKey';
import type { NodeItemConfigType } from '../../../types/node';
import { RuleNodeTypeEnum } from '../../index.type';
import { useI18n } from '/@/hooks/web/useI18n';

const keys = useCreateNodeKey(EnrichmentCategoryComponentEnum.ORIGINATOR_FIELDS);

const { t } = useI18n(); //加载国际化
export interface OriginatorFieldsDataType {
  someConfiguration?: Recordable;
}

export const OriginatorFieldsConfig: NodeItemConfigType = {
  ...keys,
  clazz: 'org.thingsboard.rule.engine.metadata.TbGetOriginatorFieldsNode',
  categoryType: RuleNodeTypeEnum.ENRICHMENT,
  name: t('designer_config.enrichments.index.originatorFields.name'),
  configurationDescriptor: {
    nodeDefinition: {
      details: t('designer_config.enrichments.index.originatorFields.details'),
      description: t('designer_config.enrichments.index.originatorFields.description'),
      inEnabled: true,
      outEnabled: true,
      relationTypes: ['Success', 'Failure'],
      customRelations: false,
      ruleChainNode: false,
      defaultConfiguration: {
        fieldsMapping: {
          name: 'originatorName',
          type: 'originatorType',
        },
      },
      uiResources: ['static/rulenode/rulenode-core-config.js'],
      configDirective: 'tbEnrichmentNodeOriginatorFieldsConfig',
      icon: '',
      iconUrl: '',
      docUrl: '',
    },
  },
};