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