debian-mirror-gitlab/app/helpers/ci/pipeline_editor_helper.rb

38 lines
1.6 KiB
Ruby
Raw Normal View History

2021-01-29 00:20:46 +05:30
# frozen_string_literal: true
module Ci
module PipelineEditorHelper
include ChecksCollaboration
def can_view_pipeline_editor?(project)
2021-04-17 20:07:23 +05:30
can_collaborate_with_project?(project)
2021-01-29 00:20:46 +05:30
end
2021-04-29 21:17:54 +05:30
def js_pipeline_editor_data(project)
2021-06-08 01:23:25 +05:30
commit_sha = project.commit ? project.commit.sha : ''
2021-04-29 21:17:54 +05:30
{
"ci-config-path": project.ci_config_path_or_default,
2021-06-08 01:23:25 +05:30
"ci-examples-help-page-path" => help_page_path('ci/examples/README'),
"ci-help-page-path" => help_page_path('ci/README'),
"commit-sha" => commit_sha,
2021-04-29 21:17:54 +05:30
"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'),
2021-06-08 01:23:25 +05:30
"needs-help-page-path" => help_page_path('ci/yaml/README', anchor: 'needs'),
2021-04-29 21:17:54 +05:30
"new-merge-request-path" => namespace_project_new_merge_request_path,
2021-06-08 01:23:25 +05:30
"pipeline_etag" => project.commit ? graphql_etag_pipeline_sha_path(commit_sha) : '',
"pipeline-page-path" => project_pipelines_path(project),
2021-04-29 21:17:54 +05:30
"project-path" => project.path,
"project-full-path" => project.full_path,
"project-namespace" => project.namespace.full_path,
2021-06-08 01:23:25 +05:30
"runner-help-page-path" => help_page_path('ci/runners/README'),
"total-branches" => project.repository.branches.length,
2021-04-29 21:17:54 +05:30
"yml-help-page-path" => help_page_path('ci/yaml/README')
}
end
2021-01-29 00:20:46 +05:30
end
end
2021-04-29 21:17:54 +05:30
2021-06-08 01:23:25 +05:30
Ci::PipelineEditorHelper.prepend_mod_with('Ci::PipelineEditorHelper')