Commit 0961c24a3553427632d6a50da01e4a48f8450744

Authored by deaflynx
1 parent 8c9aa0c8

EdgeEvents: added toast.showError() for deleted entities

@@ -389,6 +389,19 @@ export default angular.module('thingsboard.types', []) @@ -389,6 +389,19 @@ export default angular.module('thingsboard.types', [])
389 customer: "CUSTOMER", 389 customer: "CUSTOMER",
390 relation: "RELATION" 390 relation: "RELATION"
391 }, 391 },
  392 + edgeEventAction: {
  393 + updated: "UPDATED",
  394 + added: "ADDED",
  395 + assignedToEdge: "ASSIGNED_TO_EDGE",
  396 + deleted: "DELETED",
  397 + unassignedFromEdge: "UNASSIGNED_FROM_EDGE",
  398 + alarmAck: "ALARM_ACK",
  399 + alarmClear: "ALARM_CLEAR",
  400 + credentialsUpdated: "CREDENTIALS_UPDATED",
  401 + attributesUpdated: "ATTRIBUTES_UPDATED",
  402 + attributesDeleted: "ATTRIBUTES_DELETED",
  403 + timeseriesUpdated: "TIMESERIES_UPDATED"
  404 + },
392 importEntityColumnType: { 405 importEntityColumnType: {
393 name: { 406 name: {
394 name: 'import.column-type.name', 407 name: 'import.column-type.name',
@@ -102,37 +102,45 @@ export default function EventRowDirective($compile, $templateCache, $mdDialog, $ @@ -102,37 +102,45 @@ export default function EventRowDirective($compile, $templateCache, $mdDialog, $
102 switch(scope.event.edgeEventType) { 102 switch(scope.event.edgeEventType) {
103 case types.edgeEventType.relation: 103 case types.edgeEventType.relation:
104 content = angular.toJson(scope.event.entityBody); 104 content = angular.toJson(scope.event.entityBody);
  105 + showDialog();
105 break; 106 break;
106 case types.edgeEventType.ruleChainMetaData: 107 case types.edgeEventType.ruleChainMetaData:
107 - content = ruleChainService.getRuleChainMetaData(scope.event.entityId, {}).then( 108 + content = ruleChainService.getRuleChainMetaData(scope.event.entityId, {ignoreErrors: true}).then(
108 function success(info) { 109 function success(info) {
  110 + showDialog();
109 return angular.toJson(info); 111 return angular.toJson(info);
110 }, function fail() { 112 }, function fail() {
111 - toast.showError($translate.instant('edge.load-entity-error')); 113 + showError();
112 }); 114 });
113 break; 115 break;
114 default: 116 default:
115 - content = entityService.getEntity(scope.event.edgeEventType, scope.event.entityId, {}).then( 117 + content = entityService.getEntity(scope.event.edgeEventType, scope.event.entityId, {ignoreLoading: true, ignoreErrors: true}).then(
116 function success(info) { 118 function success(info) {
  119 + showDialog();
117 return angular.toJson(info); 120 return angular.toJson(info);
118 }, function fail() { 121 }, function fail() {
119 - toast.showError($translate.instant('edge.load-entity-error')); 122 + showError();
120 }); 123 });
121 break; 124 break;
122 } 125 }
123 - $mdDialog.show({  
124 - controller: 'EventContentDialogController',  
125 - controllerAs: 'vm',  
126 - templateUrl: eventErrorDialogTemplate,  
127 - locals: {content: content, title: title, contentType: contentType, showingCallback: onShowingCallback},  
128 - parent: angular.element($document[0].body),  
129 - fullscreen: true,  
130 - targetEvent: $event,  
131 - multiple: true,  
132 - onShowing: function(scope, element) {  
133 - onShowingCallback.onShowing(scope, element);  
134 - }  
135 - }); 126 + function showDialog() {
  127 + $mdDialog.show({
  128 + controller: 'EventContentDialogController',
  129 + controllerAs: 'vm',
  130 + templateUrl: eventErrorDialogTemplate,
  131 + locals: {content: content, title: title, contentType: contentType, showingCallback: onShowingCallback},
  132 + parent: angular.element($document[0].body),
  133 + fullscreen: true,
  134 + targetEvent: $event,
  135 + multiple: true,
  136 + onShowing: function(scope, element) {
  137 + onShowingCallback.onShowing(scope, element);
  138 + }
  139 + });
  140 + }
  141 + function showError() {
  142 + toast.showError($translate.instant('edge.load-entity-error'));
  143 + }
136 } 144 }
137 145
138 scope.checkTooltip = function($event) { 146 scope.checkTooltip = function($event) {
@@ -821,7 +821,7 @@ @@ -821,7 +821,7 @@
821 "make-private-edge-text": "After the confirmation the edge and all its data will be made private and won't be accessible by others.", 821 "make-private-edge-text": "After the confirmation the edge and all its data will be made private and won't be accessible by others.",
822 "import": "Import edge", 822 "import": "Import edge",
823 "label": "Label", 823 "label": "Label",
824 - "load-entity-error": "Could not load entity info", 824 + "load-entity-error": "Entity not found. Failed to load info",
825 "assign-new-edge": "Assign new edge", 825 "assign-new-edge": "Assign new edge",
826 "manage-edge-dashboards": "Manage edge dashboards", 826 "manage-edge-dashboards": "Manage edge dashboards",
827 "unassign-from-edge": "Unassign from edge", 827 "unassign-from-edge": "Unassign from edge",