Added current algo to clientStatus
Added client config editor to dashboard Little beautifying of dashboard
This commit is contained in:
parent
437b81f098
commit
7cc38f768f
5 changed files with 107 additions and 24 deletions
|
@ -185,7 +185,6 @@ Please note performance is highly dependent on system load. The numbers above ar
|
||||||
|
|
||||||
## Donations
|
## Donations
|
||||||
* Default donation 5% (5 minutes in 100 minutes) can be reduced to 1% via command line option `--donate-level`.
|
* Default donation 5% (5 minutes in 100 minutes) can be reduced to 1% via command line option `--donate-level`.
|
||||||
* The donations will be automatically splitted (50/50) on my pool to xmrig's and my wallet.
|
|
||||||
|
|
||||||
##### BenDroid (xmrigCC):
|
##### BenDroid (xmrigCC):
|
||||||
XMR: `4BEn3sSa2SsHBcwa9dNdKnGvvbyHPABr2JzoY7omn7DA2hPv84pVFvwDrcwMCWgz3dQVcrkw3gE9aTC9Mi5HxzkfF9ev1eH`
|
XMR: `4BEn3sSa2SsHBcwa9dNdKnGvvbyHPABr2JzoY7omn7DA2hPv84pVFvwDrcwMCWgz3dQVcrkw3gE9aTC9Mi5HxzkfF9ev1eH`
|
||||||
|
|
93
index.html
93
index.html
|
@ -5,16 +5,18 @@
|
||||||
<title>XMRigCC Dashboard</title>
|
<title>XMRigCC Dashboard</title>
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css">
|
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css">
|
||||||
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/select/1.2.3/css/select.dataTables.min.css">
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.right{text-align:right;}
|
.right{text-align:right;}
|
||||||
|
.center{text-align:center;}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script type="text/javascript" language="javascript" src="//code.jquery.com/jquery-1.12.4.js"></script>
|
<script type="text/javascript" language="javascript" src="//code.jquery.com/jquery-1.12.4.js"></script>
|
||||||
<script type="text/javascript" language="javascript" src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
|
<script type="text/javascript" language="javascript" src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
|
||||||
<script type="text/javascript" language="javascript" src="https://cdn.datatables.net/select/1.2.3/js/dataTables.select.min.js"></script>
|
|
||||||
<script type="text/javascript" language="javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery-timeago/1.6.1/jquery.timeago.min.js"></script>
|
<script type="text/javascript" language="javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery-timeago/1.6.1/jquery.timeago.min.js"></script>
|
||||||
|
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
|
||||||
|
<script src="https://use.fontawesome.com/6b3cdfc597.js"></script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
@ -30,6 +32,7 @@ $(document).ready(function() {
|
||||||
{ data: "client_status.client_id"},
|
{ data: "client_status.client_id"},
|
||||||
{ data: "client_status.current_pool"},
|
{ data: "client_status.current_pool"},
|
||||||
{ data: "client_status.current_status"},
|
{ data: "client_status.current_status"},
|
||||||
|
{ data: "client_status.current_algo_name"},
|
||||||
{ data: "client_status.hashrate_short", render: round, className: "right"},
|
{ data: "client_status.hashrate_short", render: round, className: "right"},
|
||||||
{ data: "client_status.hashrate_medium", render: round, className: "right"},
|
{ data: "client_status.hashrate_medium", render: round, className: "right"},
|
||||||
{ data: "client_status.hashrate_long", render: round, className: "right"},
|
{ data: "client_status.hashrate_long", render: round, className: "right"},
|
||||||
|
@ -43,18 +46,18 @@ $(document).ready(function() {
|
||||||
targets: -1,
|
targets: -1,
|
||||||
data: null,
|
data: null,
|
||||||
defaultContent:
|
defaultContent:
|
||||||
"<button id='START'>Start</button> " +
|
"<div class='btn-group btn-group-xs'>" +
|
||||||
"<button id='STOP'>Stop</button> " +
|
"<button type='button' id='START' class='btn btn-success' data-toggle='tooltip' title='Start'><i class='fa fa-play'></i></button>" +
|
||||||
"<button id='RESTART'>Restart</button> " +
|
"<button type='button' id='STOP' class='btn btn-warning' data-toggle='tooltip' title='Stop'><i class='fa fa-pause'></i></button>" +
|
||||||
"<button id='UPDATE_CONFIG'>Update</button> " +
|
"<button type='button' id='RESTART' class='btn' data-toggle='tooltip' title='Restart'><i class='fa fa-repeat'></i></button>" +
|
||||||
"<button id='SHUTDOWN'>Shutdown</button>"
|
"<button type='button' id='UPDATE_CONFIG' class='btn btn-info' data-toggle='tooltip' title='Update Config'><i class='fa fa-refresh'></i></button>" +
|
||||||
|
"<button type='button' id='EDIT' class='btn btn-primary' data-toggle='tooltip' title='Edit Client Config'><i class='fa fa-cog'></i></button>" +
|
||||||
|
"<button type='button' id='SHUTDOWN' class='btn btn-danger' data-toggle='tooltip' title='Stutdown Client'><i class='fa fa-power-off'></i></button>" +
|
||||||
|
"</div>",
|
||||||
|
className: "center"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
order: [ 11, 'desc' ],
|
order: [ 11, 'desc' ],
|
||||||
select: {
|
|
||||||
style: 'os',
|
|
||||||
selector: 'td:first-child'
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#clientStatusList tbody').on( 'click', 'button', function () {
|
$('#clientStatusList tbody').on( 'click', 'button', function () {
|
||||||
|
@ -62,11 +65,51 @@ $(document).ready(function() {
|
||||||
var clientId = data['client_status']['client_id'];
|
var clientId = data['client_status']['client_id'];
|
||||||
var action = this.id;
|
var action = this.id;
|
||||||
|
|
||||||
|
if (action != "EDIT"){
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "/admin/setClientCommand?clientId="+clientId,
|
url: "/admin/setClientCommand?clientId=" + clientId,
|
||||||
dataType:"json",
|
dataType:"text",
|
||||||
data: '{"control_command":{"command": "' + action + '"}}',
|
data: '{"control_command":{"command": "' + action + '"}}',
|
||||||
|
success: function(data){
|
||||||
|
alert("Successfully send: " + action + " to: " + clientId);
|
||||||
|
},
|
||||||
|
error: function (data) {
|
||||||
|
alert("Failed to send: " + action +" to: " + clientId + "\nError: " + JSON.stringify(data,undefined, 2));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$.get("/admin/getClientConfig?clientId="+clientId, function (jsonClientConfig) {
|
||||||
|
var htmlContent = "<div class='form-group' id='editor' data-value='" + clientId + "'>" +
|
||||||
|
"<label for='config'>Config for: " + clientId + "</label>"+
|
||||||
|
"<textarea class='form-control' rows='20' id='config'>" +
|
||||||
|
JSON.stringify(jsonClientConfig,undefined, 2); +
|
||||||
|
"</textarea>" +
|
||||||
|
"</div>";
|
||||||
|
|
||||||
|
$('#editConfig').find('.modal-body').html(htmlContent);
|
||||||
|
$('#editConfig').modal('show');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('button.btn.btn-success').click(function(event)
|
||||||
|
{
|
||||||
|
var clientId = $('#editConfig').find('.form-group')["0"].dataset.value;
|
||||||
|
|
||||||
|
event.preventDefault();
|
||||||
|
$.ajax({
|
||||||
|
url: "/admin/setClientConfig?clientId=" + clientId,
|
||||||
|
type: 'POST',
|
||||||
|
dataType: "text",
|
||||||
|
data: $('#config').val(),
|
||||||
|
success: function(data){
|
||||||
|
alert("Successfully saved config for: " + clientId);
|
||||||
|
},
|
||||||
|
error: function (data) {
|
||||||
|
alert("Failed to store config for: " + clientId + "\nError: " + JSON.stringify(data,undefined, 2));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -89,17 +132,17 @@ function round( data, type, row ) {
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<br/>
|
<br/>
|
||||||
<div style="width: 95%; margin:0 auto;">
|
<div style="width: 90%; margin:0 auto;">
|
||||||
<div style="text-align: center;">
|
<div class="center">
|
||||||
<h1>XMRigCC Dashboard</h1>
|
<h1>XMRigCC Dashboard</h1>
|
||||||
</div>
|
</div>
|
||||||
<br/>
|
|
||||||
<table id="clientStatusList" class="display" cellspacing="0" width="100%">
|
<table id="clientStatusList" class="display" cellspacing="0" width="100%">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Client Id</th>
|
<th>Client Id</th>
|
||||||
<th>Pool</th>
|
<th>Pool</th>
|
||||||
<th>Status</th>
|
<th>Status</th>
|
||||||
|
<th>Algo</th>
|
||||||
|
|
||||||
<th>Hashrate</th>
|
<th>Hashrate</th>
|
||||||
<th>Hashrate 5m</th>
|
<th>Hashrate 5m</th>
|
||||||
|
@ -116,6 +159,24 @@ function round( data, type, row ) {
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
<div class="modal fade" id="editConfig" role="dialog">
|
||||||
|
<div class="modal-dialog modal-lg">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||||
|
<h4 class="modal-title">Config editor</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-success" data-dismiss="modal">Save</button>
|
||||||
|
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
|
@ -62,6 +62,11 @@ CCClient::CCClient(const Options *options)
|
||||||
}
|
}
|
||||||
|
|
||||||
m_clientStatus.setClientId(clientId);
|
m_clientStatus.setClientId(clientId);
|
||||||
|
|
||||||
|
if (m_options->algoName() != nullptr) {
|
||||||
|
m_clientStatus.setCurrentAlgoName(m_options->algoName());
|
||||||
|
}
|
||||||
|
|
||||||
m_serverURL = std::string("http://") + options->ccUrl();
|
m_serverURL = std::string("http://") + options->ccUrl();
|
||||||
|
|
||||||
if (m_options->ccToken() != nullptr) {
|
if (m_options->ccToken() != nullptr) {
|
||||||
|
|
|
@ -43,7 +43,7 @@ ClientStatus::ClientStatus()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string ClientStatus::getClientId() const
|
std::string ClientStatus::getClientId() const
|
||||||
{
|
{
|
||||||
return m_clientId;
|
return m_clientId;
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ void ClientStatus::setClientId(const std::string& clientId)
|
||||||
m_clientId = clientId;
|
m_clientId = clientId;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string ClientStatus::getCurrentPool() const
|
std::string ClientStatus::getCurrentPool() const
|
||||||
{
|
{
|
||||||
return m_currentPool;
|
return m_currentPool;
|
||||||
}
|
}
|
||||||
|
@ -63,6 +63,16 @@ void ClientStatus::setCurrentPool(const std::string& currentPool)
|
||||||
m_currentPool = currentPool;
|
m_currentPool = currentPool;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClientStatus::setCurrentAlgoName(const std::string& algoName)
|
||||||
|
{
|
||||||
|
m_currentAlgoName = algoName;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string ClientStatus::getCurrentAlgoName() const
|
||||||
|
{
|
||||||
|
return m_currentAlgoName;
|
||||||
|
}
|
||||||
|
|
||||||
ClientStatus::Status ClientStatus::getCurrentStatus() const
|
ClientStatus::Status ClientStatus::getCurrentStatus() const
|
||||||
{
|
{
|
||||||
return m_currentStatus;
|
return m_currentStatus;
|
||||||
|
@ -178,6 +188,10 @@ bool ClientStatus::parseFromJson(const rapidjson::Document& document)
|
||||||
m_currentStatus = toStatus(clientStatus["current_status"].GetString());
|
m_currentStatus = toStatus(clientStatus["current_status"].GetString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (clientStatus.HasMember("current_algo_name")) {
|
||||||
|
m_currentAlgoName = clientStatus["current_algo_name"].GetString();
|
||||||
|
}
|
||||||
|
|
||||||
if (clientStatus.HasMember("hashrate_short")) {
|
if (clientStatus.HasMember("hashrate_short")) {
|
||||||
m_hashrateShort = clientStatus["hashrate_short"].GetDouble();
|
m_hashrateShort = clientStatus["hashrate_short"].GetDouble();
|
||||||
}
|
}
|
||||||
|
@ -228,6 +242,7 @@ rapidjson::Value ClientStatus::toJson(rapidjson::MemoryPoolAllocator<rapidjson::
|
||||||
clientStatus.AddMember("client_id", rapidjson::StringRef(m_clientId.c_str()), allocator);
|
clientStatus.AddMember("client_id", rapidjson::StringRef(m_clientId.c_str()), allocator);
|
||||||
clientStatus.AddMember("current_pool", rapidjson::StringRef(m_currentPool.c_str()), allocator);
|
clientStatus.AddMember("current_pool", rapidjson::StringRef(m_currentPool.c_str()), allocator);
|
||||||
clientStatus.AddMember("current_status", rapidjson::StringRef(toString(m_currentStatus)), allocator);
|
clientStatus.AddMember("current_status", rapidjson::StringRef(toString(m_currentStatus)), allocator);
|
||||||
|
clientStatus.AddMember("current_algo_name", rapidjson::StringRef(m_currentAlgoName.c_str()), allocator);
|
||||||
|
|
||||||
clientStatus.AddMember("hashrate_short", m_hashrateShort, allocator);
|
clientStatus.AddMember("hashrate_short", m_hashrateShort, allocator);
|
||||||
clientStatus.AddMember("hashrate_medium", m_hashrateMedium, allocator);
|
clientStatus.AddMember("hashrate_medium", m_hashrateMedium, allocator);
|
||||||
|
@ -262,4 +277,3 @@ std::string ClientStatus::toJsonString()
|
||||||
return strdup(buffer.GetString());
|
return strdup(buffer.GetString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -58,12 +58,15 @@ public:
|
||||||
return Status::RUNNING;
|
return Status::RUNNING;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string getClientId() const;
|
std::string getClientId() const;
|
||||||
void setClientId(const std::string& clientId);
|
void setClientId(const std::string& clientId);
|
||||||
|
|
||||||
const std::string getCurrentPool() const;
|
std::string getCurrentPool() const;
|
||||||
void setCurrentPool(const std::string& currentPool);
|
void setCurrentPool(const std::string& currentPool);
|
||||||
|
|
||||||
|
std::string getCurrentAlgoName() const;
|
||||||
|
void setCurrentAlgoName(const std::string &algoName);
|
||||||
|
|
||||||
Status getCurrentStatus() const;
|
Status getCurrentStatus() const;
|
||||||
void setCurrentStatus(Status currentStatus);
|
void setCurrentStatus(Status currentStatus);
|
||||||
|
|
||||||
|
@ -109,6 +112,7 @@ private:
|
||||||
|
|
||||||
std::string m_clientId;
|
std::string m_clientId;
|
||||||
std::string m_currentPool;
|
std::string m_currentPool;
|
||||||
|
std::string m_currentAlgoName;
|
||||||
|
|
||||||
double m_hashrateShort;
|
double m_hashrateShort;
|
||||||
double m_hashrateMedium;
|
double m_hashrateMedium;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue