From cd0c04a03b359dfc5b1ea3f61b93aaae8f6fec3e Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Fri, 29 Jul 2016 14:06:40 +1200 Subject: Change alarm highlight logic --- web/app/AttributeFormatter.js | 20 -------------------- web/app/view/Devices.js | 10 +++++----- web/app/view/Report.js | 5 ----- web/app/view/State.js | 8 +++++++- 4 files changed, 12 insertions(+), 31 deletions(-) (limited to 'web/app') diff --git a/web/app/AttributeFormatter.js b/web/app/AttributeFormatter.js index c32849101..3432ca1e0 100644 --- a/web/app/AttributeFormatter.js +++ b/web/app/AttributeFormatter.js @@ -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 '' + value + ''; - }, - defaultFormatter: function (value) { if (typeof value === 'number') { return Number(value.toFixed(Traccar.Style.numberPrecision)); @@ -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; } diff --git a/web/app/view/Devices.js b/web/app/view/Devices.js index c086827f8..ab6436ea6 100644 --- a/web/app/view/Devices.js +++ b/web/app/view/Devices.js @@ -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, @@ -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)) { diff --git a/web/app/view/Report.js b/web/app/view/Report.js index 78ff5d52f..4261b9040 100644 --- a/web/app/view/Report.js +++ b/web/app/view/Report.js @@ -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') }] }); diff --git a/web/app/view/State.js b/web/app/view/State.js index 1a9f014f5..547fb0cf3 100644 --- a/web/app/view/State.js +++ b/web/app/view/State.js @@ -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; + } }] }); -- cgit v1.2.3