aboutsummaryrefslogtreecommitdiff
path: root/web/app/AttributeFormatter.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-07-25 16:20:15 +1200
committerGitHub <noreply@github.com>2016-07-25 16:20:15 +1200
commit4a31e34ca62d4b1941d3bc329afc127ef7263f34 (patch)
tree09b9ad0420a4819a350bcdcffeeee2342c5d2483 /web/app/AttributeFormatter.js
parent866c3073ef48a24d86834a391a4d3d91209a6eed (diff)
parentb4841fa0a6293c0b895cf6bb65c6c2d871c78397 (diff)
downloadtrackermap-server-4a31e34ca62d4b1941d3bc329afc127ef7263f34.tar.gz
trackermap-server-4a31e34ca62d4b1941d3bc329afc127ef7263f34.tar.bz2
trackermap-server-4a31e34ca62d4b1941d3bc329afc127ef7263f34.zip
Merge pull request #2104 from ninioe/master
Added support for Alarm notifications & positions history cleaner & show alarms in report & Mute button & unlock UI files (for windows)
Diffstat (limited to 'web/app/AttributeFormatter.js')
-rw-r--r--web/app/AttributeFormatter.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/web/app/AttributeFormatter.js b/web/app/AttributeFormatter.js
index 3432ca1e0..c32849101 100644
--- a/web/app/AttributeFormatter.js
+++ b/web/app/AttributeFormatter.js
@@ -34,6 +34,24 @@ 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));
@@ -58,6 +76,8 @@ 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;
}