Browse Source
# Conflicts: # README.md # pom.xml # ruoyi-ui/package.json # ruoyi-ui/src/views/index.vue # ruoyi-ui/vue.config.jsmaster
76 changed files with 1325 additions and 1120 deletions
File diff suppressed because one or more lines are too long
@ -1,173 +1,170 @@ |
|||
<template> |
|||
<el-color-picker |
|||
v-model="theme" |
|||
:predefine="['#409EFF', '#1890ff', '#304156','#212121','#11a983', '#13c2c2', '#6959CD', '#f5222d', ]" |
|||
class="theme-picker" |
|||
popper-class="theme-picker-dropdown" |
|||
/> |
|||
</template> |
|||
|
|||
<script> |
|||
const version = require('element-ui/package.json').version // element-ui version from node_modules |
|||
const ORIGINAL_THEME = '#409EFF' // default color |
|||
|
|||
export default { |
|||
data() { |
|||
return { |
|||
chalk: '', // content of theme-chalk css |
|||
theme: '' |
|||
} |
|||
}, |
|||
computed: { |
|||
defaultTheme() { |
|||
return this.$store.state.settings.theme |
|||
} |
|||
}, |
|||
watch: { |
|||
defaultTheme: { |
|||
handler: function(val, oldVal) { |
|||
this.theme = val |
|||
}, |
|||
immediate: true |
|||
}, |
|||
async theme(val) { |
|||
await this.setTheme(val) |
|||
} |
|||
}, |
|||
created() { |
|||
if(this.defaultTheme !== ORIGINAL_THEME) { |
|||
this.setTheme(this.defaultTheme) |
|||
} |
|||
}, |
|||
|
|||
methods: { |
|||
async setTheme(val) { |
|||
const oldVal = this.chalk ? this.theme : ORIGINAL_THEME |
|||
if (typeof val !== 'string') return |
|||
const themeCluster = this.getThemeCluster(val.replace('#', '')) |
|||
const originalCluster = this.getThemeCluster(oldVal.replace('#', '')) |
|||
|
|||
const getHandler = (variable, id) => { |
|||
return () => { |
|||
const originalCluster = this.getThemeCluster(ORIGINAL_THEME.replace('#', '')) |
|||
const newStyle = this.updateStyle(this[variable], originalCluster, themeCluster) |
|||
|
|||
let styleTag = document.getElementById(id) |
|||
if (!styleTag) { |
|||
styleTag = document.createElement('style') |
|||
styleTag.setAttribute('id', id) |
|||
document.head.appendChild(styleTag) |
|||
} |
|||
styleTag.innerText = newStyle |
|||
} |
|||
} |
|||
|
|||
if (!this.chalk) { |
|||
const url = `https://unpkg.com/element-ui@${version}/lib/theme-chalk/index.css` |
|||
await this.getCSSString(url, 'chalk') |
|||
} |
|||
|
|||
const chalkHandler = getHandler('chalk', 'chalk-style') |
|||
|
|||
chalkHandler() |
|||
|
|||
const styles = [].slice.call(document.querySelectorAll('style')) |
|||
.filter(style => { |
|||
const text = style.innerText |
|||
return new RegExp(oldVal, 'i').test(text) && !/Chalk Variables/.test(text) |
|||
}) |
|||
styles.forEach(style => { |
|||
const { innerText } = style |
|||
if (typeof innerText !== 'string') return |
|||
style.innerText = this.updateStyle(innerText, originalCluster, themeCluster) |
|||
}) |
|||
|
|||
this.$emit('change', val) |
|||
}, |
|||
|
|||
updateStyle(style, oldCluster, newCluster) { |
|||
let newStyle = style |
|||
oldCluster.forEach((color, index) => { |
|||
newStyle = newStyle.replace(new RegExp(color, 'ig'), newCluster[index]) |
|||
}) |
|||
return newStyle |
|||
}, |
|||
|
|||
getCSSString(url, variable) { |
|||
return new Promise(resolve => { |
|||
const xhr = new XMLHttpRequest() |
|||
xhr.onreadystatechange = () => { |
|||
if (xhr.readyState === 4 && xhr.status === 200) { |
|||
this[variable] = xhr.responseText.replace(/@font-face{[^}]+}/, '') |
|||
resolve() |
|||
} |
|||
} |
|||
xhr.open('GET', url) |
|||
xhr.send() |
|||
}) |
|||
}, |
|||
|
|||
getThemeCluster(theme) { |
|||
const tintColor = (color, tint) => { |
|||
let red = parseInt(color.slice(0, 2), 16) |
|||
let green = parseInt(color.slice(2, 4), 16) |
|||
let blue = parseInt(color.slice(4, 6), 16) |
|||
|
|||
if (tint === 0) { // when primary color is in its rgb space |
|||
return [red, green, blue].join(',') |
|||
} else { |
|||
red += Math.round(tint * (255 - red)) |
|||
green += Math.round(tint * (255 - green)) |
|||
blue += Math.round(tint * (255 - blue)) |
|||
|
|||
red = red.toString(16) |
|||
green = green.toString(16) |
|||
blue = blue.toString(16) |
|||
|
|||
return `#${red}${green}${blue}` |
|||
} |
|||
} |
|||
|
|||
const shadeColor = (color, shade) => { |
|||
let red = parseInt(color.slice(0, 2), 16) |
|||
let green = parseInt(color.slice(2, 4), 16) |
|||
let blue = parseInt(color.slice(4, 6), 16) |
|||
|
|||
red = Math.round((1 - shade) * red) |
|||
green = Math.round((1 - shade) * green) |
|||
blue = Math.round((1 - shade) * blue) |
|||
|
|||
red = red.toString(16) |
|||
green = green.toString(16) |
|||
blue = blue.toString(16) |
|||
|
|||
return `#${red}${green}${blue}` |
|||
} |
|||
|
|||
const clusters = [theme] |
|||
for (let i = 0; i <= 9; i++) { |
|||
clusters.push(tintColor(theme, Number((i / 10).toFixed(2)))) |
|||
} |
|||
clusters.push(shadeColor(theme, 0.1)) |
|||
return clusters |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style> |
|||
.theme-message, |
|||
.theme-picker-dropdown { |
|||
z-index: 99999 !important; |
|||
} |
|||
|
|||
.theme-picker .el-color-picker__trigger { |
|||
height: 26px !important; |
|||
width: 26px !important; |
|||
padding: 2px; |
|||
} |
|||
|
|||
.theme-picker-dropdown .el-color-dropdown__link-btn { |
|||
display: none; |
|||
} |
|||
</style> |
|||
<template> |
|||
<el-color-picker |
|||
v-model="theme" |
|||
:predefine="['#409EFF', '#1890ff', '#304156','#212121','#11a983', '#13c2c2', '#6959CD', '#f5222d', ]" |
|||
class="theme-picker" |
|||
popper-class="theme-picker-dropdown" |
|||
/> |
|||
</template> |
|||
|
|||
<script> |
|||
const ORIGINAL_THEME = '#409EFF' // default color |
|||
|
|||
export default { |
|||
data() { |
|||
return { |
|||
chalk: '', // content of theme-chalk css |
|||
theme: '' |
|||
} |
|||
}, |
|||
computed: { |
|||
defaultTheme() { |
|||
return this.$store.state.settings.theme |
|||
} |
|||
}, |
|||
watch: { |
|||
defaultTheme: { |
|||
handler: function(val, oldVal) { |
|||
this.theme = val |
|||
}, |
|||
immediate: true |
|||
}, |
|||
async theme(val) { |
|||
await this.setTheme(val) |
|||
} |
|||
}, |
|||
created() { |
|||
if(this.defaultTheme !== ORIGINAL_THEME) { |
|||
this.setTheme(this.defaultTheme) |
|||
} |
|||
}, |
|||
methods: { |
|||
async setTheme(val) { |
|||
const oldVal = this.chalk ? this.theme : ORIGINAL_THEME |
|||
if (typeof val !== 'string') return |
|||
const themeCluster = this.getThemeCluster(val.replace('#', '')) |
|||
const originalCluster = this.getThemeCluster(oldVal.replace('#', '')) |
|||
|
|||
const getHandler = (variable, id) => { |
|||
return () => { |
|||
const originalCluster = this.getThemeCluster(ORIGINAL_THEME.replace('#', '')) |
|||
const newStyle = this.updateStyle(this[variable], originalCluster, themeCluster) |
|||
|
|||
let styleTag = document.getElementById(id) |
|||
if (!styleTag) { |
|||
styleTag = document.createElement('style') |
|||
styleTag.setAttribute('id', id) |
|||
document.head.appendChild(styleTag) |
|||
} |
|||
styleTag.innerText = newStyle |
|||
} |
|||
} |
|||
|
|||
if (!this.chalk) { |
|||
const url = `/styles/theme-chalk/index.css` |
|||
await this.getCSSString(url, 'chalk') |
|||
} |
|||
|
|||
const chalkHandler = getHandler('chalk', 'chalk-style') |
|||
chalkHandler() |
|||
|
|||
const styles = [].slice.call(document.querySelectorAll('style')) |
|||
.filter(style => { |
|||
const text = style.innerText |
|||
return new RegExp(oldVal, 'i').test(text) && !/Chalk Variables/.test(text) |
|||
}) |
|||
styles.forEach(style => { |
|||
const { innerText } = style |
|||
if (typeof innerText !== 'string') return |
|||
style.innerText = this.updateStyle(innerText, originalCluster, themeCluster) |
|||
}) |
|||
|
|||
this.$emit('change', val) |
|||
}, |
|||
|
|||
updateStyle(style, oldCluster, newCluster) { |
|||
let newStyle = style |
|||
oldCluster.forEach((color, index) => { |
|||
newStyle = newStyle.replace(new RegExp(color, 'ig'), newCluster[index]) |
|||
}) |
|||
return newStyle |
|||
}, |
|||
|
|||
getCSSString(url, variable) { |
|||
return new Promise(resolve => { |
|||
const xhr = new XMLHttpRequest() |
|||
xhr.onreadystatechange = () => { |
|||
if (xhr.readyState === 4 && xhr.status === 200) { |
|||
this[variable] = xhr.responseText.replace(/@font-face{[^}]+}/, '') |
|||
resolve() |
|||
} |
|||
} |
|||
xhr.open('GET', url) |
|||
xhr.send() |
|||
}) |
|||
}, |
|||
|
|||
getThemeCluster(theme) { |
|||
const tintColor = (color, tint) => { |
|||
let red = parseInt(color.slice(0, 2), 16) |
|||
let green = parseInt(color.slice(2, 4), 16) |
|||
let blue = parseInt(color.slice(4, 6), 16) |
|||
|
|||
if (tint === 0) { // when primary color is in its rgb space |
|||
return [red, green, blue].join(',') |
|||
} else { |
|||
red += Math.round(tint * (255 - red)) |
|||
green += Math.round(tint * (255 - green)) |
|||
blue += Math.round(tint * (255 - blue)) |
|||
|
|||
red = red.toString(16) |
|||
green = green.toString(16) |
|||
blue = blue.toString(16) |
|||
|
|||
return `#${red}${green}${blue}` |
|||
} |
|||
} |
|||
|
|||
const shadeColor = (color, shade) => { |
|||
let red = parseInt(color.slice(0, 2), 16) |
|||
let green = parseInt(color.slice(2, 4), 16) |
|||
let blue = parseInt(color.slice(4, 6), 16) |
|||
|
|||
red = Math.round((1 - shade) * red) |
|||
green = Math.round((1 - shade) * green) |
|||
blue = Math.round((1 - shade) * blue) |
|||
|
|||
red = red.toString(16) |
|||
green = green.toString(16) |
|||
blue = blue.toString(16) |
|||
|
|||
return `#${red}${green}${blue}` |
|||
} |
|||
|
|||
const clusters = [theme] |
|||
for (let i = 0; i <= 9; i++) { |
|||
clusters.push(tintColor(theme, Number((i / 10).toFixed(2)))) |
|||
} |
|||
clusters.push(shadeColor(theme, 0.1)) |
|||
return clusters |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style> |
|||
.theme-message, |
|||
.theme-picker-dropdown { |
|||
z-index: 99999 !important; |
|||
} |
|||
|
|||
.theme-picker .el-color-picker__trigger { |
|||
height: 26px !important; |
|||
width: 26px !important; |
|||
padding: 2px; |
|||
} |
|||
|
|||
.theme-picker-dropdown .el-color-dropdown__link-btn { |
|||
display: none; |
|||
} |
|||
</style> |
|||
|
@ -1,148 +1,148 @@ |
|||
<template> |
|||
<div class="app-container"> |
|||
<el-row> |
|||
<el-col :span="24" class="card-box"> |
|||
<el-card> |
|||
<div slot="header"><span><i class="el-icon-monitor"></i> 基本信息</span></div> |
|||
<div class="el-table el-table--enable-row-hover el-table--medium"> |
|||
<table cellspacing="0" style="width: 100%"> |
|||
<tbody> |
|||
<tr> |
|||
<td class="el-table__cell is-leaf"><div class="cell">Redis版本</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="cache.info">{{ cache.info.redis_version }}</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell">运行模式</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="cache.info">{{ cache.info.redis_mode == "standalone" ? "单机" : "集群" }}</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell">端口</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="cache.info">{{ cache.info.tcp_port }}</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell">客户端数</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="cache.info">{{ cache.info.connected_clients }}</div></td> |
|||
</tr> |
|||
<tr> |
|||
<td class="el-table__cell is-leaf"><div class="cell">运行时间(天)</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="cache.info">{{ cache.info.uptime_in_days }}</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell">使用内存</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="cache.info">{{ cache.info.used_memory_human }}</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell">使用CPU</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="cache.info">{{ parseFloat(cache.info.used_cpu_user_children).toFixed(2) }}</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell">内存配置</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="cache.info">{{ cache.info.maxmemory_human }}</div></td> |
|||
</tr> |
|||
<tr> |
|||
<td class="el-table__cell is-leaf"><div class="cell">AOF是否开启</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="cache.info">{{ cache.info.aof_enabled == "0" ? "否" : "是" }}</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell">RDB是否成功</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="cache.info">{{ cache.info.rdb_last_bgsave_status }}</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell">Key数量</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="cache.dbSize">{{ cache.dbSize }} </div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell">网络入口/出口</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="cache.info">{{ cache.info.instantaneous_input_kbps }}kps/{{cache.info.instantaneous_output_kbps}}kps</div></td> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
</el-card> |
|||
</el-col> |
|||
|
|||
<el-col :span="12" class="card-box"> |
|||
<el-card> |
|||
<div slot="header"><span><i class="el-icon-pie-chart"></i> 命令统计</span></div> |
|||
<div class="el-table el-table--enable-row-hover el-table--medium"> |
|||
<div ref="commandstats" style="height: 420px" /> |
|||
</div> |
|||
</el-card> |
|||
</el-col> |
|||
|
|||
<el-col :span="12" class="card-box"> |
|||
<el-card> |
|||
<div slot="header"><span><i class="el-icon-odometer"></i> 内存信息</span></div> |
|||
<div class="el-table el-table--enable-row-hover el-table--medium"> |
|||
<div ref="usedmemory" style="height: 420px" /> |
|||
</div> |
|||
</el-card> |
|||
</el-col> |
|||
</el-row> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { getCache } from "@/api/monitor/cache"; |
|||
import * as echarts from "echarts"; |
|||
|
|||
export default { |
|||
name: "Cache", |
|||
data() { |
|||
return { |
|||
// 统计命令信息 |
|||
commandstats: null, |
|||
// 使用内存 |
|||
usedmemory: null, |
|||
// cache信息 |
|||
cache: [] |
|||
} |
|||
}, |
|||
created() { |
|||
this.getList(); |
|||
this.openLoading(); |
|||
}, |
|||
methods: { |
|||
/** 查缓存询信息 */ |
|||
getList() { |
|||
getCache().then((response) => { |
|||
this.cache = response.data; |
|||
this.$modal.closeLoading(); |
|||
|
|||
this.commandstats = echarts.init(this.$refs.commandstats, "macarons"); |
|||
this.commandstats.setOption({ |
|||
tooltip: { |
|||
trigger: "item", |
|||
formatter: "{a} <br/>{b} : {c} ({d}%)", |
|||
}, |
|||
series: [ |
|||
{ |
|||
name: "命令", |
|||
type: "pie", |
|||
roseType: "radius", |
|||
radius: [15, 95], |
|||
center: ["50%", "38%"], |
|||
data: response.data.commandStats, |
|||
animationEasing: "cubicInOut", |
|||
animationDuration: 1000, |
|||
} |
|||
] |
|||
}); |
|||
this.usedmemory = echarts.init(this.$refs.usedmemory, "macarons"); |
|||
this.usedmemory.setOption({ |
|||
tooltip: { |
|||
formatter: "{b} <br/>{a} : " + this.cache.info.used_memory_human, |
|||
}, |
|||
series: [ |
|||
{ |
|||
name: "峰值", |
|||
type: "gauge", |
|||
min: 0, |
|||
max: 1000, |
|||
detail: { |
|||
formatter: this.cache.info.used_memory_human, |
|||
}, |
|||
data: [ |
|||
{ |
|||
value: parseFloat(this.cache.info.used_memory_human), |
|||
name: "内存消耗", |
|||
} |
|||
] |
|||
} |
|||
] |
|||
}); |
|||
window.addEventListener("resize", () => { |
|||
this.commandstats.resize(); |
|||
this.usedmemory.resize(); |
|||
}); |
|||
}); |
|||
}, |
|||
// 打开加载层 |
|||
openLoading() { |
|||
this.$modal.loading("正在加载缓存监控数据,请稍候!"); |
|||
} |
|||
} |
|||
}; |
|||
</script> |
|||
<template> |
|||
<div class="app-container"> |
|||
<el-row :gutter="10"> |
|||
<el-col :span="24" class="card-box"> |
|||
<el-card> |
|||
<div slot="header"><span><i class="el-icon-monitor"></i> 基本信息</span></div> |
|||
<div class="el-table el-table--enable-row-hover el-table--medium"> |
|||
<table cellspacing="0" style="width: 100%"> |
|||
<tbody> |
|||
<tr> |
|||
<td class="el-table__cell is-leaf"><div class="cell">Redis版本</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="cache.info">{{ cache.info.redis_version }}</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell">运行模式</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="cache.info">{{ cache.info.redis_mode == "standalone" ? "单机" : "集群" }}</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell">端口</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="cache.info">{{ cache.info.tcp_port }}</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell">客户端数</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="cache.info">{{ cache.info.connected_clients }}</div></td> |
|||
</tr> |
|||
<tr> |
|||
<td class="el-table__cell is-leaf"><div class="cell">运行时间(天)</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="cache.info">{{ cache.info.uptime_in_days }}</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell">使用内存</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="cache.info">{{ cache.info.used_memory_human }}</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell">使用CPU</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="cache.info">{{ parseFloat(cache.info.used_cpu_user_children).toFixed(2) }}</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell">内存配置</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="cache.info">{{ cache.info.maxmemory_human }}</div></td> |
|||
</tr> |
|||
<tr> |
|||
<td class="el-table__cell is-leaf"><div class="cell">AOF是否开启</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="cache.info">{{ cache.info.aof_enabled == "0" ? "否" : "是" }}</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell">RDB是否成功</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="cache.info">{{ cache.info.rdb_last_bgsave_status }}</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell">Key数量</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="cache.dbSize">{{ cache.dbSize }} </div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell">网络入口/出口</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="cache.info">{{ cache.info.instantaneous_input_kbps }}kps/{{cache.info.instantaneous_output_kbps}}kps</div></td> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
</el-card> |
|||
</el-col> |
|||
|
|||
<el-col :span="12" class="card-box"> |
|||
<el-card> |
|||
<div slot="header"><span><i class="el-icon-pie-chart"></i> 命令统计</span></div> |
|||
<div class="el-table el-table--enable-row-hover el-table--medium"> |
|||
<div ref="commandstats" style="height: 420px" /> |
|||
</div> |
|||
</el-card> |
|||
</el-col> |
|||
|
|||
<el-col :span="12" class="card-box"> |
|||
<el-card> |
|||
<div slot="header"><span><i class="el-icon-odometer"></i> 内存信息</span></div> |
|||
<div class="el-table el-table--enable-row-hover el-table--medium"> |
|||
<div ref="usedmemory" style="height: 420px" /> |
|||
</div> |
|||
</el-card> |
|||
</el-col> |
|||
</el-row> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { getCache } from "@/api/monitor/cache"; |
|||
import * as echarts from "echarts"; |
|||
|
|||
export default { |
|||
name: "Cache", |
|||
data() { |
|||
return { |
|||
// 统计命令信息 |
|||
commandstats: null, |
|||
// 使用内存 |
|||
usedmemory: null, |
|||
// cache信息 |
|||
cache: [] |
|||
} |
|||
}, |
|||
created() { |
|||
this.getList(); |
|||
this.openLoading(); |
|||
}, |
|||
methods: { |
|||
/** 查缓存询信息 */ |
|||
getList() { |
|||
getCache().then((response) => { |
|||
this.cache = response.data; |
|||
this.$modal.closeLoading(); |
|||
|
|||
this.commandstats = echarts.init(this.$refs.commandstats, "macarons"); |
|||
this.commandstats.setOption({ |
|||
tooltip: { |
|||
trigger: "item", |
|||
formatter: "{a} <br/>{b} : {c} ({d}%)", |
|||
}, |
|||
series: [ |
|||
{ |
|||
name: "命令", |
|||
type: "pie", |
|||
roseType: "radius", |
|||
radius: [15, 95], |
|||
center: ["50%", "38%"], |
|||
data: response.data.commandStats, |
|||
animationEasing: "cubicInOut", |
|||
animationDuration: 1000, |
|||
} |
|||
] |
|||
}); |
|||
this.usedmemory = echarts.init(this.$refs.usedmemory, "macarons"); |
|||
this.usedmemory.setOption({ |
|||
tooltip: { |
|||
formatter: "{b} <br/>{a} : " + this.cache.info.used_memory_human, |
|||
}, |
|||
series: [ |
|||
{ |
|||
name: "峰值", |
|||
type: "gauge", |
|||
min: 0, |
|||
max: 1000, |
|||
detail: { |
|||
formatter: this.cache.info.used_memory_human, |
|||
}, |
|||
data: [ |
|||
{ |
|||
value: parseFloat(this.cache.info.used_memory_human), |
|||
name: "内存消耗", |
|||
} |
|||
] |
|||
} |
|||
] |
|||
}); |
|||
window.addEventListener("resize", () => { |
|||
this.commandstats.resize(); |
|||
this.usedmemory.resize(); |
|||
}); |
|||
}); |
|||
}, |
|||
// 打开加载层 |
|||
openLoading() { |
|||
this.$modal.loading("正在加载缓存监控数据,请稍候!"); |
|||
} |
|||
} |
|||
}; |
|||
</script> |
|||
|
@ -1,207 +1,207 @@ |
|||
<template> |
|||
<div class="app-container"> |
|||
<el-row> |
|||
<el-col :span="12" class="card-box"> |
|||
<el-card> |
|||
<div slot="header"><span><i class="el-icon-cpu"></i> CPU</span></div> |
|||
<div class="el-table el-table--enable-row-hover el-table--medium"> |
|||
<table cellspacing="0" style="width: 100%;"> |
|||
<thead> |
|||
<tr> |
|||
<th class="el-table__cell is-leaf"><div class="cell">属性</div></th> |
|||
<th class="el-table__cell is-leaf"><div class="cell">值</div></th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<tr> |
|||
<td class="el-table__cell is-leaf"><div class="cell">核心数</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.cpu">{{ server.cpu.cpuNum }}</div></td> |
|||
</tr> |
|||
<tr> |
|||
<td class="el-table__cell is-leaf"><div class="cell">用户使用率</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.cpu">{{ server.cpu.used }}%</div></td> |
|||
</tr> |
|||
<tr> |
|||
<td class="el-table__cell is-leaf"><div class="cell">系统使用率</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.cpu">{{ server.cpu.sys }}%</div></td> |
|||
</tr> |
|||
<tr> |
|||
<td class="el-table__cell is-leaf"><div class="cell">当前空闲率</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.cpu">{{ server.cpu.free }}%</div></td> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
</el-card> |
|||
</el-col> |
|||
|
|||
<el-col :span="12" class="card-box"> |
|||
<el-card> |
|||
<div slot="header"><span><i class="el-icon-tickets"></i> 内存</span></div> |
|||
<div class="el-table el-table--enable-row-hover el-table--medium"> |
|||
<table cellspacing="0" style="width: 100%;"> |
|||
<thead> |
|||
<tr> |
|||
<th class="el-table__cell is-leaf"><div class="cell">属性</div></th> |
|||
<th class="el-table__cell is-leaf"><div class="cell">内存</div></th> |
|||
<th class="el-table__cell is-leaf"><div class="cell">JVM</div></th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<tr> |
|||
<td class="el-table__cell is-leaf"><div class="cell">总内存</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.mem">{{ server.mem.total }}G</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.jvm">{{ server.jvm.total }}M</div></td> |
|||
</tr> |
|||
<tr> |
|||
<td class="el-table__cell is-leaf"><div class="cell">已用内存</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.mem">{{ server.mem.used}}G</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.jvm">{{ server.jvm.used}}M</div></td> |
|||
</tr> |
|||
<tr> |
|||
<td class="el-table__cell is-leaf"><div class="cell">剩余内存</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.mem">{{ server.mem.free }}G</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.jvm">{{ server.jvm.free }}M</div></td> |
|||
</tr> |
|||
<tr> |
|||
<td class="el-table__cell is-leaf"><div class="cell">使用率</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.mem" :class="{'text-danger': server.mem.usage > 80}">{{ server.mem.usage }}%</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.jvm" :class="{'text-danger': server.jvm.usage > 80}">{{ server.jvm.usage }}%</div></td> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
</el-card> |
|||
</el-col> |
|||
|
|||
<el-col :span="24" class="card-box"> |
|||
<el-card> |
|||
<div slot="header"> |
|||
<span><i class="el-icon-monitor"></i> 服务器信息</span> |
|||
</div> |
|||
<div class="el-table el-table--enable-row-hover el-table--medium"> |
|||
<table cellspacing="0" style="width: 100%;"> |
|||
<tbody> |
|||
<tr> |
|||
<td class="el-table__cell is-leaf"><div class="cell">服务器名称</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.sys">{{ server.sys.computerName }}</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell">操作系统</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.sys">{{ server.sys.osName }}</div></td> |
|||
</tr> |
|||
<tr> |
|||
<td class="el-table__cell is-leaf"><div class="cell">服务器IP</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.sys">{{ server.sys.computerIp }}</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell">系统架构</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.sys">{{ server.sys.osArch }}</div></td> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
</el-card> |
|||
</el-col> |
|||
|
|||
<el-col :span="24" class="card-box"> |
|||
<el-card> |
|||
<div slot="header"> |
|||
<span><i class="el-icon-coffee-cup"></i> Java虚拟机信息</span> |
|||
</div> |
|||
<div class="el-table el-table--enable-row-hover el-table--medium"> |
|||
<table cellspacing="0" style="width: 100%;table-layout:fixed;"> |
|||
<tbody> |
|||
<tr> |
|||
<td class="el-table__cell is-leaf"><div class="cell">Java名称</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.jvm">{{ server.jvm.name }}</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell">Java版本</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.jvm">{{ server.jvm.version }}</div></td> |
|||
</tr> |
|||
<tr> |
|||
<td class="el-table__cell is-leaf"><div class="cell">启动时间</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.jvm">{{ server.jvm.startTime }}</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell">运行时长</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.jvm">{{ server.jvm.runTime }}</div></td> |
|||
</tr> |
|||
<tr> |
|||
<td colspan="1" class="el-table__cell is-leaf"><div class="cell">安装路径</div></td> |
|||
<td colspan="3" class="el-table__cell is-leaf"><div class="cell" v-if="server.jvm">{{ server.jvm.home }}</div></td> |
|||
</tr> |
|||
<tr> |
|||
<td colspan="1" class="el-table__cell is-leaf"><div class="cell">项目路径</div></td> |
|||
<td colspan="3" class="el-table__cell is-leaf"><div class="cell" v-if="server.sys">{{ server.sys.userDir }}</div></td> |
|||
</tr> |
|||
<tr> |
|||
<td colspan="1" class="el-table__cell is-leaf"><div class="cell">运行参数</div></td> |
|||
<td colspan="3" class="el-table__cell is-leaf"><div class="cell" v-if="server.jvm">{{ server.jvm.inputArgs }}</div></td> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
</el-card> |
|||
</el-col> |
|||
|
|||
<el-col :span="24" class="card-box"> |
|||
<el-card> |
|||
<div slot="header"> |
|||
<span><i class="el-icon-receiving"></i> 磁盘状态</span> |
|||
</div> |
|||
<div class="el-table el-table--enable-row-hover el-table--medium"> |
|||
<table cellspacing="0" style="width: 100%;"> |
|||
<thead> |
|||
<tr> |
|||
<th class="el-table__cell el-table__cell is-leaf"><div class="cell">盘符路径</div></th> |
|||
<th class="el-table__cell is-leaf"><div class="cell">文件系统</div></th> |
|||
<th class="el-table__cell is-leaf"><div class="cell">盘符类型</div></th> |
|||
<th class="el-table__cell is-leaf"><div class="cell">总大小</div></th> |
|||
<th class="el-table__cell is-leaf"><div class="cell">可用大小</div></th> |
|||
<th class="el-table__cell is-leaf"><div class="cell">已用大小</div></th> |
|||
<th class="el-table__cell is-leaf"><div class="cell">已用百分比</div></th> |
|||
</tr> |
|||
</thead> |
|||
<tbody v-if="server.sysFiles"> |
|||
<tr v-for="(sysFile, index) in server.sysFiles" :key="index"> |
|||
<td class="el-table__cell is-leaf"><div class="cell">{{ sysFile.dirName }}</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell">{{ sysFile.sysTypeName }}</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell">{{ sysFile.typeName }}</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell">{{ sysFile.total }}</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell">{{ sysFile.free }}</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell">{{ sysFile.used }}</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" :class="{'text-danger': sysFile.usage > 80}">{{ sysFile.usage }}%</div></td> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
</el-card> |
|||
</el-col> |
|||
</el-row> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { getServer } from "@/api/monitor/server"; |
|||
|
|||
export default { |
|||
name: "Server", |
|||
data() { |
|||
return { |
|||
// 服务器信息 |
|||
server: [] |
|||
}; |
|||
}, |
|||
created() { |
|||
this.getList(); |
|||
this.openLoading(); |
|||
}, |
|||
methods: { |
|||
/** 查询服务器信息 */ |
|||
getList() { |
|||
getServer().then(response => { |
|||
this.server = response.data; |
|||
this.$modal.closeLoading(); |
|||
}); |
|||
}, |
|||
// 打开加载层 |
|||
openLoading() { |
|||
this.$modal.loading("正在加载服务监控数据,请稍候!"); |
|||
} |
|||
} |
|||
}; |
|||
</script> |
|||
<template> |
|||
<div class="app-container"> |
|||
<el-row :gutter="10"> |
|||
<el-col :span="12" class="card-box"> |
|||
<el-card> |
|||
<div slot="header"><span><i class="el-icon-cpu"></i> CPU</span></div> |
|||
<div class="el-table el-table--enable-row-hover el-table--medium"> |
|||
<table cellspacing="0" style="width: 100%;"> |
|||
<thead> |
|||
<tr> |
|||
<th class="el-table__cell is-leaf"><div class="cell">属性</div></th> |
|||
<th class="el-table__cell is-leaf"><div class="cell">值</div></th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<tr> |
|||
<td class="el-table__cell is-leaf"><div class="cell">核心数</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.cpu">{{ server.cpu.cpuNum }}</div></td> |
|||
</tr> |
|||
<tr> |
|||
<td class="el-table__cell is-leaf"><div class="cell">用户使用率</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.cpu">{{ server.cpu.used }}%</div></td> |
|||
</tr> |
|||
<tr> |
|||
<td class="el-table__cell is-leaf"><div class="cell">系统使用率</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.cpu">{{ server.cpu.sys }}%</div></td> |
|||
</tr> |
|||
<tr> |
|||
<td class="el-table__cell is-leaf"><div class="cell">当前空闲率</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.cpu">{{ server.cpu.free }}%</div></td> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
</el-card> |
|||
</el-col> |
|||
|
|||
<el-col :span="12" class="card-box"> |
|||
<el-card> |
|||
<div slot="header"><span><i class="el-icon-tickets"></i> 内存</span></div> |
|||
<div class="el-table el-table--enable-row-hover el-table--medium"> |
|||
<table cellspacing="0" style="width: 100%;"> |
|||
<thead> |
|||
<tr> |
|||
<th class="el-table__cell is-leaf"><div class="cell">属性</div></th> |
|||
<th class="el-table__cell is-leaf"><div class="cell">内存</div></th> |
|||
<th class="el-table__cell is-leaf"><div class="cell">JVM</div></th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<tr> |
|||
<td class="el-table__cell is-leaf"><div class="cell">总内存</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.mem">{{ server.mem.total }}G</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.jvm">{{ server.jvm.total }}M</div></td> |
|||
</tr> |
|||
<tr> |
|||
<td class="el-table__cell is-leaf"><div class="cell">已用内存</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.mem">{{ server.mem.used}}G</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.jvm">{{ server.jvm.used}}M</div></td> |
|||
</tr> |
|||
<tr> |
|||
<td class="el-table__cell is-leaf"><div class="cell">剩余内存</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.mem">{{ server.mem.free }}G</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.jvm">{{ server.jvm.free }}M</div></td> |
|||
</tr> |
|||
<tr> |
|||
<td class="el-table__cell is-leaf"><div class="cell">使用率</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.mem" :class="{'text-danger': server.mem.usage > 80}">{{ server.mem.usage }}%</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.jvm" :class="{'text-danger': server.jvm.usage > 80}">{{ server.jvm.usage }}%</div></td> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
</el-card> |
|||
</el-col> |
|||
|
|||
<el-col :span="24" class="card-box"> |
|||
<el-card> |
|||
<div slot="header"> |
|||
<span><i class="el-icon-monitor"></i> 服务器信息</span> |
|||
</div> |
|||
<div class="el-table el-table--enable-row-hover el-table--medium"> |
|||
<table cellspacing="0" style="width: 100%;"> |
|||
<tbody> |
|||
<tr> |
|||
<td class="el-table__cell is-leaf"><div class="cell">服务器名称</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.sys">{{ server.sys.computerName }}</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell">操作系统</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.sys">{{ server.sys.osName }}</div></td> |
|||
</tr> |
|||
<tr> |
|||
<td class="el-table__cell is-leaf"><div class="cell">服务器IP</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.sys">{{ server.sys.computerIp }}</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell">系统架构</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.sys">{{ server.sys.osArch }}</div></td> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
</el-card> |
|||
</el-col> |
|||
|
|||
<el-col :span="24" class="card-box"> |
|||
<el-card> |
|||
<div slot="header"> |
|||
<span><i class="el-icon-coffee-cup"></i> Java虚拟机信息</span> |
|||
</div> |
|||
<div class="el-table el-table--enable-row-hover el-table--medium"> |
|||
<table cellspacing="0" style="width: 100%;table-layout:fixed;"> |
|||
<tbody> |
|||
<tr> |
|||
<td class="el-table__cell is-leaf"><div class="cell">Java名称</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.jvm">{{ server.jvm.name }}</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell">Java版本</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.jvm">{{ server.jvm.version }}</div></td> |
|||
</tr> |
|||
<tr> |
|||
<td class="el-table__cell is-leaf"><div class="cell">启动时间</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.jvm">{{ server.jvm.startTime }}</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell">运行时长</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" v-if="server.jvm">{{ server.jvm.runTime }}</div></td> |
|||
</tr> |
|||
<tr> |
|||
<td colspan="1" class="el-table__cell is-leaf"><div class="cell">安装路径</div></td> |
|||
<td colspan="3" class="el-table__cell is-leaf"><div class="cell" v-if="server.jvm">{{ server.jvm.home }}</div></td> |
|||
</tr> |
|||
<tr> |
|||
<td colspan="1" class="el-table__cell is-leaf"><div class="cell">项目路径</div></td> |
|||
<td colspan="3" class="el-table__cell is-leaf"><div class="cell" v-if="server.sys">{{ server.sys.userDir }}</div></td> |
|||
</tr> |
|||
<tr> |
|||
<td colspan="1" class="el-table__cell is-leaf"><div class="cell">运行参数</div></td> |
|||
<td colspan="3" class="el-table__cell is-leaf"><div class="cell" v-if="server.jvm">{{ server.jvm.inputArgs }}</div></td> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
</el-card> |
|||
</el-col> |
|||
|
|||
<el-col :span="24" class="card-box"> |
|||
<el-card> |
|||
<div slot="header"> |
|||
<span><i class="el-icon-receiving"></i> 磁盘状态</span> |
|||
</div> |
|||
<div class="el-table el-table--enable-row-hover el-table--medium"> |
|||
<table cellspacing="0" style="width: 100%;"> |
|||
<thead> |
|||
<tr> |
|||
<th class="el-table__cell el-table__cell is-leaf"><div class="cell">盘符路径</div></th> |
|||
<th class="el-table__cell is-leaf"><div class="cell">文件系统</div></th> |
|||
<th class="el-table__cell is-leaf"><div class="cell">盘符类型</div></th> |
|||
<th class="el-table__cell is-leaf"><div class="cell">总大小</div></th> |
|||
<th class="el-table__cell is-leaf"><div class="cell">可用大小</div></th> |
|||
<th class="el-table__cell is-leaf"><div class="cell">已用大小</div></th> |
|||
<th class="el-table__cell is-leaf"><div class="cell">已用百分比</div></th> |
|||
</tr> |
|||
</thead> |
|||
<tbody v-if="server.sysFiles"> |
|||
<tr v-for="(sysFile, index) in server.sysFiles" :key="index"> |
|||
<td class="el-table__cell is-leaf"><div class="cell">{{ sysFile.dirName }}</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell">{{ sysFile.sysTypeName }}</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell">{{ sysFile.typeName }}</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell">{{ sysFile.total }}</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell">{{ sysFile.free }}</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell">{{ sysFile.used }}</div></td> |
|||
<td class="el-table__cell is-leaf"><div class="cell" :class="{'text-danger': sysFile.usage > 80}">{{ sysFile.usage }}%</div></td> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
</el-card> |
|||
</el-col> |
|||
</el-row> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { getServer } from "@/api/monitor/server"; |
|||
|
|||
export default { |
|||
name: "Server", |
|||
data() { |
|||
return { |
|||
// 服务器信息 |
|||
server: [] |
|||
}; |
|||
}, |
|||
created() { |
|||
this.getList(); |
|||
this.openLoading(); |
|||
}, |
|||
methods: { |
|||
/** 查询服务器信息 */ |
|||
getList() { |
|||
getServer().then(response => { |
|||
this.server = response.data; |
|||
this.$modal.closeLoading(); |
|||
}); |
|||
}, |
|||
// 打开加载层 |
|||
openLoading() { |
|||
this.$modal.loading("正在加载服务监控数据,请稍候!"); |
|||
} |
|||
} |
|||
}; |
|||
</script> |
|||
|
Loading…
Reference in new issue