Skip to content

Commit

Permalink
Reuse spinner on pulse page instead of always overwriting it
Browse files Browse the repository at this point in the history
The spinner is now always in the same position. It was previously
centered during the initial page load, then on the left whenever
changing the selected period in the dropdown. This was caused by the
HTML and CSS classes which differed.
  • Loading branch information
dmarcoux committed Dec 19, 2018
1 parent 6a429ea commit 632c1d5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
5 changes: 3 additions & 2 deletions src/api/app/views/webui2/webui/projects/pulse/show.html.haml
Expand Up @@ -25,10 +25,11 @@
= link_to(project_pulse_path(@project, range: 'month'), remote: true, type: :json, class: 'dropdown-item') do
One Month
.row
.col#pulse
.col.spinner
.row
.col.text-center
%i.fas.fa-spinner.fa-spin.fa-3x
.col.d-none#pulse

:javascript
$.ajax({
Expand All @@ -38,7 +39,7 @@
});

$(".dropdown-item").click(function() {
$("#pulse").html('<div class="fa-3x"><i class="fas fa-spinner fa-spin"></i></div>')
$('#pulse, .col.spinner').toggleClass('d-none');
// FIXME: No idea why this is needed, maybe remote links are not covered by bootstrap?
$('#period-dropdown').dropdown('toggle')
});
23 changes: 12 additions & 11 deletions src/api/app/views/webui2/webui/projects/pulse/show.js.erb
@@ -1,14 +1,15 @@
$('#range-header').html("<%= escape_javascript(pulse_period(@range)) %>");
$('#range-text').html("<%= @range.titleize %>");
$('#pulse, .col.spinner').toggleClass('d-none');
$('#pulse').html("<%= escape_javascript render partial: 'pulse_list', locals: { requests_by_percentage: @requests_by_percentage,
requests_by_state: @requests_by_state,
project: @project,
commits: @commits,
new_packages: @new_packages,
deleted_packages: @deleted_packages,
updates: @updates,
project_changes: @project_changes,
builds: @builds,
branches: @branches,
comments: @comments,
requests: @requests } %>");
requests_by_state: @requests_by_state,
project: @project,
commits: @commits,
new_packages: @new_packages,
deleted_packages: @deleted_packages,
updates: @updates,
project_changes: @project_changes,
builds: @builds,
branches: @branches,
comments: @comments,
requests: @requests } %>");

0 comments on commit 632c1d5

Please sign in to comment.