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 {
};
},
computed: {
displayPipelineActions() {
return (
this.pipeline.flags.retryable ||
this.pipeline.flags.cancelable ||
this.pipeline.details.manual_actions.length ||
this.pipeline.details.has_downloadable_artifacts
);
},
actions() {
if (!this.pipeline || !this.pipeline.details) {
return [];
......@@ -54,9 +46,6 @@ export default {
isCancelling() {
return this.cancelingPipeline === this.pipeline.id;
},
showArtifacts() {
return this.pipeline.details.has_downloadable_artifacts;
},
},
watch: {
pipeline() {
......@@ -79,7 +68,7 @@ export default {
</script>
<template>
<div v-if="displayPipelineActions" class="gl-text-right">
<div class="gl-text-right">
<div class="btn-group">
<pipelines-manual-actions v-if="actions.length > 0" :actions="actions" />
......@@ -113,7 +102,7 @@ export default {
@click="handleCancelClick"
/>
<pipeline-multi-actions v-if="showArtifacts" :pipeline-id="pipeline.id" />
<pipeline-multi-actions :pipeline-id="pipeline.id" />
</div>
</div>
</template>
......@@ -1076,14 +1076,6 @@ module Ci
complete? && builds.latest.with_exposed_artifacts.exists?
end
def has_downloadable_artifacts?
if downloadable_artifacts.loaded?
downloadable_artifacts.any?
else
downloadable_artifacts.exists?
end
end
def branch_updated?
strong_memoize(:branch_updated) do
push_details.branch_updated?
......
......@@ -8,7 +8,6 @@ class PipelineDetailsEntity < Ci::PipelineEntity
end
expose :details do
expose :has_downloadable_artifacts?, as: :has_downloadable_artifacts
expose :artifacts, unless: proc { options[:disable_artifacts] } do |pipeline, options|
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
.not_to exceed_query_limit(control_count)
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
......@@ -32,7 +32,7 @@ RSpec.describe PipelineDetailsEntity do
expect(subject[:details])
.to include :duration, :finished_at
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
end
......@@ -186,35 +186,5 @@ RSpec.describe PipelineDetailsEntity do
end
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
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