diff options
Diffstat (limited to 'web/app/view')
-rw-r--r-- | web/app/view/State.js | 15 | ||||
-rw-r--r-- | web/app/view/StateController.js | 3 |
2 files changed, 10 insertions, 8 deletions
diff --git a/web/app/view/State.js b/web/app/view/State.js index ed9951b5..c0a430d9 100644 --- a/web/app/view/State.js +++ b/web/app/view/State.js @@ -1,5 +1,5 @@ /* - * Copyright 2015 Anton Tananaev (anton@traccar.org) + * Copyright 2015 - 2022 Anton Tananaev (anton@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 @@ -61,19 +61,20 @@ Ext.define('Traccar.view.State', { dataIndex: 'value', cellWrap: true, renderer: function (value, metaData, record) { - var position, device; - if (record.get('attribute') === 'alarm') { + var position, device, attribute; + attribute = record.get('attribute'); + if (attribute === 'alarm') { metaData.tdCls = 'view-color-red'; - } else if (record.get('name') === Strings.positionAddress && !value) { + } else if (attribute === 'address' && !value) { return '<a href="#" onclick="Ext.fireEvent(\'stategeocode\')" >' + Strings.sharedShowAddress + '</a>'; - } else if (record.get('name') === Strings.positionImage || record.get('name') === Strings.positionAudio) { + } else if (attribute === 'image' || attribute === 'video' || attribute === 'audio') { position = this.getController().position; if (position) { device = Ext.getStore('Devices').getById(position.get('deviceId')); if (device) { - return '<a target="_blank" href="/api/media/' + device.get('uniqueId') + '/' + value + '" >' + - value + '</a>'; + return '<a target="_blank" href="/api/media/' + + device.get('uniqueId') + '/' + value + '" >' + value + '</a>'; } } } diff --git a/web/app/view/StateController.js b/web/app/view/StateController.js index 1ab1aa2f..f04d7185 100644 --- a/web/app/view/StateController.js +++ b/web/app/view/StateController.js @@ -1,5 +1,5 @@ /* - * Copyright 2015 - 2017 Anton Tananaev (anton@traccar.org) + * Copyright 2015 - 2022 Anton Tananaev (anton@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 @@ -128,6 +128,7 @@ Ext.define('Traccar.view.StateController', { store.add(Ext.create('Traccar.model.Attribute', { priority: this.keys[key].priority, name: this.keys[key].name, + attribute: key, value: Traccar.AttributeFormatter.getFormatter(key)(this.position.get(key)) })); } |