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