Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

312 312 fixing selection in each step after calculating is resetting #334

Merged
2 changes: 2 additions & 0 deletions ui/runs/templates/runs/details.html
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,11 @@ <h3>{{ display_name }}</h3>
<form action="{% url 'runs:plot' run_name %}" id="plot_form" method="post"
enctype="multipart/form-data">
{% csrf_token %}
<fieldset id="plotfields">
<div id="plot_parameters" class="mb-2">
{% include "runs/fields.html" with fields=plot_fields %}
</div>
</fieldset>
<input type="submit" id="plot_parameters_submit" value="Plot" class="btn btn-grey">
</form>
</div>
Expand Down
18 changes: 16 additions & 2 deletions ui/runs/templates/runs/form_buttons.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@
calc_params_match = bool;
}

function disable_plot_fields(bool) {
$('#plotfields').prop('disabled', bool);
}

function isEmptyDict(obj) {
return Object.keys(obj).length == 0;
}
Expand Down Expand Up @@ -113,26 +117,35 @@
}

$(document).ready(function () {
disable_calc_button(false);
// disable only when a plot-form exists, so it can be reactivated by appropriate change (-> Outlier Detection)
if($('#plot_form').find('input').length) {
disable_plot_button(true);
disable_plot_fields(true);
}

$('#calc_form').change(function () {
const selected_method = $('#chosen_method').val();
calc_form_data = get_clean_form_data($(this));
if (equal_calc_parameters($(this)) && (calculated_method === selected_method)) {
disable_calc_button(true);
disable_plot_fields(false);
} else {
disable_calc_button(false);
disable_plot_fields(true);
}
$('#plot_form').trigger("change");
});

$('#plot_form').change(function () {
const selected_method = $('#chosen_method').val();
if (!calc_form_data || selected_method !== calculated_method) {

if (plotted_current_match() && equal_plot_parameters($(this))) {
disable_plot_button(true);
}

if (!calc_form_data || selected_method !== calculated_method) {
disable_plot_button(true)
return;
}

Expand All @@ -143,7 +156,8 @@

if (equal_plot_parameters($(this)) || !calc_params_match) {
disable_plot_button(true);
} else {
}
else {
disable_plot_button(false);
}
});
Expand Down
Loading