服务器监控页面中的tablespace 页面渲染及接口联调

This commit is contained in:
任珮宇 2023-11-10 14:58:14 +08:00
parent 91b29d157f
commit b1c86a8077
7 changed files with 212 additions and 85 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1003 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1003 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1002 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1002 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1004 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1007 B

View File

@ -1,6 +1,45 @@
<template> <template>
<div style="height: 100%;"> <div style="height: 100%">
<ConditionBox></ConditionBox> <div class="monitor-search">
<a-row type="flex" :gutter="10">
<a-col flex="335px">
<span class="item-label">Database name</span>
<a-select
style="width: 180px"
v-model="name"
placeholder="select..."
:filter-option="filterOption"
show-arrow
allowClear
:options="DbOptions"
@change="onDbChange"
>
<img slot="suffixIcon" src="@/assets/images/global/select-down.png" alt="" />
</a-select>
</a-col>
<a-col flex="335px">
<span class="item-label">DB Name</span>
<a-select
style="width: 180px"
v-model="dbName"
placeholder="select..."
show-arrow
allowClear
:options="dbNameOptions"
@change="ondbNameChange"
>
<img slot="suffixIcon" src="@/assets/images/global/select-down.png" alt="" />
</a-select>
</a-col>
</a-row>
<div class="monitor-search-btns">
<a-button class="monitor-search-btns-ant">
<img class="icon-add" src="@/assets/images/global/reset-pwd.png" alt="" />
<span style="margin-left: 10px"> Refresh </span>
</a-button>
</div>
</div>
<div class="tableSpace-main"> <div class="tableSpace-main">
<TableList <TableList
size="middle" size="middle"
@ -11,60 +50,58 @@
:pagination="false" :pagination="false"
:canSelect="false" :canSelect="false"
> >
<template slot="space" slot-scope="{ text,record}"> <template slot="space" slot-scope="{ text }">
<!-- <a-progress :percent="text" :strokeWidth="16" /> --> <div class="space">
{{ text }}% <div :class="['space-bar', `space-bar-${text > 80 ? 'r' : text > 50 ? 'y' : 'g'}`]">
<div
:class="['space-bar-progress', `space-bar-progress-${text > 80 ? 'r' : text > 50 ? 'y' : 'g'}`]"
:style="{ width: `${2.6 * text}px` }"
></div>
</div>
<div
class="space-text"
:style="{ color: text > 80 ? 'red' : text > 50 ? 'yellow' : '', 'margin-left': '30px' }"
>
{{ text.toFixed(3) }}%
</div>
</div>
</template> </template>
</TableList> </TableList>
<a-pagination
size="small"
v-model="ipagination.current"
:pageSize="ipagination.pageSize"
:page-size-options="ipagination.pageSizeOptions"
show-size-changer
show-quick-jumper
:total="ipagination.total"
:show-total="(total, range) => `Total ${total} items Page ${ipagination.current} / ${Math.ceil(total / ipagination.pageSize)}`"
show-less-items
@change="handlePageChange"
@showSizeChange="handleSizeChange"
/>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import ConditionBox from './conditionBox.vue'; import TableList from '../../components/tableList.vue'
import TableList from '../../components/tableList.vue'; import { getAction, postAction, httpAction, deleteAction } from '@/api/manage'
import { getAction,postAction,httpAction,deleteAction } from '@/api/manage' const columns = [
const columns = [{ {
title: 'DATABASE',
align: 'center',
dataIndex: 'dataBase',
width: 200,
},{
title: 'TABLE NAME', title: 'TABLE NAME',
align: 'center', align: 'center',
dataIndex: 'tableName', dataIndex: 'tableName',
width: 200, width: 300,
},{ },
{
title: 'TABLE ROWS', title: 'TABLE ROWS',
align: 'center', align: 'center',
dataIndex: 'tableRows', dataIndex: 'numRow',
width: 200, width: 200,
},{ },
{
title: 'TABLE SPACE', title: 'TABLE SPACE',
align: 'center', align: 'center',
dataIndex: 'tableSpace', dataIndex: 'used',
scopedSlots: { scopedSlots: {
customRender: 'space', customRender: 'space',
} },
},{ },
{
title: 'DATA SIZE(MB)', title: 'DATA SIZE(MB)',
align: 'center', align: 'center',
dataIndex: 'dataSize', dataIndex: 'dataSize',
width: 200, width: 200,
},{ },
{
title: 'INDEX SIZE(MB)', title: 'INDEX SIZE(MB)',
align: 'center', align: 'center',
dataIndex: 'indexSize', dataIndex: 'indexSize',
@ -73,79 +110,169 @@ const columns = [{
] ]
export default { export default {
components: { components: {
ConditionBox, TableList,
TableList
}, },
data() { data() {
return { return {
columns, columns,
dataSource: [ dataSource: [],
{
dataBase: "Energy spectrum",
tableName: "table",
tableRows: 8368,
tableSpace: 68,
dataSize: 321,
indexSize: 0.0,
},{
dataBase: "Energy spectrum",
tableName: "table",
tableRows: 8368,
tableSpace: 68,
dataSize: 321,
indexSize: 0.0,
},{
dataBase: "Energy spectrum",
tableName: "table",
tableRows: 8368,
tableSpace: 68,
dataSize: 321,
indexSize: 0.0,
},
],
loading: false, loading: false,
ipagination:{ name: undefined,
current: 1, dbName: undefined,
pageSize: 10, DbOptions: [],
pageSizeOptions: ['10', '20', '30'], dbNameOptions: [],
showTotal: (total, range) => { currId: '',
const { current, pageSize } = this.ipagination
return `Total ${total} items Page ${current} / ${Math.ceil(total / pageSize)}`
},
showQuickJumper: true,
showSizeChanger: true,
total: 0
},
} }
}, },
methods: { watch: {
handlePageChange(page, pageSize) { name(newValue, oldValue) {
this.ipagination.current = page this.currId = newValue
this.ipagination.pageSize = pageSize
this.getDbAlarmHistory(this.paramsArg)
}, },
handleSizeChange(current, size) { },
this.ipagination.current = current mounted() {
this.ipagination.pageSize = size this.getDbList()
this.getDbAlarmHistory(this.paramsArg) this.getDbNameList()
},
methods: {
filterOption(input, option) {
return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
},
getDbList() {
getAction('/sysDatabase/sourceList').then((res) => {
if (res.success) {
this.name = this.$route.query.id || res.result[0].sourceId
this.DbOptions = res.result.map((item) => {
return {
label: item.sourceName,
value: item.sourceId,
}
})
} else {
this.$message.warning('This operation fails. Contact your system administrator')
}
})
},
getDbNameList() {
let params = {
dbType: 'ORACLE',
}
getAction('/sysDatabase/dbNames', params).then((res) => {
if (res.success) {
console.log(res)
this.dbNameOptions = res.result.map((item) => {
return {
label: item,
value: item,
}
})
} else {
this.$message.warning('This operation fails. Contact your system administrator')
}
})
},
onDbChange(val) {
this.name = val
},
ondbNameChange(val) {
this.loading = true
let params = {
dbType: 'ORACLE',
dataBase: val,
}
getAction('/sysDatabase/dbInfo', params).then((res) => {
this.loading = false
if (res.success) {
this.dataSource = res.result
} else {
this.$message.warning('This operation fails. Contact your system administrator')
}
})
}, },
}, },
} }
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.tableSpace-main{ .tableSpace-main {
width: 100%; width: 100%;
height: calc(100% - 50px); height: calc(100% - 50px);
overflow: hidden; overflow: hidden;
padding-top: 15px; padding-top: 15px;
position: relative; position: relative;
} }
.ant-pagination{ .ant-pagination {
position: absolute; position: absolute;
left: 50%; left: 50%;
bottom: 0; bottom: 0;
transform: translateX(-50%); transform: translateX(-50%);
} }
.monitor-search {
height: 50px;
border-top: 1px solid rgba(13, 235, 201, 0.3);
border-bottom: 1px solid rgba(13, 235, 201, 0.3);
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 10px;
background: rgba(12, 235, 201, 0.05);
.ant-row-flex {
flex-flow: nowrap;
}
/deep/ .ant-calendar-range-picker-separator {
color: white;
}
.item-label {
display: inline-block;
font-size: 16px;
font-family: ArialMT;
color: #ade6ee;
line-height: 32px;
height: 32px;
margin-right: 10px;
}
&-btns {
&-ant {
background: #1397a3;
border: none;
}
}
}
.space {
width: 350px;
height: 16px;
display: inline-block;
position: relative;
&-bar {
width: 260px;
height: 100%;
position: absolute;
left: 0;
&-progress {
height: 100%;
}
&-progress-g {
background: url(~@/assets/images/abnormalAlarm/green.png) repeat;
}
&-progress-y {
background: url(~@/assets/images/abnormalAlarm/yellow.png) repeat;
}
&-progress-r {
background: url(~@/assets/images/abnormalAlarm/red.png) repeat;
}
}
&-bar-g {
background: url(~@/assets/images/abnormalAlarm/green-bg.png) repeat;
}
&-bar-y {
background: url(~@/assets/images/abnormalAlarm/yellow-bg.png) repeat;
}
&-bar-r {
background: url(~@/assets/images/abnormalAlarm/red-bg.png) repeat;
}
&-text {
position: absolute;
right: 0;
top: -3px;
}
}
</style> </style>