Skip to content
This repository has been archived by the owner on Jan 23, 2025. It is now read-only.

Commit

Permalink
fix close and dismiss button to work the same
Browse files Browse the repository at this point in the history
Signed-off-by: ianmuchyri <ianmuchiri8@gmail.com>
  • Loading branch information
ianmuchyri committed Mar 17, 2024
1 parent e7d7677 commit d3df822
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion ui/web/static/js/charts.js
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@ class TimeSeriesLineChart extends Echart {
}
}
xAxisArray.push(xAxis);
// Remove the previous element in the array;
// Remove the previous element in the array
xAxisArray.shift();
yAxisArray.push(yAxis);
} else {
Expand Down
20 changes: 10 additions & 10 deletions ui/web/templates/charts/linechartmodal.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<h5 class="modal-title" id="lineChartModalLabel">Time Series Line Chart</h5>
<button
type="button"
class="btn-close"
class="btn-close close-lineChart-button"
data-bs-dismiss="modal"
aria-label="Close"
></button>
Expand Down Expand Up @@ -235,8 +235,7 @@ <h5>Data Source</h5>
<div class="modal-footer">
<button
type="button"
class="btn btn-secondary"
id="close-lineChart-button"
class="btn btn-secondary close-lineChart-button"
data-bs-dismiss="modal"
>
Close
Expand All @@ -250,8 +249,8 @@ <h5>Data Source</h5>
</div>
<script>
// line chart form
const form = document.getElementById("create-lineChart-form");
document.getElementById("create-lineChart-button").addEventListener("click", function () {
const form = document.getElementById("create-lineChart-form");
if (!form.checkValidity()) {
form.classList.add("was-validated");
return;
Expand Down Expand Up @@ -332,12 +331,13 @@ <h5>Data Source</h5>

});

document.getElementById("close-lineChart-button").addEventListener("click", function () {
const form = document.getElementById("create-lineChart-form");
form.querySelector(".invalid-time").innerHTML = "";
form.querySelector("#stop-time").classList.remove("is-invalid");
form.reset();
form.classList.remove("was-validated");
document.querySelectorAll(".close-lineChart-button").forEach((element) => {
element.addEventListener("click", function () {
form.querySelector(".invalid-time").innerHTML = "";
form.querySelector("#stop-time").classList.remove("is-invalid");
form.reset();
form.classList.remove("was-validated");
})
});

function addRow() {
Expand Down

0 comments on commit d3df822

Please sign in to comment.