Commit 97e085fa authored by Matija Čupić's avatar Matija Čupić

Remove artifact searching by job name

Removes artifact searching from this MR. This will be followed up in a
separate issue.
parent c6db352c
...@@ -96,7 +96,7 @@ class Projects::ArtifactsController < Projects::ApplicationController ...@@ -96,7 +96,7 @@ class Projects::ArtifactsController < Projects::ApplicationController
end end
def artifacts_params def artifacts_params
params.permit(:sort, :search) params.permit(:sort)
end end
def validate_artifacts! def validate_artifacts!
......
...@@ -8,17 +8,10 @@ class ArtifactsFinder ...@@ -8,17 +8,10 @@ class ArtifactsFinder
def execute def execute
artifacts = @project.job_artifacts artifacts = @project.job_artifacts
artifacts = by_job_name(artifacts)
sort(artifacts) sort(artifacts)
end end
def by_job_name(artifacts)
return artifacts unless @params[:search].present?
artifacts.search_by_job_name(@params[:search])
end
private private
def sort_key def sort_key
......
...@@ -152,10 +152,6 @@ module Ci ...@@ -152,10 +152,6 @@ module Ci
self.where(project: project).sum(:size) self.where(project: project).sum(:size)
end end
def self.search_by_job_name(job_name)
joins(:job).where(ci_builds: { name: job_name })
end
def local_store? def local_store?
[nil, ::JobArtifactUploader::Store::LOCAL].include?(self.file_store) [nil, ::JobArtifactUploader::Store::LOCAL].include?(self.file_store)
end end
......
...@@ -27,15 +27,5 @@ describe ArtifactsFinder do ...@@ -27,15 +27,5 @@ describe ArtifactsFinder do
expect(subject).to eq(project.job_artifacts.order_by('size_desc')) expect(subject).to eq(project.job_artifacts.order_by('size_desc'))
end end
end end
context 'with job_name param' do
let(:params) { { search: 'unique_name' } }
it 'filters the artifacts by job name' do
build = create(:ci_build, :artifacts, project: project, name: 'unique_name')
expect(subject).to contain_exactly(*build.job_artifacts)
end
end
end end
end end
...@@ -95,17 +95,6 @@ describe Ci::JobArtifact do ...@@ -95,17 +95,6 @@ describe Ci::JobArtifact do
end end
end end
describe '.search_by_job_name' do
subject { described_class.search_by_job_name('unique_name') }
it 'returns only artifacts for specified job name' do
create(:ci_build, :artifacts)
matching_build = create(:ci_build, :artifacts, name: 'unique_name')
expect(subject).to eq(matching_build.job_artifacts)
end
end
describe 'callbacks' do describe 'callbacks' do
subject { create(:ci_job_artifact, :archive) } subject { create(:ci_job_artifact, :archive) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment