Call task checkStateState after status update [SCI-10198] (#7272)

This commit is contained in:
wandji 2024-03-14 13:15:32 +01:00 committed by GitHub
parent 8300c2c3c3
commit 8165f46f3f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 3 deletions

View file

@ -1,4 +1,4 @@
/* global animateSpinner */
/* global animateSpinner GLOBAL_CONSTANTS */
(function() {
$('.task-sharing-and-flows').on('click', '#viewTaskFlow', function() {
@ -19,7 +19,7 @@
if (statusData.status_changing) {
setTimeout(() => { checkStatusState(); }, GLOBAL_CONSTANTS.FAST_STATUS_POLLING_INTERVAL);
} else {
location.reload();
$('.task-sharing-and-flows .status-flow-container').replaceWith(statusData.html);
}
});
}
@ -45,6 +45,9 @@
success: function(result) {
animateSpinner(null, false);
$('.task-sharing-and-flows .status-flow-container').replaceWith(result.html);
if (result.status_changing) {
setTimeout(() => { checkStatusState(); }, GLOBAL_CONSTANTS.FAST_STATUS_POLLING_INTERVAL);
}
},
error: function(e) {
animateSpinner(null, false);

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class MyModulesController < ApplicationController
include TeamsHelper
include ActionView::Helpers::TextHelper
@ -121,8 +123,16 @@ class MyModulesController < ApplicationController
if @my_module.last_transition_error && @my_module.last_transition_error['type'] == 'repository_snapshot'
flash[:repository_snapshot_error] = @my_module.last_transition_error
end
response = { status_changing: @my_module.status_changing? }
unless @my_module.status_changing?
response[:html] = render_to_string(
partial: 'my_modules/status_flow/task_flow_button',
locals: { my_module: @my_module },
formats: :html
)
end
render json: { status_changing: @my_module.status_changing? }
render json: response
end
def canvas_dropdown_menu
@ -379,6 +389,7 @@ class MyModulesController < ApplicationController
render json: {
status: :changed,
status_changing: @my_module.status_changing?,
html: render_to_string(
partial: 'my_modules/status_flow/task_flow_button',
locals: { my_module: @my_module },