From 2cef805ab67ab126050e5c1413e5d569ae6858b4 Mon Sep 17 00:00:00 2001 From: Ibrahim Tachijian Date: Wed, 27 Apr 2016 22:51:20 +0000 Subject: [PATCH] Add 'Added on' column in Webui. Closes #5145,#1092,#738 --- src/webui/btjson.cpp | 4 ++-- src/webui/www/public/scripts/dynamicTable.js | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/webui/btjson.cpp b/src/webui/btjson.cpp index e6ad4eb74..a6da20965 100644 --- a/src/webui/btjson.cpp +++ b/src/webui/btjson.cpp @@ -709,8 +709,8 @@ QVariantMap toMap(BitTorrent::TorrentHandle *const torrent) ret[KEY_TORRENT_SUPER_SEEDING] = torrent->superSeeding(); ret[KEY_TORRENT_FORCE_START] = torrent->isForced(); ret[KEY_TORRENT_SAVE_PATH] = Utils::Fs::toNativePath(torrent->savePath()); - ret[KEY_TORRENT_ADDED_ON] = torrent->addedTime(); - ret[KEY_TORRENT_COMPLETION_ON] = torrent->completedTime(); + ret[KEY_TORRENT_ADDED_ON] = torrent->addedTime().toTime_t(); + ret[KEY_TORRENT_COMPLETION_ON] = torrent->completedTime().toTime_t(); return ret; } diff --git a/src/webui/www/public/scripts/dynamicTable.js b/src/webui/www/public/scripts/dynamicTable.js index 97078e305..15f30fb9c 100644 --- a/src/webui/www/public/scripts/dynamicTable.js +++ b/src/webui/www/public/scripts/dynamicTable.js @@ -452,6 +452,7 @@ var TorrentsTable = new Class({ this.newColumn('eta', 'width: 100px', 'QBT_TR(ETA)QBT_TR'); this.newColumn('ratio', 'width: 100px', 'QBT_TR(Ratio)QBT_TR'); this.newColumn('category', 'width: 100px', 'QBT_TR(Category)QBT_TR'); + this.newColumn('added_on', 'width: 100px', 'QBT_TR(Added on)QBT_TR'); this.columns['state_icon'].onclick = ''; this.columns['state_icon'].dataProperties[0] = 'state'; @@ -618,6 +619,13 @@ var TorrentsTable = new Class({ html = (Math.floor(100 * ratio) / 100).toFixed(2); //Don't round up td.set('html', html); }; + + // added on + + this.columns['added_on'].updateTd = function (td, row) { + var date = new Date(this.getRowValue(row) * 1000).toLocaleString(); + td.set('html', date); + }; }, applyFilter : function (row, filterName, categoryHash) {