mirror of
https://github.com/TwiN/gatus.git
synced 2024-11-25 01:13:40 +01:00
Revert "Revert changes that were accidentally committed" but default to showing status on hover
This commit is contained in:
parent
d8cfcd04f1
commit
118b62c979
@ -166,8 +166,11 @@
|
|||||||
let refreshIntervalHandler = 0;
|
let refreshIntervalHandler = 0;
|
||||||
let userClickedStatus = false;
|
let userClickedStatus = false;
|
||||||
|
|
||||||
|
// TODO: make this variable configurable and persist the choice in localStorage
|
||||||
|
let showStatusOnHover = true;
|
||||||
|
|
||||||
function showTooltip(serviceName, index, element) {
|
function showTooltip(serviceName, index, element) {
|
||||||
userClickedStatus = false;
|
//userClickedStatus = false;
|
||||||
clearTimeout(timerHandler);
|
clearTimeout(timerHandler);
|
||||||
let serviceResult = serviceStatuses[serviceName].results[index];
|
let serviceResult = serviceStatuses[serviceName].results[index];
|
||||||
$("#tooltip-timestamp").text(prettifyTimestamp(serviceResult.timestamp));
|
$("#tooltip-timestamp").text(prettifyTimestamp(serviceResult.timestamp));
|
||||||
@ -219,11 +222,30 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function toggleTooltip(serviceName, index, element) {
|
||||||
|
console.log("userClickedStatus="+userClickedStatus);
|
||||||
|
if (!userClickedStatus) {
|
||||||
|
showTooltip(serviceName, index, element);
|
||||||
|
userClickedStatus = true;
|
||||||
|
} else {
|
||||||
|
$("#tooltip").hide();
|
||||||
|
userClickedStatus = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function createStatusBadge(serviceStatusIndex, index, success) {
|
function createStatusBadge(serviceStatusIndex, index, success) {
|
||||||
if (success) {
|
if (success) {
|
||||||
return "<span class='status badge badge-success' style='width: 5%' onmouseenter='showTooltip(\""+serviceStatusIndex+"\", "+index+", this)' onmouseleave='fadeTooltip()' onclick='userClickedStatus = !userClickedStatus;'>✓</span>";
|
if (showStatusOnHover) {
|
||||||
|
return "<span class='status badge badge-success' style='width: 5%' onmouseenter='showTooltip(\"" + serviceStatusIndex + "\", " + index + ", this)' onmouseleave='fadeTooltip()' onclick='userClickedStatus = !userClickedStatus;'>✓</span>";
|
||||||
|
} else {
|
||||||
|
return "<span class='status badge badge-success' style='width: 5%' onclick='toggleTooltip(\"" + serviceStatusIndex + "\", " + index + ", this)'>✓</span>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (showStatusOnHover) {
|
||||||
|
return "<span class='status badge badge-danger' style='width: 5%' onmouseenter='showTooltip(\"" + serviceStatusIndex + "\", " + index + ", this)' onmouseleave='fadeTooltip()' onclick='userClickedStatus = !userClickedStatus;'>X</span>";
|
||||||
|
} else {
|
||||||
|
return "<span class='status badge badge-danger' style='width: 5%' onclick='toggleTooltip(\"" + serviceStatusIndex + "\", " + index + ", this)'>X</span>";
|
||||||
}
|
}
|
||||||
return "<span class='status badge badge-danger' style='width: 5%' onmouseenter='showTooltip(\""+serviceStatusIndex+"\", "+index+", this)' onmouseleave='fadeTooltip()' onclick='userClickedStatus = !userClickedStatus;'>X</span>";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function refreshStatuses() {
|
function refreshStatuses() {
|
||||||
|
Loading…
Reference in New Issue
Block a user