1/** 2 * Controller for date-time 3 * 4 * @module app/configuration 5 * @exports dateTimeController 6 * @name dateTimeController 7 */ 8 9window.angular && (function(angular) { 10 'use strict'; 11 12 angular.module('app.configuration').controller('dateTimeController', [ 13 '$scope', '$window', 'APIUtils', 14 function($scope, $window, APIUtils) { 15 $scope.bmc_time = ''; 16 $scope.time_mode = ''; 17 $scope.time_owner = ''; 18 $scope.loading = true; 19 20 var getTimePromise = APIUtils.getTime().then( 21 function(data) { 22 $scope.bmc_time = 23 data.data['/xyz/openbmc_project/time/bmc'].Elapsed / 1000; 24 $scope.host_time = 25 data.data['/xyz/openbmc_project/time/host'].Elapsed / 1000; 26 27 $scope.time_owner = data.data['/xyz/openbmc_project/time/owner'] 28 .TimeOwner.split('.') 29 .pop(); 30 $scope.time_mode = 31 data.data['/xyz/openbmc_project/time/sync_method'] 32 .TimeSyncMethod.split('.') 33 .pop(); 34 }, 35 function(error) { 36 console.log(JSON.stringify(error)); 37 }); 38 39 getTimePromise.finally(function() { 40 $scope.loading = false; 41 }); 42 } 43 ]); 44})(angular); 45