EdgeEvents: added toast.showError() for deleted entities

This commit is contained in:
deaflynx 2020-07-21 11:56:19 +03:00
parent 8c9aa0c8df
commit 0961c24a35
3 changed files with 39 additions and 18 deletions

View File

@ -389,6 +389,19 @@ export default angular.module('thingsboard.types', [])
customer: "CUSTOMER", customer: "CUSTOMER",
relation: "RELATION" relation: "RELATION"
}, },
edgeEventAction: {
updated: "UPDATED",
added: "ADDED",
assignedToEdge: "ASSIGNED_TO_EDGE",
deleted: "DELETED",
unassignedFromEdge: "UNASSIGNED_FROM_EDGE",
alarmAck: "ALARM_ACK",
alarmClear: "ALARM_CLEAR",
credentialsUpdated: "CREDENTIALS_UPDATED",
attributesUpdated: "ATTRIBUTES_UPDATED",
attributesDeleted: "ATTRIBUTES_DELETED",
timeseriesUpdated: "TIMESERIES_UPDATED"
},
importEntityColumnType: { importEntityColumnType: {
name: { name: {
name: 'import.column-type.name', name: 'import.column-type.name',

View File

@ -102,24 +102,28 @@ export default function EventRowDirective($compile, $templateCache, $mdDialog, $
switch(scope.event.edgeEventType) { switch(scope.event.edgeEventType) {
case types.edgeEventType.relation: case types.edgeEventType.relation:
content = angular.toJson(scope.event.entityBody); content = angular.toJson(scope.event.entityBody);
showDialog();
break; break;
case types.edgeEventType.ruleChainMetaData: case types.edgeEventType.ruleChainMetaData:
content = ruleChainService.getRuleChainMetaData(scope.event.entityId, {}).then( content = ruleChainService.getRuleChainMetaData(scope.event.entityId, {ignoreErrors: true}).then(
function success(info) { function success(info) {
showDialog();
return angular.toJson(info); return angular.toJson(info);
}, function fail() { }, function fail() {
toast.showError($translate.instant('edge.load-entity-error')); showError();
}); });
break; break;
default: default:
content = entityService.getEntity(scope.event.edgeEventType, scope.event.entityId, {}).then( content = entityService.getEntity(scope.event.edgeEventType, scope.event.entityId, {ignoreLoading: true, ignoreErrors: true}).then(
function success(info) { function success(info) {
showDialog();
return angular.toJson(info); return angular.toJson(info);
}, function fail() { }, function fail() {
toast.showError($translate.instant('edge.load-entity-error')); showError();
}); });
break; break;
} }
function showDialog() {
$mdDialog.show({ $mdDialog.show({
controller: 'EventContentDialogController', controller: 'EventContentDialogController',
controllerAs: 'vm', controllerAs: 'vm',
@ -134,6 +138,10 @@ export default function EventRowDirective($compile, $templateCache, $mdDialog, $
} }
}); });
} }
function showError() {
toast.showError($translate.instant('edge.load-entity-error'));
}
}
scope.checkTooltip = function($event) { scope.checkTooltip = function($event) {
var el = $event.target; var el = $event.target;

View File

@ -821,7 +821,7 @@
"make-private-edge-text": "After the confirmation the edge and all its data will be made private and won't be accessible by others.", "make-private-edge-text": "After the confirmation the edge and all its data will be made private and won't be accessible by others.",
"import": "Import edge", "import": "Import edge",
"label": "Label", "label": "Label",
"load-entity-error": "Could not load entity info", "load-entity-error": "Entity not found. Failed to load info",
"assign-new-edge": "Assign new edge", "assign-new-edge": "Assign new edge",
"manage-edge-dashboards": "Manage edge dashboards", "manage-edge-dashboards": "Manage edge dashboards",
"unassign-from-edge": "Unassign from edge", "unassign-from-edge": "Unassign from edge",