From 36ad3b13059c039fdf89008294e297a5957e4a95 Mon Sep 17 00:00:00 2001 From: skomerko <168652295+skomerko@users.noreply.github.com> Date: Wed, 13 Nov 2024 14:18:57 +0100 Subject: [PATCH] WebUI: Add colors to 'Status' column in Trackers table --- src/webui/www/private/css/dynamicTable.css | 23 ++++++++++++++++ src/webui/www/private/css/style.css | 16 ++++++++++++ src/webui/www/private/scripts/dynamicTable.js | 26 +++++++++++++++++++ 3 files changed, 65 insertions(+) diff --git a/src/webui/www/private/css/dynamicTable.css b/src/webui/www/private/css/dynamicTable.css index 86e3072df..59ae90f93 100644 --- a/src/webui/www/private/css/dynamicTable.css +++ b/src/webui/www/private/css/dynamicTable.css @@ -114,3 +114,26 @@ div:has(> div.dynamicTableFixedHeaderDiv):not(.invisible) { padding-bottom: 0px !important; padding-top: 0px !important; } + +/* Trackers table */ +#torrentTrackersTableDiv tr:not(.selected, :hover) { + & .trackerDisabled { + color: var(--color-tracker-disabled); + } + + & .trackerNotContacted { + color: var(--color-tracker-not-contacted); + } + + & .trackerWorking { + color: var(--color-tracker-working); + } + + & .trackerUpdating { + color: var(--color-tracker-updating); + } + + & .trackerNotWorking { + color: var(--color-tracker-not-working); + } +} diff --git a/src/webui/www/private/css/style.css b/src/webui/www/private/css/style.css index d5c627dbd..0f02cd611 100644 --- a/src/webui/www/private/css/style.css +++ b/src/webui/www/private/css/style.css @@ -19,6 +19,14 @@ --color-icon-hover: brightness(0) invert(100%) sepia(100%) saturate(0%) hue-rotate(108deg) brightness(104%) contrast(104%); + & #torrentTrackersTableDiv tr { + --color-tracker-disabled: hsl(240deg 4% 46%); + --color-tracker-not-contacted: hsl(32deg 95% 44%); + --color-tracker-working: hsl(142deg 76% 36%); + --color-tracker-updating: hsl(210deg 100% 55%); + --color-tracker-not-working: hsl(0deg 100% 65%); + } + &:not(.dark) { color-scheme: light; } @@ -34,6 +42,14 @@ --color-background-hover: hsl(26deg 50% 55%); --color-border-default: hsl(0deg 0% 33%); + & #torrentTrackersTableDiv tr { + --color-tracker-disabled: hsl(240deg 6% 83%); + --color-tracker-not-contacted: hsl(39deg 100% 72%); + --color-tracker-working: hsl(142deg 69% 58%); + --color-tracker-updating: hsl(210deg 88.1% 73.5%); + --color-tracker-not-working: hsl(0deg 100% 71%); + } + color-scheme: dark; #rssButtonBar img, diff --git a/src/webui/www/private/scripts/dynamicTable.js b/src/webui/www/private/scripts/dynamicTable.js index 4a3b2c7e6..377d52bed 100644 --- a/src/webui/www/private/scripts/dynamicTable.js +++ b/src/webui/www/private/scripts/dynamicTable.js @@ -2023,6 +2023,32 @@ window.qBittorrent.DynamicTable ??= (() => { this.columns["seeds"].compareRows = sortMixed; this.columns["leeches"].compareRows = sortMixed; this.columns["downloaded"].compareRows = sortMixed; + + this.columns["status"].updateTd = function(td, row) { + let statusClass = "trackerUnknown"; + const status = this.getRowValue(row); + switch (status) { + case "QBT_TR(Disabled)QBT_TR[CONTEXT=TrackerListWidget]": + statusClass = "trackerDisabled"; + break; + case "QBT_TR(Not contacted yet)QBT_TR[CONTEXT=TrackerListWidget]": + statusClass = "trackerNotContacted"; + break; + case "QBT_TR(Working)QBT_TR[CONTEXT=TrackerListWidget]": + statusClass = "trackerWorking"; + break; + case "QBT_TR(Updating...)QBT_TR[CONTEXT=TrackerListWidget]": + statusClass = "trackerUpdating"; + break; + case "QBT_TR(Not working)QBT_TR[CONTEXT=TrackerListWidget]": + statusClass = "trackerNotWorking"; + break; + } + + td.className = statusClass; + td.textContent = status; + td.title = status; + }; } });