diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-14 18:09:05 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-14 18:09:05 +0300 |
commit | 66bd1f0fdcaf84fa3412c70d7962b49eb8a48fde (patch) | |
tree | 23f451b4e60a6e28bcc15043d7756bb27dcc2970 /app/presenters/clusters | |
parent | 49089d4fb1f5c17328ac61c955d95a68c6d4d545 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/presenters/clusters')
-rw-r--r-- | app/presenters/clusters/cluster_presenter.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/app/presenters/clusters/cluster_presenter.rb b/app/presenters/clusters/cluster_presenter.rb index 85a62fefd8f..3dfa9626a79 100644 --- a/app/presenters/clusters/cluster_presenter.rb +++ b/app/presenters/clusters/cluster_presenter.rb @@ -2,6 +2,7 @@ module Clusters class ClusterPresenter < Gitlab::View::Presenter::Delegated + include ::Gitlab::Utils::StrongMemoize include ActionView::Helpers::SanitizeHelper include ActionView::Helpers::UrlHelper include IconsHelper @@ -60,6 +61,12 @@ module Clusters end end + def gitlab_managed_apps_logs_path + return unless logs_project && can_read_cluster? + + project_logs_path(logs_project, cluster_id: cluster.id) + end + def read_only_kubernetes_platform_fields? !cluster.provided_by_user? end @@ -85,6 +92,16 @@ module Clusters ActionController::Base.helpers.image_path(path) end + # currently log explorer is only available in the scope of the project + # for group and instance level cluster selected project does not affects + # fetching logs from gitlab managed apps namespace, therefore any project + # available to user will be sufficient. + def logs_project + strong_memoize(:logs_project) do + cluster.all_projects.first + end + end + def clusterable if cluster.group_type? cluster.group |