diff options
Diffstat (limited to 'web/app')
-rw-r--r-- | web/app/model/KnownAttribute.js | 3 | ||||
-rw-r--r-- | web/app/store/DeviceAttributes.js | 7 | ||||
-rw-r--r-- | web/app/store/GeofenceAttributes.js | 1 | ||||
-rw-r--r-- | web/app/store/GroupAttributes.js | 5 | ||||
-rw-r--r-- | web/app/store/ServerAttributes.js | 4 | ||||
-rw-r--r-- | web/app/store/UserAttributes.js | 12 | ||||
-rw-r--r-- | web/app/view/edit/Attributes.js | 9 | ||||
-rw-r--r-- | web/app/view/edit/AttributesController.js | 42 |
8 files changed, 59 insertions, 24 deletions
diff --git a/web/app/model/KnownAttribute.js b/web/app/model/KnownAttribute.js index 8e578d98..9bb14dba 100644 --- a/web/app/model/KnownAttribute.js +++ b/web/app/model/KnownAttribute.js @@ -23,6 +23,9 @@ Ext.define('Traccar.model.KnownAttribute', { name: 'key', type: 'string' }, { + name: 'name', + type: 'string' + }, { name: 'type', type: 'string' }] diff --git a/web/app/store/DeviceAttributes.js b/web/app/store/DeviceAttributes.js index 9f1ec50f..341a7691 100644 --- a/web/app/store/DeviceAttributes.js +++ b/web/app/store/DeviceAttributes.js @@ -22,24 +22,31 @@ Ext.define('Traccar.store.DeviceAttributes', { data: [{ key: 'speedLimit', + name: Strings.sharedAttributeSpeedLimit, type: 'number' }, { key: 'report.ignoreOdometer', + name: Strings.sharedAttributeReportIgnoreOdometer, type: 'boolean' }, { key: 'maintenance.start', + name: Strings.sharedAttributeMaintenanceStart, type: 'number' }, { key: 'maintenance.interval', + name: Strings.sharedAttributeMaintenanceInterval, type: 'number' }, { key: 'web.reportColor', + name: Strings.sharedAttributeWebReportColor, type: 'color' }, { key: 'devicePassword', + name: Strings.sharedAttributeDevicePassword, type: 'string' }, { key: 'processing.copyAttributes', + name: Strings.sharedAttributeProcessingCopyAttributes, type: 'string' }] }); diff --git a/web/app/store/GeofenceAttributes.js b/web/app/store/GeofenceAttributes.js index 79217f68..d8c8bb9f 100644 --- a/web/app/store/GeofenceAttributes.js +++ b/web/app/store/GeofenceAttributes.js @@ -22,6 +22,7 @@ Ext.define('Traccar.store.GeofenceAttributes', { data: [{ key: 'color', + name: Strings.sharedAttributeColor, type: 'color' }] }); diff --git a/web/app/store/GroupAttributes.js b/web/app/store/GroupAttributes.js index baf22860..5ef2aa0a 100644 --- a/web/app/store/GroupAttributes.js +++ b/web/app/store/GroupAttributes.js @@ -22,18 +22,23 @@ Ext.define('Traccar.store.GroupAttributes', { data: [{ key: 'speedLimit', + name: Strings.sharedAttributeSpeedLimit, type: 'number' }, { key: 'report.ignoreOdometer', + name: Strings.sharedAttributeReportIgnoreOdometer, type: 'boolean' }, { key: 'maintenance.start', + name: Strings.sharedAttributeMaintenanceStart, type: 'number' }, { key: 'maintenance.interval', + name: Strings.sharedAttributeMaintenanceInterval, type: 'number' }, { key: 'processing.copyAttributes', + name: Strings.sharedAttributeProcessingCopyAttributes, type: 'string' }] }); diff --git a/web/app/store/ServerAttributes.js b/web/app/store/ServerAttributes.js index aca81f22..34431423 100644 --- a/web/app/store/ServerAttributes.js +++ b/web/app/store/ServerAttributes.js @@ -22,15 +22,19 @@ Ext.define('Traccar.store.ServerAttributes', { data: [{ key: 'speedLimit', + name: Strings.sharedAttributeSpeedLimit, type: 'number' }, { key: 'maintenance.start', + name: Strings.sharedAttributeMaintenanceStart, type: 'number' }, { key: 'maintenance.interval', + name: Strings.sharedAttributeMaintenanceInterval, type: 'number' }, { key: 'web.liveRouteLength', + name: Strings.sharedAttributeWebLiveRouteLength, type: 'number', allowDecimals: false }] diff --git a/web/app/store/UserAttributes.js b/web/app/store/UserAttributes.js index 80ded0d8..f286d1b9 100644 --- a/web/app/store/UserAttributes.js +++ b/web/app/store/UserAttributes.js @@ -22,42 +22,54 @@ Ext.define('Traccar.store.UserAttributes', { data: [{ key: 'mail.smtp.host', + name: Strings.sharedAttributeMailSmtpHost, type: 'string' }, { key: 'mail.smtp.port', + name: Strings.sharedAttributeMailSmtpPort, type: 'number', allowDecimals: false, minValue: 1, maxValue: 65535 }, { key: 'mail.smtp.starttls.enable', + name: Strings.sharedAttributeMailSmtpStarttlsEnable, type: 'boolean' }, { key: 'mail.smtp.starttls.required', + name: Strings.sharedAttributeMailSmtpStarttlsRequired, type: 'boolean' }, { key: 'mail.smtp.ssl.enable', + name: Strings.sharedAttributeMailSmtpSslEnable, type: 'boolean' }, { key: 'mail.smtp.ssl.trust', + name: Strings.sharedAttributeMailSmtpSslTrust, type: 'string' }, { key: 'mail.smtp.ssl.protocols', + name: Strings.sharedAttributeMailSmtpSslProtocols, type: 'string' }, { key: 'mail.smtp.from', + name: Strings.sharedAttributeMailSmtpFrom, type: 'string' }, { key: 'mail.smtp.auth', + name: Strings.sharedAttributeMailSmtpAuth, type: 'boolean' }, { key: 'mail.smtp.username', + name: Strings.sharedAttributeMailSmtpUsername, type: 'string' }, { key: 'mail.smtp.password', + name: Strings.sharedAttributeMailSmtpPassword, type: 'string' }, { key: 'web.liveRouteLength', + name: Strings.sharedAttributeWebLiveRouteLength, type: 'number', allowDecimals: false }] diff --git a/web/app/view/edit/Attributes.js b/web/app/view/edit/Attributes.js index 93e5a3a7..80083193 100644 --- a/web/app/view/edit/Attributes.js +++ b/web/app/view/edit/Attributes.js @@ -41,7 +41,14 @@ Ext.define('Traccar.view.edit.Attributes', { }, items: [{ text: Strings.sharedName, - dataIndex: 'name' + dataIndex: 'name', + renderer: function (value, metaData) { + var result; + if (this.attributesStore) { + result = Ext.getStore(this.attributesStore).getById(value); + } + return result && result.get('name') ? result.get('name') : value; + } }, { text: Strings.stateValue, dataIndex: 'value' diff --git a/web/app/view/edit/AttributesController.js b/web/app/view/edit/AttributesController.js index cf4f64c6..235f2c5b 100644 --- a/web/app/view/edit/AttributesController.js +++ b/web/app/view/edit/AttributesController.js @@ -69,6 +69,17 @@ Ext.define('Traccar.view.edit.AttributesController', { }, this); this.getView().setStore(store); + if (this.getView().record instanceof Traccar.model.Device) { + this.getView().attributesStore = 'DeviceAttributes'; + } else if (this.getView().record instanceof Traccar.model.Geofence) { + this.getView().attributesStore = 'GeofenceAttributes'; + } else if (this.getView().record instanceof Traccar.model.Group) { + this.getView().attributesStore = 'GroupAttributes'; + } else if (this.getView().record instanceof Traccar.model.Server) { + this.getView().attributesStore = 'ServerAttributes'; + } else if (this.getView().record instanceof Traccar.model.User) { + this.getView().attributesStore = 'UserAttributes'; + } }, comboConfig: { @@ -76,36 +87,21 @@ Ext.define('Traccar.view.edit.AttributesController', { reference: 'nameComboField', name: 'name', fieldLabel: Strings.sharedName, - displayField: 'key', + displayField: 'name', + valueField: 'key', allowBlank: false, listeners: { change: 'onNameChange' } }, - replaceNameField: function (dialog, config) { - var nameTextField = dialog.lookupReference('nameTextField'); - dialog.down('form').insert(0, config); - dialog.down('form').remove(nameTextField); - }, - initDialog: function (record) { - var dialog = Ext.create('Traccar.view.dialog.Attribute'); - if (this.getView().record instanceof Traccar.model.Device) { - this.comboConfig.store = 'DeviceAttributes'; - this.replaceNameField(dialog, this.comboConfig); - } else if (this.getView().record instanceof Traccar.model.Geofence) { - this.comboConfig.store = 'GeofenceAttributes'; - this.replaceNameField(dialog, this.comboConfig); - } else if (this.getView().record instanceof Traccar.model.Group) { - this.comboConfig.store = 'GroupAttributes'; - this.replaceNameField(dialog, this.comboConfig); - } else if (this.getView().record instanceof Traccar.model.Server) { - this.comboConfig.store = 'ServerAttributes'; - this.replaceNameField(dialog, this.comboConfig); - } else if (this.getView().record instanceof Traccar.model.User) { - this.comboConfig.store = 'UserAttributes'; - this.replaceNameField(dialog, this.comboConfig); + var nameTextField, dialog = Ext.create('Traccar.view.dialog.Attribute'); + if (this.getView().attributesStore) { + this.comboConfig.store = this.getView().attributesStore; + nameTextField = dialog.lookupReference('nameTextField'); + dialog.down('form').insert(0, this.comboConfig); + dialog.down('form').remove(nameTextField); } dialog.down('form').loadRecord(record); dialog.show(); |