1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

Change page reload on ajax request in livepoll mode [skip ci]

This commit is contained in:
Anton Davydov 2015-03-26 22:47:10 +03:00
parent 087bd0354b
commit c168362226
3 changed files with 16 additions and 3 deletions

View file

@ -1,6 +1,7 @@
HEAD
-----------
- Change page reload on ajax request in livepoll mode [#2266]
- **Improve ActiveJob integration** - Web UI now shows ActiveJobs in a
nicer format and job logging shows the actual class name [#2248, #2259]
- Add Sidekiq::Process#dump\_threads API to trigger TTIN output [#2247]

View file

@ -42,3 +42,15 @@ $(function() {
$($(this).attr('data-target')).toggle();
});
});
function updatePage(url) {
setInterval(function () {
$.ajax({
url: url,
dataType: 'html'
}).done(function (data) {
var $page = $(data).filter('#page')
$('#page').replaceWith($page)
})
}, parseInt(localStorage.timeInterval) || 2000);
}

View file

@ -1,10 +1,10 @@
<% if current_path != '' %>
<% if params[:poll] %>
<script>
setInterval("window.location.reload(true)", parseInt(localStorage.timeInterval) || 2000);
updatePage('<%= root_path + current_path %>')
</script>
<a id="live-poll" class="btn btn-primary active" href="<%= root_path %><%= current_path %>"><%= t('StopPolling') %></a>
<a id="live-poll" class="btn btn-primary active" href="<%= root_path + current_path %>"><%= t('StopPolling') %></a>
<% else %>
<a id="live-poll" class="btn btn-primary" href="<%= root_path %><%= current_path %>?<%= qparams(poll: true) %>"><%= t('LivePoll') %></a>
<a id="live-poll" class="btn btn-primary" href="<%= root_path + current_path %>?<%= qparams(poll: true) %>"><%= t('LivePoll') %></a>
<% end %>
<% end %>