aboutsummaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-02-28 00:02:29 +1300
committerGitHub <noreply@github.com>2017-02-28 00:02:29 +1300
commit053962fb3c45297f3e5ecfa4e26e61e5c7ab7284 (patch)
tree15103a426c4b09db5f032572c82e34e227cd4290 /web
parenta540844ff9195716a188124960ee57bac6680ce0 (diff)
parent9d3fb390252a9d4cef09bf71c7ebaa7b1a024917 (diff)
downloadtrackermap-web-053962fb3c45297f3e5ecfa4e26e61e5c7ab7284.tar.gz
trackermap-web-053962fb3c45297f3e5ecfa4e26e61e5c7ab7284.tar.bz2
trackermap-web-053962fb3c45297f3e5ecfa4e26e61e5c7ab7284.zip
Merge pull request #416 from Abyss777/server_devicereadonly
Add server "device readonly" flag
Diffstat (limited to 'web')
-rw-r--r--web/app/model/Server.js3
-rw-r--r--web/app/view/Devices.js1
-rw-r--r--web/app/view/DevicesController.js22
-rw-r--r--web/app/view/ServerDialog.js7
4 files changed, 22 insertions, 11 deletions
diff --git a/web/app/model/Server.js b/web/app/model/Server.js
index aa14e845..f1589991 100644
--- a/web/app/model/Server.js
+++ b/web/app/model/Server.js
@@ -29,6 +29,9 @@ Ext.define('Traccar.model.Server', {
name: 'readonly',
type: 'boolean'
}, {
+ name: 'deviceReadonly',
+ type: 'boolean'
+ }, {
name: 'map',
type: 'string'
}, {
diff --git a/web/app/view/Devices.js b/web/app/view/Devices.js
index 664c094f..88e8be34 100644
--- a/web/app/view/Devices.js
+++ b/web/app/view/Devices.js
@@ -47,6 +47,7 @@ Ext.define('Traccar.view.Devices', {
xtype: 'tbfill'
}, {
xtype: 'button',
+ disabled: true,
handler: 'onAddClick',
reference: 'toolbarAddButton',
glyph: 'xf067@FontAwesome',
diff --git a/web/app/view/DevicesController.js b/web/app/view/DevicesController.js
index 62853919..ad0dd363 100644
--- a/web/app/view/DevicesController.js
+++ b/web/app/view/DevicesController.js
@@ -53,13 +53,9 @@ Ext.define('Traccar.view.DevicesController', {
init: function () {
var readonly, deviceReadonly;
- deviceReadonly = Traccar.app.getUser().get('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').setVisible(!readonly && !deviceReadonly);
- this.lookupReference('toolbarEditButton').setVisible(!readonly && !deviceReadonly);
- this.lookupReference('toolbarRemoveButton').setVisible(!readonly && !deviceReadonly);
- this.lookupReference('deviceCommandButton').setVisible(!readonly && !deviceReadonly);
- this.lookupReference('toolbarGeofencesButton').setVisible(!readonly);
+ this.lookupReference('toolbarAddButton').setDisabled(readonly || deviceReadonly);
},
onGeofencesClick: function () {
@@ -91,11 +87,15 @@ Ext.define('Traccar.view.DevicesController', {
},
updateButtons: function (selected) {
- var empty = selected.getCount() === 0;
- this.lookupReference('toolbarEditButton').setDisabled(empty);
- this.lookupReference('toolbarRemoveButton').setDisabled(empty);
- this.lookupReference('toolbarGeofencesButton').setDisabled(empty);
- this.lookupReference('deviceCommandButton').setDisabled(empty || (selected.getLastSelected().get('status') !== 'online'));
+ var readonly, deviceReadonly, empty, online;
+ deviceReadonly = Traccar.app.getPreference('deviceReadonly', false) && !Traccar.app.getUser().get('admin');
+ readonly = Traccar.app.getPreference('readonly', false) && !Traccar.app.getUser().get('admin');
+ empty = selected.getCount() === 0;
+ online = selected.getLastSelected().get('status') === 'online';
+ this.lookupReference('toolbarEditButton').setDisabled(empty || readonly || deviceReadonly);
+ this.lookupReference('toolbarRemoveButton').setDisabled(empty || readonly || deviceReadonly);
+ this.lookupReference('toolbarGeofencesButton').setDisabled(empty || readonly);
+ this.lookupReference('deviceCommandButton').setDisabled(empty || readonly || !online);
},
onSelectionChange: function (selected) {
diff --git a/web/app/view/ServerDialog.js b/web/app/view/ServerDialog.js
index 667bf47f..770ead79 100644
--- a/web/app/view/ServerDialog.js
+++ b/web/app/view/ServerDialog.js
@@ -42,6 +42,13 @@ Ext.define('Traccar.view.ServerDialog', {
fieldLabel: Strings.serverReadonly,
allowBlank: false
}, {
+ xtype: 'checkboxfield',
+ inputValue: true,
+ uncheckedValue: false,
+ name: 'deviceReadonly',
+ fieldLabel: Strings.userDeviceReadonly,
+ allowBlank: false
+ }, {
xtype: 'combobox',
name: 'map',
fieldLabel: Strings.mapLayer,