From 3a5e334b50bf35d11743d937c9fae2fb8c7829ec Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Tue, 19 Sep 2017 09:36:16 +0500 Subject: Implement Notifications per device --- web/app/view/edit/DevicesController.js | 59 ++++------------------------------ 1 file changed, 7 insertions(+), 52 deletions(-) (limited to 'web/app/view/edit/DevicesController.js') diff --git a/web/app/view/edit/DevicesController.js b/web/app/view/edit/DevicesController.js index 915f724..40202e7 100644 --- a/web/app/view/edit/DevicesController.js +++ b/web/app/view/edit/DevicesController.js @@ -62,58 +62,13 @@ Ext.define('Traccar.view.edit.DevicesController', { 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').setDisabled(readonly || deviceReadonly); - this.lookupReference('toolbarDriversButton').setHidden( - Traccar.app.getVehicleFeaturesDisabled() || Traccar.app.getBooleanAttributePreference('ui.disableDrivers')); - this.lookupReference('toolbarAttributesButton').setHidden( - Traccar.app.getBooleanAttributePreference('ui.disableComputedAttributes')); + this.lookupReference('toolbarDeviceMenu').setHidden(readonly || deviceReadonly); setInterval(function () { self.getView().getView().refresh(); }, Traccar.Style.refreshPeriod); }, - onGeofencesClick: function () { - var device = this.getView().getSelectionModel().getSelection()[0]; - Ext.create('Traccar.view.BaseWindow', { - title: Strings.sharedGeofences, - items: { - xtype: 'linkGeofencesView', - baseObjectName: 'deviceId', - linkObjectName: 'geofenceId', - storeName: 'Geofences', - baseObject: device.getId() - } - }).show(); - }, - - onAttributesClick: function () { - var device = this.getView().getSelectionModel().getSelection()[0]; - Ext.create('Traccar.view.BaseWindow', { - title: Strings.sharedComputedAttributes, - items: { - xtype: 'linkComputedAttributesView', - baseObjectName: 'deviceId', - linkObjectName: 'attributeId', - storeName: 'ComputedAttributes', - baseObject: device.getId() - } - }).show(); - }, - - onDriversClick: function () { - var device = this.getView().getSelectionModel().getSelection()[0]; - Ext.create('Traccar.view.BaseWindow', { - title: Strings.sharedDrivers, - items: { - xtype: 'linkDriversView', - baseObjectName: 'deviceId', - linkObjectName: 'driverId', - storeName: 'Drivers', - baseObject: device.getId() - } - }).show(); - }, - onCommandClick: function () { var device, deviceId, dialog, typesStore, online, commandsStore; device = this.getView().getSelectionModel().getSelection()[0]; @@ -143,15 +98,15 @@ Ext.define('Traccar.view.edit.DevicesController', { }, updateButtons: function (selected) { - var readonly, deviceReadonly, empty; + var readonly, deviceReadonly, empty, deviceMenu; deviceReadonly = Traccar.app.getPreference('deviceReadonly', false) && !Traccar.app.getUser().get('admin'); readonly = Traccar.app.getPreference('readonly', false) && !Traccar.app.getUser().get('admin'); empty = selected.length === 0; this.lookupReference('toolbarEditButton').setDisabled(empty || readonly || deviceReadonly); this.lookupReference('toolbarRemoveButton').setDisabled(empty || readonly || deviceReadonly); - this.lookupReference('toolbarGeofencesButton').setDisabled(empty || readonly); - this.lookupReference('toolbarAttributesButton').setDisabled(empty || readonly); - this.lookupReference('toolbarDriversButton').setDisabled(empty || readonly); + deviceMenu = this.lookupReference('toolbarDeviceMenu'); + deviceMenu.device = empty ? null : selected[0]; + this.lookupReference('toolbarDeviceMenu').setDisabled(empty); this.lookupReference('deviceCommandButton').setDisabled(empty || readonly); }, @@ -166,7 +121,7 @@ Ext.define('Traccar.view.edit.DevicesController', { selectDevice: function (device) { this.getView().getSelectionModel().select([device], false, true); - this.updateButtons(this.getView().getSelectionModel()); + this.updateButtons(this.getView().getSelectionModel().getSelected().items); this.getView().getView().focusRow(device); }, @@ -177,7 +132,7 @@ Ext.define('Traccar.view.edit.DevicesController', { }, onUpdateDevice: function () { - this.updateButtons(this.getView().getSelectionModel()); + this.updateButtons(this.getView().getSelectionModel().getSelected().items); }, deselectFeature: function () { -- cgit v1.2.3 From ac102b14c7ef665542eeb9f6aae69c6ccb023929 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Wed, 20 Sep 2017 10:52:31 +0500 Subject: - Change string - Use "up" method - Remove spaces --- web/app/view/DeviceMenuController.js | 10 +++++----- web/app/view/edit/CalendarsController.js | 1 - web/app/view/edit/DevicesController.js | 2 +- web/app/view/edit/DriversController.js | 1 - web/app/view/edit/NotificationsController.js | 1 - web/app/view/edit/SavedCommandsController.js | 1 - web/l10n/en.json | 2 +- 7 files changed, 7 insertions(+), 11 deletions(-) (limited to 'web/app/view/edit/DevicesController.js') diff --git a/web/app/view/DeviceMenuController.js b/web/app/view/DeviceMenuController.js index 58749a5..4fa00be 100644 --- a/web/app/view/DeviceMenuController.js +++ b/web/app/view/DeviceMenuController.js @@ -45,7 +45,7 @@ Ext.define('Traccar.view.DeviceMenuController', { baseObjectName: 'deviceId', linkObjectName: 'geofenceId', storeName: 'Geofences', - baseObject: this.getView().ownerCmp.device.getId() + baseObject: this.getView().up('deviceMenu').device.getId() } }).show(); }, @@ -58,7 +58,7 @@ Ext.define('Traccar.view.DeviceMenuController', { baseObjectName: 'deviceId', linkObjectName: 'notificationId', storeName: 'Notifications', - baseObject: this.getView().ownerCmp.device.getId() + baseObject: this.getView().up('deviceMenu').device.getId() } }).show(); }, @@ -71,7 +71,7 @@ Ext.define('Traccar.view.DeviceMenuController', { baseObjectName: 'deviceId', linkObjectName: 'attributeId', storeName: 'ComputedAttributes', - baseObject: this.getView().ownerCmp.device.getId() + baseObject: this.getView().up('deviceMenu').device.getId() } }).show(); }, @@ -84,7 +84,7 @@ Ext.define('Traccar.view.DeviceMenuController', { baseObjectName: 'deviceId', linkObjectName: 'driverId', storeName: 'Drivers', - baseObject: this.getView().ownerCmp.device.getId() + baseObject: this.getView().up('deviceMenu').device.getId() } }).show(); }, @@ -97,7 +97,7 @@ Ext.define('Traccar.view.DeviceMenuController', { baseObjectName: 'deviceId', linkObjectName: 'commandId', storeName: 'Commands', - baseObject: this.getView().ownerCmp.device.getId() + baseObject: this.getView().up('deviceMenu').device.getId() } }).show(); } diff --git a/web/app/view/edit/CalendarsController.js b/web/app/view/edit/CalendarsController.js index f582227..d11ec37 100644 --- a/web/app/view/edit/CalendarsController.js +++ b/web/app/view/edit/CalendarsController.js @@ -28,5 +28,4 @@ Ext.define('Traccar.view.edit.CalendarsController', { objectModel: 'Traccar.model.Calendar', objectDialog: 'Traccar.view.dialog.Calendar', removeTitle: Strings.sharedCalendar - }); diff --git a/web/app/view/edit/DevicesController.js b/web/app/view/edit/DevicesController.js index 40202e7..a4bbd4b 100644 --- a/web/app/view/edit/DevicesController.js +++ b/web/app/view/edit/DevicesController.js @@ -106,7 +106,7 @@ Ext.define('Traccar.view.edit.DevicesController', { this.lookupReference('toolbarRemoveButton').setDisabled(empty || readonly || deviceReadonly); deviceMenu = this.lookupReference('toolbarDeviceMenu'); deviceMenu.device = empty ? null : selected[0]; - this.lookupReference('toolbarDeviceMenu').setDisabled(empty); + deviceMenu.setDisabled(empty); this.lookupReference('deviceCommandButton').setDisabled(empty || readonly); }, diff --git a/web/app/view/edit/DriversController.js b/web/app/view/edit/DriversController.js index 2840c2a..6c8a63c 100644 --- a/web/app/view/edit/DriversController.js +++ b/web/app/view/edit/DriversController.js @@ -28,5 +28,4 @@ Ext.define('Traccar.view.edit.DriversController', { objectModel: 'Traccar.model.Driver', objectDialog: 'Traccar.view.dialog.Driver', removeTitle: Strings.sharedDriver - }); diff --git a/web/app/view/edit/NotificationsController.js b/web/app/view/edit/NotificationsController.js index bf6a666..ad22a68 100644 --- a/web/app/view/edit/NotificationsController.js +++ b/web/app/view/edit/NotificationsController.js @@ -28,5 +28,4 @@ Ext.define('Traccar.view.edit.NotificationsController', { objectModel: 'Traccar.model.Notification', objectDialog: 'Traccar.view.dialog.Notification', removeTitle: Strings.sharedNotification - }); diff --git a/web/app/view/edit/SavedCommandsController.js b/web/app/view/edit/SavedCommandsController.js index 989aeab..1511661 100644 --- a/web/app/view/edit/SavedCommandsController.js +++ b/web/app/view/edit/SavedCommandsController.js @@ -28,5 +28,4 @@ Ext.define('Traccar.view.edit.SavedCommandsController', { objectModel: 'Traccar.model.Command', objectDialog: 'Traccar.view.dialog.SavedCommand', removeTitle: Strings.sharedSavedCommand - }); diff --git a/web/l10n/en.json b/web/l10n/en.json index 156f3ec..f5ab23d 100644 --- a/web/l10n/en.json +++ b/web/l10n/en.json @@ -340,7 +340,7 @@ "alarmTampering": "Tampering Alarm", "alarmRemoving": "Removing Alarm", "notificationType": "Type of Notification", - "notificationAlways": "Send Always", + "notificationAlways": "Apply to All Devices", "notificationWeb": "Send via Web", "notificationMail": "Send via Mail", "notificationSms": "Send via SMS", -- cgit v1.2.3