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