113 lines
4.9 KiB
HTML
113 lines
4.9 KiB
HTML
{% extends "base.html" %}
|
|
|
|
{% block title %}资源监控 - 机器人管理后台{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="page-shell system-page">
|
|
<div class="page-hero">
|
|
<div class="page-hero-copy">
|
|
<div class="page-eyebrow">System Workspace</div>
|
|
<h1>服务器资源监控</h1>
|
|
<p>把系统面板统一纳入控制台视图,避免工具页与主工作流割裂。</p>
|
|
</div>
|
|
<div class="page-hero-actions">
|
|
<el-button type="primary" plain @click="reloadIframe"><i class="el-icon-refresh"></i> 刷新面板</el-button>
|
|
<el-button type="primary" @click="openInNewTab"><i class="el-icon-top-right"></i> 新窗口打开</el-button>
|
|
<el-button type="danger" @click="confirmRestart"><i class="el-icon-refresh-left"></i> 重启服务</el-button>
|
|
</div>
|
|
</div>
|
|
|
|
<el-card class="iframe-shell-card" shadow="hover">
|
|
<div slot="header" class="workspace-header">
|
|
<div>
|
|
<h3>监控面板</h3>
|
|
<p>直接在控制台内查看系统资源变化与运行状态。</p>
|
|
</div>
|
|
<div class="iframe-url">{{ src_url }}</div>
|
|
</div>
|
|
<div class="iframe-shell">
|
|
<iframe ref="monitorFrame" src="{{ src_url }}" frameborder="0"></iframe>
|
|
</div>
|
|
</el-card>
|
|
</div>
|
|
{% endblock %}
|
|
|
|
{% block scripts %}
|
|
<script>
|
|
new Vue({
|
|
el: '#app',
|
|
mixins: [baseApp],
|
|
data() {
|
|
return {
|
|
currentView: '14',
|
|
showTimeRangeSelector: false,
|
|
frameUrl: '{{ src_url }}',
|
|
restarting: false
|
|
}
|
|
},
|
|
mounted() {
|
|
this.currentView = '14';
|
|
},
|
|
methods: {
|
|
reloadIframe() {
|
|
if (this.$refs.monitorFrame) {
|
|
this.$refs.monitorFrame.src = this.frameUrl;
|
|
}
|
|
},
|
|
openInNewTab() {
|
|
window.open(this.frameUrl, '_blank');
|
|
},
|
|
confirmRestart() {
|
|
this.$confirm('确认执行 ./restart.sh 重启服务吗?这会中断当前服务几秒钟。', '重启确认', {
|
|
confirmButtonText: '确认重启',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
}).then(() => {
|
|
this.triggerRestart();
|
|
}).catch(() => {});
|
|
},
|
|
async triggerRestart() {
|
|
if (this.restarting) return;
|
|
this.restarting = true;
|
|
try {
|
|
const response = await axios.post('/api/restart_service');
|
|
if (response.data.success) {
|
|
this.$message.success(response.data.message || '已触发重启');
|
|
} else {
|
|
this.$message.error(response.data.message || '重启失败');
|
|
}
|
|
} catch (error) {
|
|
this.$message.error(error.response?.data?.message || '触发重启失败');
|
|
} finally {
|
|
this.restarting = false;
|
|
}
|
|
}
|
|
}
|
|
});
|
|
</script>
|
|
|
|
<style>
|
|
.page-shell { display: flex; flex-direction: column; gap: 16px; }
|
|
.page-hero {
|
|
display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; padding: 24px 26px; border-radius: 24px;
|
|
background: linear-gradient(135deg, rgba(79,70,229,0.10), rgba(59,130,246,0.08), rgba(255,255,255,0.9));
|
|
border: 1px solid rgba(148, 163, 184, 0.16); box-shadow: 0 18px 40px rgba(15, 23, 42, 0.06);
|
|
}
|
|
.page-hero-actions { display: flex; align-items: center; gap: 12px; }
|
|
.page-eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: #6366f1; font-weight: 700; margin-bottom: 8px; }
|
|
.page-hero-copy h1 { font-size: 30px; line-height: 1.1; margin-bottom: 10px; color: #0f172a; }
|
|
.page-hero-copy p { color: #64748b; font-size: 14px; }
|
|
.workspace-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
|
|
.workspace-header h3 { font-size: 18px; margin-bottom: 4px; }
|
|
.workspace-header p { font-size: 13px; color: #64748b; }
|
|
.iframe-url {
|
|
max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px;
|
|
color: #94a3b8; padding: 8px 12px; border-radius: 999px; background: rgba(248,250,252,0.9); border: 1px solid rgba(148,163,184,0.12);
|
|
}
|
|
.iframe-shell-card { height: calc(100vh - 230px); }
|
|
.iframe-shell-card .el-card__body { height: calc(100% - 73px); }
|
|
.iframe-shell { height: 100%; border-radius: 18px; overflow: hidden; border: 1px solid rgba(148,163,184,0.12); background: rgba(248,250,252,0.82); }
|
|
.iframe-shell iframe { width: 100%; height: 100%; border: none; display: block; background: #fff; }
|
|
</style>
|
|
{% endblock %}
|