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 on_code: 'xyz.openbmc_project.State.Chassis.PowerState.On', 31 off: 'Off', 32 off_code: 'xyz.openbmc_project.State.Chassis.PowerState.Off' 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 HOST_STATE: { 44 on: 1, 45 off: -1, 46 error: 0, 47 unreachable: -2 48 }, 49 LED_STATE: { 50 on: true, 51 off: false 52 }, 53 LED_STATE_TEXT: { 54 on: 'on', 55 off: 'off' 56 }, 57 SEVERITY_TO_HEALTH_MAP:{ 58 Emergency: 'Critical', 59 Alert: 'Critical', 60 Critical: 'Critical', 61 Error: 'Warning', 62 Warning: 'Warning', 63 Notice: 'Good', 64 Debug: 'Good', 65 Informational: 'Good' 66 }, 67 SEVERITY_TO_PRIORITY_MAP:{ 68 Emergency: 'High', 69 Alert: 'High', 70 Critical: 'High', 71 Error: 'High', 72 Warning: 'Medium', 73 Notice: 'Low', 74 Debug: 'Low', 75 Informational: 'Low' 76 }, 77 PAGINATION: { 78 LOG_ITEMS_PER_PAGE: 25 79 }, 80 HARDWARE: { 81 component_key_filter: '/xyz/openbmc_project/inventory/system', 82 parent_components: [ 83 /xyz\/openbmc_project\/inventory\/system\/chassis\/motherboard\/cpu\d+\// 84 ], 85 uppercase_titles: [ 86 'cpu', 'dimm' 87 ] 88 }, 89 SENSOR_UNIT_MAP: { 90 'xyz.openbmc_project.Sensor.Value.Unit.RPMS': 'rpms', 91 'xyz.openbmc_project.Sensor.Value.Unit.DegreesC': 'C', 92 'xyz.openbmc_project.Sensor.Value.Unit.Volts': 'volts', 93 'xyz.openbmc_project.Sensor.Value.Unit.Meters': 'meters', 94 'xyz.openbmc_project.Sensor.Value.Unit.Watts': 'watts', 95 'xyz.openbmc_project.Sensor.Value.Unit.Amperes': 'amperes', 96 'xyz.openbmc_project.Sensor.Value.Unit.Joules': 'joules' 97 }, 98 SERVER_HEALTH: { 99 critical: 'Critical', 100 warning: 'Warning', 101 good: 'Good', 102 unknown: 'Unknown' 103 }, 104 SENSOR_SORT_ORDER: [ 105 'xyz.openbmc_project.Sensor.Value.Unit.DegreesC', 106 'xyz.openbmc_project.Sensor.Value.Unit.RPMS', 107 'xyz.openbmc_project.Sensor.Value.Unit.Meters', 108 'xyz.openbmc_project.Sensor.Value.Unit.Volts', 109 'xyz.openbmc_project.Sensor.Value.Unit.Amperes', 110 'xyz.openbmc_project.Sensor.Value.Unit.Joules', 111 'xyz.openbmc_project.Sensor.Value.Unit.Meters' 112 ], 113 SENSOR_SORT_ORDER_DEFAULT: 8, 114 FIRMWARE: { 115 ACTIVATE_FIRMWARE: 'xyz.openbmc_project.Software.Activation.RequestedActivations.Active', 116 FUNCTIONAL_OBJPATH: '/xyz/openbmc_project/software/functional' 117 }, 118 POLL_INTERVALS: { 119 ACTIVATION: 5000, 120 POWER_OP: 5000, 121 }, 122 TIMEOUT: { 123 ACTIVATION: 1000 * 60 * 10, // 10 mins 124 CHASSIS_OFF: 1000 * 60 * 5, // 5 mins 125 HOST_ON: 1000 * 60 * 5, // 5 mins 126 HOST_OFF: 1000 * 60 * 5, // 5 mins 127 }, 128 MESSAGES: { 129 POLL: { 130 CHASSIS_OFF_TIMEOUT: 'Time out. Chassis did not reach power off state in allotted time.', 131 HOST_ON_TIMEOUT: 'Time out. System did not reach Running state in allotted time.', 132 HOST_OFF_TIMEOUT: 'Time out. System did not reach Off state in allotted time.', 133 HOST_QUIESCED: 'System is in Error state.', 134 }, 135 POWER_OP: { 136 POWER_ON_FAILED: 'Power On Failed', 137 WARM_REBOOT_FAILED: 'Warm Reboot Failed', 138 COLD_REBOOT_FAILED: 'Cold Reboot Failed', 139 ORDERLY_SHUTDOWN_FAILED: 'Orderly Shutdown Failed', 140 IMMEDIATE_SHUTDOWN_FAILED: 'Immediate Shutdown Failed', 141 }, 142 SENSOR: { 143 NO_SENSOR_DATA: 'There are no sensors found.', 144 CRITICAL_NO_SENSOR_DATA: 'There are no sensors in Critical state.', 145 WARNING_NO_SENSOR_DATA: 'There are no sensors in Warning state.', 146 NORMAL_NO_SENSOR_DATA: 'There are no sensors in Normal state.' 147 }, 148 ERROR_MODAL: { 149 TITLE: 'Unexpected error', 150 DESCRIPTION: 'Oops! An unexpected error occurred. Record specific details of the issue, then contact your company support services.' 151 }, 152 ERROR_MESSAGE_DESC_TEMPLATE: '{{status}} - {{description}}', 153 }, 154 POWER_CAP_TEXT: { 155 unit: 'W', 156 disabled: 'Not Enabled' 157 }, 158 POWER_CONSUMPTION_TEXT: { 159 'xyz.openbmc_project.Sensor.Value.Unit.Watts': 'W', 160 notavailable: 'Not Available' 161 }, 162 }; 163 }); 164 165})(window.angular); 166