aboutsummaryrefslogtreecommitdiff
path: root/web/app/view
diff options
context:
space:
mode:
Diffstat (limited to 'web/app/view')
-rw-r--r--web/app/view/admin/ServerDialog.js12
-rw-r--r--web/app/view/admin/ServerDialogController.js12
-rw-r--r--web/app/view/device/Device.js18
-rw-r--r--web/app/view/device/DeviceController.js18
4 files changed, 41 insertions, 19 deletions
diff --git a/web/app/view/admin/ServerDialog.js b/web/app/view/admin/ServerDialog.js
index e654c9048..d3cbc3492 100644
--- a/web/app/view/admin/ServerDialog.js
+++ b/web/app/view/admin/ServerDialog.js
@@ -36,6 +36,18 @@ Ext.define('Traccar.view.admin.ServerDialog', {
name: 'registration',
fieldLabel: strings.server_registration,
allowBlank: false
+ }, {
+ xtype: 'numberfield',
+ name: 'latitude',
+ fieldLabel: strings.server_latitude
+ }, {
+ xtype: 'numberfield',
+ name: 'longitude',
+ fieldLabel: strings.server_longitude
+ }, {
+ xtype: 'numberfield',
+ name: 'zoom',
+ fieldLabel: strings.server_zoom
}]
},
diff --git a/web/app/view/admin/ServerDialogController.js b/web/app/view/admin/ServerDialogController.js
index 8e0910b3c..bbb98d3a0 100644
--- a/web/app/view/admin/ServerDialogController.js
+++ b/web/app/view/admin/ServerDialogController.js
@@ -21,17 +21,7 @@ Ext.define('Traccar.view.admin.ServerDialogController', {
onSaveClick: function(button) {
var dialog = button.up('window').down('form');
dialog.updateRecord();
- var store = Ext.getStore('Devices');
- var device = dialog.getRecord();
- if (device.phantom) {
- store.add(device);
- }
- store.sync({
- failure: function(batch) {
- store.rejectChanges(); // TODO
- Traccar.ErrorManager.check(true, batch.exceptions[0].getResponse());
- }
- });
+ dialog.getRecord().save();
button.up('window').close();
},
diff --git a/web/app/view/device/Device.js b/web/app/view/device/Device.js
index 64f53eeb2..bccb43e9e 100644
--- a/web/app/view/device/Device.js
+++ b/web/app/view/device/Device.js
@@ -15,7 +15,7 @@
*/
Ext.define('Traccar.view.device.Device', {
- extend: 'Ext.grid.Panel',
+ extend: 'Ext.grid.Panel',
xtype: 'device-view',
requires: [
@@ -29,25 +29,31 @@ Ext.define('Traccar.view.device.Device', {
selType: 'rowmodel',
tbar: [{
- text:'Add',
+ text: strings.device_add,
handler: 'onAddClick',
reference: 'deviceAddButton'
}, {
- text:'Edit',
+ text: strings.device_edit,
disabled: true,
handler: 'onEditClick',
reference: 'deviceEditButton'
}, {
- text:'Remove',
+ text: strings.device_remove,
disabled: true,
handler: 'onRemoveClick',
reference: 'deviceRemoveButton'
}, {
xtype: 'tbfill'
}, {
- text:'Settings'
+ text: strings.device_settings,
+ menu: [{
+ text: strings.device_settings_server,
+ disabled: true,
+ handler: 'onServerClick',
+ reference: 'settingsServerButton'
+ }]
}, {
- text:'Logout',
+ text: strings.device_logout,
handler: 'onLogoutClick'
}],
diff --git a/web/app/view/device/DeviceController.js b/web/app/view/device/DeviceController.js
index 82c17860f..6d88d8d3e 100644
--- a/web/app/view/device/DeviceController.js
+++ b/web/app/view/device/DeviceController.js
@@ -19,8 +19,15 @@ Ext.define('Traccar.view.device.DeviceController', {
alias: 'controller.device',
requires: [
- 'Traccar.view.device.DeviceDialog'
+ 'Traccar.view.device.DeviceDialog',
+ 'Traccar.view.admin.ServerDialog'
],
+
+ init: function() {
+ if (Traccar.getApplication().getUser().get('admin')) {
+ this.lookupReference('settingsServerButton').setDisabled(false);
+ }
+ },
onLogoutClick: function() {
Traccar.LoginManager.logout();
@@ -44,7 +51,7 @@ Ext.define('Traccar.view.device.DeviceController', {
var device = this.getView().getSelectionModel().getSelection()[0];
Ext.Msg.show({
title: strings.device_dialog,
- message: strings.device_remove,
+ message: strings.device_remove_confirm,
buttons: Ext.Msg.YESNO,
buttonText: {
yes: strings.dialog_delete,
@@ -64,6 +71,13 @@ Ext.define('Traccar.view.device.DeviceController', {
var disabled = selected.length > 0;
this.lookupReference('deviceEditButton').setDisabled(disabled);
this.lookupReference('deviceRemoveButton').setDisabled(disabled);
+ },
+
+ onServerClick: function() {
+ var server = Traccar.getApplication().getServer();
+ var dialog = Ext.create('Traccar.view.admin.ServerDialog');
+ dialog.down('form').loadRecord(server);
+ dialog.show();
}
});