* [task#133247,done,2h] Adjust the viewing cne event style.

This commit is contained in:
zhangxiquan
2024-12-02 10:56:48 +08:00
committed by 翟晓剑
parent 9142a8e43b
commit dee5ab71db
4 changed files with 17 additions and 10 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ window.showEvents = function (instanceID,noEventTip)
{
toggleLoading('#events-panel', false);
$('#events-content').removeClass('dtable-empty-tip flex');
if (resp.data.length === 0)
if (resp.code !== 200 || resp.data.length === 0)
{
$('#events-content').html(noEventTip);
$('#events-content').addClass('dtable-empty-tip flex');
+10 -3
View File
@@ -33,7 +33,7 @@ window.changeComponent = function (instanceID)
});
};
window.showLogs = function (instanceID)
window.showLogs = function (instanceID, noLogsTip)
{
const headerHeight = document.getElementById('logs-header').offsetHeight;
document.getElementById('logs-content').style.height = `calc(100vh - ${headerHeight}px - 16px)`;
@@ -43,6 +43,13 @@ window.showLogs = function (instanceID)
const target = $.createLink('instance', 'showlogs', 'id=' + instanceID + "&component=" + instanceComponent + "&pod=" + instancePod + "&previous=" + previous);
$.getJSON(target, function (resp)
{
$('#logs-content').removeClass('dtable-empty-tip flex');
if (resp.code !== 200 || resp.data.length === 0)
{
$('#logs-content').html(noLogsTip);
$('#logs-content').addClass('dtable-empty-tip flex');
return;
}
$('#logs-content').html(resp.data.map(item => item.timestamp + ' ' + item.content).join('\n'));
$('#logs-content')[0].scrollTop = $('#logs-content')[0].scrollHeight;
});
@@ -50,10 +57,10 @@ window.showLogs = function (instanceID)
let logsTimer = null;
window.startAutoRefreshLogs = function(instanceID) {
window.startAutoRefreshLogs = function(instanceID, noLogsTip) {
if(logsTimer) clearInterval(logsTimer);
logsTimer = setInterval(function() {
showLogs(instanceID);
showLogs(instanceID,noLogsTip);
}, 5000);
}
+1 -1
View File
@@ -41,7 +41,7 @@ formPanel
set::label($lang->instance->component),
set::inline(true),
on::inited()->call('initComponent', $instance->id),
on::change()->call('showEvents', $instance->id,$lang->instance->event->noEvents)
on::change()->call('showEvents', $instance->id, $lang->instance->event->noEvents)
)
)
),
+5 -5
View File
@@ -29,10 +29,10 @@ div
setClass('btn primary'),
$lang->instance->log->autoRefresh,
span(
setID('autoRefreshBtn'),
icon(setClass('icon icon-pause'))
),
on::click()->call('toggleAutoRefresh', $instance->id)
setID('autoRefreshBtn'),
icon(setClass('icon icon-pause'))
),
on::click()->call('toggleAutoRefresh', $instance->id, $lang->instance->log->noLog)
),
$lang->instance->name,
input
@@ -75,7 +75,7 @@ div
set::items($lang->instance->isPreviousList),
set::value(0),
set::inline(true),
on::change()->call('showLogs', $instance->id)
on::change()->call('showLogs', $instance->id, $lang->instance->log->noLog)
),
formGroup(
setClass('flex mx-2 text-sm text-gray-500'),