blob: 5604df5436d0db1d6605e847655e1950587676b0 [file] [log] [blame]
Iftekharul Islamcd789502017-04-19 14:37:55 -05001/**
2 * Controller for date-time
3 *
4 * @module app/configuration
5 * @exports dateTimeController
6 * @name dateTimeController
Iftekharul Islamcd789502017-04-19 14:37:55 -05007 */
8
Andrew Geisslerba5e3f32018-05-24 10:58:00 -07009window.angular && (function(angular) {
10 'use strict';
Iftekharul Islamcd789502017-04-19 14:37:55 -050011
Andrew Geisslerd27bb132018-05-24 11:07:27 -070012 angular.module('app.configuration').controller('dateTimeController', [
Gunnar Mills7de38662018-07-18 13:01:48 -050013 '$scope', '$window', 'APIUtils',
14 function($scope, $window, APIUtils) {
15 $scope.bmc_time = '';
Gunnar Millsc74d4342018-07-18 14:52:02 -050016 $scope.time_mode = '';
17 $scope.time_owner = '';
Gunnar Mills7de38662018-07-18 13:01:48 -050018 $scope.loading = true;
19
Gunnar Millsc74d4342018-07-18 14:52:02 -050020 var getTimePromise = APIUtils.getTime().then(
Gunnar Mills7de38662018-07-18 13:01:48 -050021 function(data) {
Gunnar Millsc74d4342018-07-18 14:52:02 -050022 $scope.bmc_time =
23 data.data['/xyz/openbmc_project/time/bmc'].Elapsed / 1000;
24 $scope.time_owner = data.data['/xyz/openbmc_project/time/owner']
25 .TimeOwner.split('.')
26 .pop();
27 $scope.time_mode =
28 data.data['/xyz/openbmc_project/time/sync_method']
29 .TimeSyncMethod.split('.')
30 .pop();
Gunnar Mills7de38662018-07-18 13:01:48 -050031 },
32 function(error) {
33 console.log(JSON.stringify(error));
34 });
35
Gunnar Millsc74d4342018-07-18 14:52:02 -050036 getTimePromise.finally(function() {
Gunnar Mills7de38662018-07-18 13:01:48 -050037 $scope.loading = false;
38 });
Andrew Geisslerd27bb132018-05-24 11:07:27 -070039 }
40 ]);
Iftekharul Islamcd789502017-04-19 14:37:55 -050041})(angular);