summaryrefslogtreecommitdiffstats
path: root/glances/outputs/static/js/components/plugin-system.vue
blob: 27c27e27efdac61176fc9b92618a4a7b7897a045 (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<template>
    <section class="plugin" id="system">
        <span v-if="isDisconnected" class="critical">Disconnected from</span>
        <span class="title">{{ hostname }}</span>
        <span v-if="isLinux" class="hidden-xs hidden-sm">
            ({{ humanReadableName }} / {{ os.name }} {{ os.version }})
        </span>
        <span v-if="!isLinux" class="hidden-xs hidden-sm">
            ({{ os.name }} {{ os.version }} {{ platform }})
        </span>
    </section>
</template>

<script>
import { store } from '../store.js';

export default {
    props: {
        data: {
            type: Object
        }
    },
    data() {
        return {
            store
        };
    },
    computed: {
        config() {
            return this.store.config || {};
        },
        stats() {
            return this.data.stats['system'];
        },
        isLinux() {
            return this.data.isLinux;
        },
        hostname() {
            return this.stats['hostname'];
        },
        platform() {
            return this.stats['platform'];
        },
        os() {
            return {
                name: this.stats['os_name'],
                version: this.stats['os_version']
            };
        },
        humanReadableName() {
            return this.stats['hr_name'];
        },
        isDisconnected() {
            return this.store.status === 'FAILURE';
        },
        systemInfoMsg() {
            return this.config.system !== undefined
                ? this.config.system.system_info_msg
                : undefined;
        },
        isSystemInfoMsg() {
            return this.systemInfoMsg !== undefined;
        }
    }
};
</script>