mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-09-05 07:15:31 +08:00
feat(nginx-log): curd 生成 raw/position 后台并改只读
- NginxAccessLog + NginxLogPosition Scheme 加 #[Component] 注解 - Scheme Table name 补 ul_ 前缀(curd 严格校验要求) - curd 生成 nginx 模块完整后台(controller/model/view/js) - Base/App 双层只读控制器(参照 TimerLogBase 范式) - AccessLogBase: add/edit/delete/modify 全部 error - LogPositionBase: 同上 - 视图改造: - access_log 裁剪到 8 列核心字段(time_local/method/uri/status/remote_addr/request_time/body_bytes_sent/http_user_agent) - status/request_time 自定义 badge 渲染 - toolbar 清空 + operat 仅保留详情(B 类只读页面) - log_position 全字段 + 只读化 - HTTP 验证:index 200 OK + add/edit/delete/modify 全部返回错误
This commit is contained in:
48
app/admin/view/nginx/access_log/index.js
Normal file
48
app/admin/view/nginx/access_log/index.js
Normal file
@@ -0,0 +1,48 @@
|
||||
$(function(){
|
||||
ua.table.render({
|
||||
init: init,
|
||||
toolbar: [],
|
||||
defaultToolbar: ['filter'],
|
||||
cols: [[
|
||||
{type: 'checkbox'},
|
||||
{field: 'time_local', title: '时间', width: 170, search: 'range', templet: ua.table.date},
|
||||
{field: 'method', title: '方法', width: 80, search: 'select', selectList: {GET: 'GET', POST: 'POST', PUT: 'PUT', DELETE: 'DELETE', HEAD: 'HEAD', OPTIONS: 'OPTIONS', PATCH: 'PATCH'}},
|
||||
{field: 'uri', title: 'URI', minWidth: 200, searchOp: '%*%'},
|
||||
{field: 'status', title: '状态码', width: 90, search: 'select', selectList: {200: '200', 301: '301', 302: '302', 304: '304', 400: '400', 401: '401', 403: '403', 404: '404', 499: '499', 500: '500', 502: '502', 503: '503', 504: '504'}, templet: function(d) {
|
||||
var s = parseInt(d.status);
|
||||
var cls = 'layui-badge';
|
||||
if (s >= 200 && s < 300) cls = 'layui-badge layui-bg-green';
|
||||
else if (s >= 300 && s < 400) cls = 'layui-badge layui-bg-blue';
|
||||
else if (s >= 400 && s < 500) cls = 'layui-badge layui-bg-orange';
|
||||
else if (s >= 500) cls = 'layui-badge layui-bg-red';
|
||||
return '<span class="' + cls + '">' + d.status + '</span>';
|
||||
}},
|
||||
{field: 'remote_addr', title: '客户端IP', width: 140, searchOp: '%*%'},
|
||||
{field: 'request_time', title: '耗时(秒)', width: 100, search: 'number_limit', templet: function(d) {
|
||||
var t = parseFloat(d.request_time);
|
||||
if (t >= 1) return '<span class="layui-badge layui-bg-red">' + t + 's</span>';
|
||||
if (t >= 0.3) return '<span class="layui-badge layui-bg-orange">' + t + 's</span>';
|
||||
return t + 's';
|
||||
}},
|
||||
{field: 'body_bytes_sent', title: '响应字节', width: 100, search: 'number_limit'},
|
||||
{field: 'http_user_agent', title: 'User-Agent', minWidth: 200, search: false},
|
||||
{
|
||||
width: 100, title: '操作', templet: ua.table.tool, fixed: 'right', operat: [
|
||||
[{
|
||||
class: 'layui-btn layui-btn-primary layui-btn-xs',
|
||||
method: 'tab',
|
||||
field: 'id',
|
||||
text: '详情',
|
||||
title: '查看详情',
|
||||
auth: 'read',
|
||||
url: init.readUrl,
|
||||
icon: ''
|
||||
}]
|
||||
]
|
||||
},
|
||||
|
||||
]],
|
||||
});
|
||||
|
||||
ua.listen();
|
||||
})
|
||||
Reference in New Issue
Block a user