Removed all curves at given day

This commit is contained in:
l_samenv
2024-08-21 10:23:51 +02:00
parent 89dd427a22
commit 977ebb02d8
6 changed files with 19 additions and 60 deletions

View File

@ -57,6 +57,6 @@
margin-top: 10px;
}
.jump-button-all, .jump-button-time{
.jump-button{
width: 200px;
}

View File

@ -1,7 +1,5 @@
class DatesPopup extends HTMLElement{
static TIME = 0;
static ALL = 1;
static DAY = new Date(24*60*60*1000);
constructor(goToNowCallback, jumpCallback){
@ -23,16 +21,11 @@ class DatesPopup extends HTMLElement{
return [dateInputValue.getTime(), timeMs];
}
doJumpAllCallback(){
let dateTimeInput = this.getDateTimeInput();
this.hide();
this.jumpCallback(dateTimeInput[0], dateTimeInput[1], DatesPopup.ALL);
}
doJumpTimeCallback(){
doJumpCallback(){
let dateTimeInput = this.getDateTimeInput();
this.hide();
this.jumpCallback(dateTimeInput[0], dateTimeInput[1], DatesPopup.TIME);
this.jumpCallback(dateTimeInput[0], dateTimeInput[1]);
}
convertTimeStringToTimestamp(formattedTime){
@ -68,8 +61,7 @@ class DatesPopup extends HTMLElement{
this.getElementsByTagName("img")[0].onclick = () => {this.hide();};
this.getElementsByClassName("go-to-now-button")[0].onclick = () => {this.doGoToNowCallback();};
this.getElementsByClassName("input-date")[0].max = new Date().toISOString().split("T")[0]; // sets the max to today (set only at app start)
this.getElementsByClassName("jump-button-time")[0].onclick = () => {this.doJumpTimeCallback();};
this.getElementsByClassName("jump-button-all")[0].onclick = () => {this.doJumpAllCallback();};
this.getElementsByClassName("jump-button")[0].onclick = () => {this.doJumpCallback();};
}
render(){
@ -95,11 +87,7 @@ class DatesPopup extends HTMLElement{
</div>
<div>
<button class="jump-button-time">Curves at the given time</button>
</div>
<div>
<button class="jump-button-all">All curves of the given day</button>
<button class="jump-button">Jump</button>
</div>
</div>
</div>

View File

@ -350,7 +350,7 @@ function successHandler(s, message) {
begin = timeRange[0] - timeRange[1];
select.value = begin;
// Server-request for variable-list.*/
reqJSON(0, "http://" + hostPort + "/getvars?time=" + timeRange + "&all=False&id="
reqJSON(0, "http://" + hostPort + "/getvars?time=" + timeRange + "&id="
+ clientID, successHandler, errorHandler);
break;
// Response to a "getvars"-server-request.

View File

@ -748,7 +748,7 @@ let graphs = (function (){
resolution = Math.ceil((timeDelta / container.getBoundingClientRect().width))
}
function jumpToDate(dateTimestampMs, timeValueMs, mode){
function jumpToDate(dateTimestampMs, timeValueMs){
cursorLine(null);
@ -756,17 +756,11 @@ let graphs = (function (){
msLeftTimestampGetVars = dateTimestampMs;
msLeftTimestampGetGraph = dateTimestampMs;
if(mode == DatesPopup.TIME){
msRightTimestampGetVars = dateTimestampMs + timeValueMs;
}
else if(mode == DatesPopup.ALL){ // we ignore time
msRightTimestampGetVars = dateTimestampMs + 24*60*60*1000 - 1000; // we exclude the very beginning of the next day
}
msRightTimestampGetVars = dateTimestampMs + timeValueMs;
msRightTimestampGetGraph = dateTimestampMs + 24*60*60*1000 - 1000;
AJAX("http://" + hostPort + "/getvars?time=" + msLeftTimestampGetVars/1000 + "," + msRightTimestampGetVars/1000 + "&all=" +allQueryParameterRepresentation(mode) + "&id="+ clientID).getJSON().then(function(data){
AJAX("http://" + hostPort + "/getvars?time=" + msLeftTimestampGetVars/1000 + "," + msRightTimestampGetVars/1000 + "&id="+ clientID).getJSON().then(function(data){
blocks = data.blocks;
document.getElementById("device").innerHTML = data.device
maxTime = msRightTimestampGetGraph;
@ -785,15 +779,6 @@ let graphs = (function (){
}
function allQueryParameterRepresentation(mode){
if(mode == DatesPopup.ALL){
return "True";
}
else {
return "False";
}
}
/**
* The function called when the viewing window is moved by the mouse.
*
@ -845,7 +830,7 @@ let graphs = (function (){
let msLeftTimestamp = msRightTimestamp - 30*60*1000;
cursorLine(null);
AJAX("http://" + hostPort + "/getvars?time=" + msLeftTimestamp/1000 + "," + msRightTimestamp/1000 + "&all=False&id="+ clientID).getJSON().then(function(data){
AJAX("http://" + hostPort + "/getvars?time=" + msLeftTimestamp/1000 + "," + msRightTimestamp/1000 + "&id="+ clientID).getJSON().then(function(data){
currentMaxTime = msRightTimestamp + 60000;
currentMinTime = msLeftTimestamp;