Color coding of monitoring states in admin panel

This commit is contained in:
baldo 2016-06-11 18:13:37 +02:00
parent 98d5fde88a
commit 0718931429
2 changed files with 28 additions and 10 deletions

View file

@ -38,6 +38,14 @@
color: lightgrey; color: lightgrey;
} }
.monitoring-state-online {
color: green;
}
.monitoring-state-offline {
color: red;
}
.vpn-key-set, .coords-set { .vpn-key-set, .coords-set {
color: green; color: green;
} }

View file

@ -133,8 +133,18 @@ angular.module('ffffngAdmin').config(function(NgAdminConfigurationProvider, Rest
if (!monitoringState) { if (!monitoringState) {
return; return;
} }
switch (monitoringState.values.state) {
case 'ONLINE':
return 'monitoring-state-online';
case 'OFFLINE':
return 'monitoring-state-offline';
default:
return; return;
} }
}
var monitoringStates = nga.entity('monitoring').label('Monitoring'); var monitoringStates = nga.entity('monitoring').label('Monitoring');
monitoringStates monitoringStates
@ -147,15 +157,15 @@ angular.module('ffffngAdmin').config(function(NgAdminConfigurationProvider, Rest
.batchActions([]) .batchActions([])
.exportFields([]) .exportFields([])
.fields([ .fields([
nga.field('id').cssClasses(monitoringStateClasses()), nga.field('id').cssClasses(monitoringStateClasses),
nga.field('mac').cssClasses(monitoringStateClasses()), nga.field('mac').cssClasses(monitoringStateClasses),
nga.field('state').cssClasses(monitoringStateClasses()), nga.field('state').cssClasses(monitoringStateClasses),
nga.field('last_seen').map(formatMoment).cssClasses(monitoringStateClasses()), nga.field('last_seen').map(formatMoment).cssClasses(monitoringStateClasses),
nga.field('import_timestamp').map(formatMoment).cssClasses(monitoringStateClasses()), nga.field('import_timestamp').label('Imported').map(formatMoment).cssClasses(monitoringStateClasses),
nga.field('last_status_mail_type').cssClasses(monitoringStateClasses()), nga.field('last_status_mail_type').cssClasses(monitoringStateClasses),
nga.field('last_status_mail_sent').map(formatMoment).cssClasses(monitoringStateClasses()), nga.field('last_status_mail_sent').map(formatMoment).cssClasses(monitoringStateClasses),
nga.field('created_at').map(formatMoment).cssClasses(monitoringStateClasses()), nga.field('created_at').map(formatMoment).cssClasses(monitoringStateClasses),
nga.field('modified_at').map(formatMoment).cssClasses(monitoringStateClasses()) nga.field('modified_at').map(formatMoment).cssClasses(monitoringStateClasses)
]) ])
.filters([ .filters([
nga.field('q') nga.field('q')