aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-03-09 23:13:06 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2016-03-09 23:13:06 +1300
commit5634860cbe5c43007df354acba79d5051c1eb987 (patch)
tree1c0eb8043b2a83eaa92f0902a4e67b3c4c22d82d
parent71c5871dc0221d7a82851f2c3ca3cd2b594982f2 (diff)
downloadtraccar-server-5634860cbe5c43007df354acba79d5051c1eb987.tar.gz
traccar-server-5634860cbe5c43007df354acba79d5051c1eb987.tar.bz2
traccar-server-5634860cbe5c43007df354acba79d5051c1eb987.zip
Add parent field for device and group
-rw-r--r--debug.xml4
-rw-r--r--src/org/traccar/model/Group.java2
-rw-r--r--web/app/controller/Root.js1
-rw-r--r--web/app/model/Device.js3
-rw-r--r--web/app/model/Group.js3
-rw-r--r--web/app/view/DeviceDialog.js7
-rw-r--r--web/app/view/GroupDialog.js7
-rw-r--r--web/app/view/GroupsController.js4
-rw-r--r--web/l10n/en.json1
9 files changed, 24 insertions, 8 deletions
diff --git a/debug.xml b/debug.xml
index ce7c3190a..45c475a91 100644
--- a/debug.xml
+++ b/debug.xml
@@ -130,7 +130,7 @@
</entry>
<entry key='database.updateDevice'>
- UPDATE devices SET name = :name, uniqueId = :uniqueId WHERE id = :id;
+ UPDATE devices SET name = :name, uniqueId = :uniqueId, groupId = :groupId WHERE id = :id;
</entry>
<entry key='database.updateDeviceStatus'>
@@ -158,7 +158,7 @@
</entry>
<entry key='database.updateGroup'>
- UPDATE groups SET name = :name WHERE id = :id;
+ UPDATE groups SET name = :name, groupId = :groupId WHERE id = :id;
</entry>
<entry key='database.deleteGroup'>
diff --git a/src/org/traccar/model/Group.java b/src/org/traccar/model/Group.java
index 24f7973c8..00f2b2cfc 100644
--- a/src/org/traccar/model/Group.java
+++ b/src/org/traccar/model/Group.java
@@ -15,8 +15,6 @@
*/
package org.traccar.model;
-import java.util.Date;
-
public class Group {
private long id;
diff --git a/web/app/controller/Root.js b/web/app/controller/Root.js
index a1026d3c5..5bd567619 100644
--- a/web/app/controller/Root.js
+++ b/web/app/controller/Root.js
@@ -73,6 +73,7 @@ Ext.define('Traccar.controller.Root', {
},
loadApp: function () {
+ Ext.getStore('Groups').load();
Ext.getStore('Devices').load();
Ext.get('attribution').remove();
if (this.isPhone) {
diff --git a/web/app/model/Device.js b/web/app/model/Device.js
index 709d51953..588d53c1f 100644
--- a/web/app/model/Device.js
+++ b/web/app/model/Device.js
@@ -34,5 +34,8 @@ Ext.define('Traccar.model.Device', {
name: 'lastUpdate',
type: 'date',
dateFormat: 'c'
+ }, {
+ name: 'groupId',
+ type: 'int'
}]
});
diff --git a/web/app/model/Group.js b/web/app/model/Group.js
index 22e160315..a28897feb 100644
--- a/web/app/model/Group.js
+++ b/web/app/model/Group.js
@@ -24,5 +24,8 @@ Ext.define('Traccar.model.Group', {
}, {
name: 'name',
type: 'string'
+ }, {
+ name: 'groupId',
+ type: 'int'
}]
});
diff --git a/web/app/view/DeviceDialog.js b/web/app/view/DeviceDialog.js
index 318ac4ffe..4a22ca008 100644
--- a/web/app/view/DeviceDialog.js
+++ b/web/app/view/DeviceDialog.js
@@ -36,6 +36,13 @@ Ext.define('Traccar.view.DeviceDialog', {
name: 'uniqueId',
fieldLabel: Strings.deviceIdentifier,
allowBlank: false
+ }, {
+ xtype: 'combobox',
+ name: 'groupId',
+ fieldLabel: Strings.groupParent,
+ store: 'Groups',
+ displayField: 'name',
+ valueField: 'id'
}]
}
});
diff --git a/web/app/view/GroupDialog.js b/web/app/view/GroupDialog.js
index a34e33aa0..2cca61ef5 100644
--- a/web/app/view/GroupDialog.js
+++ b/web/app/view/GroupDialog.js
@@ -31,6 +31,13 @@ Ext.define('Traccar.view.GroupDialog', {
name: 'name',
fieldLabel: Strings.sharedName,
allowBlank: false
+ }, {
+ xtype: 'combobox',
+ name: 'groupId',
+ fieldLabel: Strings.groupParent,
+ store: 'Groups',
+ displayField: 'name',
+ valueField: 'id'
}]
}
});
diff --git a/web/app/view/GroupsController.js b/web/app/view/GroupsController.js
index 34b259658..6cc568ea2 100644
--- a/web/app/view/GroupsController.js
+++ b/web/app/view/GroupsController.js
@@ -18,10 +18,6 @@ Ext.define('Traccar.view.GroupsController', {
extend: 'Ext.app.ViewController',
alias: 'controller.groups',
- init: function () {
- Ext.getStore('Groups').load();
- },
-
onAddClick: function () {
var group, dialog;
group = Ext.create('Traccar.model.Group');
diff --git a/web/l10n/en.json b/web/l10n/en.json
index 715dce3a7..cabd76362 100644
--- a/web/l10n/en.json
+++ b/web/l10n/en.json
@@ -35,6 +35,7 @@
"deviceCommand": "Command",
"deviceFollow": "Follow",
"groupDialog": "Group",
+ "groupParent": "Group",
"settingsTitle": "Settings",
"settingsUser": "Account",
"settingsGroups": "Groups",