summaryrefslogtreecommitdiff
path: root/lib/sidebars/groups/menus/kubernetes_menu.rb
blob: 98ca7865995e1807bdbb571a1f7742ea84607e6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# frozen_string_literal: true

module Sidebars
  module Groups
    module Menus
      class KubernetesMenu < ::Sidebars::Menu
        override :link
        def link
          group_clusters_path(context.group)
        end

        override :title
        def title
          _('Kubernetes')
        end

        override :sprite_icon
        def sprite_icon
          'cloud-gear'
        end

        override :render?
        def render?
          clusterable = context.group

          Feature.enabled?(:certificate_based_clusters, clusterable, default_enabled: :yaml, type: :ops) &&
            can?(context.current_user, :read_cluster, clusterable)
        end

        override :extra_container_html_options
        def extra_container_html_options
          {
            class: 'shortcuts-kubernetes'
          }
        end

        override :active_routes
        def active_routes
          { controller: :clusters }
        end
      end
    end
  end
end