Browse Source

Edge events with translations

pull/3957/head
Artem Babak 6 years ago
parent
commit
790da527f4
  1. 123
      ui/src/app/common/types.constant.js
  2. 4
      ui/src/app/event/event-row-edge-event.tpl.html
  3. 18
      ui/src/app/event/event-table.directive.js
  4. 12
      ui/src/app/locale/locale.constant-en_US.json

123
ui/src/app/common/types.constant.js

@ -1076,6 +1076,127 @@ export default angular.module('thingsboard.types', [])
},
translate: {
customTranslationsPrefix: "custom."
}
},
edgeEventActionType: {
"ADDED": {
name: "audit-log.type-added"
},
"DELETED": {
name: "audit-log.type-deleted"
},
"UPDATED": {
name: "audit-log.type-updated"
},
"ATTRIBUTES_UPDATED": {
name: "audit-log.type-attributes-updated"
},
"ATTRIBUTES_DELETED": {
name: "audit-log.type-attributes-deleted"
},
"RPC_CALL": {
name: "audit-log.type-rpc-call"
},
"CREDENTIALS_UPDATED": {
name: "audit-log.type-credentials-updated"
},
"RELATION_ADD_OR_UPDATE": {
name: "audit-log.type-relation-add-or-update"
},
"RELATION_DELETED": {
name: "audit-log.type-relation-delete"
},
"ALARM_ACK": {
name: "audit-log.type-alarm-ack"
},
"ALARM_CLEAR": {
name: "audit-log.type-alarm-clear"
},
"CREDENTIALS_REQUEST": {
name: "edge.credentials-request"
},
"ATTRIBUTES_REQUEST": {
name: "edge.attributes-request"
},
"TIMESERIES_UPDATED": {
name: "edge.timeseries-updated"
},
"RELATION_REQUEST": {
name: "edge.relation-request"
},
"RULE_CHAIN_METADATA_REQUEST": {
name: "edge.rule-chain-metadata-request"
},
"GROUP_ENTITIES_REQUEST": {
name: "edge.group_entities_request"
},
"GROUP_PERMISSIONS_REQUEST": {
name: "edge.group-permissions-request"
},
"ASSIGNED_TO_EDGE": {
name: "audit-log.type-assigned-to-edge"
},
"UNASSIGNED_FROM_EDGE": {
name: "audit-log.type-unassigned-from-edge"
}
},
edgeEventTypeTranslations:{
"DASHBOARD": {
name: "entity.type-dashboard"
},
"ASSET": {
name: "entity.type-asset"
},
"DEVICE": {
name: "entity.type-device"
},
"ENTITY_VIEW": {
name: "entity.type-entity_view"
},
"ALARM": {
name: "entity.type-alarm"
},
"RULE_CHAIN": {
name: "entity.type-rulechain"
},
"RULE_CHAIN_META_DATA": {
name: "entity.type-rule-chain-metadata"
},
"EDGE": {
name: "entity.type-edge"
},
"USER": {
name: "entity.type-user"
},
"CUSTOMER": {
name: "entity.type-customer"
},
"RELATION": {
name: "entity.type-relation"
},
"ENTITY_GROUP": {
name: "entity.type-entity-group"
},
"SCHEDULER_EVENT": {
name: "entity.type-scheduler-event"
},
"WHITE_LABELING": {
name: "white-labeling.white-labeling"
},
"LOGIN_WHITE_LABELING": {
name: "white-labeling.login-white-labeling"
},
"CUSTOM_TRANSLATION": {
name: "custom-translation.custom-translation",
},
"WIDGETS_BUNDLE": {
name: "widget.widget-bundle"
},
"WIDGET_TYPE": {
name: "widget.type"
},
"ADMIN_SETTINGS": {
name: "permission.resource.display-type.ADMIN_SETTINGS"
}
},
}
).name;

4
ui/src/app/event/event-row-edge-event.tpl.html

@ -16,8 +16,8 @@
-->
<div class="tb-cell" flex="20">{{ event.createdTime | date : 'yyyy-MM-dd HH:mm:ss' }}</div>
<div class="tb-cell" flex="20">{{ event.type }}</div>
<div class="tb-cell" flex="40">{{ event.action }}</div>
<div class="tb-cell" flex="20">{{ event.edgeEventTypeText }}</div>
<div class="tb-cell" flex="40">{{ event.edgeEventActionText }}</div>
<div class="tb-cell" flex="20">{{ event.entityId }}</div>
<div class="tb-cell" flex="15" ng-style="{'color': statusColor}">{{ updateStatus(event.createdTime) }}</div>
<div class="tb-cell" flex="10">

18
ui/src/app/event/event-table.directive.js

@ -22,7 +22,7 @@ import eventTableTemplate from './event-table.tpl.html';
/* eslint-enable import/no-unresolved, import/default */
/*@ngInject*/
export default function EventTableDirective($compile, $templateCache, $rootScope, types,
export default function EventTableDirective($compile, $templateCache, $rootScope, $translate, types,
eventService, edgeService, attributeService) {
var linker = function (scope, element, attrs) {
@ -118,7 +118,11 @@ export default function EventTableDirective($compile, $templateCache, $rootScope
scope.events.pending = true;
promise.then(
function success(events) {
scope.events.data = scope.events.data.concat(events.data);
if (scope.eventType === types.eventType.edgeEvent.value) {
scope.events.data = scope.events.data.concat(prepareEdgeEventData(events.data));
} else {
scope.events.data = scope.events.data.concat(events.data);
}
scope.events.nextPageLink = events.nextPageLink;
scope.events.hasNext = events.hasNext;
if (scope.events.hasNext) {
@ -266,6 +270,16 @@ export default function EventTableDirective($compile, $templateCache, $rootScope
$compile(element.contents())(scope);
}
function prepareEdgeEventData(data) {
data.forEach(
edgeEvent => {
edgeEvent.edgeEventActionText = $translate.instant(types.edgeEventActionType[edgeEvent.action].name);
edgeEvent.edgeEventTypeText = $translate.instant(types.edgeEventTypeTranslations[edgeEvent.edgeId.entityType].name);
}
);
return data;
}
return {
restrict: "E",

12
ui/src/app/locale/locale.constant-en_US.json

@ -854,7 +854,17 @@
"edge-type-list-empty": "No edge types selected.",
"edge-types": "Edge types",
"license-key-hint": "To obtain your license please navigate to the <a href='https://thingsboard.io/pricing/?active=thingsboard-edge' target='_blank'>pricing page</a> and select the best license option for your case.",
"cloud-endpoint-hint": "Edge requires HTTP(s) access to Cloud (ThingsBoard CE/PE) to verify the license key. Please specify Cloud URL that Edge is able to connect to."
"cloud-endpoint-hint": "Edge requires HTTP(s) access to Cloud (ThingsBoard CE/PE) to verify the license key. Please specify Cloud URL that Edge is able to connect to.",
"set-edge-template-root-rulechain": "Make rule chain edge template root",
"set-edge-template-root-rulechain-title": "Are you sure you want to make the rule chain '{{ruleChainName}}' edge template root?",
"set-edge-template-root-rulechain-text": "After the confirmation the rule chain will become edge template root and will be root rule chain for a newly created edges.",
"set-auto-assign-to-edge": "Assign rule chain to edge(s) on creation",
"set-auto-assign-to-edge-title": "Are you sure you want to assign the edge rule chain '{{ruleChainName}}' to edge(s) on creation?",
"set-auto-assign-to-edge-text": "After the confirmation the edge rule chain will be automatically assigned to edge(s) on creation.",
"unset-auto-assign-to-edge": "Unset assign rule chain to edge(s) on creation",
"unset-auto-assign-to-edge-title": "Are you sure you want to unset assign the edge rule chain '{{ruleChainName}}' to edge(s) on creation?",
"unset-auto-assign-to-edge-text": "After the confirmation the edge rule chain will no longer be automatically assigned to edge(s) on creation."
},
"error": {
"unable-to-connect": "Unable to connect to the server! Please check your internet connection.",

Loading…
Cancel
Save