<div class="mb-2">
  <div class="progress" style="height: 20px;">
    <div id="disk-bar"
         class="progress-bar"
         role="progressbar"
         style="width: {{ disk_usage.percent }}%; background-color: {{ '#198754' if disk_usage.percent < 70 else '#ffc107' if disk_usage.percent < 85 else '#dc3545' }};"></div>
  </div>
</div>
<script>
  function diskUsageColor(percent) {
    if (percent >= 85) return "#dc3545";
    if (percent >= 70) return "#ffc107";
    return "#198754";
  }

  window.BussDCC.on("ui.system.disk.usage.updated", (disk) => {
    const bar = document.getElementById("disk-bar");

    bar.style.width = disk.percent + "%";
    bar.style.backgroundColor = diskUsageColor(disk.percent);
  });
</script>
