diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-20 23:50:22 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-20 23:50:22 +0000 |
commit | 9dc93a4519d9d5d7be48ff274127136236a3adb3 (patch) | |
tree | 70467ae3692a0e35e5ea56bcb803eb512a10bedb /app/helpers/ci | |
parent | 4b0f34b6d759d6299322b3a54453e930c6121ff0 (diff) | |
download | gitlab-ce-9dc93a4519d9d5d7be48ff274127136236a3adb3.tar.gz |
Add latest changes from gitlab-org/gitlab@13-11-stable-eev13.11.0-rc43
Diffstat (limited to 'app/helpers/ci')
-rw-r--r-- | app/helpers/ci/jobs_helper.rb | 15 | ||||
-rw-r--r-- | app/helpers/ci/pipeline_editor_helper.rb | 18 | ||||
-rw-r--r-- | app/helpers/ci/pipelines_helper.rb | 40 | ||||
-rw-r--r-- | app/helpers/ci/runners_helper.rb | 31 |
4 files changed, 96 insertions, 8 deletions
diff --git a/app/helpers/ci/jobs_helper.rb b/app/helpers/ci/jobs_helper.rb index ec17eccf693..a0d169c1358 100644 --- a/app/helpers/ci/jobs_helper.rb +++ b/app/helpers/ci/jobs_helper.rb @@ -18,6 +18,21 @@ module Ci "retry_outdated_job_docs_url" => help_page_path('ci/pipelines/settings', anchor: 'retry-outdated-jobs') } end + + def job_counts + { + "all" => limited_counter_with_delimiter(@all_builds), + "pending" => limited_counter_with_delimiter(@all_builds.pending), + "running" => limited_counter_with_delimiter(@all_builds.running), + "finished" => limited_counter_with_delimiter(@all_builds.finished) + } + end + + def job_statuses + statuses = Ci::HasStatus::AVAILABLE_STATUSES + + statuses.to_h { |status| [status, status.upcase] } + end end end diff --git a/app/helpers/ci/pipeline_editor_helper.rb b/app/helpers/ci/pipeline_editor_helper.rb index a71b0f4a83a..ceb18d90c92 100644 --- a/app/helpers/ci/pipeline_editor_helper.rb +++ b/app/helpers/ci/pipeline_editor_helper.rb @@ -7,5 +7,23 @@ module Ci def can_view_pipeline_editor?(project) can_collaborate_with_project?(project) end + + def js_pipeline_editor_data(project) + { + "ci-config-path": project.ci_config_path_or_default, + "commit-sha" => project.commit ? project.commit.sha : '', + "default-branch" => project.default_branch, + "empty-state-illustration-path" => image_path('illustrations/empty-state/empty-dag-md.svg'), + "initial-branch-name": params[:branch_name], + "lint-help-page-path" => help_page_path('ci/lint', anchor: 'validate-basic-logic-and-syntax'), + "new-merge-request-path" => namespace_project_new_merge_request_path, + "project-path" => project.path, + "project-full-path" => project.full_path, + "project-namespace" => project.namespace.full_path, + "yml-help-page-path" => help_page_path('ci/yaml/README') + } + end end end + +Ci::PipelineEditorHelper.prepend_if_ee('EE::Ci::PipelineEditorHelper') diff --git a/app/helpers/ci/pipelines_helper.rb b/app/helpers/ci/pipelines_helper.rb index 8a6f0821dbb..cabb43f45fd 100644 --- a/app/helpers/ci/pipelines_helper.rb +++ b/app/helpers/ci/pipelines_helper.rb @@ -30,6 +30,46 @@ module Ci project.has_ci? && project.builds_enabled? end + # This list of templates is for the pipeline_empty_state_templates experiment + # and will be cleaned up with https://gitlab.com/gitlab-org/gitlab/-/issues/326299 + def experiment_suggested_ci_templates + [ + { name: 'Android', logo: image_path('illustrations/logos/android.svg') }, + { name: 'Bash', logo: image_path('illustrations/logos/bash.svg') }, + { name: 'C++', logo: image_path('illustrations/logos/c_plus_plus.svg') }, + { name: 'Clojure', logo: image_path('illustrations/logos/clojure.svg') }, + { name: 'Composer', logo: image_path('illustrations/logos/composer.svg') }, + { name: 'Crystal', logo: image_path('illustrations/logos/crystal.svg') }, + { name: 'Dart', logo: image_path('illustrations/logos/dart.svg') }, + { name: 'Django', logo: image_path('illustrations/logos/django.svg') }, + { name: 'Docker', logo: image_path('illustrations/logos/docker.svg') }, + { name: 'Elixir', logo: image_path('illustrations/logos/elixir.svg') }, + { name: 'iOS-Fastlane', logo: image_path('illustrations/logos/fastlane.svg') }, + { name: 'Flutter', logo: image_path('illustrations/logos/flutter.svg') }, + { name: 'Go', logo: image_path('illustrations/logos/go_logo.svg') }, + { name: 'Gradle', logo: image_path('illustrations/logos/gradle.svg') }, + { name: 'Grails', logo: image_path('illustrations/logos/grails.svg') }, + { name: 'dotNET', logo: image_path('illustrations/logos/dotnet.svg') }, + { name: 'Rails', logo: image_path('illustrations/logos/rails.svg') }, + { name: 'Julia', logo: image_path('illustrations/logos/julia.svg') }, + { name: 'Laravel', logo: image_path('illustrations/logos/laravel.svg') }, + { name: 'Latex', logo: image_path('illustrations/logos/latex.svg') }, + { name: 'Maven', logo: image_path('illustrations/logos/maven.svg') }, + { name: 'Mono', logo: image_path('illustrations/logos/mono.svg') }, + { name: 'Nodejs', logo: image_path('illustrations/logos/node_js.svg') }, + { name: 'npm', logo: image_path('illustrations/logos/npm.svg') }, + { name: 'OpenShift', logo: image_path('illustrations/logos/openshift.svg') }, + { name: 'Packer', logo: image_path('illustrations/logos/packer.svg') }, + { name: 'PHP', logo: image_path('illustrations/logos/php.svg') }, + { name: 'Python', logo: image_path('illustrations/logos/python.svg') }, + { name: 'Ruby', logo: image_path('illustrations/logos/ruby.svg') }, + { name: 'Rust', logo: image_path('illustrations/logos/rust.svg') }, + { name: 'Scala', logo: image_path('illustrations/logos/scala.svg') }, + { name: 'Swift', logo: image_path('illustrations/logos/swift.svg') }, + { name: 'Terraform', logo: image_path('illustrations/logos/terraform.svg') } + ] + end + private def warning_markdown(pipeline) diff --git a/app/helpers/ci/runners_helper.rb b/app/helpers/ci/runners_helper.rb index ba5d4e8c65a..82347053d6f 100644 --- a/app/helpers/ci/runners_helper.rb +++ b/app/helpers/ci/runners_helper.rb @@ -4,18 +4,33 @@ module Ci module RunnersHelper include IconsHelper - def runner_status_icon(runner) + def runner_status_icon(runner, size: 16, icon_class: '') status = runner.status + + title = '' + icon = 'warning-solid' + span_class = '' + case status when :not_connected - content_tag(:span, title: _("New runner. Has not connected yet")) do - sprite_icon("warning-solid", size: 24, css_class: "gl-vertical-align-bottom!") - end + title = s_("Runners|New runner, has not connected yet") + icon = 'warning-solid' + when :online + title = s_("Runners|Runner is online, last contact was %{runner_contact} ago") % { runner_contact: time_ago_in_words(runner.contacted_at) } + icon = 'status-active' + span_class = 'gl-text-green-500' + when :offline + title = s_("Runners|Runner is offline, last contact was %{runner_contact} ago") % { runner_contact: time_ago_in_words(runner.contacted_at) } + icon = 'status-failed' + span_class = 'gl-text-red-500' + when :paused + title = s_("Runners|Runner is paused, last contact was %{runner_contact} ago") % { runner_contact: time_ago_in_words(runner.contacted_at) } + icon = 'status-paused' + span_class = 'gl-text-gray-600' + end - when :online, :offline, :paused - content_tag :span, nil, - class: "gl-display-inline-block gl-avatar gl-avatar-s16 gl-avatar-circle runner-status runner-status-#{status}", - title: _("Runner is %{status}, last contact was %{runner_contact} ago") % { status: status, runner_contact: time_ago_in_words(runner.contacted_at) } + content_tag(:span, class: span_class, title: title, data: { toggle: 'tooltip', container: 'body', testid: 'runner_status_icon', qa_selector: "runner_status_#{status}_content" }) do + sprite_icon(icon, size: size, css_class: icon_class) end end |