diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/registry/components/collapsible_container.vue | 2 | ||||
-rw-r--r-- | app/assets/javascripts/registry/components/table_registry.vue | 4 | ||||
-rw-r--r-- | app/controllers/projects/pipelines_controller.rb | 23 | ||||
-rw-r--r-- | app/controllers/projects/registry/repositories_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/projects/registry/tags_controller.rb | 3 | ||||
-rw-r--r-- | app/models/ci/pipeline.rb | 4 | ||||
-rw-r--r-- | app/models/clusters/applications/prometheus.rb | 7 | ||||
-rw-r--r-- | app/models/concerns/relative_positioning.rb | 2 | ||||
-rw-r--r-- | app/presenters/ci/pipeline_presenter.rb | 58 | ||||
-rw-r--r-- | app/serializers/test_report_entity.rb | 15 | ||||
-rw-r--r-- | app/serializers/test_report_serializer.rb | 5 | ||||
-rw-r--r-- | app/serializers/test_suite_entity.rb | 16 |
12 files changed, 131 insertions, 10 deletions
diff --git a/app/assets/javascripts/registry/components/collapsible_container.vue b/app/assets/javascripts/registry/components/collapsible_container.vue index 41bd9225c6e..3e31d24088e 100644 --- a/app/assets/javascripts/registry/components/collapsible_container.vue +++ b/app/assets/javascripts/registry/components/collapsible_container.vue @@ -85,6 +85,8 @@ export default { v-gl-modal="modalId" :title="s__('ContainerRegistry|Remove repository')" :aria-label="s__('ContainerRegistry|Remove repository')" + data-track-event="click_button" + data-track-label="registry_repository_delete" class="js-remove-repo btn-inverted" variant="danger" > diff --git a/app/assets/javascripts/registry/components/table_registry.vue b/app/assets/javascripts/registry/components/table_registry.vue index 9a2291613e4..d6d2896a8f8 100644 --- a/app/assets/javascripts/registry/components/table_registry.vue +++ b/app/assets/javascripts/registry/components/table_registry.vue @@ -192,6 +192,8 @@ export default { v-gl-modal="modalId" :disabled="!itemsToBeDeleted || itemsToBeDeleted.length === 0" class="js-delete-registry float-right" + data-track-event="click_button" + data-track-label="bulk_registry_tag_delete" variant="danger" :title="s__('ContainerRegistry|Remove selected tags')" :aria-label="s__('ContainerRegistry|Remove selected tags')" @@ -246,6 +248,8 @@ export default { v-gl-modal="modalId" :title="s__('ContainerRegistry|Remove tag')" :aria-label="s__('ContainerRegistry|Remove tag')" + data-track-event="click_button" + data-track-label="registry_tag_delete" variant="danger" class="js-delete-registry-row float-right btn-inverted btn-border-color btn-icon" @click="deleteSingleItem(index)" diff --git a/app/controllers/projects/pipelines_controller.rb b/app/controllers/projects/pipelines_controller.rb index cfa46705483..1bacdc0b1b2 100644 --- a/app/controllers/projects/pipelines_controller.rb +++ b/app/controllers/projects/pipelines_controller.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true class Projects::PipelinesController < Projects::ApplicationController + include ::Gitlab::Utils::StrongMemoize + before_action :whitelist_query_limiting, only: [:create, :retry] before_action :pipeline, except: [:index, :new, :create, :charts] before_action :set_pipeline_path, only: [:show] @@ -151,6 +153,19 @@ class Projects::PipelinesController < Projects::ApplicationController @counts[:failed] = @project.all_pipelines.failed.count(:all) end + def test_report + return unless Feature.enabled?(:junit_pipeline_view, project) + + if pipeline_test_report == :error + render json: { status: :error_parsing_report } + return + end + + render json: TestReportSerializer + .new(current_user: @current_user) + .represent(pipeline_test_report) + end + private def serialize_pipelines @@ -217,6 +232,14 @@ class Projects::PipelinesController < Projects::ApplicationController view_context.limited_counter_with_delimiter(finder.execute) end + + def pipeline_test_report + strong_memoize(:pipeline_test_report) do + @pipeline.test_reports + rescue Gitlab::Ci::Parsers::ParserError + :error + end + end end Projects::PipelinesController.prepend_if_ee('EE::Projects::PipelinesController') diff --git a/app/controllers/projects/registry/repositories_controller.rb b/app/controllers/projects/registry/repositories_controller.rb index e205e2fd4f8..9405fd526ae 100644 --- a/app/controllers/projects/registry/repositories_controller.rb +++ b/app/controllers/projects/registry/repositories_controller.rb @@ -8,6 +8,7 @@ module Projects def index @images = project.container_repositories + track_event(:list_repositories) respond_to do |format| format.html @@ -21,6 +22,7 @@ module Projects def destroy DeleteContainerRepositoryWorker.perform_async(current_user.id, image.id) + track_event(:delete_repository) respond_to do |format| format.json { head :no_content } diff --git a/app/controllers/projects/registry/tags_controller.rb b/app/controllers/projects/registry/tags_controller.rb index b5ee0ba9beb..e572c56adf5 100644 --- a/app/controllers/projects/registry/tags_controller.rb +++ b/app/controllers/projects/registry/tags_controller.rb @@ -8,6 +8,7 @@ module Projects LIMIT = 15 def index + track_event(:list_tags) respond_to do |format| format.json do render json: ContainerTagsSerializer @@ -22,6 +23,7 @@ module Projects result = Projects::ContainerRepository::DeleteTagsService .new(image.project, current_user, tags: [params[:id]]) .execute(image) + track_event(:delete_tag) respond_to do |format| format.json { head(result[:status] == :success ? :ok : bad_request) } @@ -43,6 +45,7 @@ module Projects result = Projects::ContainerRepository::DeleteTagsService .new(image.project, current_user, tags: tag_names) .execute(image) + track_event(:delete_tag_bulk) respond_to do |format| format.json { head(result[:status] == :success ? :no_content : :bad_request) } diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index aed95b4601b..b34fd3f1ec9 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -746,6 +746,10 @@ module Ci end end + def all_merge_requests_by_recency + all_merge_requests.order(id: :desc) + end + def detailed_status(current_user) Gitlab::Ci::Status::Pipeline::Factory .new(self, current_user) diff --git a/app/models/clusters/applications/prometheus.rb b/app/models/clusters/applications/prometheus.rb index 7a414d1a5bb..5e7fdd55cb6 100644 --- a/app/models/clusters/applications/prometheus.rb +++ b/app/models/clusters/applications/prometheus.rb @@ -112,7 +112,12 @@ module Clusters def delete_knative_istio_metrics return [] unless cluster.application_knative_available? - [Gitlab::Kubernetes::KubectlCmd.delete("-f", Clusters::Applications::Knative::METRICS_CONFIG)] + [ + Gitlab::Kubernetes::KubectlCmd.delete( + "-f", Clusters::Applications::Knative::METRICS_CONFIG, + "--ignore-not-found" + ) + ] end end end diff --git a/app/models/concerns/relative_positioning.rb b/app/models/concerns/relative_positioning.rb index dfe3c391880..b645cf71443 100644 --- a/app/models/concerns/relative_positioning.rb +++ b/app/models/concerns/relative_positioning.rb @@ -127,6 +127,7 @@ module RelativePositioning if pos_after && (pos_after - pos_before) < 2 before.move_sequence_after + pos_after = before.next_relative_position end self.relative_position = self.class.position_between(pos_before, pos_after) @@ -138,6 +139,7 @@ module RelativePositioning if pos_before && (pos_after - pos_before) < 2 after.move_sequence_before + pos_before = after.prev_relative_position end self.relative_position = self.class.position_between(pos_before, pos_after) diff --git a/app/presenters/ci/pipeline_presenter.rb b/app/presenters/ci/pipeline_presenter.rb index 73a048dfa56..d81b1e6c522 100644 --- a/app/presenters/ci/pipeline_presenter.rb +++ b/app/presenters/ci/pipeline_presenter.rb @@ -48,15 +48,35 @@ module Ci def ref_text if pipeline.detached_merge_request_pipeline? - _("for %{link_to_merge_request} with %{link_to_merge_request_source_branch}").html_safe % { link_to_merge_request: link_to_merge_request, link_to_merge_request_source_branch: link_to_merge_request_source_branch } + _("for %{link_to_merge_request} with %{link_to_merge_request_source_branch}") + .html_safe % { + link_to_merge_request: link_to_merge_request, + link_to_merge_request_source_branch: link_to_merge_request_source_branch + } elsif pipeline.merge_request_pipeline? - _("for %{link_to_merge_request} with %{link_to_merge_request_source_branch} into %{link_to_merge_request_target_branch}").html_safe % { link_to_merge_request: link_to_merge_request, link_to_merge_request_source_branch: link_to_merge_request_source_branch, link_to_merge_request_target_branch: link_to_merge_request_target_branch } + _("for %{link_to_merge_request} with %{link_to_merge_request_source_branch} into %{link_to_merge_request_target_branch}") + .html_safe % { + link_to_merge_request: link_to_merge_request, + link_to_merge_request_source_branch: link_to_merge_request_source_branch, + link_to_merge_request_target_branch: link_to_merge_request_target_branch + } + elsif pipeline.ref && pipeline.ref_exists? + _("for %{link_to_pipeline_ref}") + .html_safe % { link_to_pipeline_ref: link_to_pipeline_ref } elsif pipeline.ref - if pipeline.ref_exists? - _("for %{link_to_pipeline_ref}").html_safe % { link_to_pipeline_ref: link_to_pipeline_ref } - else - _("for %{ref}").html_safe % { ref: content_tag(:span, pipeline.ref, class: 'ref-name') } - end + _("for %{ref}").html_safe % { ref: plain_ref_name } + end + end + + def all_related_merge_request_text + if all_related_merge_requests.none? + 'No related merge requests found.' + else + _("%{count} related %{pluralized_subject}: %{links}" % { + count: all_related_merge_requests.count, + pluralized_subject: 'merge request'.pluralize(all_related_merge_requests.count), + links: all_related_merge_request_links.join(', ') + }).html_safe end end @@ -84,10 +104,30 @@ module Ci private + def plain_ref_name + content_tag(:span, pipeline.ref, class: 'ref-name') + end + def merge_request_presenter - return unless pipeline.triggered_by_merge_request? + strong_memoize(:merge_request_presenter) do + if pipeline.triggered_by_merge_request? + pipeline.merge_request.present(current_user: current_user) + end + end + end - @merge_request_presenter ||= pipeline.merge_request.present(current_user: current_user) + def all_related_merge_request_links + all_related_merge_requests.map do |merge_request| + mr_path = project_merge_request_path(merge_request.project, merge_request) + + link_to "#{merge_request.to_reference} #{merge_request.title}", mr_path, class: 'mr-iid' + end + end + + def all_related_merge_requests + strong_memoize(:all_related_merge_requests) do + pipeline.ref ? pipeline.all_merge_requests_by_recency.to_a : [] + end end end end diff --git a/app/serializers/test_report_entity.rb b/app/serializers/test_report_entity.rb new file mode 100644 index 00000000000..9eb487da60a --- /dev/null +++ b/app/serializers/test_report_entity.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class TestReportEntity < Grape::Entity + expose :total_time + expose :total_count + + expose :success_count + expose :failed_count + expose :skipped_count + expose :error_count + + expose :test_suites, using: TestSuiteEntity do |report| + report.test_suites.values + end +end diff --git a/app/serializers/test_report_serializer.rb b/app/serializers/test_report_serializer.rb new file mode 100644 index 00000000000..8906b09bc6a --- /dev/null +++ b/app/serializers/test_report_serializer.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +class TestReportSerializer < BaseSerializer + entity TestReportEntity +end diff --git a/app/serializers/test_suite_entity.rb b/app/serializers/test_suite_entity.rb new file mode 100644 index 00000000000..0f88a496c77 --- /dev/null +++ b/app/serializers/test_suite_entity.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class TestSuiteEntity < Grape::Entity + expose :name + expose :total_time + expose :total_count + + expose :success_count + expose :failed_count + expose :skipped_count + expose :error_count + + expose :test_cases, using: TestCaseEntity do |test_suite| + test_suite.test_cases.values.flat_map(&:values) + end +end |