summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbeccabroek <beccabroek@gmail.com>2019-01-10 15:27:03 -0600
committerbeccabroek <beccabroek@gmail.com>2019-01-21 09:52:19 -0600
commit30444c6ccb1c352e3f6fda53e3d8a73c089cf610 (patch)
tree81f75c9b6c82366007fc97524a4254488171be33
parentb7f0ee19eb0ee728eb4075646821898e7d29c7bc (diff)
downloadphosphor-webui-30444c6ccb1c352e3f6fda53e3d8a73c089cf610.tar.gz
phosphor-webui-30444c6ccb1c352e3f6fda53e3d8a73c089cf610.zip
Add toast to Date Time page
Change-Id: I0c0912f9d18fbb170ccf4863366b5973eb25050a Signed-off-by: beccabroek <beccabroek@gmail.com>
-rw-r--r--app/configuration/controllers/date-time-controller.html2
-rw-r--r--app/configuration/controllers/date-time-controller.js15
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 @@
<button type="button" class="btn-primary inline" ng-click="setTime()">Save settings</button>
<button type="button" class="btn-secondary inline" ng-click="refresh()">Cancel</button>
</div>
- <p class="success-msg" ng-show="success" role="alert">Success! Time changed!</p>
- <p class="set_time_error error-msg" ng-show="error" role="alert">Error setting time!</p>
</form>
</div>
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;
});
};
OpenPOWER on IntegriCloud