luci-app-travelmate: sync with travelmate 2.1.2-1
* fix a station scanning issue on single radio units (mainly a LuCI/JS issue) reported in the forum by multiple users Signed-off-by: Dirk Brenken <dev@brenken.org>
This commit is contained in:
parent
c5271fddb3
commit
465cea44e3
2 changed files with 103 additions and 102 deletions
|
@ -145,7 +145,7 @@ function handleStatus() {
|
||||||
poll.add(function () {
|
poll.add(function () {
|
||||||
L.resolveDefault(fs.stat('/var/state/travelmate.refresh'), null).then(function (res) {
|
L.resolveDefault(fs.stat('/var/state/travelmate.refresh'), null).then(function (res) {
|
||||||
if (res) {
|
if (res) {
|
||||||
L.resolveDefault(fs.read_direct('/var/state/travelmate.refresh'), null).then(async function (res) {
|
L.resolveDefault(fs.read('/var/state/travelmate.refresh'), null).then(async function (res) {
|
||||||
fs.remove('/var/state/travelmate.refresh');
|
fs.remove('/var/state/travelmate.refresh');
|
||||||
if (res && res === 'ui_reload') {
|
if (res && res === 'ui_reload') {
|
||||||
location.reload();
|
location.reload();
|
||||||
|
@ -172,7 +172,7 @@ function handleStatus() {
|
||||||
});
|
});
|
||||||
return L.resolveDefault(fs.stat('/tmp/trm_runtime.json'), null).then(function (res) {
|
return L.resolveDefault(fs.stat('/tmp/trm_runtime.json'), null).then(function (res) {
|
||||||
if (res) {
|
if (res) {
|
||||||
L.resolveDefault(fs.read_direct('/tmp/trm_runtime.json'), null).then(function (res) {
|
L.resolveDefault(fs.read('/tmp/trm_runtime.json'), null).then(function (res) {
|
||||||
if (res) {
|
if (res) {
|
||||||
var info = JSON.parse(res);
|
var info = JSON.parse(res);
|
||||||
if (info) {
|
if (info) {
|
||||||
|
@ -229,7 +229,7 @@ function handleStatus() {
|
||||||
return view.extend({
|
return view.extend({
|
||||||
load: function () {
|
load: function () {
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
L.resolveDefault(fs.exec_direct('/etc/init.d/travelmate', ['assoc']), {}),
|
L.resolveDefault(fs.exec('/etc/init.d/travelmate', ['assoc']), null),
|
||||||
uci.load('wireless'),
|
uci.load('wireless'),
|
||||||
uci.load('travelmate')
|
uci.load('travelmate')
|
||||||
]);
|
]);
|
||||||
|
@ -488,8 +488,8 @@ return view.extend({
|
||||||
modal travelmate tab
|
modal travelmate tab
|
||||||
*/
|
*/
|
||||||
var mac, mac_array = [];
|
var mac, mac_array = [];
|
||||||
if (result[0]) {
|
if (result[0] && result[0].code === 0) {
|
||||||
mac_array = result[0].trim().split('\n');
|
mac_array = result[0].stdout.trim().split('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
o = s.taboption('travelmate', form.Value, '_ssid', _('SSID'));
|
o = s.taboption('travelmate', form.Value, '_ssid', _('SSID'));
|
||||||
|
@ -748,6 +748,7 @@ return view.extend({
|
||||||
modal 'scan' dialog
|
modal 'scan' dialog
|
||||||
*/
|
*/
|
||||||
s.handleScan = function (radio) {
|
s.handleScan = function (radio) {
|
||||||
|
poll.stop();
|
||||||
var table = E('table', { 'class': 'table' }, [
|
var table = E('table', { 'class': 'table' }, [
|
||||||
E('tr', { 'class': 'tr table-titles' }, [
|
E('tr', { 'class': 'tr table-titles' }, [
|
||||||
E('th', { 'class': 'th col-1 middle left' }, _('Strength')),
|
E('th', { 'class': 'th col-1 middle left' }, _('Strength')),
|
||||||
|
@ -778,11 +779,13 @@ return view.extend({
|
||||||
md.style.maxWidth = '90%';
|
md.style.maxWidth = '90%';
|
||||||
md.style.maxHeight = 'none';
|
md.style.maxHeight = 'none';
|
||||||
|
|
||||||
return L.resolveDefault(fs.exec_direct('/etc/init.d/travelmate', ['scan', radio]), null)
|
return L.resolveDefault(fs.exec('/etc/init.d/travelmate', ['scan', radio]), null)
|
||||||
|
.then(L.bind(function () {
|
||||||
|
return L.resolveDefault(fs.read('/var/run/travelmate.scan'), '')
|
||||||
.then(L.bind(function (res) {
|
.then(L.bind(function (res) {
|
||||||
var lines, strength, channel, encryption, tbl_encryption, bssid, ssid, tbl_ssid, rows = [];
|
var lines, strength, channel, encryption, tbl_encryption, bssid, ssid, tbl_ssid, rows = [];
|
||||||
if (res) {
|
if (res) {
|
||||||
lines = res.trim().split('\n');
|
lines = res.split('\n');
|
||||||
for (var i = 0; i < lines.length; i++) {
|
for (var i = 0; i < lines.length; i++) {
|
||||||
if (lines[i].match(/^\s+[0-9]/)) {
|
if (lines[i].match(/^\s+[0-9]/)) {
|
||||||
encryption = lines[i].slice(80).trim();
|
encryption = lines[i].slice(80).trim();
|
||||||
|
@ -866,19 +869,16 @@ return view.extend({
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (lines[i] === '::: Empty resultset') {
|
|
||||||
rows.push([
|
|
||||||
'No scan results (empty resultset)'
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rows.push([
|
rows.push([
|
||||||
'No scan results (timeout)'
|
'Empty resultset'
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
cbi_update_table(table, rows);
|
cbi_update_table(table, rows);
|
||||||
|
poll.start();
|
||||||
|
}, this));
|
||||||
}, this));
|
}, this));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
"file": {
|
"file": {
|
||||||
"/etc/travelmate/*.login": [ "list" ],
|
"/etc/travelmate/*.login": [ "list" ],
|
||||||
"/var/run/travelmate.pid": [ "read" ],
|
"/var/run/travelmate.pid": [ "read" ],
|
||||||
|
"/var/run/travelmate.scan": [ "read" ],
|
||||||
"/var/state/travelmate.refresh": [ "read" ],
|
"/var/state/travelmate.refresh": [ "read" ],
|
||||||
"/tmp/trm_runtime.json": [ "read" ],
|
"/tmp/trm_runtime.json": [ "read" ],
|
||||||
"/sbin/logread -e trm-": [ "exec" ],
|
"/sbin/logread -e trm-": [ "exec" ],
|
||||||
|
|
Loading…
Reference in a new issue