Sharkey/src/client/app/common/views/widgets/server.cpu.vue
syuilo 9f5dc2c0df
[WIP] Use FontAwesome Component for Vue (#3127)
* wip

* Rename

* Clean up

* Clean up

* wip

* wip

* Enable tree shaking

* ✌️

* ✌️

* wip

* wip

* Clean up
2018-11-06 01:40:11 +09:00

69 lines
995 B
Vue

<template>
<div class="cpu">
<x-pie class="pie" :value="usage"/>
<div>
<p><fa icon="microchip"/>CPU</p>
<p>{{ meta.cpu.cores }} Cores</p>
<p>{{ meta.cpu.model }}</p>
</div>
</div>
</template>
<script lang="ts">
import Vue from 'vue';
import XPie from './server.pie.vue';
export default Vue.extend({
components: {
XPie
},
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>
.cpu
> .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
color var(--chartCaption)
&:first-child
font-weight bold
> [data-icon]
margin-right 4px
&:after
content ""
display block
clear both
</style>