Commit ac7d0ff0 authored by Phil Hughes's avatar Phil Hughes

Merge branch 'fl-gke-collapsible-containers' into 'master'

Adds collapsible sections in cluster page

See merge request gitlab-org/gitlab-ce!14890
parents f69b5468 04892e1d
...@@ -3,7 +3,8 @@ import Visibility from 'visibilityjs'; ...@@ -3,7 +3,8 @@ import Visibility from 'visibilityjs';
import axios from 'axios'; import axios from 'axios';
import Poll from './lib/utils/poll'; import Poll from './lib/utils/poll';
import { s__ } from './locale'; import { s__ } from './locale';
import './flash'; import initSettingsPanels from './settings_panels';
import Flash from './flash';
/** /**
* Cluster page has 2 separate parts: * Cluster page has 2 separate parts:
...@@ -24,6 +25,8 @@ class ClusterService { ...@@ -24,6 +25,8 @@ class ClusterService {
export default class Clusters { export default class Clusters {
constructor() { constructor() {
initSettingsPanels();
const dataset = document.querySelector('.js-edit-cluster-form').dataset; const dataset = document.querySelector('.js-edit-cluster-form').dataset;
this.state = { this.state = {
......
...@@ -4,6 +4,6 @@ ...@@ -4,6 +4,6 @@
} }
.alert-block { .alert-block {
margin-bottom: 20px; margin-bottom: 10px;
} }
} }
- if can?(current_user, :admin_cluster, @cluster)
.append-bottom-20
%label.append-bottom-10
= s_('ClusterIntegration|Google Container Engine')
%p
- link_gke = link_to(s_('ClusterIntegration|Google Container Engine'), @cluster.gke_cluster_url, target: '_blank', rel: 'noopener noreferrer')
= s_('ClusterIntegration|Manage your cluster by visiting %{link_gke}').html_safe % { link_gke: link_gke }
.well.form-group
%label.text-danger
= s_('ClusterIntegration|Remove cluster integration')
%p
= s_('ClusterIntegration|Removing cluster integration will remove the cluster configuration you have added to this project. It will not delete your project.')
= link_to(s_('ClusterIntegration|Remove integration'), namespace_project_cluster_path(@project.namespace, @project, @cluster.id), method: :delete, class: 'btn btn-danger', data: { confirm: "Are you sure you want to remove cluster integration from this project? This will not delete your cluster on Google Container Engine"})
- @content_class = "limit-container-width" unless fluid_layout
- breadcrumb_title "Cluster" - breadcrumb_title "Cluster"
- page_title _("Cluster") - page_title _("Cluster")
- expanded = Rails.env.test?
- status_path = status_namespace_project_cluster_path(@cluster.project.namespace, @cluster.project, @cluster.id, format: :json) if can?(current_user, :admin_cluster, @cluster) && @cluster.on_creation? - status_path = status_namespace_project_cluster_path(@cluster.project.namespace, @cluster.project, @cluster.id, format: :json) if can?(current_user, :admin_cluster, @cluster) && @cluster.on_creation?
.row.prepend-top-default.edit-cluster-form.js-edit-cluster-form{ data: { status_path: status_path, .edit-cluster-form.js-edit-cluster-form{ data: { status_path: status_path,
toggle_status: @cluster.enabled? ? 'true': 'false', toggle_status: @cluster.enabled? ? 'true': 'false',
cluster_status: @cluster.status_name, cluster_status: @cluster.status_name,
cluster_status_reason: @cluster.status_reason } } cluster_status_reason: @cluster.status_reason } }
.col-sm-4
= render 'sidebar' %section.settings
.col-sm-8 %h4= s_('ClusterIntegration|Enable cluster integration')
%label.append-bottom-10{ for: 'enable-cluster-integration' } .settings-content.expanded
= s_('ClusterIntegration|Enable cluster integration')
%p .hidden.js-cluster-error.alert.alert-danger.alert-block.append-bottom-10{ role: 'alert' }
- if @cluster.enabled? = s_('ClusterIntegration|Something went wrong while creating your cluster on Google Container Engine')
- if can?(current_user, :update_cluster, @cluster) %p.js-error-reason
= 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.')
.hidden.js-cluster-creating.alert.alert-info.alert-block.append-bottom-10{ role: 'alert' }
= s_('ClusterIntegration|Cluster is being created on Google Container Engine...')
.hidden.js-cluster-success.alert.alert-success.alert-block.append-bottom-10{ role: 'alert' }
= s_('ClusterIntegration|Cluster was successfully created on Google Container Engine')
%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 - else
= s_('ClusterIntegration|Cluster integration is enabled for this project.') = s_('ClusterIntegration|Cluster integration is disabled for this project.')
- else
= s_('ClusterIntegration|Cluster integration is disabled for this project.')
= form_for [@project.namespace.becomes(Namespace), @project, @cluster] do |field| = form_for [@project.namespace.becomes(Namespace), @project, @cluster] do |field|
= form_errors(@cluster) = form_errors(@cluster)
...@@ -36,35 +49,28 @@ ...@@ -36,35 +49,28 @@
.form-group .form-group
= field.submit s_('ClusterIntegration|Save'), class: 'btn btn-success' = field.submit s_('ClusterIntegration|Save'), class: 'btn btn-success'
- if can?(current_user, :admin_cluster, @cluster) %section.settings#js-cluster-details
%label.append-bottom-10{ for: 'google-container-engine' } .settings-header
= s_('ClusterIntegration|Google Container Engine') %h4= s_('ClusterIntegration|Cluster details')
%p %button.btn.js-settings-toggle
- link_gke = link_to(s_('ClusterIntegration|Google Container Engine'), @cluster.gke_cluster_url, target: '_blank', rel: 'noopener noreferrer') = expanded ? 'Collapse' : 'Expand'
= s_('ClusterIntegration|Manage your cluster by visiting %{link_gke}').html_safe % { link_gke: link_gke } %p= s_('ClusterIntegration|See and edit the details for your cluster')
.hidden.js-cluster-error.alert.alert-danger.alert-block{ role: 'alert' } .settings-content.no-animate{ class: ('expanded' if expanded) }
= s_('ClusterIntegration|Something went wrong while creating your cluster on Google Container Engine')
%p.js-error-reason
.hidden.js-cluster-creating.alert.alert-info.alert-block{ role: 'alert' }
= s_('ClusterIntegration|Cluster is being created on Google Container Engine...')
.hidden.js-cluster-success.alert.alert-success.alert-block{ role: 'alert' }
= s_('ClusterIntegration|Cluster was successfully created on Google Container Engine')
.form_group.append-bottom-20 .form_group.append-bottom-20
%label.append-bottom-10{ for: 'cluter-name' } %label.append-bottom-10{ for: 'cluter-name' }
= s_('ClusterIntegration|Cluster name') = s_('ClusterIntegration|Cluster name')
.input-group .input-group
%input.form-control.cluster-name{ value: @cluster.gcp_cluster_name, disabled: true } %input.form-control.cluster-name{ value: @cluster.gcp_cluster_name, disabled: true }
%span.input-group-addon.clipboard-addon %span.input-group-addon.clipboard-addon
= clipboard_button(text: @cluster.gcp_cluster_name, title: s_('ClusterIntegration|Copy cluster name')) = clipboard_button(text: @cluster.gcp_cluster_name, title: s_('ClusterIntegration|Copy cluster name'))
- if can?(current_user, :admin_cluster, @cluster) %section.settings#js-cluster-advanced-settings
.well.form_group .settings-header
%label.text-danger %h4= s_('ClusterIntegration|Advanced settings')
= s_('ClusterIntegration|Remove cluster integration') %button.btn.js-settings-toggle
%p = expanded ? 'Collapse' : 'Expand'
= s_('ClusterIntegration|Removing cluster integration will remove the cluster configuration you have added to this project. It will not delete your project.') %p= s_('ClusterIntegration|Manage Cluster integration on your GitLab project')
= link_to(s_('ClusterIntegration|Remove integration'), namespace_project_cluster_path(@project.namespace, @project, @cluster.id), method: :delete, class: 'btn btn-danger', data: { confirm: "Are you sure you want to remove cluster integration from this project? This will not delete your cluster on Google Container Engine"}) .settings-content.no-animate{ class: ('expanded' if expanded) }
= render 'advanced_settings'
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment