Browse Source

Merge pull request #15549 from Chocobo1/api

WebAPI: Use specific number to represent non-existing values
adaptive-webui-19844
Chocobo1 3 years ago committed by GitHub
parent
commit
70a11a12b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 0
      .github/PULL_REQUEST_TEMPLATE.md
  2. 4
      src/gui/transferlistsortmodel.cpp
  3. 6
      src/webui/api/torrentscontroller.cpp
  4. 2
      src/webui/www/private/scripts/prop-trackers.js

0
.github/pull_request_template.yml → .github/PULL_REQUEST_TEMPLATE.md

4
src/gui/transferlistsortmodel.cpp

@ -51,10 +51,8 @@ namespace
const bool isLeftValid = left.isValid(); const bool isLeftValid = left.isValid();
const bool isRightValid = right.isValid(); const bool isRightValid = right.isValid();
if (isLeftValid && isRightValid) if (isLeftValid == isRightValid)
return threeWayCompare(left, right); return threeWayCompare(left, right);
if (!isLeftValid && !isRightValid)
return 0;
return isLeftValid ? -1 : 1; return isLeftValid ? -1 : 1;
} }

6
src/webui/api/torrentscontroller.cpp

@ -176,7 +176,7 @@ namespace
const QJsonObject dht const QJsonObject dht
{ {
{KEY_TRACKER_URL, "** [DHT] **"}, {KEY_TRACKER_URL, "** [DHT] **"},
{KEY_TRACKER_TIER, ""}, {KEY_TRACKER_TIER, -1},
{KEY_TRACKER_MSG, (isTorrentPrivate ? privateMsg : "")}, {KEY_TRACKER_MSG, (isTorrentPrivate ? privateMsg : "")},
{KEY_TRACKER_STATUS, ((BitTorrent::Session::instance()->isDHTEnabled() && !isTorrentPrivate) ? working : disabled)}, {KEY_TRACKER_STATUS, ((BitTorrent::Session::instance()->isDHTEnabled() && !isTorrentPrivate) ? working : disabled)},
{KEY_TRACKER_PEERS_COUNT, 0}, {KEY_TRACKER_PEERS_COUNT, 0},
@ -188,7 +188,7 @@ namespace
const QJsonObject pex const QJsonObject pex
{ {
{KEY_TRACKER_URL, "** [PeX] **"}, {KEY_TRACKER_URL, "** [PeX] **"},
{KEY_TRACKER_TIER, ""}, {KEY_TRACKER_TIER, -1},
{KEY_TRACKER_MSG, (isTorrentPrivate ? privateMsg : "")}, {KEY_TRACKER_MSG, (isTorrentPrivate ? privateMsg : "")},
{KEY_TRACKER_STATUS, ((BitTorrent::Session::instance()->isPeXEnabled() && !isTorrentPrivate) ? working : disabled)}, {KEY_TRACKER_STATUS, ((BitTorrent::Session::instance()->isPeXEnabled() && !isTorrentPrivate) ? working : disabled)},
{KEY_TRACKER_PEERS_COUNT, 0}, {KEY_TRACKER_PEERS_COUNT, 0},
@ -200,7 +200,7 @@ namespace
const QJsonObject lsd const QJsonObject lsd
{ {
{KEY_TRACKER_URL, "** [LSD] **"}, {KEY_TRACKER_URL, "** [LSD] **"},
{KEY_TRACKER_TIER, ""}, {KEY_TRACKER_TIER, -1},
{KEY_TRACKER_MSG, (isTorrentPrivate ? privateMsg : "")}, {KEY_TRACKER_MSG, (isTorrentPrivate ? privateMsg : "")},
{KEY_TRACKER_STATUS, ((BitTorrent::Session::instance()->isLSDEnabled() && !isTorrentPrivate) ? working : disabled)}, {KEY_TRACKER_STATUS, ((BitTorrent::Session::instance()->isLSDEnabled() && !isTorrentPrivate) ? working : disabled)},
{KEY_TRACKER_PEERS_COUNT, 0}, {KEY_TRACKER_PEERS_COUNT, 0},

2
src/webui/www/private/scripts/prop-trackers.js

@ -97,7 +97,7 @@ window.qBittorrent.PropTrackers = (function() {
const row = { const row = {
rowId: tracker.url, rowId: tracker.url,
tier: tracker.tier, tier: (tracker.tier >= 0) ? tracker.tier : "",
url: tracker.url, url: tracker.url,
status: status, status: status,
peers: tracker.num_peers, peers: tracker.num_peers,

Loading…
Cancel
Save