Skip to content

Commit

Permalink
Merge pull request #187 from guydavis/develop
Browse files Browse the repository at this point in the history
Fix for script ordering.  Patch Chiadog to disable partial proofs spam.
  • Loading branch information
guydavis authored Jul 16, 2021
2 parents c02630d + 516c9c0 commit 25bfca6
Show file tree
Hide file tree
Showing 12 changed files with 222 additions and 221 deletions.
6 changes: 6 additions & 0 deletions scripts/chiadog_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ cd /

git clone https://github.com/martomi/chiadog.git

# Temporary patch for spam about partial proofs
# https://github.com/martomi/chiadog/issues/252#issuecomment-877416135

cd /chiadog/src/chia_log/handlers/
sed -i 's/FoundProofs(),//g' harvester_activity_handler.py

cd /chia-blockchain/

# Chia-blockchain needs PyYAML=5.4.1 but Chiadog wants exactly 5.4
Expand Down
2 changes: 0 additions & 2 deletions web/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,6 @@ def settings_plotting():
if request.method == 'POST':
selected_worker_hostname = request.form.get('worker')
plotman.save_config(worker.get_worker_by_hostname(selected_worker_hostname), request.form.get("config"))
else:
flash('Automatically set your public key values below. Please review and save the config at least once!', 'message')
workers_summary = worker.load_worker_summary()
selected_worker = find_selected_worker(workers_summary, selected_worker_hostname)
return render_template('settings/plotting.html',
Expand Down
52 changes: 22 additions & 30 deletions web/templates/alerts.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,6 @@

{% block content %}

<script>
function MonitoringLogs(hostname, blockchain) {
var d = new Date();
var height = 600;
var width = 900;
var top = (screen.height - height) / 2;
var left = (screen.width - width) / 2;
window.open("{{ url_for('logs') }}?log=alerts&hostname=" + hostname + "&blockchain=" + blockchain, 'Chiadog Log on ' + hostname, 'resizeable=yes,scrollbars=yes,height=' + height + ',width=' + width + ',top=' + top + ',left=' + left).focus();
}
function MonitoringAction(hostname, service, action, status) {
$("#"+hostname+"_btn").prop("disabled", true);
$("#"+hostname+"_btn").html(
'<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> '+ hostname + ': ' + status + '...'
);
$('#chiadog-form').append('<input type="hidden" id="action" name="action" value="' + action + '" />');
$('#chiadog-form').append('<input type="hidden" id="service" name="service" value="' + service + '" />');
$('#chiadog-form').append('<input type="hidden" id="hostname" name="hostname" value="' + hostname + '" />');
$("#chiadog-form").submit();
}
</script>

<header class="pb-3 mb-4 border-bottom">
<span class="fs-4">Alerts: Recent Notifications</span>
</header>
Expand Down Expand Up @@ -123,8 +102,30 @@ <h6>Expect at least a summary notification once daily as long as running above.<
</div>
{% endif %}

{% endblock %}

{% block scripts %}
<script>
function MonitoringLogs(hostname, blockchain) {
var d = new Date();
var height = 600;
var width = 900;
var top = (screen.height - height) / 2;
var left = (screen.width - width) / 2;
window.open("{{ url_for('logs') }}?log=alerts&hostname=" + hostname + "&blockchain=" + blockchain, 'Chiadog Log on ' + hostname, 'resizeable=yes,scrollbars=yes,height=' + height + ',width=' + width + ',top=' + top + ',left=' + left).focus();
}
function MonitoringAction(hostname, service, action, status) {
$("#"+hostname+"_btn").prop("disabled", true);
$("#"+hostname+"_btn").html(
'<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> '+ hostname + ': ' + status + '...'
);
$('#chiadog-form').append('<input type="hidden" id="action" name="action" value="' + action + '" />');
$('#chiadog-form').append('<input type="hidden" id="service" name="service" value="' + service + '" />');
$('#chiadog-form').append('<input type="hidden" id="hostname" name="hostname" value="' + hostname + '" />');
$("#chiadog-form").submit();
}
$(document).ready(function () {
$('#data').DataTable();
$("#btnStart").click(function () {
$(this).prop("disabled", true);
$(this).html(
Expand All @@ -139,15 +140,6 @@ <h6>Expect at least a summary notification once daily as long as running above.<
);
$("#chiadog-form").submit();
});
})
</script>

{% endblock %}

{% block scripts %}
<script>
$(document).ready(function () {
$('#data').DataTable();
});
</script>
{% endblock %}
55 changes: 26 additions & 29 deletions web/templates/farming.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,6 @@

{% block content %}

<script>
function ViewLogs(hostname, blockchain) {
var d = new Date();
var height = 600;
var width = 900;
var top = (screen.height - height) / 2;
var left = (screen.width - width) / 2;
window.open("{{ url_for('logs') }}?log=farming" + "&hostname=" + hostname + "&blockchain=" + blockchain, 'Farming Log for ' + blockchain + ' on ' + hostname, 'resizeable=yes,scrollbars=yes,height=' + height + ',width=' + width + ',top=' + top + ',left=' + left).focus();
}
function CheckPlots(hostname) {
var d = new Date();
var height = 600;
var width = 900;
var top = (screen.height - height) / 2;
var left = (screen.width - width) / 2;
window.open("{{ url_for('plots_check') }}?hostname=" + hostname, 'Plots Check on ' + hostname, 'resizeable=yes,scrollbars=yes,height=' + height + ',width=' + width + ',top=' + top + ',left=' + left).focus();
}
function PlotJobAnalyze(plot) {
var output = document.getElementById('plotAnalyzeContent');
output.textContent = ""; // Clear any old analysis before requesting
var xhr = new XMLHttpRequest();
xhr.open('GET', "{{ url_for('farming') }}?analyze=" + plot);
xhr.send();
xhr.onload = function () {
output.textContent = xhr.responseText;
};
}
</script>

<header class="pb-3 mb-4 border-bottom">
<div class="row align-items-md-stretch" style="width:100%">
<div class="col-md-4 fs-4">Farming: {{ farming.plot_count }} plots.</div>
Expand Down Expand Up @@ -151,6 +122,32 @@ <h5 class="modal-title" id="analyzeModalLabel">Plotting Analysis</h5>

{% block scripts %}
<script>
function ViewLogs(hostname, blockchain) {
var d = new Date();
var height = 600;
var width = 900;
var top = (screen.height - height) / 2;
var left = (screen.width - width) / 2;
window.open("{{ url_for('logs') }}?log=farming" + "&hostname=" + hostname + "&blockchain=" + blockchain, 'Farming Log for ' + blockchain + ' on ' + hostname, 'resizeable=yes,scrollbars=yes,height=' + height + ',width=' + width + ',top=' + top + ',left=' + left).focus();
}
function CheckPlots(hostname) {
var d = new Date();
var height = 600;
var width = 900;
var top = (screen.height - height) / 2;
var left = (screen.width - width) / 2;
window.open("{{ url_for('plots_check') }}?hostname=" + hostname, 'Plots Check on ' + hostname, 'resizeable=yes,scrollbars=yes,height=' + height + ',width=' + width + ',top=' + top + ',left=' + left).focus();
}
function PlotJobAnalyze(plot) {
var output = document.getElementById('plotAnalyzeContent');
output.textContent = ""; // Clear any old analysis before requesting
var xhr = new XMLHttpRequest();
xhr.open('GET', "{{ url_for('farming') }}?analyze=" + plot);
xhr.send();
xhr.onload = function () {
output.textContent = xhr.responseText;
};
}
$(document).ready(function () {
$('#data').DataTable();
});
Expand Down
18 changes: 11 additions & 7 deletions web/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,17 @@ <h6 class="display-6 text-center">Flax Netspace Size</h6>
</div>
{% endif %}

{% if global_config.farming_enabled %}
<div class="col-md-12" style="margin-top:5px; margin-bottom:5px;">
<div class="h-100 p-2 text-white bg-dark rounded-3" id="challenges-table-div">
{% include 'views/challenges.html' %}
</div>
</div>
{% endif %}

{% endblock %}

{% block scripts %}
{% if global_config.farming_enabled %}
<script>
setInterval(function () {
Expand All @@ -134,12 +145,5 @@ <h6 class="display-6 text-center">Flax Netspace Size</h6>
});
}, 1000 * 5);
</script>
<div class="col-md-12" style="margin-top:5px; margin-bottom:5px;">
<div class="h-100 p-2 text-white bg-dark rounded-3" id="challenges-table-div">
{% include 'views/challenges.html' %}
</div>
</div>

{% endif %}

{% endblock %}
1 change: 0 additions & 1 deletion web/templates/logs.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
<script>
load_log_file(); // Load once initally
</script>

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
integrity="sha384-JEW9xMcG8R+pH31jmWH6WWP0WintQrMb4s7ZOdauHnUtxwoG2vI5DkLtS3qm9Ekf"
crossorigin="anonymous"></script>
Expand Down
59 changes: 26 additions & 33 deletions web/templates/plotting.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,6 @@

{% block content %}

<script>
function PlottingLogs(type, hostname, plot_id) {
var d = new Date();
var height = 600;
var width = 900;
var top = (screen.height - height) / 2;
var left = (screen.width - width) / 2;
if (typeof plot_id !== 'undefined') {
window.open("{{ url_for('logs') }}?log=" + type + "&hostname=" + hostname + "&log_id=" + plot_id, 'Plotman Log ' + plot_id + ' on ' + hostname, 'resizeable=yes,scrollbars=yes,height=' + height + ',width=' + width + ',top=' + top + ',left=' + left).focus();
} else {
window.open("{{ url_for('logs') }}?log=" + type + "&hostname=" + hostname, 'Plotman Log on ' + hostname, 'resizeable=yes,scrollbars=yes,height=' + height + ',width=' + width + ',top=' + top + ',left=' + left).focus();
}
}
function PlottingAction(hostname, service, action, status) {
$("#"+hostname+"_btn").prop("disabled", true);
$("#"+hostname+"_btn").html(
'<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> '+ hostname + ': ' + status + '...'
);
$('#plotman-form').append('<input type="hidden" id="action" name="action" value="' + action + '" />');
$('#plotman-form').append('<input type="hidden" id="service" name="service" value="' + service + '" />');
$('#plotman-form').append('<input type="hidden" id="hostname" name="hostname" value="' + hostname + '" />');
$("#plotman-form").submit();
}
</script>

<header class="pb-3 mb-4 border-bottom">
<span class="fs-4">Plotting Status: {{ plotting.display_status }}
{% if plotting.display_status == 'Active' %}
Expand Down Expand Up @@ -179,8 +154,34 @@ <h5 class="modal-title" id="killModalLabel">Confirm Kill</h5>
{% endif %}
</form>

{% endblock %}

{% block scripts %}
<script>
function PlottingLogs(type, hostname, plot_id) {
var d = new Date();
var height = 600;
var width = 900;
var top = (screen.height - height) / 2;
var left = (screen.width - width) / 2;
if (typeof plot_id !== 'undefined') {
window.open("{{ url_for('logs') }}?log=" + type + "&hostname=" + hostname + "&log_id=" + plot_id, 'Plotman Log ' + plot_id + ' on ' + hostname, 'resizeable=yes,scrollbars=yes,height=' + height + ',width=' + width + ',top=' + top + ',left=' + left).focus();
} else {
window.open("{{ url_for('logs') }}?log=" + type + "&hostname=" + hostname, 'Plotman Log on ' + hostname, 'resizeable=yes,scrollbars=yes,height=' + height + ',width=' + width + ',top=' + top + ',left=' + left).focus();
}
}
function PlottingAction(hostname, service, action, status) {
$("#"+hostname+"_btn").prop("disabled", true);
$("#"+hostname+"_btn").html(
'<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> '+ hostname + ': ' + status + '...'
);
$('#plotman-form').append('<input type="hidden" id="action" name="action" value="' + action + '" />');
$('#plotman-form').append('<input type="hidden" id="service" name="service" value="' + service + '" />');
$('#plotman-form').append('<input type="hidden" id="hostname" name="hostname" value="' + hostname + '" />');
$("#plotman-form").submit();
}
$(document).ready(function () {
$('#data').DataTable();
$("#btnSuspend").click(function () {
$(this).prop("disabled", true);
$(this).html(
Expand All @@ -205,14 +206,6 @@ <h5 class="modal-title" id="killModalLabel">Confirm Kill</h5>
$('#plotting-form').append('<input type="hidden" id="action" name="action" value="kill" />');
$("#plotting-form").submit();
});
})
</script>
{% endblock %}

{% block scripts %}
<script>
$(document).ready(function () {
$('#data').DataTable();
});
</script>
{% endblock %}
65 changes: 34 additions & 31 deletions web/templates/settings/alerts.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,37 +32,6 @@
{% endwith %}
</div>

<script>
$(document).ready(function () {
function load_config(worker, blockchain) {
$.ajax({
type: "GET",
url: "{{ url_for('views_settings_config') }}?type=alerts&worker=" + worker + "&blockchain=" + blockchain,
})
.done(function (data) {
//console.log(data);
$("#config").val(data)
}).fail(function (jqXHR, textStatus, errorThrown) {
console.log(jqXHR, textStatus, errorThrown);
});
}
//Call the function when #input is clicked
$(document).on("change", "#worker", function (e) {
load_config($("#worker").val(), $("#blockchain").val())
});
$(document).on("change", "#blockchain", function (e) {
load_config($("#worker").val(), $("#blockchain").val())
});
//Call the function when the page loads
load_config("{{selected_worker.hostname}}", "{{selected_blockchain}}");
});

function downloadConfig() {
worker = $("#worker").val()
blockchain = $("#blockchain").val()
window.location.href = '/settings/config/' + worker + '_'+ blockchain + 'dog_config.yaml?type=alerts&worker=' + worker + "&blockchain=" + blockchain
}
</script>
<form method="POST">
<fieldset>
<div class="row mb-3">
Expand Down Expand Up @@ -99,4 +68,38 @@
</fieldset>
</form>

{% endblock %}

{% block scripts %}
<script>
$(document).ready(function () {
function load_config(worker, blockchain) {
$.ajax({
type: "GET",
url: "{{ url_for('views_settings_config') }}?type=alerts&worker=" + worker + "&blockchain=" + blockchain,
})
.done(function (data) {
//console.log(data);
$("#config").val(data)
}).fail(function (jqXHR, textStatus, errorThrown) {
console.log(jqXHR, textStatus, errorThrown);
});
}
//Call the function when #input is clicked
$(document).on("change", "#worker", function (e) {
load_config($("#worker").val(), $("#blockchain").val())
});
$(document).on("change", "#blockchain", function (e) {
load_config($("#worker").val(), $("#blockchain").val())
});
//Call the function when the page loads
load_config("{{selected_worker.hostname}}", "{{selected_blockchain}}");
});

function downloadConfig() {
worker = $("#worker").val()
blockchain = $("#blockchain").val()
window.location.href = '/settings/config/' + worker + '_'+ blockchain + 'dog_config.yaml?type=alerts&worker=' + worker + "&blockchain=" + blockchain
}
</script>
{% endblock %}
Loading

0 comments on commit 25bfca6

Please sign in to comment.