trust-module-frontend/src/Components/Layout/SettingsComponents/statusConfig.jsx

27 lines
1.3 KiB
JavaScript

export const statusConfig = {
statusMap: {
'0': { text: 'Нет соединения', color: '#757575', description: 'Устройство не отвечает' },
'1': { text: 'Норма', color: '#4CAF50', description: 'Параметры в норме' },
'2': { text: 'Отклонение', color: '#FFC107', description: 'Обнаружены отклонения от нормы' },
'3': { text: 'Критично', color: '#FF9800', description: 'Критическое состояние системы' },
'4': { text: 'Авария', color: '#F44336', description: 'Аварийное состояние системы' }
},
getStatusText(status) {
return this.statusMap[status]?.text || 'Неизвестно';
},
getStatusColor(status) {
return this.statusMap[status]?.color || '#757575';
},
getStatusDescription(status) {
return this.statusMap[status]?.description || 'Статус неизвестен';
},
getAvailableStatuses() {
return Object.entries(this.statusMap)
.filter(([key]) => key !== '0') // исключаем статус "Нет соединения"
.map(([value, config]) => ({ value, text: config.text }));
}
};