aboutsummaryrefslogtreecommitdiff
path: root/web/app/view/DevicesController.js
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-01-24 18:41:27 +0500
committerAbyss777 <abyss@fox5.ru>2017-01-26 11:42:25 +0500
commit048065b76ac3528a8fa802367aa2750c22487f6c (patch)
treec84414b2421b906d970d2a22549249629700f025 /web/app/view/DevicesController.js
parent6171c7275a32c3ad9653aafaf673ab93254c8d1a (diff)
downloadtrackermap-web-048065b76ac3528a8fa802367aa2750c22487f6c.tar.gz
trackermap-web-048065b76ac3528a8fa802367aa2750c22487f6c.tar.bz2
trackermap-web-048065b76ac3528a8fa802367aa2750c22487f6c.zip
- Polish permissions
- Makeup imports
Diffstat (limited to 'web/app/view/DevicesController.js')
-rw-r--r--web/app/view/DevicesController.js17
1 files changed, 12 insertions, 5 deletions
diff --git a/web/app/view/DevicesController.js b/web/app/view/DevicesController.js
index 20b90b3b..f7e4bb47 100644
--- a/web/app/view/DevicesController.js
+++ b/web/app/view/DevicesController.js
@@ -48,10 +48,12 @@ Ext.define('Traccar.view.DevicesController', {
},
init: function () {
- var readonly = Traccar.app.getPreference('readonly', false) && !Traccar.app.getUser().get('admin');
- this.lookupReference('toolbarAddButton').setVisible(!readonly);
- this.lookupReference('toolbarEditButton').setVisible(!readonly);
- this.lookupReference('toolbarRemoveButton').setVisible(!readonly);
+ var readonly, deviceReadonly;
+ deviceReadonly = Traccar.app.getUser().get('deviceReadonly');
+ readonly = Traccar.app.getPreference('readonly', false) && !Traccar.app.getUser().get('admin');
+ this.lookupReference('toolbarAddButton').setVisible(!readonly && !deviceReadonly);
+ this.lookupReference('toolbarEditButton').setVisible(!readonly && !deviceReadonly);
+ this.lookupReference('toolbarRemoveButton').setVisible(!readonly && !deviceReadonly);
this.lookupReference('toolbarGeofencesButton').setVisible(!readonly);
},
@@ -87,7 +89,12 @@ Ext.define('Traccar.view.DevicesController', {
if (btn === 'yes') {
store = Ext.getStore('Devices');
store.remove(device);
- store.sync();
+ store.sync({
+ failure: function (batch) {
+ store.rejectChanges();
+ Traccar.app.showError(batch.exceptions[0].getError().response);
+ }
+ });
}
}
});