1/**
2 * common Constant service
3 *
4 * @module app/common/services/constants
5 * @exports Constants
6 * @name Constants
7
8 */
9
10window.angular && (function(angular) {
11  'use strict';
12
13  angular.module('app.common.services', []).service('Constants', function() {
14    return {
15      API_CREDENTIALS:
16          {host_storage_key: 'API_HOST_KEY', default_protocol: 'https'},
17      API_RESPONSE: {
18        ERROR_STATUS: 'error',
19        ERROR_MESSAGE: '401 Unauthorized',
20        SUCCESS_STATUS: 'ok',
21        SUCCESS_MESSAGE: '200 OK'
22      },
23      CHASSIS_POWER_STATE: {
24        on: 'On',
25        on_code: 'xyz.openbmc_project.State.Chassis.PowerState.On',
26        off: 'Off',
27        off_code: 'xyz.openbmc_project.State.Chassis.PowerState.Off'
28      },
29      HOST_STATE_TEXT: {
30        on: 'Running',
31        on_code: 'xyz.openbmc_project.State.Host.HostState.Running',
32        off: 'Off',
33        off_code: 'xyz.openbmc_project.State.Host.HostState.Off',
34        error: 'Quiesced',
35        error_code: 'xyz.openbmc_project.State.Host.HostState.Quiesced',
36        unreachable: 'Unreachable'
37      },
38      HOST_STATE: {on: 1, off: -1, error: 0, unreachable: -2},
39      LED_STATE: {on: true, off: false},
40      LED_STATE_TEXT: {on: 'on', off: 'off'},
41      SEVERITY_TO_HEALTH_MAP: {
42        Emergency: 'Critical',
43        Alert: 'Critical',
44        Critical: 'Critical',
45        Error: 'Warning',
46        Warning: 'Warning',
47        Notice: 'Good',
48        Debug: 'Good',
49        Informational: 'Good'
50      },
51      SEVERITY_TO_PRIORITY_MAP: {
52        Emergency: 'High',
53        Alert: 'High',
54        Critical: 'High',
55        Error: 'High',
56        Warning: 'Medium',
57        Notice: 'Low',
58        Debug: 'Low',
59        Informational: 'Low'
60      },
61      PAGINATION: {LOG_ITEMS_PER_PAGE: 25},
62      HARDWARE: {
63        component_key_filter: '/xyz/openbmc_project/inventory/system',
64        parent_components: [
65          /xyz\/openbmc_project\/inventory\/system\/chassis\/motherboard\/cpu\d+\//
66        ],
67        uppercase_titles: ['cpu', 'dimm']
68      },
69      SENSOR_UNIT_MAP: {
70        'xyz.openbmc_project.Sensor.Value.Unit.RPMS': 'rpms',
71        'xyz.openbmc_project.Sensor.Value.Unit.DegreesC': 'C',
72        'xyz.openbmc_project.Sensor.Value.Unit.Volts': 'volts',
73        'xyz.openbmc_project.Sensor.Value.Unit.Meters': 'meters',
74        'xyz.openbmc_project.Sensor.Value.Unit.Watts': 'watts',
75        'xyz.openbmc_project.Sensor.Value.Unit.Amperes': 'amperes',
76        'xyz.openbmc_project.Sensor.Value.Unit.Joules': 'joules'
77      },
78      SERVER_HEALTH: {
79        critical: 'Critical',
80        warning: 'Warning',
81        good: 'Good',
82        unknown: 'Unknown'
83      },
84      SENSOR_SORT_ORDER: [
85        'xyz.openbmc_project.Sensor.Value.Unit.DegreesC',
86        'xyz.openbmc_project.Sensor.Value.Unit.RPMS',
87        'xyz.openbmc_project.Sensor.Value.Unit.Meters',
88        'xyz.openbmc_project.Sensor.Value.Unit.Volts',
89        'xyz.openbmc_project.Sensor.Value.Unit.Amperes',
90        'xyz.openbmc_project.Sensor.Value.Unit.Joules',
91        'xyz.openbmc_project.Sensor.Value.Unit.Meters'
92      ],
93      SENSOR_SORT_ORDER_DEFAULT: 8,
94      FIRMWARE: {
95        ACTIVATE_FIRMWARE:
96            'xyz.openbmc_project.Software.Activation.RequestedActivations.Active',
97        FUNCTIONAL_OBJPATH: '/xyz/openbmc_project/software/functional'
98      },
99      POLL_INTERVALS: {
100        ACTIVATION: 5000,
101        DOWNLOAD_IMAGE: 5000,
102        POWER_OP: 5000,
103      },
104      TIMEOUT: {
105        ACTIVATION: 1000 * 60 * 10,     // 10 mins
106        DOWNLOAD_IMAGE: 1000 * 60 * 2,  // 2 mins
107        CHASSIS_OFF: 1000 * 60 * 5,     // 5 mins
108        HOST_ON: 1000 * 60 * 5,         // 5 mins
109        HOST_OFF: 1000 * 60 * 5,        // 5 mins
110      },
111      MESSAGES: {
112        POLL: {
113          CHASSIS_OFF_TIMEOUT:
114              'Time out. Chassis did not reach power off state in allotted time.',
115          HOST_ON_TIMEOUT:
116              'Time out. System did not reach Running state in allotted time.',
117          HOST_OFF_TIMEOUT:
118              'Time out. System did not reach Off state in allotted time.',
119          HOST_QUIESCED: 'System is in Error state.',
120          DOWNLOAD_IMAGE_TIMEOUT:
121              'Time out. Did not download image in allotted time.',
122        },
123        POWER_OP: {
124          POWER_ON_FAILED: 'Power On Failed',
125          WARM_REBOOT_FAILED: 'Warm Reboot Failed',
126          COLD_REBOOT_FAILED: 'Cold Reboot Failed',
127          ORDERLY_SHUTDOWN_FAILED: 'Orderly Shutdown Failed',
128          IMMEDIATE_SHUTDOWN_FAILED: 'Immediate Shutdown Failed',
129        },
130        SENSOR: {
131          NO_SENSOR_DATA: 'There are no sensors found.',
132          CRITICAL_NO_SENSOR_DATA: 'There are no sensors in Critical state.',
133          WARNING_NO_SENSOR_DATA: 'There are no sensors in Warning state.',
134          NORMAL_NO_SENSOR_DATA: 'There are no sensors in Normal state.'
135        },
136        ERROR_MODAL: {
137          TITLE: 'Unexpected error',
138          DESCRIPTION:
139              'Oops! An unexpected error occurred. Record specific details of the issue, then contact your company support services.'
140        },
141        ERROR_MESSAGE_DESC_TEMPLATE: '{{status}} - {{description}}',
142      },
143      POWER_CAP_TEXT: {unit: 'W', disabled: 'Not Enabled'},
144      POWER_CONSUMPTION_TEXT: {
145        'xyz.openbmc_project.Sensor.Value.Unit.Watts': 'W',
146        notavailable: 'Not Available'
147      },
148    };
149  });
150
151})(window.angular);
152