Server Monitor 菜单页面 SERVICE AND PROCESS 接口参数调整,添加刷新按钮

This commit is contained in:
任珮宇 2023-12-21 14:38:11 +08:00
parent f0aa04564f
commit cd5044d1bf

View File

@ -40,6 +40,10 @@
</a-col> </a-col>
</a-row> </a-row>
<div class="service-search-btns"> <div class="service-search-btns">
<a-button class="view-btn" @click="handleRefresh">
<img class="icon-add" src="@/assets/images/global/reset-pwd.png" alt="" />
<span style="margin-left: 10px"> Refresh </span>
</a-button>
<a-button <a-button
:class="['service-search-btns-ant', type == 'cpu' ? 'service-search-btns-active' : '']" :class="['service-search-btns-ant', type == 'cpu' ? 'service-search-btns-active' : '']"
@click="handleCpu" @click="handleCpu"
@ -207,7 +211,9 @@ export default {
{ label: '1Hours', value: 1 }, { label: '1Hours', value: 1 },
{ label: '2Hours', value: 2 }, { label: '2Hours', value: 2 },
{ label: '3Hours', value: 3 }, { label: '3Hours', value: 3 },
{ label: 'user-defined', value: 0 },
], ],
userDefined: false,
ranked: { ranked: {
content: null, content: null,
legend: [], legend: [],
@ -267,13 +273,18 @@ export default {
}) })
}, },
methods: { methods: {
handleRefresh() {
if (!this.userDefined) {
this.getBeforeHours(this.queryParams.timer)
}
},
// Top-ranked processes in the last hour // Top-ranked processes in the last hour
getRankProcesses() { getRankProcesses() {
this.ranked.content && this.ranked.content.clear() this.ranked.content && this.ranked.content.clear()
this.processCpu.content && this.processCpu.content.clear() this.processCpu.content && this.processCpu.content.clear()
this.processMenbry.content && this.processMenbry.content.clear() this.processMenbry.content && this.processMenbry.content.clear()
let params = { let params = {
hostId: this.queryParams.server || '10483', hostId: this.queryParams.server,
pageName: 'serviceAndProcess', pageName: 'serviceAndProcess',
start: this.queryParams.startDate, start: this.queryParams.startDate,
end: this.queryParams.endDate, end: this.queryParams.endDate,
@ -347,6 +358,7 @@ export default {
}, },
moment, moment,
onRangeDateChange(date, dateString) { onRangeDateChange(date, dateString) {
this.queryParams.timer = 0
this.queryParams.startDate = dateString[0] this.queryParams.startDate = dateString[0]
this.queryParams.endDate = dateString[1] this.queryParams.endDate = dateString[1]
this.getRankProcesses() this.getRankProcesses()
@ -364,8 +376,7 @@ export default {
} }
}) })
let serverId = this.$route.query.serverId let serverId = this.$route.query.serverId
this.queryParams.server = '10483' this.queryParams.server = serverId || res.result[0].hostId
// this.serverOptions.find((item) => item.sourceId === serverId).hostId || res.result[0].hostId
this.getRankProcesses() this.getRankProcesses()
} else { } else {
this.$message.warning('This operation fails. Contact your system administrator') this.$message.warning('This operation fails. Contact your system administrator')
@ -377,6 +388,12 @@ export default {
this.getRankProcesses() this.getRankProcesses()
}, },
onTimeChange(val) { onTimeChange(val) {
if (val !== 0) {
this.userDefined = false
} else {
this.userDefined = true
}
this.queryParams.timer = val
this.getBeforeHours(val) this.getBeforeHours(val)
this.getRankProcesses() this.getRankProcesses()
}, },
@ -720,4 +737,12 @@ export default {
} }
} }
} }
.view-btn {
background-color: #1397a3;
font-family: ArialMT;
color: #ffffff;
border: none;
margin-left: 20px;
box-shadow: 0px 1px 1px 0px #000000;
}
</style> </style>