c5_labsci/web/admin/rigger/logfile.html
2026-01-27 00:52:00 +08:00

123 lines
3.7 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<link href="/jscss/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" charset="utf-8" src="/jscss/theme.js"></script>
<style>
.cleft {
min-width: 15em;
background: var(--bg2);
border-right: 1px solid var(--bg6);
}
.cleft>a {
display: block;
padding: 1em;
transition: background 0.5s;
}
.cleft>a:hover {
background: var(--bg5);
}
.cmain {
flex: 1;
display: flex;
height: 100%;
overflow: hidden;
flex-direction: column;
}
#id_fix {
margin: 0.5em;
display: inline-block;
}
#id_result {
overflow: auto;
flex: 1;
}
#id_result>div {
padding: 0.5em;
color: var(--txt9);
background: var(--bg1);
border-radius: 0.2em;
margin: 0.5em;
white-space: pre;
cursor: default;
}
#id_result>div.selected {
background: var(--bg6);
}
</style>
</head>
<body>
<div style="display:flex;height:100vh;">
<div class="cleft">
</div>
<div class="cmain">
<div>
<kbd id="id_fix"></kbd>
<button class="btn sm dag" style="display:none;" onclick="ciyfn.callfastfunc(this, '是否清空?', 'clear', { param: Glob.currfile }, function (json) { viewlog(Glob.currfile) });">清空操作</button>
</div>
<div id="id_result"></div>
</div>
</div>
<script type="text/javascript" src="/jscss/ciy.js"></script>
<script type="text/javascript" src="../common.js"></script>
<script type="text/javascript">
'use strict';
var Glob = {};
ciyfn.pageload(function () {
ciyfn.callfunc('init', {}, function (json) {
var html = "";
for (var i in json.logfiles) {
html += '<a onclick="viewlog(this)" data-file="' + json.logfiles[i] + '">' + json.logfiles[i] + '</a>';
}
$5('.cleft').html(html);
var urlp = ciyfn.urlparam();
if (urlp.file) {
viewlog(urlp.file);
}
});
});
function viewlog(dom) {
if (typeof (dom) == 'string') {
dom = $5('[data-file="' + dom + '"]', '.cleft');
if (dom.length == 0)
return;
dom = dom[0];
}
Glob.currfile = dom.innerText;
var opn = {};
opn.url = 'viewlog';
opn.param = { param: Glob.currfile };
if (Glob.sse)
Glob.sse.close();
$5('#id_result').html('');
$5('.btn.dag').show();
Glob.sse = new ciyclass.sse(opn);
Glob.sse.recvfix = function (data) {
$5('#id_fix').html(data);
}
Glob.sse.recvmsg = function (data, id) {
if (data == '')
return;
$5('#id_result').prepend('<div onclick="sel(this)">' + data.replace(/;;/g, '\t\t') + '</div>');
}
}
function sel(dom) {
$5(dom).toggleClass('selected');
}
</script>
</body>
</html>