summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-travelmate/htdocs/luci-static
diff options
context:
space:
mode:
authorDirk Brenken <dev@brenken.org>2021-08-21 22:04:50 +0200
committerDirk Brenken <dev@brenken.org>2021-08-21 22:08:52 +0200
commitf1d1e752b8b08b7803b6c027d9c44dded97d2a4c (patch)
treef352af7682ff74e6499a36b13223ff20921f5c50 /applications/luci-app-travelmate/htdocs/luci-static
parentadbaa8ad5d6559cc0531f40135c9d5d0326e35b6 (diff)
luci-app-travelmate: sync with travelmate 2.0.6
* a few (visual) fixes reported in the forum * emphasize normal uplinks in blue, vpn uplinks in green * sync translations Signed-off-by: Dirk Brenken <dev@brenken.org>
Diffstat (limited to 'applications/luci-app-travelmate/htdocs/luci-static')
-rw-r--r--applications/luci-app-travelmate/htdocs/luci-static/resources/view/travelmate/overview.js13
-rw-r--r--applications/luci-app-travelmate/htdocs/luci-static/resources/view/travelmate/stations.js22
2 files changed, 23 insertions, 12 deletions
diff --git a/applications/luci-app-travelmate/htdocs/luci-static/resources/view/travelmate/overview.js b/applications/luci-app-travelmate/htdocs/luci-static/resources/view/travelmate/overview.js
index 9dde97dd34..5b8f58e298 100644
--- a/applications/luci-app-travelmate/htdocs/luci-static/resources/view/travelmate/overview.js
+++ b/applications/luci-app-travelmate/htdocs/luci-static/resources/view/travelmate/overview.js
@@ -14,8 +14,9 @@ function handleAction(ev) {
var ifaceValue;
if (ev === 'restart') {
ifaceValue = String(uci.get('travelmate', 'global', 'trm_iface') || 'trm_wwan');
- return fs.exec('/sbin/ifup', [ifaceValue])
- .then(fs.exec('/etc/init.d/travelmate', ['restart']))
+ return fs.exec('/etc/init.d/travelmate', ['stop'])
+ .then(fs.exec('/sbin/ifup', [ifaceValue]))
+ .then(fs.exec('/etc/init.d/travelmate', ['start']))
}
if (ev === 'setup') {
ifaceValue = String(uci.get('travelmate', 'global', 'trm_iface') || '');
@@ -132,7 +133,6 @@ function handleAction(ev) {
])
]);
});
- return;
}
}
@@ -156,7 +156,7 @@ return view.extend({
pollData: poll.add(function () {
return L.resolveDefault(fs.stat('/tmp/trm_runtime.json'), null).then(function (res) {
var status = document.getElementById('status');
- if (res) {
+ if (res && res.size > 0) {
L.resolveDefault(fs.read_direct('/tmp/trm_runtime.json'), null).then(function (res) {
if (res) {
var info = JSON.parse(res);
@@ -207,6 +207,11 @@ return view.extend({
}
}
});
+ } else if (status) {
+ status.textContent = '-';
+ if (status.classList.contains("spinning")) {
+ status.classList.remove("spinning");
+ }
}
});
}, 1);
diff --git a/applications/luci-app-travelmate/htdocs/luci-static/resources/view/travelmate/stations.js b/applications/luci-app-travelmate/htdocs/luci-static/resources/view/travelmate/stations.js
index 53bc2ec5aa..fbf146de2c 100644
--- a/applications/luci-app-travelmate/htdocs/luci-static/resources/view/travelmate/stations.js
+++ b/applications/luci-app-travelmate/htdocs/luci-static/resources/view/travelmate/stations.js
@@ -167,11 +167,11 @@ function handleStatus() {
if (res) {
var info = JSON.parse(res);
if (info) {
- var t_device, t_ssid, t_bssid, oldUplinkView, newUplinkView,
+ var t_device, t_ssid, t_bssid, oldUplinkView, newUplinkView, uplinkColor,
uplinkId = info.data.station_id.trim().split('/'),
oldUplinkView = document.getElementsByName('uplinkStation'),
- w_sections = uci.sections('wireless', 'wifi-iface');
-
+ w_sections = uci.sections('wireless', 'wifi-iface'),
+ vpnStatus = info.data.ext_hooks.substr(13, 1);
t_device = uplinkId[0];
t_bssid = uplinkId[uplinkId.length - 1];
for (var i = 1; i < uplinkId.length - 1; i++) {
@@ -189,18 +189,22 @@ function handleStatus() {
}
}
else {
+ uplinkColor = (vpnStatus === "✔" ? 'rgb(68, 170, 68)' : 'rgb(51, 119, 204)');
for (var i = 0; i < w_sections.length; i++) {
newUplinkView = document.getElementById('cbi-wireless-' + w_sections[i]['.name']);
if (t_device === w_sections[i].device && t_ssid === w_sections[i].ssid && t_bssid === (w_sections[i].bssid || '-')) {
if (oldUplinkView.length === 0 && newUplinkView) {
newUplinkView.setAttribute('name', 'uplinkStation');
- newUplinkView.setAttribute('style', 'text-align: left !important; color: #37c !important;font-weight: bold !important;');
+ newUplinkView.setAttribute('style', 'text-align: left !important; color: ' + uplinkColor + ' !important;font-weight: bold !important;');
}
else if (oldUplinkView.length > 0 && newUplinkView && oldUplinkView[0].getAttribute('id') !== newUplinkView.getAttribute('id')) {
oldUplinkView[0].removeAttribute('style');
oldUplinkView[0].removeAttribute('name', 'uplinkStation');
newUplinkView.setAttribute('name', 'uplinkStation');
- newUplinkView.setAttribute('style', 'text-align: left !important; color: #37c !important;font-weight: bold !important;');
+ newUplinkView.setAttribute('style', 'text-align: left !important; color: ' + uplinkColor + ' !important;font-weight: bold !important;');
+ }
+ else if (newUplinkView && newUplinkView.style.color != uplinkColor) {
+ newUplinkView.setAttribute('style', 'text-align: left !important; color: ' + uplinkColor + ' !important;font-weight: bold !important;');
}
}
}
@@ -228,8 +232,10 @@ return view.extend({
m = new form.Map('wireless');
m.chain('travelmate');
- s = m.section(form.GridSection, 'wifi-iface', null, _('Overview of all configured uplinks for travelmate.<br /> \
- You can edit, remove or prioritize existing uplinks by drag \&#38; drop and scan for new ones. The currently used uplink is emphasized in blue.'));
+ s = m.section(form.GridSection, 'wifi-iface', null, _('Overview of all configured uplinks for travelmate. \
+ You can edit, remove or prioritize existing uplinks by drag \&#38; drop and scan for new ones.<br /> \
+ The currently used uplink connection is emphasized in <span style="color:rgb(51, 119, 204);font-weight:bold">blue</span>, \
+ an encrypted VPN uplink connection is emphasized in <span style="color:rgb(68, 170, 68);font-weight:bold">green</span>.'));
s.anonymous = true;
s.sortable = true;
s.filter = function (section_id) {
@@ -685,7 +691,7 @@ return view.extend({
radio = radios[i].sid;
if (radio) {
btns.push(E('button', {
- 'class': 'cbi-button cbi-button-positive',
+ 'class': 'cbi-button cbi-button-apply',
'id': radio,
'click': ui.createHandlerFn(this, 'handleScan', radio)
}, [_('Scan on ' + radio + '...')]),