Commit 29537456 authored by Maxime Orefice's avatar Maxime Orefice

Stop exposing has_downloadable_artifacts from pipelines.json

This commit stop exposing a new attribute which allowed us to
determine when showing our download dropdown button on the
pipeline index page. We will now always display it by default.
parent 05c87a33
...@@ -36,14 +36,6 @@ export default { ...@@ -36,14 +36,6 @@ export default {
}; };
}, },
computed: { computed: {
displayPipelineActions() {
return (
this.pipeline.flags.retryable ||
this.pipeline.flags.cancelable ||
this.pipeline.details.manual_actions.length ||
this.pipeline.details.has_downloadable_artifacts
);
},
actions() { actions() {
if (!this.pipeline || !this.pipeline.details) { if (!this.pipeline || !this.pipeline.details) {
return []; return [];
...@@ -54,9 +46,6 @@ export default { ...@@ -54,9 +46,6 @@ export default {
isCancelling() { isCancelling() {
return this.cancelingPipeline === this.pipeline.id; return this.cancelingPipeline === this.pipeline.id;
}, },
showArtifacts() {
return this.pipeline.details.has_downloadable_artifacts;
},
}, },
watch: { watch: {
pipeline() { pipeline() {
...@@ -79,7 +68,7 @@ export default { ...@@ -79,7 +68,7 @@ export default {
</script> </script>
<template> <template>
<div v-if="displayPipelineActions" class="gl-text-right"> <div class="gl-text-right">
<div class="btn-group"> <div class="btn-group">
<pipelines-manual-actions v-if="actions.length > 0" :actions="actions" /> <pipelines-manual-actions v-if="actions.length > 0" :actions="actions" />
...@@ -113,7 +102,7 @@ export default { ...@@ -113,7 +102,7 @@ export default {
@click="handleCancelClick" @click="handleCancelClick"
/> />
<pipeline-multi-actions v-if="showArtifacts" :pipeline-id="pipeline.id" /> <pipeline-multi-actions :pipeline-id="pipeline.id" />
</div> </div>
</div> </div>
</template> </template>
...@@ -1076,14 +1076,6 @@ module Ci ...@@ -1076,14 +1076,6 @@ module Ci
complete? && builds.latest.with_exposed_artifacts.exists? complete? && builds.latest.with_exposed_artifacts.exists?
end end
def has_downloadable_artifacts?
if downloadable_artifacts.loaded?
downloadable_artifacts.any?
else
downloadable_artifacts.exists?
end
end
def branch_updated? def branch_updated?
strong_memoize(:branch_updated) do strong_memoize(:branch_updated) do
push_details.branch_updated? push_details.branch_updated?
......
...@@ -8,7 +8,6 @@ class PipelineDetailsEntity < Ci::PipelineEntity ...@@ -8,7 +8,6 @@ class PipelineDetailsEntity < Ci::PipelineEntity
end end
expose :details do expose :details do
expose :has_downloadable_artifacts?, as: :has_downloadable_artifacts
expose :artifacts, unless: proc { options[:disable_artifacts] } do |pipeline, options| expose :artifacts, unless: proc { options[:disable_artifacts] } do |pipeline, options|
rel = pipeline.downloadable_artifacts rel = pipeline.downloadable_artifacts
......
---
title: Stop exposing has_downloadable_artifacts in pipelines.json
merge_request: 60950
author:
type: performance
...@@ -4491,18 +4491,4 @@ RSpec.describe Ci::Pipeline, :mailer, factory_default: :keep do ...@@ -4491,18 +4491,4 @@ RSpec.describe Ci::Pipeline, :mailer, factory_default: :keep do
.not_to exceed_query_limit(control_count) .not_to exceed_query_limit(control_count)
end end
end end
describe '#has_downloadable_artifacts?' do
it 'returns false when when pipeline does not have downloadable artifacts' do
pipeline = create(:ci_pipeline, :success)
expect(pipeline.has_downloadable_artifacts?). to eq(false)
end
it 'returns false when when pipeline does not have downloadable artifacts' do
pipeline = create(:ci_pipeline, :with_codequality_reports)
expect(pipeline.has_downloadable_artifacts?). to eq(true)
end
end
end end
...@@ -32,7 +32,7 @@ RSpec.describe PipelineDetailsEntity do ...@@ -32,7 +32,7 @@ RSpec.describe PipelineDetailsEntity do
expect(subject[:details]) expect(subject[:details])
.to include :duration, :finished_at .to include :duration, :finished_at
expect(subject[:details]) expect(subject[:details])
.to include :stages, :artifacts, :has_downloadable_artifacts, :manual_actions, :scheduled_actions .to include :stages, :artifacts, :manual_actions, :scheduled_actions
expect(subject[:details][:status]).to include :icon, :favicon, :text, :label expect(subject[:details][:status]).to include :icon, :favicon, :text, :label
end end
...@@ -186,35 +186,5 @@ RSpec.describe PipelineDetailsEntity do ...@@ -186,35 +186,5 @@ RSpec.describe PipelineDetailsEntity do
end end
it_behaves_like 'public artifacts' it_behaves_like 'public artifacts'
context 'when pipeline has downloadable artifacts' do
subject(:entity) { described_class.represent(pipeline, request: request, disable_artifacts: disable_artifacts).as_json }
let_it_be(:pipeline) { create(:ci_pipeline, :with_codequality_reports) }
context 'when disable_artifacts is true' do
subject(:entity) { described_class.represent(pipeline, request: request, disable_artifacts: true).as_json }
it 'excludes artifacts data' do
expect(entity[:details]).not_to include(:artifacts)
end
it 'returns true for has_downloadable_artifacts' do
expect(entity[:details][:has_downloadable_artifacts]).to eq(true)
end
end
context 'when disable_artifacts is false' do
subject(:entity) { described_class.represent(pipeline, request: request, disable_artifacts: false).as_json }
it 'includes artifacts data' do
expect(entity[:details]).to include(:artifacts)
end
it 'returns true for has_downloadable_artifacts' do
expect(entity[:details][:has_downloadable_artifacts]).to eq(true)
end
end
end
end end
end end
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