Skip to content

Commit

Permalink
Reuse the existing function and handle the additional parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
ncounter committed Mar 28, 2024
1 parent d8758b6 commit f576e51
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src/api/app/assets/javascripts/webui/request.js
Expand Up @@ -185,13 +185,14 @@ function loadDiffs(element){
});
}

function loadChanges(requestNumber, requestActionId) { // jshint ignore:line
$('.loading-diff').removeClass('invisible');
var url = '/request/' + requestNumber + '/request_action/' + requestActionId + '/changes';
function loadChanges(requestNumber, requestActionId, diffToSupersededId) { // jshint ignore:line
$('.tab-content.sourcediff .loading').removeClass('invisible');
var queryString = diffToSupersededId ? '?diff_to_superseded=' + diffToSupersededId : '';
var url = '/request/' + requestNumber + '/request_action/' + requestActionId + '/changes' + queryString;
$.ajax({
url: url,
success: function() {
$('.loading-diff').addClass('invisible');
$('.tab-content.sourcediff .loading').addClass('invisible');
}
});
}
Expand Down
5 changes: 4 additions & 1 deletion src/api/app/components/sourcediff_component.html.haml
Expand Up @@ -2,9 +2,12 @@
.col
- if @action.diff_not_cached
.clearfix.mb-2.text-center
.btn.btn-outline-primary.cache-refresh{ title: 'Refresh results', onclick: "loadChanges(#{@bs_request.number}, #{@action.id});" }
.btn.btn-outline-primary.cache-refresh{ title: 'Refresh results', onclick: "loadChanges(#{@bs_request.number}, #{@action.id}, #{@diff_to_superseded&.number});" }
Crunching the latest data. Refresh again in a few seconds
%i.fas.fa-sync-alt{ id: "cache#0-reload" }
.text-center.p-4.loading.invisible
%i.fas.fa-spinner.fa-spin.me-1
Loading changes...
- else
- (@action.webui_sourcediff).each do |sourcediff|
.clearfix.mb-2
Expand Down

0 comments on commit f576e51

Please sign in to comment.