summaryrefslogtreecommitdiff
path: root/app/views/projects/clusters/_integration_form.html.haml
blob: 0af6e6e05772193be78100079f32f05c70415dbe (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
= form_for @cluster, url: namespace_project_cluster_path(@project.namespace, @project, @cluster), as: :cluster do |field|
  = form_errors(@cluster)
  .form-group.append-bottom-20
    %h5= s_('ClusterIntegration|Integration status')
    %p
      - if @cluster.enabled?
        - if can?(current_user, :update_cluster, @cluster)
          = s_('ClusterIntegration|Cluster integration is enabled for this project. Disabling this integration will not affect your cluster, it will only temporarily turn off GitLab\'s connection to it.')
        - else
          = s_('ClusterIntegration|Cluster integration is enabled for this project.')
      - else
        = s_('ClusterIntegration|Cluster integration is disabled for this project.')
    %label.append-bottom-10.js-cluster-enable-toggle-area
      %button{ type: 'button',
        class: "js-project-feature-toggle project-feature-toggle #{'is-checked' if @cluster.enabled?} #{'is-disabled' unless can?(current_user, :update_cluster, @cluster)}",
        "aria-label": s_("ClusterIntegration|Toggle Cluster"),
        disabled: !can?(current_user, :update_cluster, @cluster) }
        = field.hidden_field :enabled, { class: 'js-project-feature-toggle-input'}
        %span.toggle-icon
          = sprite_icon('status_success_borderless', size: 16, css_class: 'toggle-icon-svg toggle-status-checked')
          = sprite_icon('status_failed_borderless', size: 16, css_class: 'toggle-icon-svg toggle-status-unchecked')

  .form-group
    %h5= s_('ClusterIntegration|Environment scope')
    %p
      = s_("ClusterIntegration|Choose which of your project's environments will use this cluster.")
      = link_to s_("ClusterIntegration|Learn more about environments"), help_page_path('ci/environments')
    = field.text_field :environment_scope, class: 'form-control js-select-on-focus', readonly: !has_multiple_clusters?(@project), placeholder: s_('ClusterIntegration|Environment scope')

  - if can?(current_user, :update_cluster, @cluster)
    .form-group
      = field.submit _('Save changes'), class: 'btn btn-success'