summaryrefslogtreecommitdiff
path: root/src/client/app/common/views/widgets/server.uptimes.vue
blob: 0da5c4ec500487e08928384d1d25d3b3b6b8f8b4 (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
47
<template>
<div class="uptimes">
	<p>Uptimes</p>
	<p>Process: {{ process }}</p>
	<p>OS: {{ os }}</p>
</div>
</template>

<script lang="ts">
import Vue from 'vue';
import formatUptime from '../../scripts/format-uptime';

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 = formatUptime(stats.process_uptime);
			this.os = formatUptime(stats.os_uptime);
		}
	}
});
</script>

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

	> p
		margin 0
		font-size 12px
		color var(--text)

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