metrics: close stream on unmount
This commit is contained in:
@@ -4,7 +4,7 @@ import { useI18n } from 'vue-i18n';
|
||||
const i18n = useI18n();
|
||||
const t = i18n.t;
|
||||
|
||||
import { ref, onMounted, useTemplateRef } from 'vue';
|
||||
import { ref, onMounted, onUnmounted, useTemplateRef } from 'vue';
|
||||
import Chart from 'chart.js/auto';
|
||||
import moment from 'moment-timezone';
|
||||
import { SingleSelect, Spinner } from 'pankow';
|
||||
@@ -190,7 +190,6 @@ async function refresh() {
|
||||
callback: (value) => `${value} GiB`,
|
||||
color: (value /* ,index, ticks */) => {
|
||||
const tickValue = parseFloat(value['tick']['value']);
|
||||
console.log(value);
|
||||
return ((tickValue * 1024 * 1024 * 1024) > roundedMemory) ? '#ff7d98' : '#46a9ec';
|
||||
},
|
||||
maxTicksLimit: 6 // max tick labels to show
|
||||
@@ -230,6 +229,10 @@ onMounted(async () => {
|
||||
await refresh();
|
||||
});
|
||||
|
||||
onUnmounted(async () => {
|
||||
if (metricStream) metricStream.close();
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
Reference in New Issue
Block a user