Skip to content

Commit 12ada30

Browse files
authored
Handle pie chart item style conditionally (#3532)
2 parents 353ba2f + 41cdc97 commit 12ada30

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

scripts/js/charts.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ globalThis.htmlLegendPlugin = {
6767
const boxSpan = document.createElement("span");
6868
boxSpan.title = "Toggle visibility";
6969
boxSpan.style.color = item.fillStyle;
70+
boxSpan.style.cursor = "pointer";
7071
boxSpan.innerHTML = `<i class="colorBoxWrapper fa ${item.hidden ? "fa-square" : "fa-check-square"}"></i>`;
7172

7273
boxSpan.addEventListener("click", () => {
@@ -91,17 +92,20 @@ globalThis.htmlLegendPlugin = {
9192
if (isQueryTypeChart || isForwardDestinationChart) {
9293
// Text (link to query log page)
9394
link.title = `List ${item.text} queries`;
95+
link.className = "legend-label-text clickable";
9496

9597
if (isQueryTypeChart) {
9698
link.href = `queries?type=${item.text}`;
9799
} else if (isForwardDestinationChart) {
98100
// Encode the forward destination as it may contain an "#" character
99101
link.href = `queries?upstream=${encodeURIComponent(upstreams[item.text])}`;
100102
}
103+
} else {
104+
// no clickable links in other charts
105+
link.className = "legend-label-text";
101106
}
102107

103108
link.style.textDecoration = item.hidden ? "line-through" : "";
104-
link.className = "legend-label-text";
105109
link.textContent = item.text;
106110

107111
li.append(boxSpan, link);

style/pi-hole.css

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ td.lookatme {
270270
}
271271

272272
.chart-legend li {
273+
cursor: default;
273274
position: relative;
274275
line-height: 1;
275276
margin: 0 0 8px;
@@ -300,10 +301,14 @@ td.lookatme {
300301
word-break: break-word;
301302
}
302303

303-
.chart-legend li a.legend-label-text:hover {
304+
.chart-legend li a.legend-label-text.clickable:hover {
304305
text-decoration: underline;
305306
}
306307

308+
.chart-legend li a.legend-label-text.clickable {
309+
cursor: pointer; /* Pointer cursor only for clickable items */
310+
}
311+
307312
/* These are needed because AdmintLTE 2.x doesn't support Font Awesome 5.x */
308313
.sidebar-menu > li > a > .fab,
309314
.sidebar-menu > li > a > .far,

0 commit comments

Comments
 (0)