aboutsummaryrefslogtreecommitdiff
path: root/web/app
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-07-23 22:36:05 +1200
committerGitHub <noreply@github.com>2017-07-23 22:36:05 +1200
commit33eafa3dd89b517fe0b06394eb2edfebd131cb33 (patch)
tree7f6f4f267fbbbcf9090d0b003fc7a9d91f37b5e9 /web/app
parentfa5f3054efe7ca926f49f19da45013e1cf1ed81c (diff)
parent58919b078db6c163f47bcf03dcc576bb5c3ac56f (diff)
downloadtrackermap-web-33eafa3dd89b517fe0b06394eb2edfebd131cb33.tar.gz
trackermap-web-33eafa3dd89b517fe0b06394eb2edfebd131cb33.tar.bz2
trackermap-web-33eafa3dd89b517fe0b06394eb2edfebd131cb33.zip
Merge pull request #531 from Abyss777/refactor_managers
Refactor managers
Diffstat (limited to 'web/app')
-rw-r--r--web/app/view/edit/Devices.js8
-rw-r--r--web/app/view/edit/DevicesController.js3
-rw-r--r--web/app/view/edit/GroupsController.js3
-rw-r--r--web/app/view/edit/UsersController.js7
-rw-r--r--web/app/view/permissions/BaseController.js4
5 files changed, 7 insertions, 18 deletions
diff --git a/web/app/view/edit/Devices.js b/web/app/view/edit/Devices.js
index d6018006..d5e6d5f4 100644
--- a/web/app/view/edit/Devices.js
+++ b/web/app/view/edit/Devices.js
@@ -161,9 +161,11 @@ Ext.define('Traccar.view.edit.Devices', {
},
renderer: function (value) {
var i, result = '';
- for (i = 0; i < value.length; i++) {
- result += Traccar.AttributeFormatter.geofenceIdFormatter(value[i]);
- result += (i < value.length - 1) ? ', ' : '';
+ if (Ext.isArray(value)) {
+ for (i = 0; i < value.length; i++) {
+ result += Traccar.AttributeFormatter.geofenceIdFormatter(value[i]);
+ result += (i < value.length - 1) ? ', ' : '';
+ }
}
return result;
}
diff --git a/web/app/view/edit/DevicesController.js b/web/app/view/edit/DevicesController.js
index 48c5f5b8..9de298cf 100644
--- a/web/app/view/edit/DevicesController.js
+++ b/web/app/view/edit/DevicesController.js
@@ -73,7 +73,6 @@ Ext.define('Traccar.view.edit.DevicesController', {
baseObjectName: 'deviceId',
linkObjectName: 'geofenceId',
storeName: 'Geofences',
- urlApi: 'api/devices/geofences',
baseObject: device.getId()
}
}).show();
@@ -88,7 +87,6 @@ Ext.define('Traccar.view.edit.DevicesController', {
baseObjectName: 'deviceId',
linkObjectName: 'attributeId',
storeName: 'ComputedAttributes',
- urlApi: 'api/devices/attributes',
baseObject: device.getId()
}
}).show();
@@ -103,7 +101,6 @@ Ext.define('Traccar.view.edit.DevicesController', {
baseObjectName: 'deviceId',
linkObjectName: 'driverId',
storeName: 'Drivers',
- urlApi: 'api/devices/drivers',
baseObject: device.getId()
}
}).show();
diff --git a/web/app/view/edit/GroupsController.js b/web/app/view/edit/GroupsController.js
index 9ced956c..21f17ffa 100644
--- a/web/app/view/edit/GroupsController.js
+++ b/web/app/view/edit/GroupsController.js
@@ -43,7 +43,6 @@ Ext.define('Traccar.view.edit.GroupsController', {
baseObjectName: 'groupId',
linkObjectName: 'geofenceId',
storeName: admin ? 'AllGeofences' : 'Geofences',
- urlApi: 'api/groups/geofences',
baseObject: group.getId()
}
}).show();
@@ -60,7 +59,6 @@ Ext.define('Traccar.view.edit.GroupsController', {
baseObjectName: 'groupId',
linkObjectName: 'attributeId',
storeName: admin ? 'AllComputedAttributes' : 'ComputedAttributes',
- urlApi: 'api/groups/attributes',
baseObject: group.getId()
}
}).show();
@@ -77,7 +75,6 @@ Ext.define('Traccar.view.edit.GroupsController', {
baseObjectName: 'groupId',
linkObjectName: 'driverId',
storeName: admin ? 'AllDrivers' : 'Drivers',
- urlApi: 'api/groups/drivers',
baseObject: group.getId()
}
}).show();
diff --git a/web/app/view/edit/UsersController.js b/web/app/view/edit/UsersController.js
index 1fa17dfe..fb7a36e2 100644
--- a/web/app/view/edit/UsersController.js
+++ b/web/app/view/edit/UsersController.js
@@ -77,7 +77,6 @@ Ext.define('Traccar.view.edit.UsersController', {
linkObjectName: 'deviceId',
storeName: 'AllDevices',
linkStoreName: 'Devices',
- urlApi: 'api/permissions/devices',
baseObject: user.getId()
}
}).show();
@@ -93,7 +92,6 @@ Ext.define('Traccar.view.edit.UsersController', {
linkObjectName: 'groupId',
storeName: 'AllGroups',
linkStoreName: 'Groups',
- urlApi: 'api/permissions/groups',
baseObject: user.getId()
}
}).show();
@@ -109,7 +107,6 @@ Ext.define('Traccar.view.edit.UsersController', {
linkObjectName: 'geofenceId',
storeName: 'AllGeofences',
linkStoreName: 'Geofences',
- urlApi: 'api/permissions/geofences',
baseObject: user.getId()
}
}).show();
@@ -136,7 +133,6 @@ Ext.define('Traccar.view.edit.UsersController', {
linkObjectName: 'calendarId',
storeName: 'AllCalendars',
linkStoreName: 'Calendars',
- urlApi: 'api/permissions/calendars',
baseObject: user.getId()
}
}).show();
@@ -151,7 +147,6 @@ Ext.define('Traccar.view.edit.UsersController', {
baseObjectName: 'userId',
linkObjectName: 'managedUserId',
storeName: 'Users',
- urlApi: 'api/permissions/users',
baseObject: user.getId()
}
}).show();
@@ -167,7 +162,6 @@ Ext.define('Traccar.view.edit.UsersController', {
linkObjectName: 'attributeId',
storeName: 'AllComputedAttributes',
linkStoreName: 'ComputedAttributes',
- urlApi: 'api/permissions/attributes',
baseObject: user.getId()
}
}).show();
@@ -183,7 +177,6 @@ Ext.define('Traccar.view.edit.UsersController', {
linkObjectName: 'driverId',
storeName: 'AllDrivers',
linkStoreName: 'Drivers',
- urlApi: 'api/permissions/drivers',
baseObject: user.getId()
}
}).show();
diff --git a/web/app/view/permissions/BaseController.js b/web/app/view/permissions/BaseController.js
index 8a85a5e2..860a29b3 100644
--- a/web/app/view/permissions/BaseController.js
+++ b/web/app/view/permissions/BaseController.js
@@ -53,7 +53,7 @@ Ext.define('Traccar.view.permissions.BaseController', {
data[this.getView().linkObjectName] = record.getId();
Ext.Ajax.request({
scope: this,
- url: this.getView().urlApi,
+ url: 'api/permissions',
jsonData: Ext.util.JSON.encode(data),
callback: function (options, success, response) {
if (!success) {
@@ -71,7 +71,7 @@ Ext.define('Traccar.view.permissions.BaseController', {
Ext.Ajax.request({
scope: this,
method: 'DELETE',
- url: this.getView().urlApi,
+ url: 'api/permissions',
jsonData: Ext.util.JSON.encode(data),
callback: function (options, success, response) {
if (!success) {