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

Calculate spinner and hide next button #536

Merged
merged 3 commits into from
Nov 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions ui/runs/static/runs/runs.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,14 @@ $(document).ready(function () {
let id = $(this).attr("id");
$('#chosen-' + id).text(this.files[0].name);
});


// calculate button spinner
$('.calculateSpinner').on('click', function() {
// Change button content to show 'Calculating...' with a spinner
$(this).html(`
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
Calculating...
`);
});
});
21 changes: 13 additions & 8 deletions ui/runs/templates/runs/details.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
{% endblock %}

{% block content %}

<div class="wrapper">
<div class="wrapper">
{# include sidebar #}
<nav id="sidebar" class="border border-end-0 border-top-0 border-bottom-0">
{{ sidebar }}
Expand Down Expand Up @@ -140,8 +140,10 @@ <h3>{{ display_name }}</h3>
</div>
{% endfor %}
</div>
<input type="submit" id="calculate_parameters_submit" value="Calculate"
class="btn btn-red">
<button type="submit" id="calculate_parameters_submit"
class="btn btn-red calculateSpinner">
Calculate
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ein kleine Frage: Ist Calculate hier einfach der Value des Buttons bevor er gedrückt wird und nur eine andere Schreibweise als vorher?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ja, genau. Calculate ist hier nur der Text, der auf dem Button angezeigt wird.
Wenn man zusätzlich noch name und value angeben würde, würden die Werte als name=value mit dem Form übermittelt werden. Vorher beim Input war der Unterscheid, dass ein Input kein Start und End-Tag hat, sondern nur aus einem Tag besteht, sodass hier der Text nicht zwischen die Tags geschrieben werden kann. Bei diesem Wird dann value als Anzeigetext verwendet.
Wenn dich das noch genauer interessiert, ist diese Website ganz gut zum herumspielen: https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_input_test

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay danke! Das schaue ich mir mal an, habe damit bisher noch nicht so viel Kontakt gehabt!

</button>
</form>
</div>
<div class="col">
Expand Down Expand Up @@ -174,8 +176,10 @@ <h3>{{ display_name }}</h3>
{% endfor %}
</div>
<div class="form-group">
<input type="submit" value="Calculate" id="calculate_parameters_submit"
class="btn btn-red mr-auto">
<button type="submit" id="calculate_parameters_submit"
class="btn btn-red mr-auto calculateSpinner">
Calculate
</button>
{% if section == "data_preprocessing" %}
<a href="{% url 'runs:plot' run_name %}" id="plot_parameters_submit" class="btn btn-grey {% if not show_plot_button %} disabled {% endif %}">Plot</a>
{% endif %}
Expand Down Expand Up @@ -277,8 +281,9 @@ <h5 class="modal-title" id="calculationInProgressModalLabel">Do you want back?</
</div>
</div>
{% endif %}
<button class="btn btn-red" {% if not results_exist or last_step %} disabled {% endif %}>Next
</button>
{% if not last_step %}
<button class="btn btn-red" {% if not results_exist %} disabled {% endif %} >Next</button>
{% endif %}
</div>
</form>
</div>
Expand Down
Loading