Merge pull request #813 from bergware/master

Make diagnostics messages left aligned
This commit is contained in:
tom mortensen
2021-03-25 09:32:25 -07:00
committed by GitHub
4 changed files with 27 additions and 19 deletions

View File

@@ -1,8 +1,8 @@
Menu="Dashboard"
---
<?PHP
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, Bergware International.
/* Copyright 2005-2021, Lime Technology
* Copyright 2012-2021, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
@@ -165,6 +165,7 @@ span.ctrl{float:right;margin-right:10px}
span.outer{float:left}
span.inner{width:<?=$theme1?153:140?>px}
span.ups{width:200px;display:inline-block}
span.tx{width:75px;display:inline-block}
span.busy,i.inactive{opacity:0.5}
span#inbound{width:75px;display:inline-block}
span#load{width:120px;display:inline-block}
@@ -705,15 +706,15 @@ function update1() {
$('td#'+vtun+'-hs-'+n[vtun]).text("_(not received)_");
} else if (info[1] > 86400) {
var d = parseInt(info[1]/86400);
var s = d==1 ? "_(day)_" : "_(days)_";
$('td#'+vtun+'-hs-'+n[vtun]).text(d+s+" _(ago)_");
var s = d==1 ? " _(day)_" : " _(days)_";
$('td#'+vtun+'-hs-'+n[vtun]).text(sprintf("_(%s ago)_",d+s));
} else {
var h = parseInt(info[1]/3600).pad();
var m = parseInt(info[1]/60%60).pad();
var s = parseInt(info[1]%60).pad();
$('td#'+vtun+'-hs-'+n[vtun]).text(h+':'+m+':'+s+" _(ago)_");
$('td#'+vtun+'-hs-'+n[vtun]).text(sprintf("_(%s ago)_",h+':'+m+':'+s));
}
$('td#'+vtun+'-rx-'+n[vtun]).html(info[2]+'&nbsp;<i class="fa fa-fw fa-arrow-up"></i>&nbsp;&nbsp;&nbsp;'+info[3]+'&nbsp;<i class="fa fa-fw fa-arrow-down"></i>');
$('td#'+vtun+'-rx-'+n[vtun]).html(info[2]+'&nbsp;<i class="fa fa-fw fa-arrow-down"></i><span class="tx">'+info[3]+'&nbsp;<i class="fa fa-fw fa-arrow-up"></i></span>');
}
setTimeout(update1,1000);
});
@@ -973,6 +974,12 @@ function sortTable(table,index) {
}
}
function sprintf() {
var text = arguments[0];
for (var i=1,arg; arg=arguments[i]; i++) text = text.replace('%s',arg);
return text;
}
var cpuload = new NchanSubscriber('/sub/cpuload');
cpuload.on('message',function(data) {
/*
@@ -1007,6 +1014,7 @@ var sortableHelper = function(e,ui){
ui.find('tr:first').children().each(function(i){$(this).width(width[i]);});
return ui;
};
$(function() {
$('table').sortable({helper:sortableHelper,items:'.sortable',handle:'.section,.next',cursor:'move',axis:'y',containment:'parent',delay:100,opacity:0.5,zIndex:9999,
update:function(e,ui){

View File

@@ -65,13 +65,16 @@ if ($.cookie('deletepool')!=null) {
}
function doDispatch(form) {
var fields = {};
var id = "<?=addslashes(htmlspecialchars($id))?>_";
<?if ($display['unit']=='F'):?>
if (form.<?=addslashes(htmlspecialchars($id))?>_hotTemp.value>0) form.<?=addslashes(htmlspecialchars($id))?>_hotTemp.value = Math.round((form.<?=addslashes(htmlspecialchars($id))?>_hotTemp.value-32)*5/9);
if (form.<?=addslashes(htmlspecialchars($id))?>_maxTemp.value>0) form.<?=addslashes(htmlspecialchars($id))?>_maxTemp.value = Math.round((form.<?=addslashes(htmlspecialchars($id))?>_maxTemp.value-32)*5/9);
var hottemp = $(form).find('input[name="'+id+'hotTemp"]');
var maxtemp = $(form).find('input[name="'+id+'maxTemp"]');
if (hottemp.val()>0) hottemp.val(Math.round((hottemp.val()-32)*5/9));
if (maxtemp.val()>0) maxtemp.val(Math.round((maxtemp.val()-32)*5/9));
<?endif;?>
fields['#cfg'] = "/boot/config/smart-one.cfg";
fields['#cleanup'] = true;
$(form).find('input[name^="<?=addslashes(htmlspecialchars($id))?>_"]').each(function(){fields[$(this).attr('name')] = $(this).val(); $(this).prop('disabled',true);});
$(form).find('input[name^="'+id+'"]').each(function(){fields[$(this).attr('name')] = $(this).val(); $(this).prop('disabled',true);});
$.post('/webGui/include/Dispatcher.php',fields);
}
function prepareDeviceInfo(form) {

View File

@@ -41,13 +41,13 @@ diagnostic.on('message',function(data) {
}
});
function cleanUp(file) {
if (document.hasFocus()) {
function cleanUp(file) {
if (document.hasFocus()) {
$.post('/webGui/include/Download.php',{cmd:'delete',file:file});
$("#download").attr("disabled",false);
} else {
setTimeout(function(){cleanUp(file);},2000);
}
} else {
setTimeout(function(){cleanUp(file);},2000);
}
}
function zipfile(){
@@ -63,7 +63,7 @@ function diagnostics(file) {
diagnostic.start();
swal({
title: "_(Downloading)_...",
text: "/boot/logs"+zip+"<br><tt><span id='command'></span></tt>",
text: "/boot/logs"+zip+"<br><br><tt style='display:inline-block;text-align:left'><span id='command'></span></tt>",
allowOutsideClick: false,
showConfirmButton: false,
showCancelButton: false,
@@ -116,5 +116,3 @@ to the system log.*
:end
<input id='download' type="button" value="_(Download)_" onclick="$(this).attr('disabled',true);diagnostics(zipfile())"><input type="button" value="_(Done)_" onclick="done()"><input type="checkbox" id="anonymize" checked>_(Anonymize diagnostics)_

View File

@@ -146,9 +146,8 @@ if ($locale) {
}
}
// split URI into translation levels
$uri = array_filter(explode('/',strtok($_SERVER['REQUEST_URI'],'?')));
$uri = array_filter(explode('/',strtolower(strtok($_SERVER['REQUEST_URI'],'?'))));
foreach($uri as $more) {
$more = strtolower($more);
$text = "$docroot/languages/$locale/$more.txt";
if (file_exists($text)) {
// additional translations