Files
ulthon_admin/extend/base/admin/view/system/host/index.js
augushong b7094eee8a fix(host): 主机列表页设为只读
Remove add/edit/delete buttons and auth attributes from host list page. Hosts are auto-registered via heartbeat, manual CRUD is meaningless. Keep only setMaster operation.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-26 18:33:47 +08:00

46 lines
2.3 KiB
PHP

$(function(){
ua.table.render({
init: init,
cols: [[
{type: 'checkbox'},
{field: 'id', title: 'ID'},
{field: 'node_id', title: '节点ID'},
{field: 'ip_address', title: 'IP地址'},
{field: 'status', search: 'select', selectList: ua.getDataBrage('select_list_status'), title: '状态', templet: ua.table.switch},
{field: 'is_master', search: 'select', selectList: ua.getDataBrage('select_list_is_master'), title: '节点角色', templet: function(data) {
if (data.is_master == 1) {
return '<span class="layui-badge layui-bg-green">主节点</span>';
}
return '<span class="layui-badge layui-bg-gray">从节点</span>';
}},
{field: 'last_heartbeat_at', title: '最后心跳时间'},
{field: 'os_info', title: '系统信息'},
{field: 'php_version', title: 'PHP版本'},
{field: 'cpu_load', title: 'CPU负载'},
{field: 'memory_usage', title: '内存占用'},
{field: 'disk_free', title: '磁盘可用空间'},
{field: 'disk_total', title: '磁盘总空间'},
{field: 'create_time', title: '首次运行时间'},
{width: 200, title: '操作', templet: ua.table.tool, operat: [
[{
text: '设为主节点',
url: init.set_master_url,
method: 'request',
field: function(data) {
return {node_id: data.node_id};
},
auth: 'set-master',
class: 'layui-btn layui-btn-xs layui-btn-warm',
title: '确认将该节点设为主节点?切换后原主节点将变为从节点。',
_if: function(data) {
return data.status == 1 && data.is_master != 1;
}
}]
], fixed:'right'},
]],
});
ua.listen();
})