aboutsummaryrefslogtreecommitdiff
path: root/web/app/store
diff options
context:
space:
mode:
Diffstat (limited to 'web/app/store')
-rw-r--r--web/app/store/DeviceAttributes.js9
-rw-r--r--web/app/store/DistanceUnits.js4
-rw-r--r--web/app/store/GroupAttributes.js9
-rw-r--r--web/app/store/ServerAttributes.js9
-rw-r--r--web/app/store/SpeedUnits.js4
5 files changed, 22 insertions, 13 deletions
diff --git a/web/app/store/DeviceAttributes.js b/web/app/store/DeviceAttributes.js
index a4303546..8f476d4e 100644
--- a/web/app/store/DeviceAttributes.js
+++ b/web/app/store/DeviceAttributes.js
@@ -23,7 +23,8 @@ Ext.define('Traccar.store.DeviceAttributes', {
data: [{
key: 'speedLimit',
name: Strings.attributeSpeedLimit,
- type: 'number'
+ type: 'number',
+ convert: 'speed'
}, {
key: 'report.ignoreOdometer',
name: Strings.attributeReportIgnoreOdometer,
@@ -31,11 +32,13 @@ Ext.define('Traccar.store.DeviceAttributes', {
}, {
key: 'maintenance.start',
name: Strings.attributeMaintenanceStart,
- type: 'number'
+ type: 'number',
+ convert: 'distance'
}, {
key: 'maintenance.interval',
name: Strings.attributeMaintenanceInterval,
- type: 'number'
+ type: 'number',
+ convert: 'distance'
}, {
key: 'web.reportColor',
name: Strings.attributeWebReportColor,
diff --git a/web/app/store/DistanceUnits.js b/web/app/store/DistanceUnits.js
index 0dcddbea..514a051e 100644
--- a/web/app/store/DistanceUnits.js
+++ b/web/app/store/DistanceUnits.js
@@ -33,13 +33,13 @@ Ext.define('Traccar.store.DistanceUnits', {
factor: 0.000539957
}],
- convertValue: function (value, unit) {
+ convertValue: function (value, unit, back) {
var model;
if (!unit) {
unit = 'km';
}
model = this.findRecord('key', unit);
- return value * model.get('factor');
+ return back ? value / model.get('factor') : value * model.get('factor');
},
formatValue: function (value, unit) {
diff --git a/web/app/store/GroupAttributes.js b/web/app/store/GroupAttributes.js
index 35caa8c7..95507243 100644
--- a/web/app/store/GroupAttributes.js
+++ b/web/app/store/GroupAttributes.js
@@ -23,7 +23,8 @@ Ext.define('Traccar.store.GroupAttributes', {
data: [{
key: 'speedLimit',
name: Strings.attributeSpeedLimit,
- type: 'number'
+ type: 'number',
+ convert: 'speed'
}, {
key: 'report.ignoreOdometer',
name: Strings.attributeReportIgnoreOdometer,
@@ -31,11 +32,13 @@ Ext.define('Traccar.store.GroupAttributes', {
}, {
key: 'maintenance.start',
name: Strings.attributeMaintenanceStart,
- type: 'number'
+ type: 'number',
+ convert: 'distance'
}, {
key: 'maintenance.interval',
name: Strings.attributeMaintenanceInterval,
- type: 'number'
+ type: 'number',
+ convert: 'distance'
}, {
key: 'processing.copyAttributes',
name: Strings.attributeProcessingCopyAttributes,
diff --git a/web/app/store/ServerAttributes.js b/web/app/store/ServerAttributes.js
index 71705e04..602aab87 100644
--- a/web/app/store/ServerAttributes.js
+++ b/web/app/store/ServerAttributes.js
@@ -23,15 +23,18 @@ Ext.define('Traccar.store.ServerAttributes', {
data: [{
key: 'speedLimit',
name: Strings.attributeSpeedLimit,
- type: 'number'
+ type: 'number',
+ convert: 'speed'
}, {
key: 'maintenance.start',
name: Strings.attributeMaintenanceStart,
- type: 'number'
+ type: 'number',
+ convert: 'distance'
}, {
key: 'maintenance.interval',
name: Strings.attributeMaintenanceInterval,
- type: 'number'
+ type: 'number',
+ convert: 'distance'
}, {
key: 'web.liveRouteLength',
name: Strings.attributeWebLiveRouteLength,
diff --git a/web/app/store/SpeedUnits.js b/web/app/store/SpeedUnits.js
index a14ab22d..ce976952 100644
--- a/web/app/store/SpeedUnits.js
+++ b/web/app/store/SpeedUnits.js
@@ -33,13 +33,13 @@ Ext.define('Traccar.store.SpeedUnits', {
factor: 1.15078
}],
- convertValue: function (value, unit) {
+ convertValue: function (value, unit, back) {
var model;
if (!unit) {
unit = 'kn';
}
model = this.findRecord('key', unit);
- return value * model.get('factor');
+ return back ? value / model.get('factor') : value * model.get('factor');
},
formatValue: function (value, unit) {