From 30444c6ccb1c352e3f6fda53e3d8a73c089cf610 Mon Sep 17 00:00:00 2001 From: beccabroek Date: Thu, 10 Jan 2019 15:27:03 -0600 Subject: Add toast to Date Time page Change-Id: I0c0912f9d18fbb170ccf4863366b5973eb25050a Signed-off-by: beccabroek --- app/configuration/controllers/date-time-controller.html | 2 -- app/configuration/controllers/date-time-controller.js | 15 ++++++--------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/app/configuration/controllers/date-time-controller.html b/app/configuration/controllers/date-time-controller.html index 23a93d2..78d693b 100644 --- a/app/configuration/controllers/date-time-controller.html +++ b/app/configuration/controllers/date-time-controller.html @@ -64,7 +64,5 @@ - - diff --git a/app/configuration/controllers/date-time-controller.js b/app/configuration/controllers/date-time-controller.js index a08a141..826ae72 100644 --- a/app/configuration/controllers/date-time-controller.js +++ b/app/configuration/controllers/date-time-controller.js @@ -10,8 +10,8 @@ window.angular && (function(angular) { 'use strict'; angular.module('app.configuration').controller('dateTimeController', [ - '$scope', '$window', 'APIUtils', '$route', '$q', - function($scope, $window, APIUtils, $route, $q) { + '$scope', '$window', 'APIUtils', '$route', '$q', 'ngToast', + function($scope, $window, APIUtils, $route, $q, ngToast) { $scope.bmc = {}; // Only used when the owner is "Split" $scope.host = {}; @@ -20,8 +20,6 @@ window.angular && (function(angular) { // Possible time owners // https://github.com/openbmc/phosphor-dbus-interfaces/blob/master/xyz/openbmc_project/Time/Owner.interface.yaml#L13 $scope.timeOwners = ['BMC', 'Host', 'Both', 'Split']; - $scope.error = false; - $scope.success = false; $scope.loading = true; var timePath = '/xyz/openbmc_project/time/'; @@ -85,8 +83,6 @@ window.angular && (function(angular) { }); $scope.setTime = function() { - $scope.error = false; - $scope.success = false; $scope.loading = true; var promises = [setTimeMode(), setTimeOwner(), setNTPServers()]; @@ -123,11 +119,12 @@ window.angular && (function(angular) { $q.all(manual_promises) .then( function() { - $scope.success = true; + ngToast.success('Date and time settings saved'); }, function(errors) { console.log(JSON.stringify(errors)); - $scope.error = true; + ngToast.danger( + 'Date and time settings could not be saved'); }) .finally(function() { $scope.loading = false; @@ -135,7 +132,7 @@ window.angular && (function(angular) { }, function(errors) { console.log(JSON.stringify(errors)); - $scope.error = true; + ngToast.danger('Date and time settings could not be saved'); $scope.loading = false; }); }; -- cgit v1.2.1