4 <p class="title is-4">{{ item.name }}</p>
5 <p class="subtitle is-6">
6 <template v-if="item.subtitle">
9 <template v-else-if="vms">
11 <strong class="danger">Error loading info!</strong>
13 <div v-else class="metrics">
14 <span>VMs: <strong class="is-number">{{ vms.running }}</strong></span>
15 <span>Disk: <strong class="is-number" :class="statusClass(diskUsed)">{{ diskUsed }}%</strong></span>
16 <span>Mem: <strong class="is-number" :class="statusClass(memoryUsed)">{{ memoryUsed }}%</strong></span>
17 <span>CPU: <strong class="is-number" :class="statusClass(cpuUsed)">{{ cpuUsed }}%</strong></span>
26 import service from "@/mixins/service.js";
27 import Generic from "./Generic.vue";
53 if (value > this.item.danger_value) return 'danger';
54 if (value > this.item.warning_value) return 'warning';
57 fetchStatus: async function () {
61 "Authorization": this.item.api_token
64 const status = await this.fetch(`/api2/json/nodes/${this.item.node}/status`, options);
66 this.memoryUsed = ( (status.data.memory.used * 100) / status.data.memory.total ).toFixed(1);
67 this.diskUsed = ( (status.data.rootfs.used * 100) / status.data.rootfs.total ).toFixed(1);
68 this.cpuUsed = (status.data.cpu * 100).toFixed(1);
70 const vms = await this.fetch(`/api2/json/nodes/${this.item.node}/qemu`, options);
71 this.vms.total += vms.data.length;
72 this.vms.running += vms.data.filter( i => i.status === 'running' ).length;
83 <style scoped lang="scss">
98 justify-content: space-between;