Iftekharul Islam | 99d199f | 2017-03-24 15:28:25 -0500 | [diff] [blame] | 1 | /** |
| 2 | * data service |
| 3 | * |
| 4 | * @module app/common/services/dataService |
| 5 | * @exports dataService |
| 6 | * @name dataService |
| 7 | |
| 8 | * @version 0.0.1 |
| 9 | */ |
| 10 | |
| 11 | window.angular && (function (angular) { |
| 12 | 'use strict'; |
| 13 | |
| 14 | angular |
| 15 | .module('app.common.services') |
| 16 | .service('dataService', ['Constants', function (Constants) { |
| 17 | this.app_version = "openBMC V.0.0.1"; |
| 18 | this.server_health = 'Error'; |
| 19 | this.server_state = 'Unreachable'; |
| 20 | this.server_status = -2; |
| 21 | this.chassis_state = 'On'; |
Iftekharul Islam | cd78950 | 2017-04-19 14:37:55 -0500 | [diff] [blame] | 22 | this.LED_state = Constants.LED_STATE_TEXT.off; |
| 23 | this.server_id = Constants.API_CREDENTIALS.host.replace(/[^\d]+/m,""); |
Iftekharul Islam | 99d199f | 2017-03-24 15:28:25 -0500 | [diff] [blame] | 24 | this.last_updated = new Date(); |
| 25 | |
| 26 | this.loading = false; |
| 27 | this.server_unreachable = false; |
| 28 | this.loading_message = ""; |
| 29 | this.showNavigation = false; |
| 30 | this.bodyStyle = {}; |
| 31 | this.path = ''; |
Iftekharul Islam | d2269e2 | 2017-05-02 09:32:45 -0500 | [diff] [blame] | 32 | this.sensorData = []; |
Iftekharul Islam | 99d199f | 2017-03-24 15:28:25 -0500 | [diff] [blame] | 33 | |
| 34 | this.setPowerOnState = function(){ |
| 35 | this.server_state = Constants.HOST_STATE_TEXT.on; |
| 36 | this.server_status = Constants.HOST_STATE.on; |
| 37 | }, |
| 38 | |
| 39 | this.setPowerOffState = function(){ |
| 40 | this.server_state = Constants.HOST_STATE_TEXT.off; |
| 41 | this.server_status = Constants.HOST_STATE.off; |
| 42 | }, |
| 43 | |
| 44 | this.setBootingState = function(){ |
| 45 | this.server_state = Constants.HOST_STATE_TEXT.booting; |
| 46 | this.server_status = Constants.HOST_STATE.booting; |
| 47 | }, |
| 48 | |
| 49 | this.setUnreachableState = function(){ |
| 50 | this.server_state = Constants.HOST_STATE_TEXT.unreachable; |
| 51 | this.server_status = Constants.HOST_STATE.unreachable; |
| 52 | } |
| 53 | }]); |
| 54 | |
| 55 | })(window.angular); |