📃More logging + updated default plugins to load
Some checks are pending
docker / docker_dev (push) Waiting to run

This commit is contained in:
jokob-sk
2024-06-29 23:42:51 +10:00
parent 0b5cf66451
commit e2d0914334
6 changed files with 77 additions and 49 deletions

View File

@@ -10,46 +10,54 @@ function renderLogArea($params) {
$buttons = isset($params['buttons']) ? $params['buttons'] : [];
$content = "";
if(filesize($filePath) > 2000000) {
$content = file_get_contents($filePath, false, null, -2000000);
if (filesize($filePath) > 2000000) {
$content = file_get_contents($filePath, false, null, -2000000);
} else {
$content = file_get_contents($filePath);
}
}
// Prepare the download button HTML if filePath starts with /app/front
$downloadButtonHtml = '';
if (strpos($filePath, '/app/front') === 0) {
$downloadButtonHtml = '
<span class="span-padding">
<a href="' . htmlspecialchars(str_replace('/app/front', '', $filePath)) . '" target="_blank">
<i class="fa fa-download"></i>
</a>
</span>';
}
// Prepare buttons HTML
$buttonsHtml = '';
foreach ($buttons as $button) {
$labelStringCode = isset($button['labelStringCode']) ? $button['labelStringCode'] : '';
$event = isset($button['event']) ? $button['event'] : '';
$buttonsHtml .= '
<div class="col-sm-6 col-xs-6">
<button class="btn btn-primary" onclick="' . htmlspecialchars($event) . '">' . lang($labelStringCode) . '</button>
</div>';
}
// Render the log area HTML
$html = '
<div class="log-area box box-solid box-primary">
<div class="row logs-row col-sm-12 col-xs-12">
<textarea id="app_log" class="' . $textAreaCssClass . '" cols="70" rows="10" wrap="off" readonly>'
.$content.
<textarea id="app_log" class="' . htmlspecialchars($textAreaCssClass) . '" cols="70" rows="10" wrap="off" readonly>'
. htmlspecialchars($content) .
'</textarea>
</div>
<div class="row logs-row">
<div class="log-file col-sm-8 col-xs-12">' . $fileName . '
<div class="logs-size">' . number_format((filesize($filePath) / 1000000), 2, ",", ".") . ' MB
<span class="span-padding"><a href="' . $filePath . '" target="_blank"><i class="fa fa-download"></i></a></span>
</div>
<div class="log-file col-sm-8 col-xs-12">' . htmlspecialchars($fileName) . '
<div class="logs-size">' . number_format((filesize($filePath) / 1000000), 2, ",", ".") . ' MB'
. $downloadButtonHtml .
'</div>
</div>
<div class="col-sm-4 col-xs-12">
';
// Render each button
foreach ($buttons as $button) {
$labelStringCode = isset($button['labelStringCode']) ? $button['labelStringCode'] : '';
$event = isset($button['event']) ? $button['event'] : '';
$html .= '
<div class="col-sm-6 col-xs-6">
<button class="btn btn-primary" onclick="' . $event . '">' . lang($labelStringCode) . '</button>
<div class="col-sm-4 col-xs-12">'
. $buttonsHtml .
'</div>
</div>
';
}
$html .= '
</div>
</div>
</div>
';
</div>';
return $html;
}