aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-07-26 01:09:49 +1200
committerGitHub <noreply@github.com>2016-07-26 01:09:49 +1200
commit4064f864e20d3d40025a94e10cf56084d2c78287 (patch)
tree0a9e69d6139e19a830a979a45b76f82ccbe27bb4
parent7e20896334f4f6927cf14c5272cf7d893efc3a05 (diff)
parentfb0a1689fda9a06ecf5e6a9a97ba8b2b704cacb9 (diff)
downloadtraccar-server-4064f864e20d3d40025a94e10cf56084d2c78287.tar.gz
traccar-server-4064f864e20d3d40025a94e10cf56084d2c78287.tar.bz2
traccar-server-4064f864e20d3d40025a94e10cf56084d2c78287.zip
Merge pull request #2155 from Abyss777/attributes
Added group and server attributes
-rw-r--r--debug.xml7
-rw-r--r--schema/changelog-3.7.xml8
-rw-r--r--setup/unix/traccar.xml7
-rw-r--r--setup/windows/traccar.xml7
-rw-r--r--src/org/traccar/model/Group.java12
-rw-r--r--src/org/traccar/model/Server.java12
-rw-r--r--swagger.json6
-rw-r--r--web/app/model/Group.js2
-rw-r--r--web/app/model/Server.js2
-rw-r--r--web/app/view/BaseEditDialog.js5
-rw-r--r--web/app/view/BaseEditDialogController.js14
-rw-r--r--web/app/view/DeviceDialog.js19
-rw-r--r--web/app/view/DeviceDialogController.js38
-rw-r--r--web/app/view/ServerDialog.js2
-rw-r--r--web/app/view/UserDialog.js13
-rw-r--r--web/app/view/UserDialogController.js20
16 files changed, 54 insertions, 120 deletions
diff --git a/debug.xml b/debug.xml
index 095f7d4b2..f078a7e9d 100644
--- a/debug.xml
+++ b/debug.xml
@@ -102,7 +102,8 @@
latitude = :latitude,
longitude = :longitude,
zoom = :zoom,
- twelveHourFormat = :twelveHourFormat
+ twelveHourFormat = :twelveHourFormat,
+ attributes = :attributes
WHERE id = :id;
</entry>
@@ -190,11 +191,11 @@
</entry>
<entry key='database.insertGroup'>
- INSERT INTO groups (name, groupId) VALUES (:name, :groupId);
+ INSERT INTO groups (name, groupId, attributes) VALUES (:name, :groupId, :attributes);
</entry>
<entry key='database.updateGroup'>
- UPDATE groups SET name = :name, groupId = :groupId WHERE id = :id;
+ UPDATE groups SET name = :name, groupId = :groupId, attributes = :attributes WHERE id = :id;
</entry>
<entry key='database.deleteGroup'>
diff --git a/schema/changelog-3.7.xml b/schema/changelog-3.7.xml
index c988b8bdb..ae85f69f3 100644
--- a/schema/changelog-3.7.xml
+++ b/schema/changelog-3.7.xml
@@ -26,6 +26,14 @@
<dropColumn tableName="devices" columnName="motion" />
+ <addColumn tableName="groups">
+ <column name="attributes" type="VARCHAR(4096)" />
+ </addColumn>
+
+ <addColumn tableName="server">
+ <column name="attributes" type="VARCHAR(4096)" />
+ </addColumn>
+
</changeSet>
<changeSet author="author" id="changelog-3.7-notmssql">
diff --git a/setup/unix/traccar.xml b/setup/unix/traccar.xml
index 90cb5f74e..186e981cb 100644
--- a/setup/unix/traccar.xml
+++ b/setup/unix/traccar.xml
@@ -51,7 +51,8 @@
latitude = :latitude,
longitude = :longitude,
zoom = :zoom,
- twelveHourFormat = :twelveHourFormat
+ twelveHourFormat = :twelveHourFormat,
+ attributes = :attributes
WHERE id = :id;
</entry>
@@ -139,11 +140,11 @@
</entry>
<entry key='database.insertGroup'>
- INSERT INTO groups (name, groupId) VALUES (:name, :groupId);
+ INSERT INTO groups (name, groupId, attributes) VALUES (:name, :groupId, :attributes);
</entry>
<entry key='database.updateGroup'>
- UPDATE groups SET name = :name, groupId = :groupId WHERE id = :id;
+ UPDATE groups SET name = :name, groupId = :groupId, attributes = :attributes WHERE id = :id;
</entry>
<entry key='database.deleteGroup'>
diff --git a/setup/windows/traccar.xml b/setup/windows/traccar.xml
index 25128a3e0..aa3809763 100644
--- a/setup/windows/traccar.xml
+++ b/setup/windows/traccar.xml
@@ -51,7 +51,8 @@
latitude = :latitude,
longitude = :longitude,
zoom = :zoom,
- twelveHourFormat = :twelveHourFormat
+ twelveHourFormat = :twelveHourFormat,
+ attributes = :attributes
WHERE id = :id;
</entry>
@@ -139,11 +140,11 @@
</entry>
<entry key='database.insertGroup'>
- INSERT INTO groups (name, groupId) VALUES (:name, :groupId);
+ INSERT INTO groups (name, groupId, attributes) VALUES (:name, :groupId, :attributes);
</entry>
<entry key='database.updateGroup'>
- UPDATE groups SET name = :name, groupId = :groupId WHERE id = :id;
+ UPDATE groups SET name = :name, groupId = :groupId, attributes = :attributes 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 00f2b2cfc..e70b3f3d5 100644
--- a/src/org/traccar/model/Group.java
+++ b/src/org/traccar/model/Group.java
@@ -15,17 +15,7 @@
*/
package org.traccar.model;
-public class Group {
-
- private long id;
-
- public long getId() {
- return id;
- }
-
- public void setId(long id) {
- this.id = id;
- }
+public class Group extends Extensible {
private String name;
diff --git a/src/org/traccar/model/Server.java b/src/org/traccar/model/Server.java
index 270fd61fa..b1557bf8f 100644
--- a/src/org/traccar/model/Server.java
+++ b/src/org/traccar/model/Server.java
@@ -15,17 +15,7 @@
*/
package org.traccar.model;
-public class Server {
-
- private long id;
-
- public long getId() {
- return id;
- }
-
- public void setId(long id) {
- this.id = id;
- }
+public class Server extends Extensible {
private boolean registration;
diff --git a/swagger.json b/swagger.json
index a16794a41..8b4157917 100644
--- a/swagger.json
+++ b/swagger.json
@@ -1235,7 +1235,8 @@
},
"twelveHourFormat": {
"type": "boolean"
- }
+ },
+ "attributes": {}
}
},
"Command": {
@@ -1286,7 +1287,8 @@
},
"groupId": {
"type": "integer"
- }
+ },
+ "attributes": {}
}
},
"DevicePermission": {
diff --git a/web/app/model/Group.js b/web/app/model/Group.js
index a28897feb..bb18b5b3f 100644
--- a/web/app/model/Group.js
+++ b/web/app/model/Group.js
@@ -27,5 +27,7 @@ Ext.define('Traccar.model.Group', {
}, {
name: 'groupId',
type: 'int'
+ }, {
+ name: 'attributes'
}]
});
diff --git a/web/app/model/Server.js b/web/app/model/Server.js
index 3f6e466d9..02968c2d6 100644
--- a/web/app/model/Server.js
+++ b/web/app/model/Server.js
@@ -54,6 +54,8 @@ Ext.define('Traccar.model.Server', {
}, {
name: 'twelveHourFormat',
type: 'boolean'
+ }, {
+ name: 'attributes'
}],
proxy: {
diff --git a/web/app/view/BaseEditDialog.js b/web/app/view/BaseEditDialog.js
index 051dfbe93..1af095c98 100644
--- a/web/app/view/BaseEditDialog.js
+++ b/web/app/view/BaseEditDialog.js
@@ -18,6 +18,11 @@ Ext.define('Traccar.view.BaseEditDialog', {
extend: 'Traccar.view.BaseDialog',
buttons: [{
+ text: Strings.sharedAttributes,
+ handler: 'showAttributesView'
+ }, {
+ xtype: 'tbfill'
+ }, {
text: Strings.sharedSave,
handler: 'onSaveClick'
}, {
diff --git a/web/app/view/BaseEditDialogController.js b/web/app/view/BaseEditDialogController.js
index 33bd01bd8..511309650 100644
--- a/web/app/view/BaseEditDialogController.js
+++ b/web/app/view/BaseEditDialogController.js
@@ -38,5 +38,19 @@ Ext.define('Traccar.view.BaseEditDialogController', {
record.save();
}
button.up('window').close();
+ },
+
+ showAttributesView: function (button) {
+ var dialog, record;
+ dialog = button.up('window').down('form');
+ record = dialog.getRecord();
+ Ext.create('Traccar.view.BaseWindow', {
+ title: Strings.sharedAttributes,
+ modal: false,
+ items: {
+ xtype: 'attributesView',
+ record: record
+ }
+ }).show();
}
});
diff --git a/web/app/view/DeviceDialog.js b/web/app/view/DeviceDialog.js
index 2938d5dc3..e88618fc5 100644
--- a/web/app/view/DeviceDialog.js
+++ b/web/app/view/DeviceDialog.js
@@ -18,10 +18,10 @@ Ext.define('Traccar.view.DeviceDialog', {
extend: 'Traccar.view.BaseEditDialog',
requires: [
- 'Traccar.view.DeviceDialogController'
+ 'Traccar.view.BaseEditDialog'
],
- controller: 'deviceDialog',
+ controller: 'baseEditDialog',
title: Strings.deviceDialog,
items: {
@@ -45,18 +45,5 @@ Ext.define('Traccar.view.DeviceDialog', {
displayField: 'name',
valueField: 'id'
}]
- },
-
- buttons: [{
- text : Strings.sharedAttributes,
- handler: 'showAttributesView'
- }, {
- xtype: 'tbfill'
- }, {
- text: Strings.sharedSave,
- handler: 'onSaveClick'
- }, {
- text: Strings.sharedCancel,
- handler: 'closeView'
- }]
+ }
});
diff --git a/web/app/view/DeviceDialogController.js b/web/app/view/DeviceDialogController.js
deleted file mode 100644
index 0a0f86883..000000000
--- a/web/app/view/DeviceDialogController.js
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright 2016 Anton Tananaev (anton.tananaev@gmail.com)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-Ext.define('Traccar.view.DeviceDialogController', {
- extend: 'Traccar.view.BaseEditDialogController',
- alias: 'controller.deviceDialog',
-
- requires: [
- 'Traccar.view.Attributes'
- ],
-
- showAttributesView: function (button) {
- var dialog, record;
- dialog = button.up('window').down('form');
- record = dialog.getRecord();
- Ext.create('Traccar.view.BaseWindow', {
- title: Strings.sharedAttributes,
- modal: false,
- items: {
- xtype: 'attributesView',
- record: record
- }
- }).show();
- }
-});
diff --git a/web/app/view/ServerDialog.js b/web/app/view/ServerDialog.js
index 67f3a7ab2..1af000042 100644
--- a/web/app/view/ServerDialog.js
+++ b/web/app/view/ServerDialog.js
@@ -31,7 +31,7 @@ Ext.define('Traccar.view.ServerDialog', {
name: 'registration',
fieldLabel: Strings.serverRegistration,
allowBlank: false
- },{
+ }, {
xtype: 'checkboxfield',
name: 'readonly',
fieldLabel: Strings.serverReadonly,
diff --git a/web/app/view/UserDialog.js b/web/app/view/UserDialog.js
index 378cc0681..df8a26e7e 100644
--- a/web/app/view/UserDialog.js
+++ b/web/app/view/UserDialog.js
@@ -89,18 +89,5 @@ Ext.define('Traccar.view.UserDialog', {
fieldLabel: Strings.settingsTwelveHourFormat,
allowBlank: false
}]
- }],
-
- buttons: [{
- text : Strings.sharedAttributes,
- handler: 'showAttributesView'
- }, {
- xtype: 'tbfill'
- }, {
- text: Strings.sharedSave,
- handler: 'onSaveClick'
- }, {
- text: Strings.sharedCancel,
- handler: 'closeView'
}]
});
diff --git a/web/app/view/UserDialogController.js b/web/app/view/UserDialogController.js
index 49dfd9d70..c3a4ca62d 100644
--- a/web/app/view/UserDialogController.js
+++ b/web/app/view/UserDialogController.js
@@ -15,13 +15,9 @@
*/
Ext.define('Traccar.view.UserDialogController', {
- extend: 'Ext.app.ViewController',
+ extend: 'Traccar.view.BaseEditDialogController',
alias: 'controller.userDialog',
- requires: [
- 'Traccar.view.Attributes'
- ],
-
init: function () {
if (Traccar.app.getUser().get('admin')) {
this.lookupReference('adminField').setDisabled(false);
@@ -48,19 +44,5 @@ Ext.define('Traccar.view.UserDialogController', {
});
}
button.up('window').close();
- },
-
- showAttributesView: function (button) {
- var dialog, record;
- dialog = button.up('window').down('form');
- record = dialog.getRecord();
- Ext.create('Traccar.view.BaseWindow', {
- title: Strings.sharedAttributes,
- modal: false,
- items: {
- xtype: 'attributesView',
- record: record
- }
- }).show();
}
});