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      CERTIFICATE_TYPES: [
24        {
25          'Description': 'HTTPS Certificate',
26          'location':
27              '/redfish/v1/Managers/bmc/NetworkProtocol/HTTPS/Certificates'
28        },
29        {
30          'Description': 'LDAP Certificate',
31          'location': '/redfish/v1/AccountService/LDAP/Certificates'
32        }
33      ],
34      HOST_STATE_TEXT: {
35        on: 'Running',
36        on_code: 'xyz.openbmc_project.State.Host.HostState.Running',
37        off: 'Off',
38        off_code: 'xyz.openbmc_project.State.Host.HostState.Off',
39        error: 'Quiesced',
40        error_code: 'xyz.openbmc_project.State.Host.HostState.Quiesced',
41        unreachable: 'Unreachable'
42      },
43      LED_STATE: {on: true, off: false},
44      LED_STATE_TEXT: {on: 'on', off: 'off'},
45      SEVERITY_TO_PRIORITY_MAP: {
46        Emergency: 'High',
47        Alert: 'High',
48        Critical: 'High',
49        Error: 'High',
50        Warning: 'Medium',
51        Notice: 'Low',
52        Debug: 'Low',
53        Informational: 'Low'
54      },
55      PAGINATION: {LOG_ITEMS_PER_PAGE: 25},
56      HARDWARE: {
57        component_key_filter: '/xyz/openbmc_project/inventory/system',
58        parent_components: [
59          /xyz\/openbmc_project\/inventory\/system\/chassis\/motherboard\/cpu\d+\//
60        ],
61        uppercase_titles: ['cpu', 'dimm']
62      },
63      SENSOR_UNIT_MAP: {
64        'xyz.openbmc_project.Sensor.Value.Unit.RPMS': 'rpms',
65        'xyz.openbmc_project.Sensor.Value.Unit.DegreesC': 'C',
66        'xyz.openbmc_project.Sensor.Value.Unit.Volts': 'volts',
67        'xyz.openbmc_project.Sensor.Value.Unit.Meters': 'meters',
68        'xyz.openbmc_project.Sensor.Value.Unit.Watts': 'watts',
69        'xyz.openbmc_project.Sensor.Value.Unit.Amperes': 'amperes',
70        'xyz.openbmc_project.Sensor.Value.Unit.Joules': 'joules'
71      },
72      SERVER_HEALTH: {
73        critical: 'Critical',
74        warning: 'Warning',
75        good: 'Good',
76        unknown: 'Unknown'
77      },
78      SENSOR_SORT_ORDER: [
79        'xyz.openbmc_project.Sensor.Value.Unit.DegreesC',
80        'xyz.openbmc_project.Sensor.Value.Unit.RPMS',
81        'xyz.openbmc_project.Sensor.Value.Unit.Meters',
82        'xyz.openbmc_project.Sensor.Value.Unit.Volts',
83        'xyz.openbmc_project.Sensor.Value.Unit.Amperes',
84        'xyz.openbmc_project.Sensor.Value.Unit.Joules',
85        'xyz.openbmc_project.Sensor.Value.Unit.Meters'
86      ],
87      SENSOR_SORT_ORDER_DEFAULT: 8,
88      FIRMWARE: {
89        ACTIVATE_FIRMWARE:
90            'xyz.openbmc_project.Software.Activation.RequestedActivations.Active',
91        FUNCTIONAL_OBJPATH: '/xyz/openbmc_project/software/functional'
92      },
93      POLL_INTERVALS: {
94        ACTIVATION: 5000,
95        DOWNLOAD_IMAGE: 5000,
96        POWER_OP: 5000,
97      },
98      TIMEOUT: {
99        ACTIVATION: 1000 * 60 * 10,        // 10 mins
100        DOWNLOAD_IMAGE: 1000 * 60 * 2,     // 2 mins
101        HOST_ON: 1000 * 60 * 5,            // 5 mins
102        HOST_OFF: 1000 * 60 * 5,           // 5 mins
103        HOST_OFF_IMMEDIATE: 1000 * 60 * 2  // 2 mins
104      },
105      MESSAGES: {
106        POLL: {
107          HOST_ON_TIMEOUT:
108              'Time out. System did not reach Running state in allotted time.',
109          HOST_OFF_TIMEOUT:
110              'Time out. System did not reach Off state in allotted time.',
111          HOST_QUIESCED: 'System is in Error state.',
112          DOWNLOAD_IMAGE_TIMEOUT:
113              'Time out. Did not download image in allotted time.',
114        },
115        POWER_OP: {
116          POWER_ON_FAILED: 'Power On Failed',
117          WARM_REBOOT_FAILED: 'Warm Reboot Failed',
118          COLD_REBOOT_FAILED: 'Cold Reboot Failed',
119          ORDERLY_SHUTDOWN_FAILED: 'Orderly Shutdown Failed',
120          IMMEDIATE_SHUTDOWN_FAILED: 'Immediate Shutdown Failed',
121        },
122        SENSOR: {
123          NO_SENSOR_DATA: 'There are no sensors found.',
124          CRITICAL_NO_SENSOR_DATA: 'There are no sensors in Critical state.',
125          WARNING_NO_SENSOR_DATA: 'There are no sensors in Warning state.',
126          NORMAL_NO_SENSOR_DATA: 'There are no sensors in Normal state.'
127        },
128        ERROR_MESSAGE_DESC_TEMPLATE: '{{status}} - {{description}}',
129      },
130      POWER_CAP_TEXT: {unit: 'W', disabled: 'Not Enabled'},
131      POWER_CONSUMPTION_TEXT: {
132        'xyz.openbmc_project.Sensor.Value.Unit.Watts': 'W',
133        notavailable: 'Not Available'
134      },
135    };
136  });
137})(window.angular);
138