summaryrefslogtreecommitdiff
path: root/app/helpers
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2017-03-16 12:09:52 +0000
committerYorick Peterse <yorickpeterse@gmail.com>2017-03-16 12:09:52 +0000
commitabb5f765c1e1affe0e132c86811e356e4a7008c9 (patch)
tree815fbaa397217d82d82cae996498617494aee8e2 /app/helpers
parent8c5a3ffe9d29767eaf2e75038056efe29579b7bf (diff)
parent7d5b8993f47f02488cb37811719193d4ecb45e0a (diff)
downloadgitlab-ce-abb5f765c1e1affe0e132c86811e356e4a7008c9.tar.gz
Merge branch '27376-cache-default-branch-pipeline-on-project' into 'master'
Speed up several project lists See merge request !9903
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/ci_status_helper.rb18
-rw-r--r--app/helpers/projects_helper.rb7
2 files changed, 25 insertions, 0 deletions
diff --git a/app/helpers/ci_status_helper.rb b/app/helpers/ci_status_helper.rb
index a7cdca9ba2e..2de9e0de310 100644
--- a/app/helpers/ci_status_helper.rb
+++ b/app/helpers/ci_status_helper.rb
@@ -59,6 +59,24 @@ module CiStatusHelper
custom_icon(icon_name)
end
+ def pipeline_status_cache_key(pipeline_status)
+ "pipeline-status/#{pipeline_status.sha}-#{pipeline_status.status}"
+ end
+
+ def render_project_pipeline_status(pipeline_status, tooltip_placement: 'auto left')
+ project = pipeline_status.project
+ path = pipelines_namespace_project_commit_path(
+ project.namespace,
+ project,
+ pipeline_status.sha)
+
+ render_status_with_link(
+ 'commit',
+ pipeline_status.status,
+ path,
+ tooltip_placement: tooltip_placement)
+ end
+
def render_commit_status(commit, ref: nil, tooltip_placement: 'auto left')
project = commit.project
path = pipelines_namespace_project_commit_path(
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
index 4befeacc135..bd0c2cd661e 100644
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -159,6 +159,13 @@ module ProjectsHelper
choose a GitLab CI Yaml template and commit your changes. #{link_to_autodeploy_doc}".html_safe
end
+ def project_list_cache_key(project)
+ key = [project.namespace.cache_key, project.cache_key, controller.controller_name, controller.action_name, current_application_settings.cache_key, 'v2.3']
+ key << pipeline_status_cache_key(project.pipeline_status) if project.pipeline_status.has_status?
+
+ key
+ end
+
private
def repo_children_classes(field)