1/**
2 * common Constant service
3 *
4 * @module app/common/services/constants
5 * @exports Constants
6 * @name Constants
7
8 * @version 0.0.1
9 */
10
11window.angular && (function (angular) {
12    'use strict';
13
14    angular
15        .module('app.common.services', [])
16        .service('Constants', function () {
17            return {
18                API_CREDENTIALS: {
19                    host_storage_key: 'API_HOST_KEY',
20                    default_protocol: 'https'
21                },
22                API_RESPONSE: {
23                    ERROR_STATUS: 'error',
24                    ERROR_MESSAGE: '401 Unauthorized',
25                    SUCCESS_STATUS: 'ok',
26                    SUCCESS_MESSAGE: '200 OK'
27                },
28                CHASSIS_POWER_STATE: {
29                    on: 'On',
30                    off: 'Off'
31                },
32                HOST_STATE_TEXT: {
33                    on: 'Running',
34                    off: 'Off',
35                    booting: 'Quiesced',
36                    unreachable: 'Unreachable'
37                },
38                HOST_STATE: {
39                    on: 1,
40                    off: -1,
41                    booting: 0,
42                    unreachable: -2
43                },
44                LED_STATE: {
45                    on: true,
46                    off: false
47                },
48                LED_STATE_TEXT: {
49                    on: 'on',
50                    off: 'off'
51                },
52                SEVERITY_TO_HEALTH_MAP:{
53                    Emergency: 'Critical',
54                    Alert: 'Critical',
55                    Critical: 'Critical',
56                    Error: 'Warning',
57                    Warning: 'Warning',
58                    Notice: 'Good',
59                    Debug: 'Good',
60                    Informational: 'Good'
61                },
62                SEVERITY_TO_PRIORITY_MAP:{
63                    Emergency: 'High',
64                    Alert: 'High',
65                    Critical: 'High',
66                    Error: 'High',
67                    Warning: 'Medium',
68                    Notice: 'Low',
69                    Debug: 'Low',
70                    Informational: 'Low'
71                },
72                PAGINATION: {
73                    LOG_ITEMS_PER_PAGE: 25
74                },
75                HARDWARE: {
76                  component_key_filter: '/xyz/openbmc_project/inventory/system',
77                  parent_components: [
78                   /xyz\/openbmc_project\/inventory\/system\/chassis\/motherboard\/cpu\d+\//
79                  ],
80                  uppercase_titles: [
81                   'cpu', 'dimm'
82                  ]
83                },
84                SENSOR_UNIT_MAP: {
85                  'xyz.openbmc_project.Sensor.Value.Unit.RPMS': 'rpms',
86                  'xyz.openbmc_project.Sensor.Value.Unit.DegreesC': 'C',
87                  'xyz.openbmc_project.Sensor.Value.Unit.Volts': 'volts',
88                  'xyz.openbmc_project.Sensor.Value.Unit.Meters': 'meters',
89                  'xyz.openbmc_project.Sensor.Value.Unit.Watts': 'watts',
90                  'xyz.openbmc_project.Sensor.Value.Unit.Amperes': 'amperes',
91                  'xyz.openbmc_project.Sensor.Value.Unit.Joules': 'joules'
92                },
93                SERVER_HEALTH: {
94                    critical: 'Critical',
95                    warning: 'Warning',
96                    good: 'Good',
97                    unknown: 'Unknown'
98                },
99                SENSOR_SORT_ORDER: [
100                   'xyz.openbmc_project.Sensor.Value.Unit.DegreesC',
101                   'xyz.openbmc_project.Sensor.Value.Unit.RPMS',
102                   'xyz.openbmc_project.Sensor.Value.Unit.Meters',
103                   'xyz.openbmc_project.Sensor.Value.Unit.Volts',
104                   'xyz.openbmc_project.Sensor.Value.Unit.Amperes',
105                   'xyz.openbmc_project.Sensor.Value.Unit.Joules',
106                   'xyz.openbmc_project.Sensor.Value.Unit.Meters'
107                ],
108                SENSOR_SORT_ORDER_DEFAULT: 8,
109                FIRMWARE: {
110                  ACTIVATE_FIRMWARE: 'xyz.openbmc_project.Software.Activation.RequestedActivations.Active',
111                  FUNCTIONAL_OBJPATH: '/xyz/openbmc_project/software/functional'
112                },
113               POLL_INTERVALS: {
114                  ACTIVATION: 5000
115                },
116               TIMEOUT: {
117                  ACTIVATION: 1000 * 60 * 10, // 10 mins
118                },
119                MESSAGES: {
120                  SENSOR: {
121                    NO_SENSOR_DATA: 'There are no sensors found.',
122                    CRITICAL_NO_SENSOR_DATA: 'There are no sensors in Critical state.',
123                    WARNING_NO_SENSOR_DATA: 'There are no sensors in Warning state.'
124                  }
125                },
126                POWER_CAP_TEXT: {
127                    unit: 'W',
128                    disabled: 'Not Enabled'
129                },
130                POWER_CONSUMPTION_TEXT: {
131                    'xyz.openbmc_project.Sensor.Value.Unit.Watts': 'W',
132                    notavailable: 'Not Available'
133                },
134            };
135        });
136
137})(window.angular);
138