Merge pull request #2593 from mlorb/ml-sci-4649

Expand assigned inventory after updating assigned items on task [SCI-4649]
This commit is contained in:
Alex Kriuchykhin 2020-05-22 11:07:27 +02:00 committed by GitHub
commit 43166ab6d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 3 deletions

View file

@ -11,11 +11,14 @@ var MyModuleRepositories = (function() {
var FULL_VIEW_TABLE_SCROLLBAR;
var SELECTED_ROWS = {};
function reloadRepositoriesList() {
function reloadRepositoriesList(repositoryId) {
var repositoriesContainer = $('#assigned-items-container');
$.get(repositoriesContainer.data('repositories-list-url'), function(result) {
repositoriesContainer.html(result.html);
$('.assigned-items-title').attr('data-assigned-items-count', result.assigned_rows_count);
// expand recently updated repository
$('#assigned-items-container').collapse('show');
$('#assigned-repository-items-container-' + repositoryId).collapse('show');
});
}
@ -600,7 +603,7 @@ var MyModuleRepositories = (function() {
$(FULL_VIEW_TABLE.table().container()).find('.dataTable')
.attr('data-assigned-items-count', data.rows_count);
FULL_VIEW_TABLE.ajax.reload(null, false);
reloadRepositoriesList();
reloadRepositoriesList(data.repository_id);
updateFullViewRowsCount(data.rows_count);
renderFullViewAssignButtons();
},

View file

@ -52,7 +52,11 @@ class MyModuleRepositoriesController < ApplicationController
respond_to do |format|
format.json do
render json: { flash: flash, rows_count: @my_module.repository_rows_count(@repository) }, status: status
render json: {
flash: flash,
rows_count: @my_module.repository_rows_count(@repository),
repository_id: @repository.repository_snapshots.find_by(selected: true)&.id || @repository.id
}, status: status
end
end
end