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",
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: {
name: {
name: 'import.column-type.name',

View File

@ -102,37 +102,45 @@ export default function EventRowDirective($compile, $templateCache, $mdDialog, $
switch(scope.event.edgeEventType) {
case types.edgeEventType.relation:
content = angular.toJson(scope.event.entityBody);
showDialog();
break;
case types.edgeEventType.ruleChainMetaData:
content = ruleChainService.getRuleChainMetaData(scope.event.entityId, {}).then(
content = ruleChainService.getRuleChainMetaData(scope.event.entityId, {ignoreErrors: true}).then(
function success(info) {
showDialog();
return angular.toJson(info);
}, function fail() {
toast.showError($translate.instant('edge.load-entity-error'));
showError();
});
break;
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) {
showDialog();
return angular.toJson(info);
}, function fail() {
toast.showError($translate.instant('edge.load-entity-error'));
showError();
});
break;
}
$mdDialog.show({
controller: 'EventContentDialogController',
controllerAs: 'vm',
templateUrl: eventErrorDialogTemplate,
locals: {content: content, title: title, contentType: contentType, showingCallback: onShowingCallback},
parent: angular.element($document[0].body),
fullscreen: true,
targetEvent: $event,
multiple: true,
onShowing: function(scope, element) {
onShowingCallback.onShowing(scope, element);
}
});
function showDialog() {
$mdDialog.show({
controller: 'EventContentDialogController',
controllerAs: 'vm',
templateUrl: eventErrorDialogTemplate,
locals: {content: content, title: title, contentType: contentType, showingCallback: onShowingCallback},
parent: angular.element($document[0].body),
fullscreen: true,
targetEvent: $event,
multiple: true,
onShowing: function(scope, element) {
onShowingCallback.onShowing(scope, element);
}
});
}
function showError() {
toast.showError($translate.instant('edge.load-entity-error'));
}
}
scope.checkTooltip = function($event) {

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.",
"import": "Import edge",
"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",
"manage-edge-dashboards": "Manage edge dashboards",
"unassign-from-edge": "Unassign from edge",