diff options
Diffstat (limited to 'app/helpers/clusters_helper.rb')
-rw-r--r-- | app/helpers/clusters_helper.rb | 42 |
1 files changed, 19 insertions, 23 deletions
diff --git a/app/helpers/clusters_helper.rb b/app/helpers/clusters_helper.rb index 1475a26ca09..959dac1254e 100644 --- a/app/helpers/clusters_helper.rb +++ b/app/helpers/clusters_helper.rb @@ -1,17 +1,6 @@ # frozen_string_literal: true module ClustersHelper - def create_new_cluster_label(provider: nil) - case provider - when 'aws' - s_('ClusterIntegration|Create new cluster on EKS') - when 'gcp' - s_('ClusterIntegration|Create new cluster on GKE') - else - s_('ClusterIntegration|Create new cluster') - end - end - def display_cluster_agents?(clusterable) clusterable.is_a?(Project) end @@ -26,22 +15,19 @@ module ClustersHelper gcp: { path: image_path('illustrations/logos/google_gke.svg'), text: s_('ClusterIntegration|Google GKE') } }, clusters_empty_state_image: image_path('illustrations/empty-state/empty-state-clusters.svg'), + empty_state_image: image_path('illustrations/empty-state/empty-state-agents.svg'), empty_state_help_text: clusterable.empty_state_help_text, - new_cluster_path: clusterable.new_path(tab: 'create'), + new_cluster_path: clusterable.new_path, + add_cluster_path: clusterable.connect_path, can_add_cluster: clusterable.can_add_cluster?.to_s, - can_admin_cluster: clusterable.can_admin_cluster?.to_s - } - end - - def js_clusters_data(clusterable) - { - default_branch_name: clusterable.default_branch, - empty_state_image: image_path('illustrations/empty-state/empty-state-agents.svg'), - project_path: clusterable.full_path, - add_cluster_path: clusterable.new_path(tab: 'add'), + can_admin_cluster: clusterable.can_admin_cluster?.to_s, + display_cluster_agents: display_cluster_agents?(clusterable).to_s, + certificate_based_clusters_enabled: Feature.enabled?(:certificate_based_clusters, clusterable, default_enabled: :yaml, type: :ops).to_s, + default_branch_name: default_branch_name(clusterable), + project_path: clusterable_project_path(clusterable), kas_address: Gitlab::Kas.external_url, gitlab_version: Gitlab.version_info - }.merge(js_clusters_list_data(clusterable)) + } end def js_cluster_form_data(cluster, can_edit) @@ -122,4 +108,14 @@ module ClustersHelper def can_admin_cluster?(user, cluster) can?(user, :admin_cluster, cluster) end + + private + + def default_branch_name(clusterable) + clusterable.default_branch if clusterable.is_a?(Project) + end + + def clusterable_project_path(clusterable) + clusterable.full_path if clusterable.is_a?(Project) + end end |