action.ts 13 KB
import { useI18n } from '/@/hooks/web/useI18n';

const { t } = useI18n() as any; //加载国际化

// Assign to customer
export enum AssignToCustomerFieldsEnum {
  CUSTOMER_NAME_PATTERN = 'customerNamePattern',
  CREATE_CUSTOMER_IF_NOT_EXISTS = 'createCustomerIfNotExists',
  CUSTOMER_CACHE_EXPIRATION = 'customerCacheExpiration',
}

export enum AssignToCustomerFieldsNameEnum {
  CUSTOMER_NAME_PATTERN = t(
    'designer_form_label.actions.index.AssignToCustomerFieldsNameEnum.CUSTOMER_NAME_PATTERN'
  ),
  CREATE_CUSTOMER_IF_NOT_EXISTS = t(
    'designer_form_label.actions.index.AssignToCustomerFieldsNameEnum.CREATE_CUSTOMER_IF_NOT_EXISTS'
  ),
  CUSTOMER_CACHE_EXPIRATION = t(
    'designer_form_label.actions.index.AssignToCustomerFieldsNameEnum.CUSTOMER_CACHE_EXPIRATION'
  ),
}

// clear alarm
export enum ClearAlarmFieldsEnum {
  ALARM_TYPE = 'alarmType',
  ALARM_DETAILS_BUILD_JS = 'alarmDetailsBuildJs',
}

export enum ClearAlarmFieldsNameEnum {
  ALARM_TYPE = t('designer_form_label.actions.index.ClearAlarmFieldsNameEnum.ALARM_TYPE'),
  ALARM_DETAILS_BUILD_JS = t(
    'designer_form_label.actions.index.ClearAlarmFieldsNameEnum.ALARM_DETAILS_BUILD_JS'
  ),
}

// Create alarm
export enum CreateAlarmFieldsEnum {
  ALARM_DETAILS_BUILD_JS = 'alarmDetailsBuildJs',
  USE_MESSAGE_ALARM_DATA = 'useMessageAlarmData',
  OVERWRITE_ALARM_DETAILS = 'overwriteAlarmDetails',
  ALARM_TYPE = 'alarmType',
  SEVERITY = 'severity',
  PROPAGATE = 'propagate',
  RELATION_TYPES = 'relationTypes',
  PROPAGATE_TO_OWNER = 'propagateToOwner',
  PROPAGATE_TO_TENANT = 'propagateToTenant',
  DYNAMIC_SEVERITY = 'dynamicSeverity',
}

export enum CreateAlarmFieldsNameEnum {
  ALARM_DETAILS_BUILD_JS = t(
    'designer_form_label.actions.index.CreateAlarmFieldsNameEnum.ALARM_DETAILS_BUILD_JS'
  ),
  USE_MESSAGE_ALARM_DATA = t(
    'designer_form_label.actions.index.CreateAlarmFieldsNameEnum.USE_MESSAGE_ALARM_DATA'
  ),
  OVERWRITE_ALARM_DETAILS = t(
    'designer_form_label.actions.index.CreateAlarmFieldsNameEnum.OVERWRITE_ALARM_DETAILS'
  ),
  ALARM_TYPE = t('designer_form_label.actions.index.CreateAlarmFieldsNameEnum.ALARM_TYPE'),
  SEVERITY = t('designer_form_label.actions.index.CreateAlarmFieldsNameEnum.SEVERITY'),
  PROPAGATE = t('designer_form_label.actions.index.CreateAlarmFieldsNameEnum.PROPAGATE'),
  RELATION_TYPES = t('designer_form_label.actions.index.CreateAlarmFieldsNameEnum.RELATION_TYPES'),
  PROPAGATE_TO_OWNER = t(
    'designer_form_label.actions.index.CreateAlarmFieldsNameEnum.PROPAGATE_TO_OWNER'
  ),
  PROPAGATE_TO_TENANT = t(
    'designer_form_label.actions.index.CreateAlarmFieldsNameEnum.PROPAGATE_TO_TENANT'
  ),
  DYNAMIC_SEVERITY = t(
    'designer_form_label.actions.index.CreateAlarmFieldsNameEnum.DYNAMIC_SEVERITY'
  ),
}

// Create relation
export enum CreateRelationFieldsEnum {
  DIRECTION = 'direction',
  ENTITY_TYPE = 'entityType',
  ENTITY_NAME_PATTERN = 'entityNamePattern',
  ENTITY_TYPE_PATTERN = 'entityTypePattern',
  RELATION_TYPE = 'relationType',
  CREATE_ENTITY_IF_NOT_EXISTS = 'createEntityIfNotExists',
  REMOVE_CURRENT_RELATIONS = 'removeCurrentRelations',
  CHANGE_ORIGINATOR_TO_RELATED_ENTITY = 'changeOriginatorToRelatedEntity',
  ENTITY_CACHE_EXPIRATION = 'entityCacheExpiration',
}

export enum CreateRelationFieldsNameEnum {
  DIRECTION = t('designer_form_label.actions.index.CreateRelationFieldsNameEnum.DIRECTION'),
  ENTITY_TYPE = t('designer_form_label.actions.index.CreateRelationFieldsNameEnum.ENTITY_TYPE'),
  ENTITY_NAME_PATTERN = t(
    'designer_form_label.actions.index.CreateRelationFieldsNameEnum.ENTITY_NAME_PATTERN'
  ),
  ENTITY_TYPE_PATTERN = t(
    'designer_form_label.actions.index.CreateRelationFieldsNameEnum.ENTITY_TYPE_PATTERN'
  ),
  RELATION_TYPE = t('designer_form_label.actions.index.CreateRelationFieldsNameEnum.RELATION_TYPE'),
  CREATE_ENTITY_IF_NOT_EXISTS = t(
    'designer_form_label.actions.index.CreateRelationFieldsNameEnum.CREATE_ENTITY_IF_NOT_EXISTS'
  ),
  REMOVE_CURRENT_RELATIONS = t(
    'designer_form_label.actions.index.CreateRelationFieldsNameEnum.REMOVE_CURRENT_RELATIONS'
  ),
  CHANGE_ORIGINATOR_TO_RELATED_ENTITY = t(
    'designer_form_label.actions.index.CreateRelationFieldsNameEnum.CHANGE_ORIGINATOR_TO_RELATED_ENTITY'
  ),
  ENTITY_CACHE_EXPIRATION = t(
    'designer_form_label.actions.index.CreateRelationFieldsNameEnum.ENTITY_CACHE_EXPIRATION'
  ),
}

// Delay deprecated
export enum DelayDeprecatedFieldsEnum {
  USE_METADATA_PERIOD_IN_SECONDS_PATTERNS = 'useMetadataPeriodInSecondsPatterns',
  PERIOD_IN_SECONDS = 'periodInSeconds',
  PERIOD_IN_SECONDS_PATTERN = 'periodInSecondsPattern',
  MAX_PENDING_MSGS = 'maxPendingMsgs',
}

export enum DelayDeprecatedFieldsNameEnum {
  USE_METADATA_PERIOD_IN_SECONDS_PATTERNS = t(
    'designer_form_label.actions.index.DelayDeprecatedFieldsNameEnum.USE_METADATA_PERIOD_IN_SECONDS_PATTERNS'
  ),
  PERIOD_IN_SECONDS = t(
    'designer_form_label.actions.index.DelayDeprecatedFieldsNameEnum.PERIOD_IN_SECONDS'
  ),
  PERIOD_IN_SECONDS_PATTERN = t(
    'designer_form_label.actions.index.DelayDeprecatedFieldsNameEnum.PERIOD_IN_SECONDS_PATTERN'
  ),
  MAX_PENDING_MSGS = t(
    'designer_form_label.actions.index.DelayDeprecatedFieldsNameEnum.MAX_PENDING_MSGS'
  ),
}

export enum DeleteRelationFieldsEnum {
  DELETE_FOR_SINGLE_ENTITY = 'deleteForSingleEntity',
  DIRECTION = 'direction',
  ENTITY_TYPE = 'entityType',
  ENTITY_NAME_PATTERN = 'entityNamePattern',
  RELATION_TYPE = 'relationType',
  ENTITY_CACHE_EXPIRATION = 'entityCacheExpiration',
}

export enum DeleteRelationFieldsNameEnum {
  DELETE_FOR_SINGLE_ENTITY = t(
    'designer_form_label.actions.index.DeleteRelationFieldsNameEnum.DELETE_FOR_SINGLE_ENTITY'
  ),
  DIRECTION = t('designer_form_label.actions.index.DeleteRelationFieldsNameEnum.DIRECTION'),
  ENTITY_TYPE = t('designer_form_label.actions.index.DeleteRelationFieldsNameEnum.ENTITY_TYPE'),
  ENTITY_NAME_PATTERN = t(
    'designer_form_label.actions.index.DeleteRelationFieldsNameEnum.ENTITY_NAME_PATTERN'
  ),
  RELATION_TYPE = t('designer_form_label.actions.index.DeleteRelationFieldsNameEnum.RELATION_TYPE'),
  ENTITY_CACHE_EXPIRATION = t(
    'designer_form_label.actions.index.DeleteRelationFieldsNameEnum.ENTITY_CACHE_EXPIRATION'
  ),
}

// device profile
export enum DeviceProfileFieldsEnum {
  PERSIST_ALARM_RULES_STATE = 'persistAlarmRulesState',
  FETCH_ALARM_RULES_STATE_ON_START = 'fetchAlarmRulesStateOnStart',
}

export enum DeviceProfileFieldsNameEnum {
  PERSIST_ALARM_RULES_STATE = t(
    'designer_form_label.actions.index.DeviceProfileFieldsNameEnum.PERSIST_ALARM_RULES_STATE'
  ),
  FETCH_ALARM_RULES_STATE_ON_START = t(
    'designer_form_label.actions.index.DeviceProfileFieldsNameEnum.FETCH_ALARM_RULES_STATE_ON_START'
  ),
}

// Generator
export enum GeneratorFieldsEnum {
  MSG_COUNT = 'msgCount',
  PERIOD_IN_SECONDS = 'periodInSeconds',
  JS_SCRIPT = 'jsScript',
  ORIGINATOR_ID = 'originatorId',
  ORIGINATOR_TYPE = 'originatorType',
}

export enum GeneratorFieldsNameEnum {
  MSG_COUNT = t('designer_form_label.actions.index.GeneratorFieldsNameEnum.MSG_COUNT'),
  PERIOD_IN_SECONDS = t(
    'designer_form_label.actions.index.GeneratorFieldsNameEnum.PERIOD_IN_SECONDS'
  ),
  JS_SCRIPT = t('designer_form_label.actions.index.GeneratorFieldsNameEnum.JS_SCRIPT'),
  // ORIGINATOR_ID = '资产',
  ORIGINATOR_TYPE = t('designer_form_label.actions.index.GeneratorFieldsNameEnum.ORIGINATOR_TYPE'),
}

// Gps geofencing events
export enum GpsGeofencingEventsFieldsEnum {
  LATITUDE_KEY_NAME = 'latitudeKeyName',
  LONGITUDE_KEY_NAME = 'longitudeKeyName',
  PERIMETER_TYPE = 'perimeterType',
  FETCH_PERIMETER_INFO_FROM_MESSAGE_METADATA = 'fetchPerimeterInfoFromMessageMetadata',
  PERIMETER_KEY_NAME = 'perimeterKeyName',
  CENTER_LATITUDE = 'centerLatitude',
  CENTER_LONGITUDE = 'centerLongitude',
  RANGE = 'range',
  RANGE_UNIT = 'rangeUnit',
  POLYGONS_DEFINITION = 'polygonsDefinition',
  MIN_INSIDE_DURATION = 'minInsideDuration',
  MIN_INSIDE_DURATION_TIME_UNIT = 'minInsideDurationTimeUnit',
  MIN_OUTSIDE_DURATION = 'minOutsideDuration',
  MIN_OUTSIDE_DURATION_TIME_UNIT = 'minOutsideDurationTimeUnit',
}

export enum GpsGeofencingEventsFieldsNameEnum {
  LATITUDE_KEY_NAME = t(
    'designer_form_label.actions.index.GpsGeofencingEventsFieldsNameEnum.LATITUDE_KEY_NAME'
  ),
  LONGITUDE_KEY_NAME = t(
    'designer_form_label.actions.index.GpsGeofencingEventsFieldsNameEnum.LONGITUDE_KEY_NAME'
  ),
  PERIMETER_TYPE = t(
    'designer_form_label.actions.index.GpsGeofencingEventsFieldsNameEnum.PERIMETER_TYPE'
  ),
  FETCH_PERIMETER_INFO_FROM_MESSAGE_METADATA = t(
    'designer_form_label.actions.index.GpsGeofencingEventsFieldsNameEnum.FETCH_PERIMETER_INFO_FROM_MESSAGE_METADATA'
  ),
  PERIMETER_KEY_NAME = t(
    'designer_form_label.actions.index.GpsGeofencingEventsFieldsNameEnum.PERIMETER_KEY_NAME'
  ),
  CENTER_LATITUDE = t(
    'designer_form_label.actions.index.GpsGeofencingEventsFieldsNameEnum.CENTER_LATITUDE'
  ),
  CENTER_LONGITUDE = t(
    'designer_form_label.actions.index.GpsGeofencingEventsFieldsNameEnum.CENTER_LONGITUDE'
  ),
  RANGE = t('designer_form_label.actions.index.GpsGeofencingEventsFieldsNameEnum.RANGE'),
  RANGE_UNIT = t('designer_form_label.actions.index.GpsGeofencingEventsFieldsNameEnum.RANGE_UNIT'),
  POLYGONS_DEFINITION = t(
    'designer_form_label.actions.index.GpsGeofencingEventsFieldsNameEnum.POLYGONS_DEFINITION'
  ),
  MIN_INSIDE_DURATION = t(
    'designer_form_label.actions.index.GpsGeofencingEventsFieldsNameEnum.MIN_INSIDE_DURATION'
  ),
  MIN_INSIDE_DURATION_TIME_UNIT = t(
    'designer_form_label.actions.index.GpsGeofencingEventsFieldsNameEnum.MIN_INSIDE_DURATION_TIME_UNIT'
  ),
  MIN_OUTSIDE_DURATION = t(
    'designer_form_label.actions.index.GpsGeofencingEventsFieldsNameEnum.MIN_OUTSIDE_DURATION'
  ),
  MIN_OUTSIDE_DURATION_TIME_UNIT = t(
    'designer_form_label.actions.index.GpsGeofencingEventsFieldsNameEnum.MIN_OUTSIDE_DURATION_TIME_UNIT'
  ),
}

// Log
export enum LogFieldsEnum {
  JS_SCRIPT = 'jsScript',
}

export enum LogFieldsNameEnum {
  JS_SCRIPT = t('designer_form_label.actions.index.LogFieldsNameEnum.JS_SCRIPT'),
}

// Message Count
export enum MessageCountFieldsEnum {
  INTERVAL = 'interval',
  TELEMETRY_PREFIX = 'telemetryPrefix',
}

export enum MessageCountFieldsNameEnum {
  INTERVAL = t('designer_form_label.actions.index.MessageCountFieldsNameEnum.INTERVAL'),
  TELEMETRY_PREFIX = t(
    'designer_form_label.actions.index.MessageCountFieldsNameEnum.TELEMETRY_PREFIX'
  ),
}

// Push to edge
export enum PushToEdgeFieldsEnum {
  SCOPE = 'scope',
}

export enum PushToEdgeFieldsNameEnum {
  SCOPE = t('designer_form_label.actions.index.PushToEdgeFieldsNameEnum.SCOPE'),
}
// Rpc call reply
export enum RpcCallReplyFieldsEnum {
  REQUEST_ID_META_DATA_ATTRIBUTE = 'requestIdMetaDataAttribute',
}

export enum RpcCallReplyFieldsNameEnum {
  REQUEST_ID_META_DATA_ATTRIBUTE = t(
    'designer_form_label.actions.index.RpcCallReplyFieldsNameEnum.REQUEST_ID_META_DATA_ATTRIBUTE'
  ),
}

// Rpc call request
export enum RpcCallRequestFieldsEnum {
  TIMEOUT_IN_SECONDS = 'timeoutInSeconds',
}

export enum RpcCallRequestFieldsNameEnum {
  TIMEOUT_IN_SECONDS = t(
    'designer_form_label.actions.index.RpcCallRequestFieldsNameEnum.TIMEOUT_IN_SECONDS'
  ),
}

// Save attribute
export enum SaveAttributesFieldsEnum {
  NOTIFY_DEVICE = 'notifyDevice',
  SCOPE = 'scope',
}

export enum SaveAttributesFieldsNameEnum {
  NOTIFY_DEVICE = t('designer_form_label.actions.index.SaveAttributesFieldsNameEnum.NOTIFY_DEVICE'),
  SCOPE = t('designer_form_label.actions.index.SaveAttributesFieldsNameEnum.SCOPE'),
}

// Save event
export enum SaveEventFieldsEnum {
  CONFIGURATION = 'CONFIGURATION',
}

export enum SaveEventFieldsNameEnum {
  CONFIGURATION = t('designer_form_label.actions.index.SaveEventFieldsNameEnum.CONFIGURATION'),
}

// Save timeseries
export enum SaveTimeseriesFieldsEnum {
  DEFAULT_TTL = 'defaultTTL',
  SKIP_LATEST_PERSISTENCE = 'skipLatestPersistence',
  USE_SERVER_TS = 'useServerTs',
}

export enum SaveTimeseriesFieldsNameEnum {
  DEFAULT_TTL = t('designer_form_label.actions.index.SaveTimeseriesFieldsNameEnum.DEFAULT_TTL'),
  SKIP_LATEST_PERSISTENCE = t(
    'designer_form_label.actions.index.SaveTimeseriesFieldsNameEnum.SKIP_LATEST_PERSISTENCE'
  ),
  USE_SERVER_TS = t('designer_form_label.actions.index.SaveTimeseriesFieldsNameEnum.USE_SERVER_TS'),
}

// save to custom table
export enum SaveToCustomTableFieldsEnum {
  FIELDS_MAPPING = 'fieldsMapping',
  TABLE_NAME = 'tableName',
}

export enum SaveToCustomTableFieldsNameEnum {
  FIELDS_MAPPING = t(
    'designer_form_label.actions.index.SaveToCustomTableFieldsNameEnum.FIELDS_MAPPING'
  ),
  TABLE_NAME = t('designer_form_label.actions.index.SaveToCustomTableFieldsNameEnum.TABLE_NAME'),
}

// Unassign from customer
export enum UnassignFromCustomerFieldsEnum {
  CUSTOMER_NAME_PATTERN = 'customerNamePattern',
  CUSTOMER_CACHE_EXPIRATION = 'customerCacheExpiration',
}

export enum UnassignFromCustomerFieldsNameEnum {
  CUSTOMER_NAME_PATTERN = t(
    'designer_form_label.actions.index.UnassignFromCustomerFieldsNameEnum.CUSTOMER_NAME_PATTERN'
  ),
  CUSTOMER_CACHE_EXPIRATION = t(
    'designer_form_label.actions.index.UnassignFromCustomerFieldsNameEnum.CUSTOMER_CACHE_EXPIRATION'
  ),
}