add quick time range buttons for position history
This commit is contained in:
@ -1631,6 +1631,16 @@
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="divide-y">
|
||||
|
||||
<!-- quick range -->
|
||||
<div class="flex p-2 space-x-2">
|
||||
<button @click="onPositionHistoryQuickRangeClick('1h')" type="button" class="w-full bg-gray-100 rounded border shadow px-2 py-1 text-sm hover:bg-gray-200 text-center">1 Hour</button>
|
||||
<button @click="onPositionHistoryQuickRangeClick('24h')" type="button" class="w-full bg-gray-100 rounded border shadow px-2 py-1 text-sm hover:bg-gray-200 text-center">24 Hours</button>
|
||||
<button @click="onPositionHistoryQuickRangeClick('7d')" type="button" class="w-full bg-gray-100 rounded border shadow px-2 py-1 text-sm hover:bg-gray-200 text-center">7 Days</button>
|
||||
</div>
|
||||
|
||||
<!-- manual range -->
|
||||
<div class="p-2 space-y-1">
|
||||
|
||||
<!-- from -->
|
||||
@ -1646,6 +1656,8 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -2601,6 +2613,34 @@
|
||||
// load position history
|
||||
this.loadNodePositionHistory(nodeId);
|
||||
|
||||
},
|
||||
onPositionHistoryQuickRangeClick: function(range) {
|
||||
|
||||
// update position history time range
|
||||
switch(range){
|
||||
case "1h": {
|
||||
this.positionHistoryDateTimeFrom = moment().subtract(1, "hours").format('YYYY-MM-DDTHH:mm');
|
||||
this.positionHistoryDateTimeTo = moment().format('YYYY-MM-DDTHH:mm');
|
||||
break;
|
||||
}
|
||||
case "24h": {
|
||||
this.positionHistoryDateTimeFrom = moment().subtract(24, "hours").format('YYYY-MM-DDTHH:mm');
|
||||
this.positionHistoryDateTimeTo = moment().format('YYYY-MM-DDTHH:mm');
|
||||
break;
|
||||
}
|
||||
case "7d": {
|
||||
this.positionHistoryDateTimeFrom = moment().subtract(7, "days").format('YYYY-MM-DDTHH:mm');
|
||||
this.positionHistoryDateTimeTo = moment().format('YYYY-MM-DDTHH:mm');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// reload position history
|
||||
const node = this.selectedNodeToShowPositionHistory;
|
||||
if(node){
|
||||
this.loadNodePositionHistory(node.node_id);
|
||||
}
|
||||
|
||||
},
|
||||
getShareLinkForNode: function(nodeId) {
|
||||
return window.location.origin + `/?node_id=${nodeId}`;
|
||||
|
Reference in New Issue
Block a user