From 1cc86f7df5704aa19d1af643c5fbf852a301858b Mon Sep 17 00:00:00 2001 From: Gabor Somogyi Date: Wed, 4 May 2016 12:49:23 +0200 Subject: SupportedCommand model removed --- web/app/Application.js | 3 +-- web/app/model/SupportedCommand.js | 28 ---------------------------- web/app/store/SupportedCommands.js | 16 +++------------- web/app/view/CommandDialog.js | 2 +- web/app/view/CommandDialogController.js | 3 +++ 5 files changed, 8 insertions(+), 44 deletions(-) delete mode 100644 web/app/model/SupportedCommand.js (limited to 'web/app') diff --git a/web/app/Application.js b/web/app/Application.js index da3fdd505..f68ef981e 100644 --- a/web/app/Application.js +++ b/web/app/Application.js @@ -30,8 +30,7 @@ Ext.define('Traccar.Application', { 'Device', 'Position', 'Attribute', - 'Command', - 'SupportedCommand' + 'Command' ], stores: [ diff --git a/web/app/model/SupportedCommand.js b/web/app/model/SupportedCommand.js deleted file mode 100644 index 35c34c8cd..000000000 --- a/web/app/model/SupportedCommand.js +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2016 Gabor Somogyi (gabor.g.somogyi@gmail.com) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -Ext.define('Traccar.model.SupportedCommand', { - extend: 'Ext.data.Model', - identifier: 'negative', - - fields: [{ - name: 'key', - type: 'string' - }, { - name: 'name', - type: 'string' - }] -}); diff --git a/web/app/store/SupportedCommands.js b/web/app/store/SupportedCommands.js index 64e4af88d..612909180 100644 --- a/web/app/store/SupportedCommands.js +++ b/web/app/store/SupportedCommands.js @@ -16,25 +16,15 @@ Ext.define('Traccar.store.SupportedCommands', { extend: 'Ext.data.Store', - model: 'Traccar.model.SupportedCommand', + fields: [ + { type: 'string', name: 'key'} + ], listeners: { 'beforeload' : function(store, eOpts) { var proxy; proxy = store.getProxy(); proxy.setUrl('/api/supportedcommands?deviceId' + proxy.extraParams.deviceId); - }, - 'load' : function(store, records, successful, eOpts) { - if (typeof records !== "undefined") { - records.forEach(function(entry) { - if (typeof entry !== "undefined" && typeof entry.data.name !== "undefined") { - var translatedName = Strings[entry.data.name]; - if (typeof translatedName !== "undefined") { - entry.data.name = translatedName; - } - } - }, this); - } } }, diff --git a/web/app/view/CommandDialog.js b/web/app/view/CommandDialog.js index e24105699..05412f39c 100644 --- a/web/app/view/CommandDialog.js +++ b/web/app/view/CommandDialog.js @@ -31,7 +31,7 @@ Ext.define('Traccar.view.CommandDialog', { name: 'type', fieldLabel: Strings.commandType, store: 'SupportedCommands', - displayField: 'name', + displayField: 'key', valueField: 'key', listeners: { select: 'onSelect' diff --git a/web/app/view/CommandDialogController.js b/web/app/view/CommandDialogController.js index 93109a2d6..ec6b8b3b9 100644 --- a/web/app/view/CommandDialogController.js +++ b/web/app/view/CommandDialogController.js @@ -18,6 +18,9 @@ Ext.define('Traccar.view.CommandDialogController', { extend: 'Ext.app.ViewController', alias: 'controller.commandDialog', + onShow: function () { + }, + onSelect: function (selected) { this.lookupReference('paramPositionPeriodic').setHidden( selected.getValue() !== 'positionPeriodic'); -- cgit v1.2.3