Add a message for progressive logs with no data

This commit is contained in:
Ilia Ross
2024-05-29 17:38:28 +03:00
parent a420c7142f
commit e88ba87eae
2 changed files with 10 additions and 1 deletions

View File

@@ -37,6 +37,7 @@ view_header=Last $1 lines of $2
view_header2=Last $1 lines
view_header3=Lines of $1
view_empty=Log file is empty
view_loading=Log file is being watched .. No new lines yet.
view_filter=Filter lines with text $1
view_filter_btn=Filter

View File

@@ -232,13 +232,14 @@ if (!$follow) {
$got = undef;
}
}
print "<i>$text{'view_empty'}</i>\n"
print "<i data-empty>$text{'view_empty'}</i>\n"
if (!$got || $safe_proc_out =~ /-- No entries --/m);
print "</pre>\n";
}
# Progressive output
else {
print "<pre id='logdata' data-reversed='$reverse'>";
print "<i data-loading>$text{'view_loading'}</i>\n";
print "</pre>\n";
my %tinfo = &get_theme_info($current_theme);
my $spa_theme = $tinfo{'spa'} ? 1 : 0;
@@ -261,6 +262,13 @@ else {
while (!done) {
const chunk = decoder.decode(value, { stream: true }).trim(),
dataReversed = logDataElement.getAttribute("data-reversed");
if (!processText.started) {
processText.started = true;
const loadingElement = logDataElement.querySelector("i[data-loading]");
if (loadingElement) {
loadingElement.remove();
}
}
let lines = chunk.split("\\n");
if (dataReversed === "1") {
lines = lines.reverse();