Files
cloudron-box/dashboard/src/components/DiskUsage.vue
T

95 lines
1.6 KiB
Vue
Raw Normal View History

2025-02-17 16:38:30 +01:00
<script setup>
import { ref, onMounted } from 'vue';
import Section from './Section.vue';
import SystemModel from '../models/SystemModel.js';
2025-07-17 17:06:37 +02:00
import DiskUsageItem from './DiskUsageItem.vue';
2025-02-17 16:38:30 +01:00
const systemModel = SystemModel.create();
const ready = ref(false);
2025-07-17 17:06:37 +02:00
const filesystems = ref([]);
2025-02-17 16:38:30 +01:00
onMounted(async () => {
2025-07-17 17:06:37 +02:00
const [error, result] = await systemModel.filesystems();
if (error) return console.error(error);
filesystems.value = result;
ready.value = true;
2025-02-17 16:38:30 +01:00
});
</script>
<template>
<Section :title="$t('system.diskUsage.title')">
2025-07-17 17:06:37 +02:00
<div class="filesystems-grid">
<DiskUsageItem v-for="filesystem in filesystems" :key="filesystem.filesystem" :filesystem="filesystem" />
2025-02-17 16:38:30 +01:00
</div>
</Section>
</template>
<style scoped>
2025-07-17 17:06:37 +02:00
.filesystems-grid {
display: flex;
height: 100%;
width: 100%;
transition: 300ms;
flex-wrap: wrap;
justify-content: start;
align-content: start;
}
2025-02-17 16:38:30 +01:00
.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>