Files
cloudron-box/dashboard/src/components/DiskUsage.vue
Girish Ramakrishnan 66107cf7a4 system: make filesystem return value an array
Filesystem of df output is not unique
2025-07-20 10:06:01 +02:00

95 lines
1.6 KiB
Vue

<script setup>
import { ref, onMounted } from 'vue';
import Section from './Section.vue';
import SystemModel from '../models/SystemModel.js';
import DiskUsageItem from './DiskUsageItem.vue';
const systemModel = SystemModel.create();
const ready = ref(false);
const filesystems = ref([]);
onMounted(async () => {
const [error, result] = await systemModel.filesystems();
if (error) return console.error(error);
filesystems.value = result;
ready.value = true;
});
</script>
<template>
<Section :title="$t('system.diskUsage.title')">
<div class="filesystems-grid">
<DiskUsageItem v-for="filesystem in filesystems" :key="filesystem.filesystem" :filesystem="filesystem" />
</div>
</Section>
</template>
<style scoped>
.filesystems-grid {
display: flex;
height: 100%;
width: 100%;
transition: 300ms;
flex-wrap: wrap;
justify-content: start;
align-content: start;
}
.usage-bar {
display: flex;
flex-wrap: nowrap;
width: 100%;
height: 20px;
background-color: #d8dee4;
color: #7f7f7f;
}
@media (prefers-color-scheme: dark) {
.usage-bar {
background-color: white;
}
}
.usage-bar-section {
display: inline-block;
height: 100%;
}
.usage-bar-section-remaining {
display: inline-block;
height: 100%;
margin: auto;
}
.color-indicator {
display: inline-block;
width: 16px;
height: 16px;
border-radius: 3px;
line-height: 16px;
margin-right: 4px;
}
.disk-content {
white-space: nowrap;
overflow: auto;
}
.disk-content-size {
color: #777;
margin-left: 4px;
}
.disks-last-updated {
font-size: 12px;
font-weight: bold;
align-self: center;
}
</style>