aboutsummaryrefslogtreecommitdiff
path: root/web/app/view
diff options
context:
space:
mode:
Diffstat (limited to 'web/app/view')
-rw-r--r--web/app/view/SettingsMenu.js6
-rw-r--r--web/app/view/SettingsMenuController.js11
-rw-r--r--web/app/view/State.js14
-rw-r--r--web/app/view/StateController.js54
-rw-r--r--web/app/view/dialog/AttributeAlias.js57
-rw-r--r--web/app/view/edit/AttributeAliases.js65
-rw-r--r--web/app/view/edit/AttributeAliasesController.js79
7 files changed, 3 insertions, 283 deletions
diff --git a/web/app/view/SettingsMenu.js b/web/app/view/SettingsMenu.js
index f893a15..7fb7636 100644
--- a/web/app/view/SettingsMenu.js
+++ b/web/app/view/SettingsMenu.js
@@ -74,12 +74,6 @@ Ext.define('Traccar.view.SettingsMenu', {
reference: 'settingsNotificationsButton'
}, {
hidden: true,
- text: Strings.sharedAttributeAliases,
- glyph: 'xf02c@FontAwesome',
- handler: 'onAttributeAliasesClick',
- reference: 'settingsAttributeAliasesButton'
- }, {
- hidden: true,
text: Strings.sharedComputedAttributes,
glyph: 'xf0ae@FontAwesome',
handler: 'onComputedAttributesClick',
diff --git a/web/app/view/SettingsMenuController.js b/web/app/view/SettingsMenuController.js
index 7175260..5968a53 100644
--- a/web/app/view/SettingsMenuController.js
+++ b/web/app/view/SettingsMenuController.js
@@ -28,7 +28,6 @@ Ext.define('Traccar.view.SettingsMenuController', {
'Traccar.view.edit.Geofences',
'Traccar.view.edit.Drivers',
'Traccar.view.Notifications',
- 'Traccar.view.edit.AttributeAliases',
'Traccar.view.edit.ComputedAttributes',
'Traccar.view.Statistics',
'Traccar.view.dialog.DeviceDistance',
@@ -61,7 +60,6 @@ Ext.define('Traccar.view.SettingsMenuController', {
Traccar.app.getVehicleFeaturesDisabled() || Traccar.app.getBooleanAttributePreference('ui.disableDrivers'));
}
if (admin || !deviceReadonly && !readonly) {
- this.lookupReference('settingsAttributeAliasesButton').setHidden(false);
this.lookupReference('settingsComputedAttributesButton').setHidden(
Traccar.app.getBooleanAttributePreference('ui.disableComputedAttributes'));
}
@@ -120,15 +118,6 @@ Ext.define('Traccar.view.SettingsMenuController', {
}).show();
},
- onAttributeAliasesClick: function () {
- Ext.create('Traccar.view.BaseWindow', {
- title: Strings.sharedAttributeAliases,
- items: {
- xtype: 'attributeAliasesView'
- }
- }).show();
- },
-
onComputedAttributesClick: function () {
Ext.create('Traccar.view.BaseWindow', {
title: Strings.sharedComputedAttributes,
diff --git a/web/app/view/State.js b/web/app/view/State.js
index 23113c6..8214971 100644
--- a/web/app/view/State.js
+++ b/web/app/view/State.js
@@ -35,23 +35,9 @@ Ext.define('Traccar.view.State', {
xtype: 'tbtext',
html: Strings.stateTitle,
baseCls: 'x-panel-header-title-default'
- }, {
- xtype: 'tbfill'
- }, {
- xtype: 'button',
- disabled: true,
- handler: 'onAliasEditClick',
- reference: 'aliasEditButton',
- glyph: 'xf02b@FontAwesome',
- tooltip: Strings.sharedEdit,
- tooltipType: 'title'
}]
},
- listeners: {
- selectionchange: 'onSelectionChange'
- },
-
columns: {
defaults: {
minWidth: Traccar.Style.columnWidthNormal,
diff --git a/web/app/view/StateController.js b/web/app/view/StateController.js
index 95f5f55..3bf7671 100644
--- a/web/app/view/StateController.js
+++ b/web/app/view/StateController.js
@@ -22,9 +22,7 @@ Ext.define('Traccar.view.StateController', {
requires: [
'Traccar.AttributeFormatter',
'Traccar.model.Attribute',
- 'Traccar.model.AttributeAlias',
- 'Traccar.model.Position',
- 'Traccar.view.dialog.AttributeAlias'
+ 'Traccar.model.Position'
],
config: {
@@ -33,7 +31,6 @@ Ext.define('Traccar.view.StateController', {
'*': {
selectdevice: 'selectDevice',
selectreport: 'selectReport',
- updatealiases: 'updateAliases',
deselectfeature: 'deselectFeature'
}
},
@@ -44,21 +41,11 @@ Ext.define('Traccar.view.StateController', {
},
'#ReportRoute': {
clear: 'clearReport'
- },
- '#AttributeAliases': {
- add: 'updateAliases',
- update: 'updateAliases'
}
}
}
},
- init: function () {
- var visible = !Traccar.app.getUser().get('deviceReadonly') && !Traccar.app.getPreference('readonly', false);
- this.lookupReference('aliasEditButton').setVisible(visible);
- this.aliasesStore = Ext.getStore('AttributeAliases');
- },
-
keys: (function () {
var i, list, result;
result = {};
@@ -100,7 +87,7 @@ Ext.define('Traccar.view.StateController', {
},
updatePosition: function () {
- var attributes, store, key, aliasIndex, name, value;
+ var attributes, store, key, name, value;
store = Ext.getStore('Attributes');
store.removeAll();
@@ -119,12 +106,7 @@ Ext.define('Traccar.view.StateController', {
for (key in attributes) {
if (attributes.hasOwnProperty(key)) {
this.lookupAttribute = key;
- aliasIndex = this.aliasesStore.findBy(this.findAttribute, this);
- if (aliasIndex !== -1) {
- name = this.aliasesStore.getAt(aliasIndex).get('alias');
- } else {
- name = Ext.getStore('PositionAttributes').getAttributeName(key, true);
- }
+ name = Ext.getStore('PositionAttributes').getAttributeName(key, true);
if (this.position.get('attribute.' + key) !== undefined) {
value = Traccar.AttributeFormatter.getAttributeFormatter(key)(this.position.get('attribute.' + key));
} else {
@@ -173,35 +155,5 @@ Ext.define('Traccar.view.StateController', {
this.position = null;
Ext.getStore('Attributes').removeAll();
}
- },
-
- onSelectionChange: function (selection, selected) {
- var enabled = selected.length > 0 && selected[0].get('priority') === 1024;
- this.lookupReference('aliasEditButton').setDisabled(!enabled);
- },
-
- onAliasEditClick: function () {
- var attribute, aliasIndex, attributeAlias, dialog;
- attribute = this.getView().getSelectionModel().getSelection()[0];
- this.lookupAttribute = attribute.get('attribute');
- aliasIndex = this.aliasesStore.findBy(this.findAttribute, this);
- if (aliasIndex !== -1) {
- attributeAlias = this.aliasesStore.getAt(aliasIndex);
- } else {
- attributeAlias = Ext.create('Traccar.model.AttributeAlias', {
- deviceId: this.position.get('deviceId'),
- attribute: attribute.get('attribute')
- });
- attributeAlias.store = this.aliasesStore;
- }
- dialog = Ext.create('Traccar.view.dialog.AttributeAlias');
- dialog.down('form').loadRecord(attributeAlias);
- dialog.show();
- },
-
- updateAliases: function () {
- if (this.position) {
- this.updatePosition();
- }
}
});
diff --git a/web/app/view/dialog/AttributeAlias.js b/web/app/view/dialog/AttributeAlias.js
deleted file mode 100644
index 6072a30..0000000
--- a/web/app/view/dialog/AttributeAlias.js
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright 2016 - 2017 Anton Tananaev (anton@traccar.org)
- * Copyright 2016 - 2017 Andrey Kunitsyn (andrey@traccar.org)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-Ext.define('Traccar.view.dialog.AttributeAlias', {
- extend: 'Traccar.view.dialog.Base',
-
- requires: [
- 'Traccar.view.dialog.AttributeController'
- ],
-
- controller: 'attribute',
- title: Strings.sharedAttributeAlias,
-
- items: {
- xtype: 'form',
- items: [{
- xtype: 'textfield',
- name: 'attribute',
- fieldLabel: Strings.sharedAttribute,
- allowBlank: false
- }, {
- xtype: 'textfield',
- name: 'alias',
- fieldLabel: Strings.sharedAlias,
- allowBlank: false
- }]
- },
-
- buttons: [{
- glyph: 'xf00c@FontAwesome',
- tooltip: Strings.sharedSave,
- tooltipType: 'title',
- minWidth: 0,
- handler: 'onSaveClick'
- }, {
- glyph: 'xf00d@FontAwesome',
- tooltip: Strings.sharedCancel,
- tooltipType: 'title',
- minWidth: 0,
- handler: 'closeView'
- }]
-});
diff --git a/web/app/view/edit/AttributeAliases.js b/web/app/view/edit/AttributeAliases.js
deleted file mode 100644
index 6e11016..0000000
--- a/web/app/view/edit/AttributeAliases.js
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright 2016 - 2017 Anton Tananaev (anton@traccar.org)
- * Copyright 2016 - 2017 Andrey Kunitsyn (andrey@traccar.org)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-Ext.define('Traccar.view.edit.AttributeAliases', {
- extend: 'Ext.grid.Panel',
- xtype: 'attributeAliasesView',
-
- requires: [
- 'Traccar.view.edit.AttributeAliasesController',
- 'Traccar.view.edit.Toolbar'
- ],
-
- controller: 'attributeAliases',
-
- tbar: {
- xtype: 'editToolbar',
- items: ['-', {
- xtype: 'tbtext',
- html: Strings.sharedDevice
- }, {
- xtype: 'combobox',
- reference: 'deviceField',
- store: 'Devices',
- displayField: 'name',
- valueField: 'id',
- editable: false,
- listeners: {
- change: 'onDeviceChange'
- }
- }]
- },
-
- listeners: {
- selectionchange: 'onSelectionChange'
- },
-
- columns: {
- defaults: {
- flex: 1,
- minWidth: Traccar.Style.columnWidthNormal
- },
- items: [{
- text: Strings.sharedAttribute,
- dataIndex: 'attribute'
- }, {
- text: Strings.sharedAlias,
- dataIndex: 'alias'
- }]
- }
-});
diff --git a/web/app/view/edit/AttributeAliasesController.js b/web/app/view/edit/AttributeAliasesController.js
deleted file mode 100644
index 8ac68bc..0000000
--- a/web/app/view/edit/AttributeAliasesController.js
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright 2016 - 2017 Anton Tananaev (anton@traccar.org)
- * Copyright 2016 - 2017 Andrey Kunitsyn (andrey@traccar.org)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-Ext.define('Traccar.view.edit.AttributeAliasesController', {
- extend: 'Traccar.view.edit.ToolbarController',
- alias: 'controller.attributeAliases',
-
- requires: [
- 'Traccar.view.dialog.AttributeAlias',
- 'Traccar.model.AttributeAlias'
- ],
-
- objectModel: 'Traccar.model.AttributeAlias',
- objectDialog: 'Traccar.view.dialog.AttributeAlias',
- removeTitle: Strings.sharedAttributeAlias,
-
- init: function () {
- var manager = Traccar.app.getUser().get('admin') || Traccar.app.getUser().get('userLimit') > 0;
- this.lookupReference('deviceField').setStore(manager ? 'AllDevices' : 'Devices');
- this.lookupReference('toolbarAddButton').setDisabled(true);
- this.lookupReference('toolbarEditButton').setDisabled(true);
- this.lookupReference('toolbarRemoveButton').setDisabled(true);
- this.getView().setStore(Ext.create('Ext.data.ChainedStore', {
- storeId: 'EditorAttributeAliases',
- source: 'AttributeAliases'
- }));
- this.getView().getStore().filter('deviceId', 0);
- },
-
- onAddClick: function () {
- var attributeAlias, dialog, deviceId;
- attributeAlias = Ext.create('Traccar.model.AttributeAlias');
- attributeAlias.store = Ext.getStore('AttributeAliases');
- deviceId = this.lookupReference('deviceField').getValue();
- attributeAlias.set('deviceId', deviceId);
- dialog = Ext.create('Traccar.view.dialog.AttributeAlias');
- dialog.down('form').loadRecord(attributeAlias);
- dialog.show();
- },
-
- onSelectionChange: function (selection, selected) {
- var disabled = !this.lookupReference('deviceField').getValue();
- this.lookupReference('toolbarAddButton').setDisabled(disabled);
- disabled = !selected || selected.length === 0 || !this.lookupReference('deviceField').getValue();
- this.lookupReference('toolbarEditButton').setDisabled(disabled);
- this.lookupReference('toolbarRemoveButton').setDisabled(disabled);
- },
-
- onDeviceChange: function (combobox, value) {
- var manager = Traccar.app.getUser().get('admin') || Traccar.app.getUser().get('userLimit') > 0;
- this.onSelectionChange();
- if (value !== null) {
- this.getView().getStore().filter('deviceId', value);
- if (manager && this.getView().getStore().getCount() === 0) {
- Ext.getStore('AttributeAliases').getProxy().setExtraParam('deviceId', value);
- Ext.getStore('AttributeAliases').load({
- addRecords: true
- });
- }
- } else {
- this.getView().getStore().filter('deviceId', 0);
- }
- }
-});