Skip to content

Commit

Permalink
HAWKULAR-519 : Send event instead of Notification on ExecuteOperation
Browse files Browse the repository at this point in the history
  • Loading branch information
ammendonca committed Dec 17, 2015
1 parent 5ae4dd5 commit 503e3f3
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 17 deletions.
12 changes: 7 additions & 5 deletions dist/hawkular-ui-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,6 @@ var hawkularRest;
prefix: 'GenericSuccessResponse=',
handle: function (operationResponse, binaryData) {
$log.log('Execution Operation request delivery: ', operationResponse.message);
NotificationService.info('Execution Ops request delivery: ' + operationResponse.message);
}
},
{
Expand All @@ -795,13 +794,16 @@ var hawkularRest;
prefix: 'ExecuteOperationResponse=',
handle: function (operationResponse, binaryData) {
$log.log('Handling ExecuteOperationResponse');
var message;
if (operationResponse.status === "OK") {
NotificationService.success('Operation "' + operationResponse.operationName + '" on resource "'
+ operationResponse.resourcePath + '" succeeded.');
message = 'Operation "' + operationResponse.operationName + '" on resource "'
+ operationResponse.resourcePath + '" succeeded.';
$rootScope.$broadcast('ExecuteOperationSuccess', message, operationResponse.resourcePath, operationResponse.operationName);
}
else if (operationResponse.status === "ERROR") {
NotificationService.error('Operation "' + operationResponse.operationName + '" on resource "'
+ operationResponse.resourcePath + '" failed: ' + operationResponse.message);
message = 'Operation "' + operationResponse.operationName + '" on resource "'
+ operationResponse.resourcePath + '" failed: ' + operationResponse.message;
$rootScope.$broadcast('ExecuteOperationError', message, operationResponse.resourcePath, operationResponse.operationName);
}
else {
$log.log('Unexpected operationResponse: ', operationResponse);
Expand Down
12 changes: 7 additions & 5 deletions dist/hawkular-ui-service.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,6 @@ var hawkularRest;
prefix: 'GenericSuccessResponse=',
handle: function (operationResponse, binaryData) {
$log.log('Execution Operation request delivery: ', operationResponse.message);
NotificationService.info('Execution Ops request delivery: ' + operationResponse.message);
}
},
{
Expand All @@ -795,13 +794,16 @@ var hawkularRest;
prefix: 'ExecuteOperationResponse=',
handle: function (operationResponse, binaryData) {
$log.log('Handling ExecuteOperationResponse');
var message;
if (operationResponse.status === "OK") {
NotificationService.success('Operation "' + operationResponse.operationName + '" on resource "'
+ operationResponse.resourcePath + '" succeeded.');
message = 'Operation "' + operationResponse.operationName + '" on resource "'
+ operationResponse.resourcePath + '" succeeded.';
$rootScope.$broadcast('ExecuteOperationSuccess', message, operationResponse.resourcePath, operationResponse.operationName);
}
else if (operationResponse.status === "ERROR") {
NotificationService.error('Operation "' + operationResponse.operationName + '" on resource "'
+ operationResponse.resourcePath + '" failed: ' + operationResponse.message);
message = 'Operation "' + operationResponse.operationName + '" on resource "'
+ operationResponse.resourcePath + '" failed: ' + operationResponse.message;
$rootScope.$broadcast('ExecuteOperationError', message, operationResponse.resourcePath, operationResponse.operationName);
}
else {
$log.log('Unexpected operationResponse: ', operationResponse);
Expand Down
17 changes: 10 additions & 7 deletions src/rest/hawkRest-ops-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,6 @@ module hawkularRest {
prefix: 'GenericSuccessResponse=',
handle: (operationResponse, binaryData:Blob) => {
$log.log('Execution Operation request delivery: ', operationResponse.message);
// Probably makes no sense to show this in the UI
NotificationService.info('Execution Ops request delivery: ' + operationResponse.message);
}
},
{
Expand All @@ -134,13 +132,18 @@ module hawkularRest {
prefix: 'ExecuteOperationResponse=',
handle: (operationResponse:IExecutionOperationResponse, binaryData:Blob) => {
$log.log('Handling ExecuteOperationResponse');
if (operationResponse.status === "OK") {

NotificationService.success('Operation "' + operationResponse.operationName + '" on resource "'
+ operationResponse.resourcePath + '" succeeded.');
let message;
if (operationResponse.status === "OK") {
message = 'Operation "' + operationResponse.operationName + '" on resource "'
+ operationResponse.resourcePath + '" succeeded.';
$rootScope.$broadcast('ExecuteOperationSuccess', message, operationResponse.resourcePath,
operationResponse.operationName);
} else if (operationResponse.status === "ERROR") {
NotificationService.error('Operation "' + operationResponse.operationName + '" on resource "'
+ operationResponse.resourcePath + '" failed: ' + operationResponse.message);
message = 'Operation "' + operationResponse.operationName + '" on resource "'
+ operationResponse.resourcePath + '" failed: ' + operationResponse.message;
$rootScope.$broadcast('ExecuteOperationError', message, operationResponse.resourcePath,
operationResponse.operationName);
} else {
$log.log('Unexpected operationResponse: ', operationResponse);
}
Expand Down

0 comments on commit 503e3f3

Please sign in to comment.