aboutsummaryrefslogtreecommitdiff
path: root/web/app/view/StateController.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-09-06 09:42:39 +1200
committerGitHub <noreply@github.com>2017-09-06 09:42:39 +1200
commit00e840b3dbc087a0b187f283d14f5169a626da93 (patch)
tree1cc058f5e54b0619a6c2cf4f0d22d7b99e34a869 /web/app/view/StateController.js
parent6a87e86cee0cdbcc196166f3f1b330903364931b (diff)
parent4808ca260bbbc2c87f8e079360db316215b76854 (diff)
downloadtrackermap-web-00e840b3dbc087a0b187f283d14f5169a626da93.tar.gz
trackermap-web-00e840b3dbc087a0b187f283d14f5169a626da93.tar.bz2
trackermap-web-00e840b3dbc087a0b187f283d14f5169a626da93.zip
Merge pull request #572 from Abyss777/remove_aliases
Remove Attribute Aliases
Diffstat (limited to 'web/app/view/StateController.js')
-rw-r--r--web/app/view/StateController.js54
1 files changed, 3 insertions, 51 deletions
diff --git a/web/app/view/StateController.js b/web/app/view/StateController.js
index 95f5f555..3bf76717 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();
- }
}
});