diff options
author | beccabroek <beccabroek@gmail.com> | 2019-01-08 14:24:29 -0600 |
---|---|---|
committer | beccabroek <beccabroek@gmail.com> | 2019-01-15 09:26:31 -0600 |
commit | 92d13b62f56fa302a8231690e7371c6ae04f50ba (patch) | |
tree | 440688faac62468d2f105a806ee653e67d01f922 | |
parent | 2264b42e8b6e24069421933c1f6d8835b67e69fb (diff) | |
download | phosphor-webui-92d13b62f56fa302a8231690e7371c6ae04f50ba.tar.gz phosphor-webui-92d13b62f56fa302a8231690e7371c6ae04f50ba.zip |
Add toast to Power Operations page
Replaces error messages with tast notifications on
the Power Operations page.
Change-Id: If92bcb18fc96e9dbd74807faf27feb9c82b6fc59
Signed-off-by: beccabroek <beccabroek@gmail.com>
-rw-r--r-- | app/server-control/controllers/power-operations-controller.js | 51 |
1 files changed, 9 insertions, 42 deletions
diff --git a/app/server-control/controllers/power-operations-controller.js b/app/server-control/controllers/power-operations-controller.js index 6c6f68c..1bb0a81 100644 --- a/app/server-control/controllers/power-operations-controller.js +++ b/app/server-control/controllers/power-operations-controller.js @@ -11,10 +11,10 @@ window.angular && (function(angular) { angular.module('app.serverControl').controller('powerOperationsController', [ '$scope', 'APIUtils', 'dataService', 'Constants', '$timeout', '$interval', - '$interpolate', '$q', + '$interpolate', '$q', 'ngToast', function( $scope, APIUtils, dataService, Constants, $timeout, $interval, - $interpolate, $q) { + $interpolate, $q, ngToast) { $scope.dataService = dataService; $scope.confirm = false; $scope.power_confirm = false; @@ -64,14 +64,7 @@ window.angular && (function(angular) { $scope.loading = false; }) .catch(function(error) { - dataService.activateErrorModal({ - title: Constants.MESSAGES.POWER_OP.POWER_ON_FAILED, - description: error.statusText ? - $interpolate( - Constants.MESSAGES.ERROR_MESSAGE_DESC_TEMPLATE)( - {status: error.status, description: error.statusText}) : - error - }); + ngToast.danger(Constants.MESSAGES.POWER_OP.POWER_ON_FAILED); $scope.loading = false; }); }; @@ -125,14 +118,7 @@ window.angular && (function(angular) { $scope.loading = false; }) .catch(function(error) { - dataService.activateErrorModal({ - title: Constants.MESSAGES.POWER_OP.WARM_REBOOT_FAILED, - description: error.statusText ? - $interpolate( - Constants.MESSAGES.ERROR_MESSAGE_DESC_TEMPLATE)( - {status: error.status, description: error.statusText}) : - error - }); + ngToast.danger(Constants.MESSAGES.POWER_OP.WARM_REBOOT_FAILED); $scope.loading = false; }); }; @@ -175,14 +161,7 @@ window.angular && (function(angular) { $scope.loading = false; }) .catch(function(error) { - dataService.activateErrorModal({ - title: Constants.MESSAGES.POWER_OP.COLD_REBOOT_FAILED, - description: error.statusText ? - $interpolate( - Constants.MESSAGES.ERROR_MESSAGE_DESC_TEMPLATE)( - {status: error.status, description: error.statusText}) : - error - }); + ngToast.danger(Constants.MESSAGES.POWER_OP.COLD_REBOOT_FAILED); $scope.loading = false; }); }; @@ -212,14 +191,8 @@ window.angular && (function(angular) { $scope.loading = false; }) .catch(function(error) { - dataService.activateErrorModal({ - title: Constants.MESSAGES.POWER_OP.ORDERLY_SHUTDOWN_FAILED, - description: error.statusText ? - $interpolate( - Constants.MESSAGES.ERROR_MESSAGE_DESC_TEMPLATE)( - {status: error.status, description: error.statusText}) : - error - }); + ngToast.danger( + Constants.MESSAGES.POWER_OP.ORDERLY_SHUTDOWN_FAILED); $scope.loading = false; }); }; @@ -247,14 +220,8 @@ window.angular && (function(angular) { $scope.loading = false; }) .catch(function(error) { - dataService.activateErrorModal({ - title: Constants.MESSAGES.POWER_OP.IMMEDIATE_SHUTDOWN_FAILED, - description: error.statusText ? - $interpolate( - Constants.MESSAGES.ERROR_MESSAGE_DESC_TEMPLATE)( - {status: error.status, description: error.statusText}) : - error - }); + ngToast.danger( + Constants.MESSAGES.POWER_OP.IMMEDIATE_SHUTDOWN_FAILED); $scope.loading = false; }); }; |