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 389 customer: "CUSTOMER",
390 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 405 importEntityColumnType: {
393 406 name: {
394 407 name: 'import.column-type.name',
... ...
... ... @@ -102,37 +102,45 @@ export default function EventRowDirective($compile, $templateCache, $mdDialog, $
102 102 switch(scope.event.edgeEventType) {
103 103 case types.edgeEventType.relation:
104 104 content = angular.toJson(scope.event.entityBody);
  105 + showDialog();
105 106 break;
106 107 case types.edgeEventType.ruleChainMetaData:
107   - content = ruleChainService.getRuleChainMetaData(scope.event.entityId, {}).then(
  108 + content = ruleChainService.getRuleChainMetaData(scope.event.entityId, {ignoreErrors: true}).then(
108 109 function success(info) {
  110 + showDialog();
109 111 return angular.toJson(info);
110 112 }, function fail() {
111   - toast.showError($translate.instant('edge.load-entity-error'));
  113 + showError();
112 114 });
113 115 break;
114 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 118 function success(info) {
  119 + showDialog();
117 120 return angular.toJson(info);
118 121 }, function fail() {
119   - toast.showError($translate.instant('edge.load-entity-error'));
  122 + showError();
120 123 });
121 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 146 scope.checkTooltip = function($event) {
... ...
... ... @@ -821,7 +821,7 @@
821 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 822 "import": "Import edge",
823 823 "label": "Label",
824   - "load-entity-error": "Could not load entity info",
  824 + "load-entity-error": "Entity not found. Failed to load info",
825 825 "assign-new-edge": "Assign new edge",
826 826 "manage-edge-dashboards": "Manage edge dashboards",
827 827 "unassign-from-edge": "Unassign from edge",
... ...