graphs: make top level div and clean the timer

This commit is contained in:
Girish Ramakrishnan
2025-07-03 17:31:49 +02:00
parent 6f358dd8ea
commit b3071603d0
4 changed files with 12 additions and 8 deletions

View File

@@ -2,7 +2,7 @@
<script setup>
import moment from 'moment-timezone';
import { onMounted, useTemplateRef, watch } from 'vue';
import { onMounted, onUnmounted, useTemplateRef, watch } from 'vue';
import Chart from 'chart.js/auto';
import { prettyDecimalSize } from 'pankow/utils';
@@ -216,6 +216,10 @@ onMounted(async function () {
await onPeriodChanged();
});
onUnmounted(async function () {
if (liveRefreshIntervalId) clearInterval(liveRefreshIntervalId);
});
defineExpose({
setData,
pushData,
@@ -224,9 +228,11 @@ defineExpose({
</script>
<template>
<label>{{ title }} <span class="pull-right text-small">{{ subtext }}</span></label>
<div class="graph">
<canvas ref="graphNode"></canvas>
<div>
<label>{{ title }} <span class="pull-right text-small">{{ subtext }}</span></label>
<div class="graph">
<canvas ref="graphNode"></canvas>
</div>
</div>
</template>