fix(ec2): use chart.js/auto, watch currentTab, and ensure visible line points
All checks were successful
Deploy Beta (NATIVE) / deploy (push) Successful in 44s

This commit is contained in:
vickytechkey 2026-10-23 21:44:00 +05:30
parent 98b4a8ca65
commit 9387507589

View file

@ -374,7 +374,7 @@
<script> <script>
import { Modal } from "bootstrap"; import { Modal } from "bootstrap";
import { Chart } from "chart.js"; import Chart from "chart.js/auto";
import dayjs from "dayjs"; import dayjs from "dayjs";
export default { export default {
@ -457,6 +457,13 @@ sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl \\
return null; return null;
}, },
}, },
watch: {
currentTab() {
this.$nextTick(() => {
this.renderCharts();
});
},
},
mounted() { mounted() {
this.modal = new Modal(this.$refs.modal); this.modal = new Modal(this.$refs.modal);
}, },
@ -585,7 +592,11 @@ sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl \\
backgroundColor: "rgba(13, 202, 240, 0.15)", backgroundColor: "rgba(13, 202, 240, 0.15)",
fill: true, fill: true,
tension: 0.25, tension: 0.25,
pointRadius: values.length > 30 ? 0 : 2, borderWidth: 2,
pointRadius: values.length > 50 ? 1 : 4,
pointHoverRadius: 6,
pointBackgroundColor: "#0dcaf0",
pointBorderColor: "#ffffff",
}, },
], ],
"%" "%"
@ -673,18 +684,24 @@ sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl \\
{ {
label: "Network In (KB/s)", label: "Network In (KB/s)",
data: inValues, data: inValues,
borderColor: "#0d6efd", borderColor: "#38bdf8",
backgroundColor: "transparent", backgroundColor: "rgba(56, 189, 248, 0.15)",
fill: true,
tension: 0.2, tension: 0.2,
pointRadius: 0, borderWidth: 2,
pointRadius: inValues.length > 50 ? 1 : 3,
pointHoverRadius: 6,
}, },
{ {
label: "Network Out (KB/s)", label: "Network Out (KB/s)",
data: outValues, data: outValues,
borderColor: "#6f42c1", borderColor: "#a855f7",
backgroundColor: "transparent", backgroundColor: "rgba(168, 85, 247, 0.15)",
fill: true,
tension: 0.2, tension: 0.2,
pointRadius: 0, borderWidth: 2,
pointRadius: outValues.length > 50 ? 1 : 3,
pointHoverRadius: 6,
}, },
], ],
" KB/s" " KB/s"
@ -709,18 +726,24 @@ sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl \\
{ {
label: "Read (KB/s)", label: "Read (KB/s)",
data: readValues, data: readValues,
borderColor: "#198754", borderColor: "#00e676",
backgroundColor: "transparent", backgroundColor: "rgba(0, 230, 118, 0.15)",
fill: true,
tension: 0.2, tension: 0.2,
pointRadius: 0, borderWidth: 2,
pointRadius: readValues.length > 50 ? 1 : 3,
pointHoverRadius: 6,
}, },
{ {
label: "Write (KB/s)", label: "Write (KB/s)",
data: writeValues, data: writeValues,
borderColor: "#dc3545", borderColor: "#f43f5e",
backgroundColor: "transparent", backgroundColor: "rgba(244, 63, 94, 0.15)",
fill: true,
tension: 0.2, tension: 0.2,
pointRadius: 0, borderWidth: 2,
pointRadius: writeValues.length > 50 ? 1 : 3,
pointHoverRadius: 6,
}, },
], ],
" KB/s" " KB/s"