diff options
Diffstat (limited to 'app')
6 files changed, 92 insertions, 9 deletions
diff --git a/app/assets/javascripts/ci/pipeline_schedules/components/pipeline_schedules.vue b/app/assets/javascripts/ci/pipeline_schedules/components/pipeline_schedules.vue index db55fd96ad0..d03de91ea07 100644 --- a/app/assets/javascripts/ci/pipeline_schedules/components/pipeline_schedules.vue +++ b/app/assets/javascripts/ci/pipeline_schedules/components/pipeline_schedules.vue @@ -19,6 +19,7 @@ import getPipelineSchedulesQuery from '../graphql/queries/get_pipeline_schedules import PipelineSchedulesTable from './table/pipeline_schedules_table.vue'; import TakeOwnershipModal from './take_ownership_modal.vue'; import DeletePipelineScheduleModal from './delete_pipeline_schedule_modal.vue'; +import PipelineScheduleEmptyState from './pipeline_schedules_empty_state.vue'; export default { i18n: { @@ -48,6 +49,7 @@ export default { GlLink, PipelineSchedulesTable, TakeOwnershipModal, + PipelineScheduleEmptyState, }, inject: { fullPath: { @@ -249,6 +251,7 @@ export default { </gl-alert> <gl-tabs + v-if="isLoading || count > 0" sync-active-tab-with-query-params query-param-name="scope" nav-class="gl-flex-grow-1 gl-align-items-center" @@ -289,6 +292,8 @@ export default { </template> </gl-tabs> + <pipeline-schedule-empty-state v-else-if="!isLoading && count === 0" /> + <take-ownership-modal :visible="showTakeOwnershipModal" @takeOwnership="takeOwnership" diff --git a/app/assets/javascripts/ci/pipeline_schedules/components/pipeline_schedules_empty_state.vue b/app/assets/javascripts/ci/pipeline_schedules/components/pipeline_schedules_empty_state.vue new file mode 100644 index 00000000000..f633ba053ee --- /dev/null +++ b/app/assets/javascripts/ci/pipeline_schedules/components/pipeline_schedules_empty_state.vue @@ -0,0 +1,63 @@ +<script> +import scheduleSvg from '@gitlab/svgs/dist/illustrations/schedule-md.svg'; +import { GlEmptyState, GlLink, GlSprintf } from '@gitlab/ui'; +import { helpPagePath } from '~/helpers/help_page_helper'; +import { s__ } from '~/locale'; + +export default { + i18n: { + pipelineSchedules: s__('PipelineSchedules|Pipeline schedules'), + description: s__( + 'PipelineSchedules|A scheduled pipeline starts automatically at regular intervals, like daily or weekly. The pipeline: ', + ), + learnMore: s__( + 'PipelineSchedules|Learn more in the %{linkStart}scheduled pipelines documentation.%{linkEnd}', + ), + listElements: [ + s__('PipelineSchedules|Runs for a specific branch or tag.'), + s__('PipelineSchedules|Can have custom CI/CD variables.'), + s__('PipelineSchedules|Runs with the same project permissions as the schedule owner.'), + ], + createNew: s__('PipelineSchedules|Create a new pipeline schedule'), + }, + components: { + GlEmptyState, + GlLink, + GlSprintf, + }, + computed: { + scheduleSvgPath() { + return `data:image/svg+xml;utf8,${encodeURIComponent(scheduleSvg)}`; + }, + schedulesHelpPath() { + return helpPagePath('ci/pipelines/schedules'); + }, + }, +}; +</script> +<template> + <gl-empty-state + :svg-path="scheduleSvgPath" + :primary-button-text="$options.i18n.createNew" + primary-button-link="#" + > + <template #title> + <h3> + {{ $options.i18n.pipelineSchedules }} + </h3> + </template> + <template #description> + <p class="gl-mb-0">{{ $options.i18n.description }}</p> + <ul class="gl-list-style-position-inside" data-testid="pipeline-schedules-characteristics"> + <li v-for="(el, index) in $options.i18n.listElements" :key="index">{{ el }}</li> + </ul> + <p> + <gl-sprintf :message="$options.i18n.learnMore"> + <template #link="{ content }"> + <gl-link :href="schedulesHelpPath" target="_blank">{{ content }}</gl-link> + </template> + </gl-sprintf> + </p> + </template> + </gl-empty-state> +</template> diff --git a/app/assets/javascripts/pages/projects/pipeline_schedules/index/index.js b/app/assets/javascripts/pages/projects/pipeline_schedules/index/index.js index 27610df482d..4bdbb70d942 100644 --- a/app/assets/javascripts/pages/projects/pipeline_schedules/index/index.js +++ b/app/assets/javascripts/pages/projects/pipeline_schedules/index/index.js @@ -67,10 +67,9 @@ function initTakeownershipModal() { }); } -initPipelineSchedulesCallout(); - if (gon.features?.pipelineSchedulesVue) { initPipelineSchedulesApp(); } else { + initPipelineSchedulesCallout(); initTakeownershipModal(); } diff --git a/app/services/design_management/save_designs_service.rb b/app/services/design_management/save_designs_service.rb index 64537293e65..ea5675c6ddd 100644 --- a/app/services/design_management/save_designs_service.rb +++ b/app/services/design_management/save_designs_service.rb @@ -113,7 +113,7 @@ module DesignManagement def file_content(file, full_path) transformer = ::Lfs::FileTransformer.new(project, repository, target_branch) - transformer.new_file(full_path, file.to_io).content + transformer.new_file(full_path, file.to_io, detect_content_type: Feature.enabled?(:design_management_allow_dangerous_images, project)).content end # Returns the latest blobs for the designs as a Hash of `{ Design => Blob }` diff --git a/app/services/lfs/file_transformer.rb b/app/services/lfs/file_transformer.rb index 69d33e1c873..a02fce552cf 100644 --- a/app/services/lfs/file_transformer.rb +++ b/app/services/lfs/file_transformer.rb @@ -29,11 +29,11 @@ module Lfs @branch_name = branch_name end - def new_file(file_path, file_content, encoding: nil) + def new_file(file_path, file_content, encoding: nil, detect_content_type: false) if project.lfs_enabled? && lfs_file?(file_path) file_content = parse_file_content(file_content, encoding: encoding) lfs_pointer_file = Gitlab::Git::LfsPointerFile.new(file_content) - lfs_object = create_lfs_object!(lfs_pointer_file, file_content) + lfs_object = create_lfs_object!(lfs_pointer_file, file_content, detect_content_type) link_lfs_object!(lfs_object) @@ -63,9 +63,17 @@ module Lfs end # rubocop: disable CodeReuse/ActiveRecord - def create_lfs_object!(lfs_pointer_file, file_content) + def create_lfs_object!(lfs_pointer_file, file_content, detect_content_type) LfsObject.find_or_create_by(oid: lfs_pointer_file.sha256, size: lfs_pointer_file.size) do |lfs_object| - lfs_object.file = CarrierWaveStringFile.new(file_content) + lfs_object.file = if detect_content_type && (content_type = Gitlab::Utils::MimeType.from_string(file_content)) + CarrierWaveStringFile.new_file( + file_content: file_content, + filename: '', + content_type: content_type + ) + else + CarrierWaveStringFile.new(file_content) + end end end # rubocop: enable CodeReuse/ActiveRecord diff --git a/app/workers/projects/refresh_build_artifacts_size_statistics_worker.rb b/app/workers/projects/refresh_build_artifacts_size_statistics_worker.rb index 705bf0534f7..ec23bde5898 100644 --- a/app/workers/projects/refresh_build_artifacts_size_statistics_worker.rb +++ b/app/workers/projects/refresh_build_artifacts_size_statistics_worker.rb @@ -11,6 +11,10 @@ module Projects idempotent! + MAX_RUNNING_LOW = 1 + MAX_RUNNING_MEDIUM = 3 + MAX_RUNNING_HIGH = 5 + def perform_work(*args) refresh = Projects::RefreshBuildArtifactsSizeStatisticsService.new.execute return unless refresh @@ -33,8 +37,12 @@ module Projects end def max_running_jobs - if ::Feature.enabled?(:projects_build_artifacts_size_refresh, type: :ops) - 10 + if ::Feature.enabled?(:projects_build_artifacts_size_refresh_high, type: :ops) + MAX_RUNNING_HIGH + elsif ::Feature.enabled?(:projects_build_artifacts_size_refresh_medium, type: :ops) + MAX_RUNNING_MEDIUM + elsif ::Feature.enabled?(:projects_build_artifacts_size_refresh, type: :ops) + MAX_RUNNING_LOW else 0 end |