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-row>
<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
:class="['service-search-btns-ant', type == 'cpu' ? 'service-search-btns-active' : '']"
@click="handleCpu"
@ -207,7 +211,9 @@ export default {
{ label: '1Hours', value: 1 },
{ label: '2Hours', value: 2 },
{ label: '3Hours', value: 3 },
{ label: 'user-defined', value: 0 },
],
userDefined: false,
ranked: {
content: null,
legend: [],
@ -267,13 +273,18 @@ export default {
})
},
methods: {
handleRefresh() {
if (!this.userDefined) {
this.getBeforeHours(this.queryParams.timer)
}
},
// Top-ranked processes in the last hour
getRankProcesses() {
this.ranked.content && this.ranked.content.clear()
this.processCpu.content && this.processCpu.content.clear()
this.processMenbry.content && this.processMenbry.content.clear()
let params = {
hostId: this.queryParams.server || '10483',
hostId: this.queryParams.server,
pageName: 'serviceAndProcess',
start: this.queryParams.startDate,
end: this.queryParams.endDate,
@ -347,6 +358,7 @@ export default {
},
moment,
onRangeDateChange(date, dateString) {
this.queryParams.timer = 0
this.queryParams.startDate = dateString[0]
this.queryParams.endDate = dateString[1]
this.getRankProcesses()
@ -364,8 +376,7 @@ export default {
}
})
let serverId = this.$route.query.serverId
this.queryParams.server = '10483'
// this.serverOptions.find((item) => item.sourceId === serverId).hostId || res.result[0].hostId
this.queryParams.server = serverId || res.result[0].hostId
this.getRankProcesses()
} else {
this.$message.warning('This operation fails. Contact your system administrator')
@ -377,6 +388,12 @@ export default {
this.getRankProcesses()
},
onTimeChange(val) {
if (val !== 0) {
this.userDefined = false
} else {
this.userDefined = true
}
this.queryParams.timer = val
this.getBeforeHours(val)
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>