aboutsummaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-03-29 21:56:33 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2017-03-29 21:56:33 +1300
commit0a35d3a7c4aa2968e2b8d4b73cfbd486c9fc625b (patch)
tree7f1623354cc52d2232398e8adc7e17b31d088f81 /web
parent86f54b5db9269d0ba010a22e281b379bdae3751f (diff)
downloadtrackermap-web-0a35d3a7c4aa2968e2b8d4b73cfbd486c9fc625b.tar.gz
trackermap-web-0a35d3a7c4aa2968e2b8d4b73cfbd486c9fc625b.tar.bz2
trackermap-web-0a35d3a7c4aa2968e2b8d4b73cfbd486c9fc625b.zip
More devices table improvements
Diffstat (limited to 'web')
-rw-r--r--web/app/Style.js1
-rw-r--r--web/app/view/edit/Devices.js25
-rw-r--r--web/app/view/edit/DevicesController.js6
-rw-r--r--web/l10n/en.json3
4 files changed, 31 insertions, 4 deletions
diff --git a/web/app/Style.js b/web/app/Style.js
index c594d92e..aa749ce9 100644
--- a/web/app/Style.js
+++ b/web/app/Style.js
@@ -18,6 +18,7 @@
Ext.define('Traccar.Style', {
singleton: true,
+ refreshPeriod: 60 * 1000,
reconnectTimeout: 60 * 1000,
normalPadding: 10,
diff --git a/web/app/view/edit/Devices.js b/web/app/view/edit/Devices.js
index 9393b432..42291f0b 100644
--- a/web/app/view/edit/Devices.js
+++ b/web/app/view/edit/Devices.js
@@ -90,7 +90,7 @@ Ext.define('Traccar.view.edit.Devices', {
columns: {
defaults: {
- flex: 2,
+ flex: 1,
minWidth: Traccar.Style.columnWidthNormal
},
items: [{
@@ -132,7 +132,6 @@ Ext.define('Traccar.view.edit.Devices', {
}, {
text: Strings.deviceStatus,
dataIndex: 'status',
- flex: 1,
filter: {
type: 'list',
labelField: 'name',
@@ -151,7 +150,27 @@ Ext.define('Traccar.view.edit.Devices', {
}, {
text: Strings.deviceLastUpdate,
dataIndex: 'lastUpdate',
- renderer: Traccar.AttributeFormatter.getFormatter('lastUpdate')
+ renderer: function (value, metaData, record) {
+ var status, seconds, interval;
+
+ status = record.get('status');
+ if (status) {
+ metaData.tdCls = Ext.getStore('DeviceStatuses').getById(status).get('color');
+ }
+
+ if (value) {
+ seconds = Math.floor((new Date() - value) / 1000);
+ interval = Math.floor(seconds / 86400);
+ if (interval > 1) {
+ return interval + ' ' + Strings.sharedDays;
+ }
+ interval = Math.floor(seconds / 3600);
+ if (interval > 1) {
+ return interval + ' ' + Strings.sharedHours;
+ }
+ return Math.floor(seconds / 60) + ' ' + Strings.sharedMinutes;
+ }
+ }
}]
}
});
diff --git a/web/app/view/edit/DevicesController.js b/web/app/view/edit/DevicesController.js
index 895f0fbd..0d18c186 100644
--- a/web/app/view/edit/DevicesController.js
+++ b/web/app/view/edit/DevicesController.js
@@ -52,10 +52,14 @@ Ext.define('Traccar.view.edit.DevicesController', {
removeTitle: Strings.sharedDevice,
init: function () {
- var readonly, deviceReadonly;
+ var self = this, readonly, deviceReadonly;
deviceReadonly = Traccar.app.getPreference('deviceReadonly', false) && !Traccar.app.getUser().get('admin');
readonly = Traccar.app.getPreference('readonly', false) && !Traccar.app.getUser().get('admin');
this.lookupReference('toolbarAddButton').setDisabled(readonly || deviceReadonly);
+
+ setInterval(function () {
+ self.getView().getView().refresh();
+ }, Traccar.Style.refreshPeriod);
},
onGeofencesClick: function () {
diff --git a/web/l10n/en.json b/web/l10n/en.json
index dc243331..f494978f 100644
--- a/web/l10n/en.json
+++ b/web/l10n/en.json
@@ -17,6 +17,9 @@
"sharedHour": "Hour",
"sharedMinute": "Minute",
"sharedSecond": "Second",
+ "sharedDays": "days",
+ "sharedHours": "hours",
+ "sharedMinutes": "minutes",
"sharedDecimalDegrees": "Decimal Degrees",
"sharedDegreesDecimalMinutes": "Degrees Decimal Minutes",
"sharedDegreesMinutesSeconds": "Degrees Minutes Seconds",