2018-02-19 22:56:39 +00:00
|
|
|
<template>
|
|
|
|
<div class="cpu">
|
|
|
|
<x-pie class="pie" :value="usage"/>
|
|
|
|
<div>
|
|
|
|
<p>%fa:microchip%CPU</p>
|
2018-02-21 15:07:37 +00:00
|
|
|
<p>{{ meta.cpu.cores }} Cores</p>
|
|
|
|
<p>{{ meta.cpu.model }}</p>
|
2018-02-19 22:56:39 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
|
|
|
import XPie from './server.pie.vue';
|
|
|
|
|
|
|
|
export default Vue.extend({
|
|
|
|
components: {
|
2018-02-20 16:39:51 +00:00
|
|
|
XPie
|
2018-02-19 22:56:39 +00:00
|
|
|
},
|
|
|
|
props: ['connection', 'meta'],
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
usage: 0
|
|
|
|
};
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
this.connection.on('stats', this.onStats);
|
|
|
|
},
|
|
|
|
beforeDestroy() {
|
|
|
|
this.connection.off('stats', this.onStats);
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
onStats(stats) {
|
|
|
|
this.usage = stats.cpu_usage;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
2018-04-19 22:50:49 +00:00
|
|
|
root(isDark)
|
2018-02-19 22:56:39 +00:00
|
|
|
> .pie
|
|
|
|
padding 10px
|
|
|
|
height 100px
|
|
|
|
float left
|
|
|
|
|
|
|
|
> div
|
|
|
|
float left
|
|
|
|
width calc(100% - 100px)
|
|
|
|
padding 10px 10px 10px 0
|
|
|
|
|
|
|
|
> p
|
|
|
|
margin 0
|
|
|
|
font-size 12px
|
2018-04-19 22:50:49 +00:00
|
|
|
color isDark ? #a8b4bd : #505050
|
2018-02-19 22:56:39 +00:00
|
|
|
|
|
|
|
&:first-child
|
|
|
|
font-weight bold
|
|
|
|
|
|
|
|
> [data-fa]
|
|
|
|
margin-right 4px
|
|
|
|
|
|
|
|
&:after
|
|
|
|
content ""
|
|
|
|
display block
|
|
|
|
clear both
|
|
|
|
|
2018-04-19 22:50:49 +00:00
|
|
|
.cpu[data-darkmode]
|
|
|
|
root(true)
|
|
|
|
|
|
|
|
.cpu:not([data-darkmode])
|
|
|
|
root(false)
|
|
|
|
|
2018-02-19 22:56:39 +00:00
|
|
|
</style>
|