cluster_user.json•6.34 kB
{
"type": "page",
"title": "多集群管理",
"remark": {
"body": "当前用户可操作集群列表。如需纳管新集群,请联系平台管理员,在 “平台设置-多集群管理” 中操作。",
"icon": "question-mark",
"placement": "right",
"trigger": "click",
"rootClose": true
},
"body": [
{
"type": "crud",
"id": "detailCRUD",
"name": "detailCRUD",
"autoFillHeight": true,
"autoGenerateFilter": {
"columnsNum": 4,
"showBtnToolbar": false
},
"headerToolbar": [
{
"type": "columns-toggler",
"align": "right",
"draggable": true,
"icon": "fas fa-cog",
"overlay": true,
"footerBtnSize": "sm"
},
{
"type": "tpl",
"tpl": "共${count}条",
"align": "right",
"visibleOn": "${count}"
},
{
"type": "columns-toggler",
"align": "left"
},
"reload",
"bulkActions"
],
"loadDataOnce": true,
"syncLocation": false,
"perPage": 10,
"api": "get:/params/cluster/all",
"columns": [
{
"type": "operation",
"label": "操作",
"width": 300,
"buttons": [
{
"type": "button",
"icon": "fas fa-link text-primary",
"label": "连接",
"actionType": "ajax",
"api": "post:/mgm/cluster/${cluster_id_base64}/reconnect"
},
{
"type": "button",
"icon": "fas fa-check-circle text-primary",
"label": "切换",
"onEvent": {
"click": {
"actions": [
{
"actionType": "custom",
"script": "window.setCurrentClusterId(event.data.cluster_id)"
}
]
}
}
}
],
"toggled": true
},
{
"name": "fileName",
"label": "名称",
"type": "text",
"sortable": true
},
{
"name": "clusterName",
"label": "集群名称",
"type": "text",
"sortable": true
},
{
"name": "userName",
"label": "用户名",
"type": "text",
"sortable": true
},
{
"name": "namespace",
"label": "命名空间",
"type": "text"
},
{
"name": "current",
"label": "是否当前集群",
"type": "tpl",
"tpl": "<% if (window.getCurrentClusterId() === data.cluster_id) { %><span class='label label-success'>当前集群</span><% if (data.clusterConnectStatus !== 'connected') { %> ⚠️ <% } %><% } %>"
},
{
"name": "clusterConnectStatus",
"label": "可访问性",
"type": "mapping",
"map": {
"connected": "<span class='label label-success'>已连接</span>",
"disconnected": "<span class='label label-danger'>未连接</span>",
"failed": "<span class='label label-danger'>连接失败</span>",
"connecting": "<span class='label label-warning'>连接中</span>",
"*": "<span class='label label-default'>${clusterConnectStatus}</span>"
},
"popOver": {
"trigger": "hover",
"showIcon": false,
"body": {
"mode": "dialog",
"type": "tpl",
"tpl": "<span class='text-gray-500 text-sm'>${err} </span>"
}
},
"popOverEnableOn": "this.err"
},
{
"name": "heartbeat_history",
"label": "心跳状态",
"type": "tpl",
"width": "140px",
"tpl": "<% if (Array.isArray(data.heartbeat_history) && data.heartbeat_history.length) { data.heartbeat_history.forEach(function(h){ %><span title='时间:<%=h.time%>\n结果:<% if (h.success) { %>成功<% } else { %>失败<% } %>' style='display:inline-block;width:10px;height:10px;border-radius:50%;background-color:<% if (h.success) { %>#10b981<% } else { %>#ef4444<% } %>;margin-right:6px;'></span><% }); } else { %><span class='text-muted'>—</span><% } %>"
},
{
"name": "k8s_gpt_problems_count",
"label": "智检",
"width": "200px",
"type": "container",
"body": [
{
"type": "tpl",
"tpl": "<% if (data.k8s_gpt_problems_count) { %><span class='label label-danger'><%=data.k8s_gpt_problems_count%></span><% } %>"
},
{
"type": "container",
"body": [
{
"type": "button",
"label": "检测",
"level": "link",
"actionType": "ajax",
"api": "post:/k8s/k8s_gpt/cluster/${cluster_id_base64}/run"
},
{
"type": "button",
"label": "查看",
"level": "link",
"actionType": "drawer",
"drawer": {
"overlay": false,
"closeOnEsc": true,
"closeOnOutside": true,
"size": "lg",
"title": "AI 智能巡检 集群${clusterName} (ESC 关闭)",
"body": [
{
"type": "k8sGPT",
"api": "/k8s/k8s_gpt/cluster/${cluster_id_base64}/result"
}
]
}
}
]
}
]
},
{
"name": "server",
"label": "集群地址",
"type": "text",
"width": "180px",
"sortable": true
},
{
"name": "serverVersion",
"label": "集群版本",
"type": "text",
"sortable": true
},
{
"name": "not_after",
"label": "证书有效期",
"type": "text",
"sortable": true
}
]
}
]
}