optz
This commit is contained in:
@@ -28,22 +28,29 @@
|
|||||||
<a-tabs v-model:active-tab="activeTab" class="detail-tabs">
|
<a-tabs v-model:active-tab="activeTab" class="detail-tabs">
|
||||||
<a-tab-pane key="overview" title="实例详情">
|
<a-tab-pane key="overview" title="实例详情">
|
||||||
<a-descriptions :column="2" bordered class="info-descriptions">
|
<a-descriptions :column="2" bordered class="info-descriptions">
|
||||||
<a-descriptions-item label="唯一标识">{{ record.unique_id || '-' }}</a-descriptions-item>
|
<a-descriptions-item label="唯一标识">{{ record.server_identity || '-' }}</a-descriptions-item>
|
||||||
<a-descriptions-item label="服务器名称">{{ record.name || '-' }}</a-descriptions-item>
|
<a-descriptions-item label="服务器名称">{{ record.name || '-' }}</a-descriptions-item>
|
||||||
<a-descriptions-item label="服务器类型">{{ getServerTypeText(record.server_type) }}</a-descriptions-item>
|
<a-descriptions-item label="服务器类型">{{ getServerTypeText(record.server_type) }}</a-descriptions-item>
|
||||||
<a-descriptions-item label="操作系统">{{ record.os || '-' }}</a-descriptions-item>
|
<a-descriptions-item label="操作系统">{{ formatOSInfo(record.os, record.os_version) }}</a-descriptions-item>
|
||||||
|
<a-descriptions-item label="内核类型">{{ record.kernel || '-' }}</a-descriptions-item>
|
||||||
<a-descriptions-item label="位置信息">{{ record.location || '-' }}</a-descriptions-item>
|
<a-descriptions-item label="位置信息">{{ record.location || '-' }}</a-descriptions-item>
|
||||||
<a-descriptions-item label="标签">{{ record.tags || '-' }}</a-descriptions-item>
|
<a-descriptions-item label="标签">{{ record.tags || '-' }}</a-descriptions-item>
|
||||||
<a-descriptions-item label="IP地址">{{ record.ip || '-' }}</a-descriptions-item>
|
<a-descriptions-item label="IP 地址">{{ record.ip_address || '-' }}</a-descriptions-item>
|
||||||
<a-descriptions-item label="远程端口">{{ record.remote_port || '-' }}</a-descriptions-item>
|
<a-descriptions-item label="远程访问">{{ record.remote_access || '-' }}</a-descriptions-item>
|
||||||
<a-descriptions-item label="Agent URL">{{ record.agent_url || '-' }}</a-descriptions-item>
|
<a-descriptions-item label="Agent 配置">{{ record.agent_config || '-' }}</a-descriptions-item>
|
||||||
<a-descriptions-item label="数据采集">
|
<a-descriptions-item label="状态">{{ getStatusText(record.status) }}</a-descriptions-item>
|
||||||
<a-tag :color="record.data_collection ? 'green' : 'gray'">
|
<a-descriptions-item label="最后检查时间">{{ formatTime(record.last_check_time) }}</a-descriptions-item>
|
||||||
{{ record.data_collection ? '已开启' : '未开启' }}
|
<a-descriptions-item label="采集状态">
|
||||||
|
<a-tag :color="record.collect_on ? 'green' : 'gray'">
|
||||||
|
{{ record.collect_on ? '已启用' : '未启用' }}
|
||||||
</a-tag>
|
</a-tag>
|
||||||
</a-descriptions-item>
|
</a-descriptions-item>
|
||||||
<a-descriptions-item label="采集间隔">{{ record.collection_interval ? `${record.collection_interval}分钟` : '-' }}</a-descriptions-item>
|
<a-descriptions-item label="采集间隔">{{ record.collect_interval ? `${record.collect_interval}秒` : '-' }}</a-descriptions-item>
|
||||||
<a-descriptions-item label="备注信息" :span="2">{{ record.remark || '-' }}</a-descriptions-item>
|
<a-descriptions-item label="采集参数">{{ record.collect_args || '-' }}</a-descriptions-item>
|
||||||
|
<a-descriptions-item label="采集结果" :span="2">{{ record.collect_last_result || '-' }}</a-descriptions-item>
|
||||||
|
<a-descriptions-item label="描述信息" :span="2">{{ record.description || '-' }}</a-descriptions-item>
|
||||||
|
<a-descriptions-item label="创建时间">{{ formatTime(record.created_at) }}</a-descriptions-item>
|
||||||
|
<a-descriptions-item label="更新时间">{{ formatTime(record.updated_at) }}</a-descriptions-item>
|
||||||
</a-descriptions>
|
</a-descriptions>
|
||||||
</a-tab-pane>
|
</a-tab-pane>
|
||||||
|
|
||||||
@@ -555,10 +562,35 @@ const getStatusText = (status?: string) => {
|
|||||||
offline: '离线',
|
offline: '离线',
|
||||||
maintenance: '维护中',
|
maintenance: '维护中',
|
||||||
retired: '已退役',
|
retired: '已退役',
|
||||||
|
unknown: '未知',
|
||||||
}
|
}
|
||||||
return textMap[status || ''] || '-'
|
return textMap[status || ''] || '-'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const formatOSInfo = (os?: string, osVersion?: string) => {
|
||||||
|
const parts = []
|
||||||
|
if (os) parts.push(os)
|
||||||
|
if (osVersion) parts.push(osVersion)
|
||||||
|
return parts.length > 0 ? parts.join(' ') : '-'
|
||||||
|
}
|
||||||
|
|
||||||
|
const formatTime = (time?: string | Date) => {
|
||||||
|
if (!time) return '-'
|
||||||
|
try {
|
||||||
|
const date = new Date(time)
|
||||||
|
return date.toLocaleString('zh-CN', {
|
||||||
|
year: 'numeric',
|
||||||
|
month: '2-digit',
|
||||||
|
day: '2-digit',
|
||||||
|
hour: '2-digit',
|
||||||
|
minute: '2-digit',
|
||||||
|
second: '2-digit',
|
||||||
|
})
|
||||||
|
} catch (e) {
|
||||||
|
return '-'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const getServerTypeText = (type?: string) => {
|
const getServerTypeText = (type?: string) => {
|
||||||
const typeMap: Record<string, string> = {
|
const typeMap: Record<string, string> = {
|
||||||
physical: '物理服务器',
|
physical: '物理服务器',
|
||||||
@@ -567,7 +599,6 @@ const getServerTypeText = (type?: string) => {
|
|||||||
}
|
}
|
||||||
return typeMap[type || ''] || '-'
|
return typeMap[type || ''] || '-'
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleRemoteControl = () => {
|
const handleRemoteControl = () => {
|
||||||
emit('remote-control')
|
emit('remote-control')
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
</a-row>
|
</a-row>
|
||||||
|
|
||||||
<a-row :gutter="20">
|
<a-row :gutter="20">
|
||||||
<a-col :span="12">
|
<a-col :span="8">
|
||||||
<a-form-item field="server_type" label="服务器类型">
|
<a-form-item field="server_type" label="服务器类型">
|
||||||
<a-select v-model="formData.server_type" placeholder="请选择服务器类型">
|
<a-select v-model="formData.server_type" placeholder="请选择服务器类型">
|
||||||
<a-option value="physical">物理服务器</a-option>
|
<a-option value="physical">物理服务器</a-option>
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
</a-select>
|
</a-select>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="12">
|
<a-col :span="8">
|
||||||
<a-form-item field="os" label="操作系统">
|
<a-form-item field="os" label="操作系统">
|
||||||
<a-select v-model="formData.os" placeholder="请选择操作系统">
|
<a-select v-model="formData.os" placeholder="请选择操作系统">
|
||||||
<a-option value="windows">Windows</a-option>
|
<a-option value="windows">Windows</a-option>
|
||||||
@@ -45,6 +45,15 @@
|
|||||||
</a-select>
|
</a-select>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item field="kernel" label="内核类型">
|
||||||
|
<a-select v-model="formData.kernel" placeholder="请选择内核类型">
|
||||||
|
<a-option value="X86">X86</a-option>
|
||||||
|
<a-option value="ARM">ARM</a-option>
|
||||||
|
<a-option value="other">其它</a-option>
|
||||||
|
</a-select>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
|
|
||||||
<a-form-item field="rack_id" label="数据中心/楼层/机柜">
|
<a-form-item field="rack_id" label="数据中心/楼层/机柜">
|
||||||
@@ -67,14 +76,14 @@
|
|||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="12">
|
<a-col :span="12">
|
||||||
<a-form-item field="remote_port" label="远程访问端口">
|
<a-form-item field="remote_access" label="远程访问端口">
|
||||||
<a-input v-model="formData.remote_port" placeholder="为空则不可远程访问" />
|
<a-input v-model="formData.remote_access" placeholder="为空则不可远程访问" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
|
|
||||||
<a-form-item field="agent_url" label="Agent URL配置">
|
<a-form-item field="agent_config" label="Agent 配置">
|
||||||
<a-input v-model="formData.agent_url" placeholder="请输入Agent URL配置" />
|
<a-input v-model="formData.agent_config" placeholder="请输入Agent 配置" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
|
||||||
<a-row :gutter="20">
|
<a-row :gutter="20">
|
||||||
@@ -135,13 +144,14 @@ const formData = reactive({
|
|||||||
name: '',
|
name: '',
|
||||||
server_type: '',
|
server_type: '',
|
||||||
os: '',
|
os: '',
|
||||||
|
kernel: '',
|
||||||
datacenter_id: undefined as number | undefined,
|
datacenter_id: undefined as number | undefined,
|
||||||
floor_id: undefined as number | undefined,
|
floor_id: undefined as number | undefined,
|
||||||
rack_id: undefined as number | undefined,
|
rack_id: undefined as number | undefined,
|
||||||
tags: '',
|
tags: '',
|
||||||
ip: '',
|
ip: '',
|
||||||
remote_port: '',
|
remote_access: '',
|
||||||
agent_url: '',
|
agent_config: '',
|
||||||
data_collection: false,
|
data_collection: false,
|
||||||
collection_interval: 5,
|
collection_interval: 5,
|
||||||
remark: '',
|
remark: '',
|
||||||
@@ -168,8 +178,8 @@ watch(
|
|||||||
rack_id: props.record.rack_id,
|
rack_id: props.record.rack_id,
|
||||||
tags: props.record.tags || '',
|
tags: props.record.tags || '',
|
||||||
ip: props.record.ip || '',
|
ip: props.record.ip || '',
|
||||||
remote_port: props.record.remote_port || '',
|
remote_access: props.record.remote_access || '',
|
||||||
agent_url: props.record.agent_url || '',
|
agent_config: props.record.agent_config || '',
|
||||||
data_collection: props.record.data_collection || false,
|
data_collection: props.record.data_collection || false,
|
||||||
collection_interval: props.record.collection_interval || 5,
|
collection_interval: props.record.collection_interval || 5,
|
||||||
remark: props.record.remark || '',
|
remark: props.record.remark || '',
|
||||||
@@ -190,8 +200,8 @@ watch(
|
|||||||
rack_id: undefined,
|
rack_id: undefined,
|
||||||
tags: '',
|
tags: '',
|
||||||
ip: '',
|
ip: '',
|
||||||
remote_port: '',
|
remote_access: '',
|
||||||
agent_url: '',
|
agent_config: '',
|
||||||
data_collection: false,
|
data_collection: false,
|
||||||
collection_interval: 5,
|
collection_interval: 5,
|
||||||
remark: '',
|
remark: '',
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ export const columns = [
|
|||||||
slotName: 'id',
|
slotName: 'id',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
dataIndex: 'unique_id',
|
dataIndex: 'service_identity',
|
||||||
title: '唯一标识',
|
title: '唯一标识',
|
||||||
width: 150,
|
width: 150,
|
||||||
},
|
},
|
||||||
@@ -16,7 +16,7 @@ export const columns = [
|
|||||||
width: 150,
|
width: 150,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
dataIndex: 'type',
|
dataIndex: 'server_type',
|
||||||
title: '类型',
|
title: '类型',
|
||||||
width: 120,
|
width: 120,
|
||||||
},
|
},
|
||||||
@@ -25,6 +25,11 @@ export const columns = [
|
|||||||
title: '操作系统',
|
title: '操作系统',
|
||||||
width: 150,
|
width: 150,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
dataIndex: 'kernel',
|
||||||
|
title: '内核类型',
|
||||||
|
width: 150,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
dataIndex: 'location',
|
dataIndex: 'location',
|
||||||
title: '位置信息',
|
title: '位置信息',
|
||||||
|
|||||||
38
src/views/ops/pages/dc/server/model.txt
Normal file
38
src/views/ops/pages/dc/server/model.txt
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
|
||||||
|
// ControlServer 服务器管理表
|
||||||
|
type ControlServer struct {
|
||||||
|
ID uint `gorm:"primarykey" json:"id"`
|
||||||
|
CreatedAt time.Time `json:"created_at"`
|
||||||
|
UpdatedAt time.Time `json:"updated_at"`
|
||||||
|
DeletedAt gorm.DeletedAt `gorm:"index" json:"deleted_at,omitempty"`
|
||||||
|
|
||||||
|
// 服务器唯一标识
|
||||||
|
ServerIdentity string `gorm:"type:varchar(255);not null;uniqueIndex" json:"server_identity"` // 服务器唯一标识
|
||||||
|
|
||||||
|
// 服务器基本信息
|
||||||
|
Name string `gorm:"type:varchar(100);not null" json:"name"` // 服务器名称
|
||||||
|
IPAddress string `gorm:"type:varchar(50)" json:"ip_address"` // IP地址
|
||||||
|
Description string `gorm:"type:text" json:"description"` // 描述信息
|
||||||
|
|
||||||
|
// 服务器类型和标签
|
||||||
|
OS string `gorm:"type:varchar(50)" json:"os"` // 操作系统: Windows/Linux/Mac/Other
|
||||||
|
OSVersion string `gorm:"type:varchar(50)" json:"os_version"` // 操作系统版本: 10.0.19041.1/18.04.5/14.1.0/Other
|
||||||
|
Kernel string `gorm:"type:varchar(50)" json:"kernel"` // 内核类型:x86/arm
|
||||||
|
ServerType string `gorm:"type:varchar(50)" json:"server_type"` // 服务器类型: physical/virtual/cloud
|
||||||
|
Tags string `gorm:"type:varchar(500)" json:"tags"` // 标签:PC/Server
|
||||||
|
Location string `gorm:"type:varchar(200)" json:"location"` // 位置/机房信息
|
||||||
|
|
||||||
|
// 远程访问
|
||||||
|
RemoteAccess string `gorm:"type:varchar(255)" json:"remote_access"` // 远程访问
|
||||||
|
AgentConfig string `gorm:"type:varchar(255)" json:"agent_config"` // Agent配置
|
||||||
|
|
||||||
|
// 状态信息
|
||||||
|
Status string `gorm:"type:varchar(20);not null;default:unknown" json:"status"` // 状态: online/offline/unknown
|
||||||
|
LastCheckTime time.Time `json:"last_check_time"` // 最后检查时间
|
||||||
|
|
||||||
|
// 采集器配置
|
||||||
|
CollectOn bool `gorm:"default:true" json:"collect_on"` // 是否启用采集
|
||||||
|
CollectArgs string `gorm:"type:varchar(255)" json:"collect_args"` // 采集参数
|
||||||
|
CollectInterval int `gorm:"default:60" json:"collect_interval"` // 采集间隔(秒)
|
||||||
|
CollectLastResult string `gorm:"type:varchar(2000)" json:"collect_last_result"` // 采集最后结果
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user