Skip to content

Commit

Permalink
Change alarm highlight logic
Browse files Browse the repository at this point in the history
  • Loading branch information
tananaev committed Jul 29, 2016
1 parent 88c9571 commit cd0c04a
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 35 deletions.
6 changes: 3 additions & 3 deletions web/app.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
.status-color-online {
.view-color-green {
background-color: rgba(77, 250, 144, 0.3);
}
.status-color-unknown {
.view-color-yellow {
background-color: rgba(250, 190, 77, 0.3);
}
.status-color-offline {
.view-color-red {
background-color: rgba(255, 84, 104, 0.3);
}

Expand Down
20 changes: 0 additions & 20 deletions web/app/AttributeFormatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,6 @@ Ext.define('Traccar.AttributeFormatter', {
return Ext.getStore('DistanceUnits').formatValue(value, Traccar.app.getPreference('distanceUnit'));
},

alarmFormatter: function (attributes) {
var value = '';
if (attributes instanceof Object) {//for Traccar.view.Attributes
if (attributes.hasOwnProperty('alarm')) {
value = attributes.alarm;
if (typeof value === 'boolean') {
value = (value ? Ext.Msg.buttonText.yes : Ext.Msg.buttonText.no);
}
}
} else {//for Traccar.view.Report
value = attributes;
if (typeof value === 'boolean') {
value = (value ? Ext.Msg.buttonText.yes : Ext.Msg.buttonText.no);
}
}
return '<span style="color:red;">' + value + '</span>';
},

defaultFormatter: function (value) {
if (typeof value === 'number') {
return Number(value.toFixed(Traccar.Style.numberPrecision));
Expand All @@ -76,8 +58,6 @@ Ext.define('Traccar.AttributeFormatter', {
return this.courseFormatter;
} else if (key === 'distance' || key === 'odometer') {
return this.distanceFormatter;
} else if (key === 'alarm') {
return this.alarmFormatter;
} else {
return this.defaultFormatter;
}
Expand Down
10 changes: 5 additions & 5 deletions web/app/view/Devices.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ Ext.define('Traccar.view.Devices', {
tooltipType: 'title'
}, {
xtype: 'tbfill'
},{
}, {
id: 'muteButton',
glyph: 'xf1f7@FontAwesome',
tooltip: Strings.muteButton,
tooltip: Strings.sharedMute,
tooltipType: 'title',
pressed : true,
enableToggle: true,
Expand Down Expand Up @@ -156,13 +156,13 @@ Ext.define('Traccar.view.Devices', {
renderer: function (value, metaData, record) {
switch (record.get('status')) {
case 'online':
metaData.tdCls = 'status-color-online';
metaData.tdCls = 'view-color-green';
break;
case 'offline':
metaData.tdCls = 'status-color-offline';
metaData.tdCls = 'view-color-red';
break;
default:
metaData.tdCls = 'status-color-unknown';
metaData.tdCls = 'view-color-yellow';
break;
}
if (Traccar.app.getPreference('twelveHourFormat', false)) {
Expand Down
5 changes: 0 additions & 5 deletions web/app/view/Report.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,5 @@ Ext.define('Traccar.view.Report', {
dataIndex: 'address',
flex: 1,
renderer: Traccar.AttributeFormatter.getFormatter('address')
}, {
text: 'Alarm',
dataIndex: 'attributes',
flex: 1,
renderer: Traccar.AttributeFormatter.getFormatter('alarm')
}]
});
8 changes: 7 additions & 1 deletion web/app/view/State.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ Ext.define('Traccar.view.State', {
}, {
text: Strings.stateValue,
dataIndex: 'value',
flex: 1
flex: 1,
renderer: function (value, metaData, record) {
if (record.get('name') === 'Alarm') {
metaData.tdCls = 'view-color-red';
}
return value;
}
}]
});
2 changes: 1 addition & 1 deletion web/l10n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
"sharedSearch": "Search",
"sharedGeofence": "Geofence",
"sharedGeofences": "Geofences",
"muteButton": "Mute",
"sharedNotifications": "Notifications",
"sharedAttributes": "Attributes",
"sharedAttribute": "Attribute",
"sharedArea": "Area",
"sharedMute": "Mute",
"errorTitle": "Error",
"errorUnknown": "Unknown error",
"errorConnection": "Connection error",
Expand Down

0 comments on commit cd0c04a

Please sign in to comment.