mirror of
https://github.com/unraid/webgui.git
synced 2026-03-07 10:30:37 -06:00
Display progress messages in blue
This commit is contained in:
@@ -395,6 +395,35 @@ echo " <a href='http://lime-technology.com/wiki/index.php/Official_Documentation
|
||||
echo "</span></div>";
|
||||
?>
|
||||
<script>
|
||||
function parseINI(data){
|
||||
var regex = {
|
||||
section: /^\s*\[\s*\"*([^\]]*)\s*\"*\]\s*$/,
|
||||
param: /^\s*([^=]+?)\s*=\s*\"*(.*?)\s*\"*$/,
|
||||
comment: /^\s*;.*$/
|
||||
};
|
||||
var value = {};
|
||||
var lines = data.split(/[\r\n]+/);
|
||||
var section = null;
|
||||
lines.forEach(function(line){
|
||||
if(regex.comment.test(line)){
|
||||
return;
|
||||
}else if(regex.param.test(line)){
|
||||
var match = line.match(regex.param);
|
||||
if(section){
|
||||
value[section][match[1]] = match[2];
|
||||
}else{
|
||||
value[match[1]] = match[2];
|
||||
}
|
||||
}else if(regex.section.test(line)){
|
||||
var match = line.match(regex.section);
|
||||
value[match[1]] = {};
|
||||
section = match[1];
|
||||
}else if(line.length == 0 && section){
|
||||
section = null;
|
||||
};
|
||||
});
|
||||
return value;
|
||||
}
|
||||
$(function() {
|
||||
<?if ($notify['entity'] & 1 == 1):?>
|
||||
$.post('/webGui/include/Notify.php',{cmd:'init'},function(){timers.notifier = setTimeout(notifier,0);});
|
||||
@@ -470,8 +499,31 @@ $(function() {
|
||||
}
|
||||
|
||||
$('form').append($('<input>').attr({type:'hidden', name:'csrf_token', value:'<?=$var['csrf_token']?>'}));
|
||||
var watchdog = new NchanSubscriber('/sub/watchdog');
|
||||
watchdog.on('message', function(data){$('#statusbar').html(data);});
|
||||
|
||||
var watchdog = new NchanSubscriber('/sub/var');
|
||||
watchdog.on('message', function(data){
|
||||
var ini=parseINI(data);
|
||||
var status, progress;
|
||||
if (ini['fsState']=="Stopped") {
|
||||
status="<span class='red strong'>Array Stopped</span>";
|
||||
}else if (ini['fsState']=="Starting") {
|
||||
status="<span class='orange strong'>Array Starting</span>";
|
||||
}else {
|
||||
status="<span class='green strong'>Array Started</span>";
|
||||
if (ini['mdResync'] > 0) {
|
||||
var action;
|
||||
if (ini['mdResyncAction'].indexOf("recon")>=0) action="Parity-Sync / Data-Rebuild";
|
||||
else if (ini['mdResyncAction'].indexOf("clear")>=0) action="Clearing";
|
||||
else if (ini['mdResyncAction'] == "check") action="Read-Check";
|
||||
else if (ini['mdResyncAction'].indexOf("check")>=0) action="Parity-Check";
|
||||
action += " " + (ini['mdResyncPos']/(ini['mdResync']/100+1)).toFixed(1) + " %";
|
||||
status += "•<span class='orange strong'>"+action+"</span>";
|
||||
}
|
||||
}
|
||||
if (ini['fsProgress'].length)
|
||||
status += "•<span class='blue strong'>"+ini['fsProgress']+"</span>";
|
||||
$('#statusbar').html(status);
|
||||
});
|
||||
watchdog.start();
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user