summaryrefslogtreecommitdiff
path: root/src/client/app/common/views/widgets/server.uptimes.vue
blob: 06713d83ce541f2177d58c7d38a53b12d8d91150 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<template>
<div class="uptimes">
	<p>Uptimes</p>
	<p>Process: {{ process ? process.toFixed(0) : '---' }}s</p>
	<p>OS: {{ os ? os.toFixed(0) : '---' }}s</p>
</div>
</template>

<script lang="ts">
import Vue from 'vue';

export default Vue.extend({
	props: ['connection'],
	data() {
		return {
			process: 0,
			os: 0
		};
	},
	mounted() {
		this.connection.on('stats', this.onStats);
	},
	beforeDestroy() {
		this.connection.off('stats', this.onStats);
	},
	methods: {
		onStats(stats) {
			this.process = stats.process_uptime;
			this.os = stats.os_uptime;
		}
	}
});
</script>

<style lang="stylus" scoped>
.uptimes
	padding 10px 14px

	> p
		margin 0
		font-size 12px
		color #505050

		&:first-child
			font-weight bold
</style>