Merge pull request #7912 from aignatov-bio/ai-sci-11131-hide-archived-rows-from-storage-location-assignment

Hide archived rows and repositories in storage locations assignment modal [SCI-11131]
This commit is contained in:
aignatov-bio 2024-10-03 13:03:44 +02:00 committed by GitHub
commit 56c23a8e8f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 5 deletions

View file

@ -44,11 +44,12 @@ class RepositoriesController < ApplicationController
end end
def list def list
results = @repositories results = @repositories.select(:id, :name, 'LOWER(repositories.name)')
results = results.name_like(params[:query]) if params[:query].present? results = results.name_like(params[:query]) if params[:query].present?
results = results.joins(:repository_rows).distinct if params[:non_empty].present? results = results.joins(:repository_rows).distinct if params[:non_empty].present?
results = results.active if params[:active].present?
render json: { data: results.map { |r| [r.id, r.name] } } render json: { data: results.order('LOWER(repositories.name) asc').map { |r| [r.id, r.name] } }
end end
def rows_list def rows_list
@ -59,7 +60,9 @@ class RepositoriesController < ApplicationController
params[:query] params[:query]
) )
end end
render json: { data: results.map { |r| [r.id, r.name] } } results = results.active if params[:active].present?
render json: { data: results.order('LOWER(repository_rows.name) asc').map { |r| [r.id, r.name] } }
end end
def sidebar def sidebar

View file

@ -48,14 +48,14 @@ export default {
}, },
computed: { computed: {
repositoriesUrl() { repositoriesUrl() {
return list_team_repositories_path(this.teamId, { non_empty: true }); return list_team_repositories_path(this.teamId, { non_empty: true, active: true });
}, },
rowsUrl() { rowsUrl() {
if (!this.selectedRepository) { if (!this.selectedRepository) {
return null; return null;
} }
return rows_list_team_repositories_path(this.teamId); return rows_list_team_repositories_path(this.teamId, { active: true });
} }
}, },
data() { data() {