Files
small-packages/luci-app-dae/luasrc/view/dae/dae_status.htm
T
2026-07-28 01:38:11 +08:00

58 lines
1.9 KiB
HTML

<script type="text/javascript">//<![CDATA[
XHR.poll(3, '<%=url("admin/services/dae/status")%>', null,
function(x, data)
{
var tb = document.getElementById('dae_status');
if (data && tb)
{
if (data.running)
{
if (data.memory) {
tb.innerHTML = '<em style="color:green"><b><%:DAE%> <%:RUNNING%></b></em> <span style="color:#666; font-size:0.9em;">(<%:Memory Usage%>: ' + data.memory + ')</span>';
} else {
tb.innerHTML = '<em style="color:green"><b><%:DAE%> <%:RUNNING%></b></em>';
}
}
else
{
tb.innerHTML = '<em style=\"color:red\"><b><%:DAE%> <%:NOT RUNNING%></b></em>';
}
}
}
);
// 检查URL参数,显示reload成功的提示
window.addEventListener('load', function() {
var urlParams = new URLSearchParams(window.location.search);
if (urlParams.has('reload')) {
var notification = document.createElement('div');
notification.className = 'alert alert-success';
notification.style = 'margin-top: 10px;';
notification.textContent = '<%:Service reloaded successfully%>';
var container = document.querySelector('.cbi-section');
if (container) {
container.parentNode.insertBefore(notification, container);
// 3秒后自动移除提示
setTimeout(function() {
notification.style.opacity = '0';
notification.style.transition = 'opacity 0.5s ease';
setTimeout(function() {
notification.remove();
}, 500);
}, 3000);
}
// 从URL中移除参数,避免刷新页面再次显示提示
history.replaceState({}, document.title, window.location.pathname);
}
});
//]]></script>
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
<fieldset class="cbi-section">
<p id="dae_status">
<em><b><%:Collecting data...%></b></em>
</p>
</fieldset>