Fixed some bugs in Dashboard
* Added client Version to tooltip * Add version check and "update available" notification to Dashboard
This commit is contained in:
parent
f87f1efe2a
commit
5c38710c5c
7 changed files with 142 additions and 100 deletions
|
@ -28,10 +28,11 @@ build_script:
|
|||
- cmake -G "Visual Studio 15 2017 Win64" -T v141,host=x64 ..
|
||||
- msbuild xmrig.sln /p:Configuration=Release
|
||||
|
||||
|
||||
after_build:
|
||||
- cd c:\xmrigCC
|
||||
- cmd: 7z a xmrigCC-win64.zip "c:\xmrigCC\build\Release\*.*" "c:\xmrigCC\src\*config*" "c:\xmrigCC\index.html"
|
||||
- cmd: 7z a xmrigCC-mvc-win64.zip "c:\xmrigCC\build\Release\*.*" "c:\xmrigCC\src\*config*" "c:\xmrigCC\index.html"
|
||||
- cmd: dir
|
||||
|
||||
artifacts:
|
||||
- path: xmrigCC-win64.zip
|
||||
- path: xmrigCC-mvc-win64.zip
|
||||
|
|
126
index.html
126
index.html
|
@ -27,19 +27,14 @@ $.fn.dataTable.ext.search.push(
|
|||
function( settings, data, dataIndex ) {
|
||||
var hide = document.getElementById("hideOffline").checked;
|
||||
|
||||
var lastStatus = settings.aoData[dataIndex]._aData.client_status.last_status_update * 1000;
|
||||
var threshold = new Date().getTime() - 60 * 1000;
|
||||
|
||||
if (lastStatus > threshold || !hide) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
return (isOnline(settings.aoData[dataIndex]._aData.client_status.last_status_update * 1000) || !hide);
|
||||
}
|
||||
);
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
var latestRelease = "";
|
||||
|
||||
var table = $('#clientStatusList').DataTable({
|
||||
dom: '<"toolbar">frtip',
|
||||
processing : true,
|
||||
|
@ -80,63 +75,35 @@ $(document).ready(function() {
|
|||
"footerCallback": function ( row, data, start, end, display ) {
|
||||
var api = this.api();
|
||||
|
||||
sumHashrateShort = round(api
|
||||
.column(4)
|
||||
.data()
|
||||
.reduce( function (a, b) {
|
||||
return a + b;
|
||||
}, 0 ));
|
||||
var sumHashrateShort = 0;
|
||||
var sumHashrateMedium = 0;
|
||||
var sumHashrateLong = 0;
|
||||
var sumHashrateHighest = 0;
|
||||
var sumHashesTotal = 0;
|
||||
var avgTimeTotal = 0;
|
||||
var sumSharesGood = 0;
|
||||
var sumSharedTotal = 0;
|
||||
|
||||
sumHashrateMedium = round(api
|
||||
.column(5)
|
||||
.data()
|
||||
.reduce( function (a, b) {
|
||||
return a + b;
|
||||
}, 0 ));
|
||||
for (var i = 0; i < data.length; ++i) {
|
||||
if (isOnline(data[i].client_status.last_status_update * 1000)) {
|
||||
sumHashrateShort += data[i].client_status.hashrate_short;
|
||||
sumHashrateMedium += data[i].client_status.hashrate_medium;
|
||||
sumHashrateLong += data[i].client_status.hashrate_long;
|
||||
sumHashrateHighest += data[i].client_status.hashrate_highest;
|
||||
sumHashesTotal += data[i].client_status.hashes_total;
|
||||
avgTimeTotal = (avgTimeTotal + data[i].client_status.avg_time) / 2;
|
||||
sumSharesGood += data[i].client_status.shares_good;
|
||||
sumSharedTotal += data[i].client_status.shares_total;
|
||||
}
|
||||
}
|
||||
|
||||
sumHashrateLong = round(api
|
||||
.column(6)
|
||||
.data()
|
||||
.reduce( function (a, b) {
|
||||
return a + b;
|
||||
}, 0 ));
|
||||
sumHashrateShort = round(sumHashrateShort);
|
||||
sumHashrateMedium = round(sumHashrateMedium);
|
||||
sumHashrateLong = round(sumHashrateLong);
|
||||
sumHashrateHighest = round(sumHashrateHighest);
|
||||
avgTimeTotal = round(avgTimeTotal);
|
||||
|
||||
sumHashrateHighest = round(api
|
||||
.column(7)
|
||||
.data()
|
||||
.reduce( function (a, b) {
|
||||
return a + b;
|
||||
}, 0 ));
|
||||
|
||||
sumHashesTotal = api
|
||||
.column(8)
|
||||
.data()
|
||||
.reduce( function (a, b) {
|
||||
return a + b;
|
||||
}, 0 );
|
||||
|
||||
avgTimeTotal = round(api
|
||||
.column(9)
|
||||
.data()
|
||||
.reduce( function (a, b) {
|
||||
return a + b;
|
||||
}, 0 )/end);
|
||||
|
||||
sumSharesGood = api
|
||||
.column(10)
|
||||
.data()
|
||||
.reduce( function (a, b) {
|
||||
return a + b;
|
||||
}, 0 );
|
||||
|
||||
sumSharedTotal = api
|
||||
.column(11)
|
||||
.data()
|
||||
.reduce( function (a, b) {
|
||||
return a + b;
|
||||
}, 0 );
|
||||
|
||||
// Update footer
|
||||
// update footer
|
||||
$(api.column(4).footer()).html(sumHashrateShort);
|
||||
$(api.column(5).footer()).html(sumHashrateMedium);
|
||||
$(api.column(6).footer()).html(sumHashrateLong);
|
||||
|
@ -145,6 +112,24 @@ $(document).ready(function() {
|
|||
$(api.column(9).footer()).html(avgTimeTotal);
|
||||
$(api.column(10).footer()).html(sumSharesGood);
|
||||
$(api.column(11).footer()).html(sumSharedTotal);
|
||||
|
||||
// check version
|
||||
if (latestRelease === "" && $(api).context[0].json !== undefined) {
|
||||
$.ajax({
|
||||
url: "https://api.github.com/repos/Bendr0id/xmrigCC/releases/latest",
|
||||
type: 'GET',
|
||||
dataType: "json",
|
||||
success: function (release) {
|
||||
latestRelease = release.tag_name;
|
||||
if (latestRelease !== $(api).context[0].json.current_version) {
|
||||
$("#notificationBar").html('<div class="alert alert-info alert-dismissable fade in">' +
|
||||
'<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>' +
|
||||
'<a href="https://github.com/Bendr0id/xmrigCC/releases/latest"><strong>Update!</strong> XMRigCC v' + latestRelease + ' is available for download\n</a>' +
|
||||
'</div>');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -247,11 +232,12 @@ function clientInfo( data, type, row ) {
|
|||
tooltip += '\n';
|
||||
tooltip += "Client IP: " + row.client_status.external_ip;
|
||||
tooltip += '\n';
|
||||
tooltip += "Version: " + row.client_status.version;
|
||||
tooltip += '\n';
|
||||
tooltip += "Status: ";
|
||||
|
||||
var lastStatus = row.client_status.last_status_update * 1000;
|
||||
var threshold = new Date().getTime() - 60 * 1000;
|
||||
if (lastStatus > threshold) {
|
||||
if (isOnline(lastStatus)) {
|
||||
tooltip += "Online";
|
||||
return '<span data-toggle="tooltip" title="'+ tooltip + '"><div class="online">' + data + '</div></span>';
|
||||
}
|
||||
|
@ -268,12 +254,22 @@ function round( data, type, row ) {
|
|||
return Math.round(data * 100) / 100;
|
||||
}
|
||||
|
||||
function isOnline(lastStatus) {
|
||||
var threshold = new Date().getTime() - 60 * 1000;
|
||||
if (lastStatus > threshold) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<br/>
|
||||
<div style="width: 90%; margin:0 auto;">
|
||||
<div id="notificationBar"></div>
|
||||
<div class="center">
|
||||
<h1>XMRigCC Dashboard</h1>
|
||||
</div>
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include <fstream>
|
||||
#include <3rdparty/rapidjson/stringbuffer.h>
|
||||
#include <3rdparty/rapidjson/prettywriter.h>
|
||||
#include <version.h>
|
||||
|
||||
#include "CCClient.h"
|
||||
#include "App.h"
|
||||
|
@ -41,11 +42,13 @@
|
|||
#if _WIN32
|
||||
# include "winsock2.h"
|
||||
#else
|
||||
|
||||
# include "unistd.h"
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
CCClient *CCClient::m_self = nullptr;
|
||||
CCClient* CCClient::m_self = nullptr;
|
||||
uv_mutex_t CCClient::m_mutex;
|
||||
|
||||
CCClient::CCClient(Options* options, uv_async_t* async)
|
||||
|
@ -59,10 +62,10 @@ CCClient::CCClient(Options* options, uv_async_t* async)
|
|||
std::string clientId;
|
||||
if (m_options->ccWorkerId()) {
|
||||
clientId = m_options->ccWorkerId();
|
||||
} else{
|
||||
} else {
|
||||
char hostname[128];
|
||||
memset(hostname, 0, sizeof(hostname));
|
||||
gethostname(hostname, sizeof(hostname)-1);
|
||||
gethostname(hostname, sizeof(hostname) - 1);
|
||||
clientId = std::string(hostname);
|
||||
}
|
||||
|
||||
|
@ -76,6 +79,7 @@ CCClient::CCClient(Options* options, uv_async_t* async)
|
|||
m_clientStatus.setHugepages(Mem::isHugepagesAvailable());
|
||||
m_clientStatus.setDoubleHashMode(Mem::isDoubleHash());
|
||||
|
||||
m_clientStatus.setVersion(Version::string());
|
||||
m_clientStatus.setCpuBrand(Cpu::brand());
|
||||
m_clientStatus.setCpuAES(Cpu::hasAES());
|
||||
m_clientStatus.setCpuCores(Cpu::cores());
|
||||
|
@ -98,7 +102,7 @@ CCClient::~CCClient()
|
|||
m_self = nullptr;
|
||||
}
|
||||
|
||||
void CCClient::updateHashrate(const Hashrate *hashrate)
|
||||
void CCClient::updateHashrate(const Hashrate* hashrate)
|
||||
{
|
||||
if (m_self) {
|
||||
uv_mutex_lock(&m_mutex);
|
||||
|
@ -113,7 +117,7 @@ void CCClient::updateHashrate(const Hashrate *hashrate)
|
|||
}
|
||||
|
||||
|
||||
void CCClient::updateNetworkState(const NetworkState &network)
|
||||
void CCClient::updateNetworkState(const NetworkState& network)
|
||||
{
|
||||
if (m_self) {
|
||||
uv_mutex_lock(&m_mutex);
|
||||
|
@ -161,7 +165,7 @@ void CCClient::publishClientStatusReport()
|
|||
LOG_WARN("[CC-Client] Command: SHUTDOWN received -> shutdown");
|
||||
}
|
||||
|
||||
m_self->m_async->data = reinterpret_cast<void *>(controlCommand.getCommand());
|
||||
m_self->m_async->data = reinterpret_cast<void*>(controlCommand.getCommand());
|
||||
uv_async_send(m_self->m_async);
|
||||
} else {
|
||||
LOG_ERR("[CC-Client] Unknown command received from CC Server.");
|
||||
|
@ -198,7 +202,7 @@ void CCClient::updateConfig()
|
|||
} else {
|
||||
LOG_ERR("[CC-Client] Not able to store client config to file %s.", m_self->m_options->configFile());
|
||||
}
|
||||
} else{
|
||||
} else {
|
||||
LOG_ERR("[CC-Client] Not able to store client config. received client config is broken!");
|
||||
}
|
||||
}
|
||||
|
@ -244,7 +248,7 @@ void CCClient::onThreadStarted(void* handle)
|
|||
uv_run(&m_self->m_client_loop, UV_RUN_DEFAULT);
|
||||
}
|
||||
|
||||
void CCClient::onReport(uv_timer_t *handle)
|
||||
void CCClient::onReport(uv_timer_t* handle)
|
||||
{
|
||||
if (m_self) {
|
||||
m_self->publishClientStatusReport();
|
||||
|
|
|
@ -115,6 +115,16 @@ void ClientStatus::setExternalIp(const std::string& externalIp)
|
|||
m_externalIp = externalIp;
|
||||
}
|
||||
|
||||
std::string ClientStatus::getVersion() const
|
||||
{
|
||||
return m_version;
|
||||
}
|
||||
|
||||
void ClientStatus::setVersion(const std::string& version)
|
||||
{
|
||||
m_version = version;
|
||||
}
|
||||
|
||||
bool ClientStatus::hasHugepages() const
|
||||
{
|
||||
return m_hasHugepages;
|
||||
|
@ -321,6 +331,10 @@ bool ClientStatus::parseFromJson(const rapidjson::Document& document)
|
|||
m_externalIp = clientStatus["external_ip"].GetString();
|
||||
}
|
||||
|
||||
if (clientStatus.HasMember("version")) {
|
||||
m_version = clientStatus["version"].GetString();
|
||||
}
|
||||
|
||||
if (clientStatus.HasMember("hugepages_available")) {
|
||||
m_hasHugepages = clientStatus["hugepages_available"].GetBool();
|
||||
}
|
||||
|
@ -411,6 +425,7 @@ rapidjson::Value ClientStatus::toJson(rapidjson::MemoryPoolAllocator<rapidjson::
|
|||
clientStatus.AddMember("current_algo_name", rapidjson::StringRef(m_currentAlgoName.c_str()), allocator);
|
||||
clientStatus.AddMember("cpu_brand", rapidjson::StringRef(m_cpuBrand.c_str()), allocator);
|
||||
clientStatus.AddMember("external_ip", rapidjson::StringRef(m_externalIp.c_str()), allocator);
|
||||
clientStatus.AddMember("version", rapidjson::StringRef(m_version.c_str()), allocator);
|
||||
|
||||
clientStatus.AddMember("hugepages_available", m_hasHugepages, allocator);
|
||||
clientStatus.AddMember("hugepages_enabled", m_isHugepagesEnabled, allocator);
|
||||
|
|
|
@ -68,13 +68,16 @@ public:
|
|||
void setCurrentPool(const std::string& currentPool);
|
||||
|
||||
std::string getCurrentAlgoName() const;
|
||||
void setCurrentAlgoName(const std::string &algoName);
|
||||
void setCurrentAlgoName(const std::string& algoName);
|
||||
|
||||
std::string getCpuBrand() const;
|
||||
void setCpuBrand(const std::string &cpuBrand);
|
||||
void setCpuBrand(const std::string& cpuBrand);
|
||||
|
||||
std::string getExternalIp() const;
|
||||
void setExternalIp(const std::string &externalIp);
|
||||
void setExternalIp(const std::string& externalIp);
|
||||
|
||||
std::string getVersion() const;
|
||||
void setVersion(const std::string& version);
|
||||
|
||||
bool hasHugepages() const;
|
||||
void setHugepages(bool hasHugepages);
|
||||
|
@ -148,6 +151,7 @@ private:
|
|||
std::string m_currentAlgoName;
|
||||
std::string m_cpuBrand;
|
||||
std::string m_externalIp;
|
||||
std::string m_version;
|
||||
|
||||
bool m_hasHugepages;
|
||||
bool m_isHugepagesEnabled;
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <3rdparty/rapidjson/filereadstream.h>
|
||||
#include <3rdparty/rapidjson/error/en.h>
|
||||
#include <3rdparty/rapidjson/prettywriter.h>
|
||||
#include <version.h>
|
||||
#include "log/Log.h"
|
||||
#include "Service.h"
|
||||
|
||||
|
@ -194,6 +195,7 @@ unsigned Service::getClientStatusList(std::string& resp)
|
|||
clientStatusList.PushBack(clientStatusEntry, allocator);
|
||||
}
|
||||
|
||||
document.AddMember("current_version", rapidjson::StringRef(Version::string().c_str()), allocator);
|
||||
document.AddMember("client_status_list", clientStatusList, allocator);
|
||||
|
||||
rapidjson::StringBuffer buffer(0, 4096);
|
||||
|
|
|
@ -36,14 +36,14 @@
|
|||
#define APP_DESC "XMRigCC CPU miner"
|
||||
#define APP_COPYRIGHT "Copyright (C) 2017- BenDr0id"
|
||||
#endif
|
||||
#define APP_VERSION "1.1.0 (based on XMRig 2.4.2)"
|
||||
#define APP_VERSION "1.1.1 (based on XMRig 2.4.2)"
|
||||
#define APP_DOMAIN ""
|
||||
#define APP_SITE "https://github.com/Bendr0id/xmrigCC"
|
||||
#define APP_KIND "cpu"
|
||||
|
||||
#define APP_VER_MAJOR 1
|
||||
#define APP_VER_MINOR 1
|
||||
#define APP_VER_BUILD 0
|
||||
#define APP_VER_BUILD 1
|
||||
#define APP_VER_REV 0
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
@ -62,4 +62,24 @@
|
|||
# endif
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
|
||||
class Version
|
||||
{
|
||||
public:
|
||||
inline static std::string string()
|
||||
{
|
||||
std::string version = std::to_string(APP_VER_MAJOR) + std::string(".") + std::to_string(APP_VER_MINOR) +
|
||||
std::string(".") + std::to_string(APP_VER_BUILD);
|
||||
|
||||
return version;
|
||||
}
|
||||
|
||||
inline static int code()
|
||||
{
|
||||
std::string version = std::to_string(APP_VER_MAJOR) + std::to_string(APP_VER_MINOR) + std::to_string(APP_VER_BUILD);
|
||||
|
||||
return std::stoi(version);
|
||||
}
|
||||
};
|
||||
#endif /* __VERSION_H__ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue