Commit 24730b03 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'cluster-info-tabs' into 'master'

Split cluster info page into tabs

See merge request gitlab-org/gitlab!25940
parents 74fd1c72 d300f2af
...@@ -315,10 +315,13 @@ export default class Clusters { ...@@ -315,10 +315,13 @@ export default class Clusters {
this.checkForNewInstalls(prevApplicationMap, this.store.state.applications); this.checkForNewInstalls(prevApplicationMap, this.store.state.applications);
this.updateContainer(prevStatus, this.store.state.status, this.store.state.statusReason); this.updateContainer(prevStatus, this.store.state.status, this.store.state.statusReason);
this.toggleIngressDomainHelpText(
prevApplicationMap[INGRESS], if (this.ingressDomainHelpText) {
this.store.state.applications[INGRESS], this.toggleIngressDomainHelpText(
); prevApplicationMap[INGRESS],
this.store.state.applications[INGRESS],
);
}
} }
showToken() { showToken() {
......
...@@ -263,7 +263,6 @@ Crossplane runs inside your Kubernetes cluster and supports secure connectivity ...@@ -263,7 +263,6 @@ Crossplane runs inside your Kubernetes cluster and supports secure connectivity
<template> <template>
<section id="cluster-applications"> <section id="cluster-applications">
<h4>{{ s__('ClusterIntegration|Applications') }}</h4>
<p class="append-bottom-0"> <p class="append-bottom-0">
{{ {{
s__(`ClusterIntegration|Choose which applications to install on your Kubernetes cluster. s__(`ClusterIntegration|Choose which applications to install on your Kubernetes cluster.
......
...@@ -26,11 +26,38 @@ module ClustersHelper ...@@ -26,11 +26,38 @@ module ClustersHelper
end end
end end
def render_cluster_info_tab_content(tab, expanded)
case tab
when 'environments'
render_if_exists 'clusters/clusters/environments'
when 'health'
render_if_exists 'clusters/clusters/health'
when 'apps'
render 'applications'
when 'settings'
render 'advanced_settings_container'
else
render('details', expanded: expanded)
end
end
def has_rbac_enabled?(cluster) def has_rbac_enabled?(cluster)
return cluster.platform_kubernetes_rbac? if cluster.platform_kubernetes return cluster.platform_kubernetes_rbac? if cluster.platform_kubernetes
cluster.provider.has_rbac_enabled? cluster.provider.has_rbac_enabled?
end end
def project_cluster?(cluster)
cluster.cluster_type.in?('project_type')
end
def cluster_created?(cluster)
!cluster.status_name.in?(%i/scheduled creating/)
end
def can_admin_cluster?(user, cluster)
can?(user, :admin_cluster, cluster)
end
end end
ClustersHelper.prepend_if_ee('EE::ClustersHelper') ClustersHelper.prepend_if_ee('EE::ClustersHelper')
- if can_admin_cluster?(current_user, @cluster)
.settings.expanded.border-0.m-0
%p
= s_('ClusterIntegration|Advanced options on this Kubernetes cluster’s integration')
.settings-content#advanced-settings-section
= render 'clusters/clusters/advanced_settings'
- active = params[:tab] == 'settings'
- if can_admin_cluster?(current_user, @cluster)
%li.nav-item{ role: 'presentation' }
%a#cluster-settings-tab.nav-link{ class: active_when(active), href: clusterable.cluster_path(@cluster.id, params: {tab: 'settings'}) }
%span= _('Advanced Settings')
.cluster-applications-table#js-cluster-applications
- active = params[:tab] == 'apps'
%li.nav-item{ role: 'presentation' }
%a#cluster-apps-tab.nav-link.qa-applications{ class: active_when(active), href: clusterable.cluster_path(@cluster.id, params: {tab: 'apps'}) }
%span= _('Applications')
%section#cluster-integration
- unless @cluster.status_name.in? %i/scheduled creating/
= render 'form'
- unless @cluster.status_name.in? %i/scheduled creating/
= render_if_exists 'projects/clusters/prometheus_graphs'
.cluster-applications-table#js-cluster-applications
%section.settings#js-cluster-details{ class: ('expanded' if expanded) }
.settings-header
%h4= s_('ClusterIntegration|Kubernetes cluster details')
%button.btn.js-settings-toggle{ type: 'button' }
= expanded ? _('Collapse') : _('Expand')
%p= s_('ClusterIntegration|See and edit the details for your Kubernetes cluster')
.settings-content
= render 'clusters/platforms/kubernetes/form', cluster: @cluster, platform: @cluster.platform_kubernetes, update_cluster_url_path: clusterable.cluster_path(@cluster)
%section.settings.no-animate#js-cluster-advanced-settings{ class: ('expanded' if expanded) }
.settings-header
%h4= _('Advanced settings')
%button.btn.js-settings-toggle{ type: 'button' }
= expanded ? _('Collapse') : _('Expand')
%p= s_("ClusterIntegration|Advanced options on this Kubernetes cluster's integration")
.settings-content#advanced-settings-section
= render 'advanced_settings'
%section#cluster-integration
= render 'gitlab_integration_form'
%section.settings.no-animate{ class: ('expanded' if expanded) }
.settings-header
%h4= s_('ClusterIntegration|Provider details')
%button.btn.js-settings-toggle{ type: 'button' }
= expanded ? _('Collapse') : _('Expand')
%p= s_('ClusterIntegration|See and edit the details for your Kubernetes cluster')
.settings-content
= render 'provider_details_form', cluster: @cluster, platform: @cluster.platform_kubernetes, update_cluster_url_path: clusterable.cluster_path(@cluster)
- active = params[:tab] == 'details' || !params[:tab].present?
%li.nav-item{ role: 'presentation' }
%a#cluster-details-tab.nav-link.qa-details{ class: active_when(active), href: clusterable.cluster_path(@cluster.id, params: {tab: 'details'}) }
%span= _('Details')
= form_for @cluster, url: clusterable.cluster_path(@cluster), as: :cluster, html: { class: 'cluster_integration_form' } do |field| = form_for @cluster, url: clusterable.cluster_path(@cluster), as: :cluster, html: { class: 'js-cluster-integration-form' } do |field|
= form_errors(@cluster) = form_errors(@cluster)
.form-group .form-group
%h5= s_('ClusterIntegration|Integration status') .d-flex.align-items-center
%label.append-bottom-0.js-cluster-enable-toggle-area %h4.pr-2.m-0
= render "shared/buttons/project_feature_toggle", is_checked: @cluster.enabled?, label: s_("ClusterIntegration|Toggle Kubernetes cluster"), disabled: !can?(current_user, :update_cluster, @cluster), data: { qa_selector: 'integration_status_toggle' } do = s_('ClusterIntegration|GitLab Integration')
= field.hidden_field :enabled, { class: 'js-project-feature-toggle-input'} %label.append-bottom-0.js-cluster-enable-toggle-area{ title: s_('ClusterIntegration|Enable or disable GitLab\'s connection to your Kubernetes cluster.'), data: { toggle: 'tooltip', container: 'body' } }
.form-text.text-muted= s_('ClusterIntegration|Enable or disable GitLab\'s connection to your Kubernetes cluster.') = render "shared/buttons/project_feature_toggle", is_checked: @cluster.enabled?, label: s_("ClusterIntegration|Toggle Kubernetes cluster"), disabled: !can?(current_user, :update_cluster, @cluster), data: { qa_selector: 'integration_status_toggle' } do
= field.hidden_field :enabled, { class: 'js-project-feature-toggle-input'}
.form-group .form-group
%h5= s_('ClusterIntegration|Environment scope') %h5= s_('ClusterIntegration|Environment scope')
...@@ -17,7 +18,8 @@ ...@@ -17,7 +18,8 @@
- environment_scope_url = help_page_path('user/project/clusters/index', anchor: 'base-domain') - environment_scope_url = help_page_path('user/project/clusters/index', anchor: 'base-domain')
- environment_scope_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: environment_scope_url } - environment_scope_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: environment_scope_url }
.form-text.text-muted .form-text.text-muted
%code * %code
= _('*')
= s_("ClusterIntegration| is the default environment scope for this cluster. This means that all jobs, regardless of their environment, will use this cluster. %{environment_scope_start}More information%{environment_scope_end}").html_safe % { environment_scope_start: environment_scope_start, environment_scope_end: '</a>'.html_safe } = s_("ClusterIntegration| is the default environment scope for this cluster. This means that all jobs, regardless of their environment, will use this cluster. %{environment_scope_start}More information%{environment_scope_end}").html_safe % { environment_scope_start: environment_scope_start, environment_scope_end: '</a>'.html_safe }
.form-group .form-group
...@@ -29,7 +31,8 @@ ...@@ -29,7 +31,8 @@
= s_('ClusterIntegration|Specifying a domain will allow you to use Auto Review Apps and Auto Deploy stages for %{auto_devops_start}Auto DevOps%{auto_devops_end}. The domain should have a wildcard DNS configured matching the domain.').html_safe % { auto_devops_start: auto_devops_start, auto_devops_end: '</a>'.html_safe } = s_('ClusterIntegration|Specifying a domain will allow you to use Auto Review Apps and Auto Deploy stages for %{auto_devops_start}Auto DevOps%{auto_devops_end}. The domain should have a wildcard DNS configured matching the domain.').html_safe % { auto_devops_start: auto_devops_start, auto_devops_end: '</a>'.html_safe }
%span{ :class => ["js-ingress-domain-help-text", ("hide" unless @cluster.application_ingress_external_ip.present?)] } %span{ :class => ["js-ingress-domain-help-text", ("hide" unless @cluster.application_ingress_external_ip.present?)] }
= s_('ClusterIntegration|Alternatively') = s_('ClusterIntegration|Alternatively')
%code{ :class => "js-ingress-domain-snippet" } #{@cluster.application_ingress_external_ip}.nip.io %code{ :class => "js-ingress-domain-snippet" }
= s_('ClusterIntegration|%{external_ip}.nip.io').html_safe % { external_ip: @cluster.application_ingress_external_ip }
= s_('ClusterIntegration| can be used instead of a custom domain.') = s_('ClusterIntegration| can be used instead of a custom domain.')
- custom_domain_url = help_page_path('user/clusters/applications.md', anchor: 'pointing-your-dns-at-the-external-endpoint') - custom_domain_url = help_page_path('user/clusters/applications.md', anchor: 'pointing-your-dns-at-the-external-endpoint')
- custom_domain_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: custom_domain_url } - custom_domain_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: custom_domain_url }
......
= bootstrap_form_for cluster, url: update_cluster_url_path, html: { class: 'gl-show-field-errors' }, = bootstrap_form_for cluster, url: update_cluster_url_path, html: { class: 'js-provider-details gl-show-field-errors' },
as: :cluster do |field| as: :cluster do |field|
- copy_name_btn = clipboard_button(text: cluster.name, title: s_('ClusterIntegration|Copy Kubernetes cluster name'), - copy_name_btn = clipboard_button(text: cluster.name, title: s_('ClusterIntegration|Copy Kubernetes cluster name'),
class: 'input-group-text btn-default') if cluster.read_only_kubernetes_platform_fields? class: 'input-group-text btn-default') if cluster.read_only_kubernetes_platform_fields?
......
...@@ -5,8 +5,6 @@ ...@@ -5,8 +5,6 @@
- manage_prometheus_path = edit_project_service_path(@cluster.project, 'prometheus') if @project - manage_prometheus_path = edit_project_service_path(@cluster.project, 'prometheus') if @project
- cluster_environments_path = clusterable.environments_cluster_path(@cluster) - cluster_environments_path = clusterable.environments_cluster_path(@cluster)
- expanded = expanded_by_default?
- status_path = clusterable.cluster_status_cluster_path(@cluster.id, format: :json) if can?(current_user, :admin_cluster, @cluster) - status_path = clusterable.cluster_status_cluster_path(@cluster.id, format: :json) if can?(current_user, :admin_cluster, @cluster)
.edit-cluster-form.js-edit-cluster-form{ data: { status_path: status_path, .edit-cluster-form.js-edit-cluster-form{ data: { status_path: status_path,
install_helm_path: clusterable.install_applications_cluster_path(@cluster, :helm), install_helm_path: clusterable.install_applications_cluster_path(@cluster, :helm),
...@@ -44,7 +42,19 @@ ...@@ -44,7 +42,19 @@
%h4= @cluster.name %h4= @cluster.name
= render 'banner' = render 'banner'
- if cluster_environments_path.present? - if cluster_created?(@cluster)
= render_if_exists 'clusters/clusters/cluster_environments', expanded: expanded .js-toggle-container
- else %ul.nav-links.mobile-separator.nav.nav-tabs{ role: 'tablist' }
= render 'configure', expanded: expanded = render 'details_tab'
= render_if_exists 'clusters/clusters/environments_tab'
= render_if_exists 'clusters/clusters/health_tab'
= render 'applications_tab'
= render 'advanced_settings_tab'
.tab-content.py-3
.tab-pane.active{ role: 'tabpanel' }
= render_cluster_info_tab_content(params[:tab], expanded_by_default?)
---
title: Split cluster info page into tabs
merge_request: 25940
author:
type: changed
- is_configure_active = !params[:tab] || params[:tab] == 'configure'
- is_project_type = @cluster.cluster_type.in? 'project_type'
- is_creating = @cluster.status_name.in? %i/scheduled creating/
- if !is_project_type && !is_creating
.js-toggle-container
%ul.nav-links.mobile-separator.nav.nav-tabs{ role: 'tablist' }
%li.nav-item{ role: 'presentation' }
%a.nav-link{ class: active_when(is_configure_active), href: clusterable.cluster_path(@cluster.id, params: {tab: 'configure'}), id: 'cluster-configure-tab' }
%span= _('Configuration')
%li.nav-item{ role: 'presentation' }
%a.nav-link{ class: active_when(!is_configure_active), href: clusterable.cluster_path(@cluster.id, params: {tab: 'environments'}), id: 'cluster-environments-tab' }
%span.js-cluster-nav-environments= _('Environments')
.tab-content
- if is_configure_active
.tab-pane.active{ id: 'cluster-configure-pane', role: 'tabpanel' }
= render 'configure', expanded: expanded
- else
.tab-pane.active{ id: 'cluster-environments-pane', role: 'tabpanel' }
#js-cluster-environments
- else
= render 'configure', expanded: expanded
- cluster_environments_path = clusterable.environments_cluster_path(@cluster)
- active = params[:tab] == 'environments'
- if !project_cluster?(@cluster) && cluster_environments_path.present?
%li.nav-item{ role: 'presentation' }
%a#cluster-environments-tab.nav-link{ class: active_when(active), href: clusterable.cluster_path(@cluster.id, params: {tab: 'environments'}) }
%span.js-cluster-nav-environments= _('Environments')
- return unless show_cluster_health_graphs?
%section.settings.no-animate.expanded.cluster-health-graphs.qa-cluster-health-section#cluster-health %section.settings.no-animate.expanded.cluster-health-graphs.qa-cluster-health-section#cluster-health
%h4= s_('ClusterIntegration|Cluster health')
- if @cluster&.application_prometheus_available? - if @cluster&.application_prometheus_available?
#prometheus-graphs{ data: cluster_health_data(@cluster).merge({ "alerts-endpoint" => ('/' if Feature.enabled?(:prometheus_computed_alerts)), #prometheus-graphs{ data: cluster_health_data(@cluster).merge({ "alerts-endpoint" => ('/' if Feature.enabled?(:prometheus_computed_alerts)),
"prometheus-alerts-available" => ('true' if Feature.enabled?(:prometheus_computed_alerts)) }) } "prometheus-alerts-available" => ('true' if Feature.enabled?(:prometheus_computed_alerts)) }) }
- else - else
%p.settings-message.text-center= s_("ClusterIntegration|In order to view the health of your cluster, you must first install Prometheus below.") %p.settings-message.text-center= s_("ClusterIntegration|In order to view the health of your cluster, you must first install Prometheus in the Applications tab.")
- active = params[:tab] == 'health'
%li.nav-item{ role: 'presentation' }
%a#cluster-health-tab.nav-link.qa-health{ class: active_when(active), href: clusterable.cluster_path(@cluster.id, params: {tab: 'health'}) }
%span= _('Health')
...@@ -22,15 +22,20 @@ describe 'Cluster Health board', :js, :use_clean_rails_memory_store_caching, :si ...@@ -22,15 +22,20 @@ describe 'Cluster Health board', :js, :use_clean_rails_memory_store_caching, :si
it 'shows cluster board section within the page' do it 'shows cluster board section within the page' do
visit cluster_path visit cluster_path
expect(page).to have_text('Cluster health') expect(page).to have_text('Health')
expect(page).to have_css('#cluster-health')
click_link 'Health'
expect(page).to have_css('.cluster-health-graphs')
end end
context 'no prometheus installed' do context 'no prometheus installed' do
it 'shows install prometheus message' do it 'shows install prometheus message' do
visit cluster_path visit cluster_path
expect(page).to have_text('you must first install Prometheus below') click_link 'Health'
expect(page).to have_text('you must first install Prometheus in the Applications tab')
end end
end end
...@@ -47,6 +52,9 @@ describe 'Cluster Health board', :js, :use_clean_rails_memory_store_caching, :si ...@@ -47,6 +52,9 @@ describe 'Cluster Health board', :js, :use_clean_rails_memory_store_caching, :si
it 'shows container and waiting for data message' do it 'shows container and waiting for data message' do
visit cluster_path visit cluster_path
click_link 'Health'
wait_for_requests wait_for_requests
expect(page).to have_css('.prometheus-graphs') expect(page).to have_css('.prometheus-graphs')
...@@ -61,6 +69,9 @@ describe 'Cluster Health board', :js, :use_clean_rails_memory_store_caching, :si ...@@ -61,6 +69,9 @@ describe 'Cluster Health board', :js, :use_clean_rails_memory_store_caching, :si
it 'renders charts' do it 'renders charts' do
visit cluster_path visit cluster_path
click_link 'Health'
wait_for_requests wait_for_requests
expect(page).to have_css('.prometheus-graphs') expect(page).to have_css('.prometheus-graphs')
......
...@@ -52,7 +52,7 @@ describe 'EE Clusters', :js do ...@@ -52,7 +52,7 @@ describe 'EE Clusters', :js do
before do before do
click_link 'default-cluster' click_link 'default-cluster'
fill_in 'cluster_environment_scope', with: 'production/*' fill_in 'cluster_environment_scope', with: 'production/*'
within '.cluster_integration_form' do within '.js-cluster-integration-form' do
click_button 'Save changes' click_button 'Save changes'
end end
end end
...@@ -135,7 +135,7 @@ describe 'EE Clusters', :js do ...@@ -135,7 +135,7 @@ describe 'EE Clusters', :js do
end end
it 'user sees a cluster details page' do it 'user sees a cluster details page' do
expect(page).to have_content('Enable or disable GitLab\'s connection to your Kubernetes cluster.') expect(page).to have_content('GitLab Integration')
expect(page.find_field('cluster[environment_scope]').value).to eq('staging/*') expect(page.find_field('cluster[environment_scope]').value).to eq('staging/*')
end end
end end
...@@ -144,7 +144,7 @@ describe 'EE Clusters', :js do ...@@ -144,7 +144,7 @@ describe 'EE Clusters', :js do
before do before do
click_link 'default-cluster' click_link 'default-cluster'
fill_in 'cluster_environment_scope', with: 'production/*' fill_in 'cluster_environment_scope', with: 'production/*'
within ".cluster_integration_form" do within ".js-cluster-integration-form" do
click_button 'Save changes' click_button 'Save changes'
end end
end end
......
...@@ -25,8 +25,8 @@ describe 'clusters/clusters/show' do ...@@ -25,8 +25,8 @@ describe 'clusters/clusters/show' do
it 'displays the Cluster health section' do it 'displays the Cluster health section' do
render render
expect(rendered).to have_selector('#cluster-health') expect(rendered).to have_selector('#cluster-health-tab')
expect(rendered).to have_content('Cluster health') expect(rendered).to have_content('Health')
end end
end end
......
...@@ -1550,13 +1550,13 @@ msgstr "" ...@@ -1550,13 +1550,13 @@ msgstr ""
msgid "Advanced" msgid "Advanced"
msgstr "" msgstr ""
msgid "Advanced permissions, Large File Storage and Two-Factor authentication settings." msgid "Advanced Settings"
msgstr "" msgstr ""
msgid "Advanced search functionality" msgid "Advanced permissions, Large File Storage and Two-Factor authentication settings."
msgstr "" msgstr ""
msgid "Advanced settings" msgid "Advanced search functionality"
msgstr "" msgstr ""
msgid "After a successful password update you will be redirected to login screen." msgid "After a successful password update you will be redirected to login screen."
...@@ -4024,6 +4024,9 @@ msgstr "" ...@@ -4024,6 +4024,9 @@ msgstr ""
msgid "ClusterIntegration|%{appList} was successfully installed on your Kubernetes cluster" msgid "ClusterIntegration|%{appList} was successfully installed on your Kubernetes cluster"
msgstr "" msgstr ""
msgid "ClusterIntegration|%{external_ip}.nip.io"
msgstr ""
msgid "ClusterIntegration|%{title} uninstalled successfully." msgid "ClusterIntegration|%{title} uninstalled successfully."
msgstr "" msgstr ""
...@@ -4060,7 +4063,7 @@ msgstr "" ...@@ -4060,7 +4063,7 @@ msgstr ""
msgid "ClusterIntegration|Adding an integration will share the cluster across all projects." msgid "ClusterIntegration|Adding an integration will share the cluster across all projects."
msgstr "" msgstr ""
msgid "ClusterIntegration|Advanced options on this Kubernetes cluster's integration" msgid "ClusterIntegration|Advanced options on this Kubernetes clusters integration"
msgstr "" msgstr ""
msgid "ClusterIntegration|All data not committed to GitLab will be deleted and cannot be restored." msgid "ClusterIntegration|All data not committed to GitLab will be deleted and cannot be restored."
...@@ -4096,9 +4099,6 @@ msgstr "" ...@@ -4096,9 +4099,6 @@ msgstr ""
msgid "ClusterIntegration|Any running pipelines will be canceled." msgid "ClusterIntegration|Any running pipelines will be canceled."
msgstr "" msgstr ""
msgid "ClusterIntegration|Applications"
msgstr ""
msgid "ClusterIntegration|Apply for credit" msgid "ClusterIntegration|Apply for credit"
msgstr "" msgstr ""
...@@ -4150,9 +4150,6 @@ msgstr "" ...@@ -4150,9 +4150,6 @@ msgstr ""
msgid "ClusterIntegration|Cluster being created" msgid "ClusterIntegration|Cluster being created"
msgstr "" msgstr ""
msgid "ClusterIntegration|Cluster health"
msgstr ""
msgid "ClusterIntegration|Cluster management project (alpha)" msgid "ClusterIntegration|Cluster management project (alpha)"
msgstr "" msgstr ""
...@@ -4345,7 +4342,7 @@ msgstr "" ...@@ -4345,7 +4342,7 @@ msgstr ""
msgid "ClusterIntegration|If you do not wish to delete all associated GitLab resources, you can simply remove the integration." msgid "ClusterIntegration|If you do not wish to delete all associated GitLab resources, you can simply remove the integration."
msgstr "" msgstr ""
msgid "ClusterIntegration|In order to view the health of your cluster, you must first install Prometheus below." msgid "ClusterIntegration|In order to view the health of your cluster, you must first install Prometheus in the Applications tab."
msgstr "" msgstr ""
msgid "ClusterIntegration|Ingress" msgid "ClusterIntegration|Ingress"
...@@ -4369,9 +4366,6 @@ msgstr "" ...@@ -4369,9 +4366,6 @@ msgstr ""
msgid "ClusterIntegration|Integrate Kubernetes cluster automation" msgid "ClusterIntegration|Integrate Kubernetes cluster automation"
msgstr "" msgstr ""
msgid "ClusterIntegration|Integration status"
msgstr ""
msgid "ClusterIntegration|Issuer Email" msgid "ClusterIntegration|Issuer Email"
msgstr "" msgstr ""
...@@ -4408,9 +4402,6 @@ msgstr "" ...@@ -4408,9 +4402,6 @@ msgstr ""
msgid "ClusterIntegration|Kubernetes cluster" msgid "ClusterIntegration|Kubernetes cluster"
msgstr "" msgstr ""
msgid "ClusterIntegration|Kubernetes cluster details"
msgstr ""
msgid "ClusterIntegration|Kubernetes cluster is being created..." msgid "ClusterIntegration|Kubernetes cluster is being created..."
msgstr "" msgstr ""
...@@ -4561,6 +4552,9 @@ msgstr "" ...@@ -4561,6 +4552,9 @@ msgstr ""
msgid "ClusterIntegration|Prometheus is an open-source monitoring system with %{gitlabIntegrationLink} to monitor deployed applications." msgid "ClusterIntegration|Prometheus is an open-source monitoring system with %{gitlabIntegrationLink} to monitor deployed applications."
msgstr "" msgstr ""
msgid "ClusterIntegration|Provider details"
msgstr ""
msgid "ClusterIntegration|Provision Role ARN" msgid "ClusterIntegration|Provision Role ARN"
msgstr "" msgstr ""
...@@ -10291,6 +10285,9 @@ msgstr "" ...@@ -10291,6 +10285,9 @@ msgstr ""
msgid "Header message" msgid "Header message"
msgstr "" msgstr ""
msgid "Health"
msgstr ""
msgid "Health Check" msgid "Health Check"
msgstr "" msgstr ""
......
...@@ -9,9 +9,13 @@ module QA ...@@ -9,9 +9,13 @@ module QA
module Show module Show
def self.prepended(page) def self.prepended(page)
page.module_eval do page.module_eval do
view 'ee/app/views/projects/clusters/_prometheus_graphs.html.haml' do view 'ee/app/views/clusters/clusters/_health.html.haml' do
element :cluster_health_section element :cluster_health_section
end end
view 'ee/app/views/clusters/clusters/_health_tab.html.haml' do
element :health, required: true
end
end end
end end
...@@ -21,10 +25,9 @@ module QA ...@@ -21,10 +25,9 @@ module QA
end end
end end
def has_cluster_health_title? def open_health
within_cluster_health_section do has_element?(:health, wait: 30)
has_text?('Cluster health') click_element :health
end
end end
def has_cluster_health_graphs? def has_cluster_health_graphs?
......
...@@ -10,17 +10,35 @@ module QA ...@@ -10,17 +10,35 @@ module QA
element :ingress_ip_address, 'id="ingress-endpoint"' # rubocop:disable QA/ElementWithPattern element :ingress_ip_address, 'id="ingress-endpoint"' # rubocop:disable QA/ElementWithPattern
end end
view 'app/views/clusters/clusters/_form.html.haml' do view 'app/views/clusters/clusters/_gitlab_integration_form.html.haml' do
element :integration_status_toggle, required: true element :integration_status_toggle, required: true
element :base_domain_field, required: true element :base_domain_field, required: true
element :save_changes_button, required: true element :save_changes_button, required: true
end end
view 'app/views/clusters/clusters/_details_tab.html.haml' do
element :details, required: true
end
view 'app/views/clusters/clusters/_applications_tab.html.haml' do
element :applications, required: true
end
view 'app/assets/javascripts/clusters/components/application_row.vue' do view 'app/assets/javascripts/clusters/components/application_row.vue' do
element :install_button element :install_button
element :uninstall_button element :uninstall_button
end end
def open_details
has_element?(:details, wait: 30)
click_element :details
end
def open_applications
has_element?(:applications, wait: 30)
click_element :applications
end
def install!(application_name) def install!(application_name)
within_element(application_name) do within_element(application_name) do
has_element?(:install_button, application: application_name, wait: 30) has_element?(:install_button, application: application_name, wait: 30)
......
...@@ -38,6 +38,9 @@ module QA ...@@ -38,6 +38,9 @@ module QA
# We must wait a few seconds for permissions to be set up correctly for new cluster # We must wait a few seconds for permissions to be set up correctly for new cluster
sleep 10 sleep 10
# Open applications tab
show.open_applications
# Helm must be installed before everything else # Helm must be installed before everything else
show.install!(:helm) show.install!(:helm)
show.await_installed(:helm) show.await_installed(:helm)
...@@ -52,6 +55,8 @@ module QA ...@@ -52,6 +55,8 @@ module QA
if @install_ingress if @install_ingress
populate(:ingress_ip) populate(:ingress_ip)
show.open_details
show.set_domain("#{ingress_ip}.nip.io") show.set_domain("#{ingress_ip}.nip.io")
show.save_domain show.save_domain
end end
......
...@@ -42,7 +42,7 @@ module QA ...@@ -42,7 +42,7 @@ module QA
def verify_cluster_health_graphs def verify_cluster_health_graphs
Page::Project::Operations::Kubernetes::Show.perform do |cluster| Page::Project::Operations::Kubernetes::Show.perform do |cluster|
cluster.refresh cluster.refresh
expect(cluster).to have_cluster_health_title cluster.open_health
cluster.wait_for_cluster_health cluster.wait_for_cluster_health
end end
......
...@@ -17,7 +17,7 @@ describe 'Clusterable > Show page' do ...@@ -17,7 +17,7 @@ describe 'Clusterable > Show page' do
it 'allow the user to set domain' do it 'allow the user to set domain' do
visit cluster_path visit cluster_path
within '#cluster-integration' do within '.js-cluster-integration-form' do
fill_in('cluster_base_domain', with: 'test.com') fill_in('cluster_base_domain', with: 'test.com')
click_on 'Save changes' click_on 'Save changes'
end end
...@@ -34,7 +34,7 @@ describe 'Clusterable > Show page' do ...@@ -34,7 +34,7 @@ describe 'Clusterable > Show page' do
end end
it 'shows help text with the domain as an alternative to custom domain' do it 'shows help text with the domain as an alternative to custom domain' do
within '#cluster-integration' do within '.js-cluster-integration-form' do
expect(find(cluster_ingress_help_text_selector)).not_to match_css(hide_modifier_selector) expect(find(cluster_ingress_help_text_selector)).not_to match_css(hide_modifier_selector)
end end
end end
...@@ -44,7 +44,7 @@ describe 'Clusterable > Show page' do ...@@ -44,7 +44,7 @@ describe 'Clusterable > Show page' do
it 'alternative to custom domain is not shown' do it 'alternative to custom domain is not shown' do
visit cluster_path visit cluster_path
within '#cluster-integration' do within '.js-cluster-integration-form' do
expect(find(cluster_ingress_help_text_selector)).to match_css(hide_modifier_selector) expect(find(cluster_ingress_help_text_selector)).to match_css(hide_modifier_selector)
end end
end end
...@@ -63,7 +63,7 @@ describe 'Clusterable > Show page' do ...@@ -63,7 +63,7 @@ describe 'Clusterable > Show page' do
end end
it 'is not able to edit the name, API url, CA certificate nor token' do it 'is not able to edit the name, API url, CA certificate nor token' do
within('#js-cluster-details') do within('.js-provider-details') do
cluster_name_field = find('.cluster-name') cluster_name_field = find('.cluster-name')
api_url_field = find('#cluster_platform_kubernetes_attributes_api_url') api_url_field = find('#cluster_platform_kubernetes_attributes_api_url')
ca_certificate_field = find('#cluster_platform_kubernetes_attributes_ca_cert') ca_certificate_field = find('#cluster_platform_kubernetes_attributes_ca_cert')
...@@ -77,6 +77,8 @@ describe 'Clusterable > Show page' do ...@@ -77,6 +77,8 @@ describe 'Clusterable > Show page' do
end end
it 'displays GKE information' do it 'displays GKE information' do
click_link 'Advanced Settings'
within('#advanced-settings-section') do within('#advanced-settings-section') do
expect(page).to have_content('Google Kubernetes Engine') expect(page).to have_content('Google Kubernetes Engine')
expect(page).to have_content('Manage your Kubernetes cluster by visiting') expect(page).to have_content('Manage your Kubernetes cluster by visiting')
...@@ -91,7 +93,7 @@ describe 'Clusterable > Show page' do ...@@ -91,7 +93,7 @@ describe 'Clusterable > Show page' do
end end
it 'is able to edit the name, API url, CA certificate and token' do it 'is able to edit the name, API url, CA certificate and token' do
within('#js-cluster-details') do within('.js-provider-details') do
cluster_name_field = find('#cluster_name') cluster_name_field = find('#cluster_name')
api_url_field = find('#cluster_platform_kubernetes_attributes_api_url') api_url_field = find('#cluster_platform_kubernetes_attributes_api_url')
ca_certificate_field = find('#cluster_platform_kubernetes_attributes_ca_cert') ca_certificate_field = find('#cluster_platform_kubernetes_attributes_ca_cert')
...@@ -105,6 +107,8 @@ describe 'Clusterable > Show page' do ...@@ -105,6 +107,8 @@ describe 'Clusterable > Show page' do
end end
it 'does not display GKE information' do it 'does not display GKE information' do
click_link 'Advanced Settings'
within('#advanced-settings-section') do within('#advanced-settings-section') do
expect(page).not_to have_content('Google Kubernetes Engine') expect(page).not_to have_content('Google Kubernetes Engine')
expect(page).not_to have_content('Manage your Kubernetes cluster by visiting') expect(page).not_to have_content('Manage your Kubernetes cluster by visiting')
......
...@@ -17,6 +17,12 @@ shared_examples "installing applications on a cluster" do ...@@ -17,6 +17,12 @@ shared_examples "installing applications on a cluster" do
context 'when cluster is created' do context 'when cluster is created' do
let(:cluster) { create(:cluster, :provided_by_gcp, *cluster_factory_args) } let(:cluster) { create(:cluster, :provided_by_gcp, *cluster_factory_args) }
before do
page.within('.js-edit-cluster-form') do
click_link 'Applications'
end
end
it 'user can install applications' do it 'user can install applications' do
wait_for_requests wait_for_requests
...@@ -29,6 +35,7 @@ shared_examples "installing applications on a cluster" do ...@@ -29,6 +35,7 @@ shared_examples "installing applications on a cluster" do
context 'when user installs Helm' do context 'when user installs Helm' do
before do before do
allow(ClusterInstallAppWorker).to receive(:perform_async) allow(ClusterInstallAppWorker).to receive(:perform_async)
wait_for_requests
page.within('.js-cluster-application-row-helm') do page.within('.js-cluster-application-row-helm') do
page.find(:css, '.js-cluster-application-install-button').click page.find(:css, '.js-cluster-application-install-button').click
......
...@@ -34,7 +34,7 @@ describe 'User Cluster', :js do ...@@ -34,7 +34,7 @@ describe 'User Cluster', :js do
it 'user sees a cluster details page' do it 'user sees a cluster details page' do
subject subject
expect(page).to have_content('Kubernetes cluster integration') expect(page).to have_content('GitLab Integration')
expect(page.find_field('cluster[name]').value).to eq('dev-cluster') expect(page.find_field('cluster[name]').value).to eq('dev-cluster')
expect(page.find_field('cluster[platform_kubernetes_attributes][api_url]').value) expect(page.find_field('cluster[platform_kubernetes_attributes][api_url]').value)
.to have_content('http://example.com') .to have_content('http://example.com')
...@@ -93,7 +93,7 @@ describe 'User Cluster', :js do ...@@ -93,7 +93,7 @@ describe 'User Cluster', :js do
context 'when user disables the cluster' do context 'when user disables the cluster' do
before do before do
page.find(:css, '.js-cluster-enable-toggle-area .js-project-feature-toggle').click page.find(:css, '.js-cluster-enable-toggle-area .js-project-feature-toggle').click
page.within('#cluster-integration') { click_button 'Save changes' } page.within('.js-cluster-integration-form') { click_button 'Save changes' }
end end
it 'user sees the successful message' do it 'user sees the successful message' do
...@@ -105,7 +105,7 @@ describe 'User Cluster', :js do ...@@ -105,7 +105,7 @@ describe 'User Cluster', :js do
before do before do
fill_in 'cluster_name', with: 'my-dev-cluster' fill_in 'cluster_name', with: 'my-dev-cluster'
fill_in 'cluster_platform_kubernetes_attributes_token', with: 'new-token' fill_in 'cluster_platform_kubernetes_attributes_token', with: 'new-token'
page.within('#js-cluster-details') { click_button 'Save changes' } page.within('.js-provider-details') { click_button 'Save changes' }
end end
it 'user sees the successful message' do it 'user sees the successful message' do
...@@ -117,6 +117,7 @@ describe 'User Cluster', :js do ...@@ -117,6 +117,7 @@ describe 'User Cluster', :js do
context 'when user destroys the cluster' do context 'when user destroys the cluster' do
before do before do
click_link 'Advanced Settings'
click_button 'Remove integration and resources' click_button 'Remove integration and resources'
fill_in 'confirm_cluster_name_input', with: cluster.name fill_in 'confirm_cluster_name_input', with: cluster.name
click_button 'Remove integration' click_button 'Remove integration'
......
...@@ -119,7 +119,7 @@ describe 'Gcp Cluster', :js, :do_not_mock_admin_mode do ...@@ -119,7 +119,7 @@ describe 'Gcp Cluster', :js, :do_not_mock_admin_mode do
context 'when user disables the cluster' do context 'when user disables the cluster' do
before do before do
page.find(:css, '.js-cluster-enable-toggle-area .js-project-feature-toggle').click page.find(:css, '.js-cluster-enable-toggle-area .js-project-feature-toggle').click
page.within('#cluster-integration') { click_button 'Save changes' } page.within('.js-cluster-integration-form') { click_button 'Save changes' }
end end
it 'user sees the successful message' do it 'user sees the successful message' do
...@@ -130,7 +130,7 @@ describe 'Gcp Cluster', :js, :do_not_mock_admin_mode do ...@@ -130,7 +130,7 @@ describe 'Gcp Cluster', :js, :do_not_mock_admin_mode do
context 'when user changes cluster parameters' do context 'when user changes cluster parameters' do
before do before do
fill_in 'cluster_platform_kubernetes_attributes_namespace', with: 'my-namespace' fill_in 'cluster_platform_kubernetes_attributes_namespace', with: 'my-namespace'
page.within('#js-cluster-details') { click_button 'Save changes' } page.within('.js-provider-details') { click_button 'Save changes' }
end end
it 'user sees the successful message' do it 'user sees the successful message' do
...@@ -141,6 +141,7 @@ describe 'Gcp Cluster', :js, :do_not_mock_admin_mode do ...@@ -141,6 +141,7 @@ describe 'Gcp Cluster', :js, :do_not_mock_admin_mode do
context 'when user destroys the cluster' do context 'when user destroys the cluster' do
before do before do
click_link 'Advanced Settings'
click_button 'Remove integration and resources' click_button 'Remove integration and resources'
fill_in 'confirm_cluster_name_input', with: cluster.name fill_in 'confirm_cluster_name_input', with: cluster.name
click_button 'Remove integration' click_button 'Remove integration'
......
...@@ -41,7 +41,7 @@ describe 'User Cluster', :js do ...@@ -41,7 +41,7 @@ describe 'User Cluster', :js do
it 'user sees a cluster details page' do it 'user sees a cluster details page' do
subject subject
expect(page).to have_content('Kubernetes cluster integration') expect(page).to have_content('GitLab Integration')
expect(page.find_field('cluster[name]').value).to eq('dev-cluster') expect(page.find_field('cluster[name]').value).to eq('dev-cluster')
expect(page.find_field('cluster[platform_kubernetes_attributes][api_url]').value) expect(page.find_field('cluster[platform_kubernetes_attributes][api_url]').value)
.to have_content('http://example.com') .to have_content('http://example.com')
...@@ -79,7 +79,7 @@ describe 'User Cluster', :js do ...@@ -79,7 +79,7 @@ describe 'User Cluster', :js do
context 'when user disables the cluster' do context 'when user disables the cluster' do
before do before do
page.find(:css, '.js-cluster-enable-toggle-area .js-project-feature-toggle').click page.find(:css, '.js-cluster-enable-toggle-area .js-project-feature-toggle').click
page.within('#cluster-integration') { click_button 'Save changes' } page.within('.js-cluster-integration-form') { click_button 'Save changes' }
end end
it 'user sees the successful message' do it 'user sees the successful message' do
...@@ -91,7 +91,7 @@ describe 'User Cluster', :js do ...@@ -91,7 +91,7 @@ describe 'User Cluster', :js do
before do before do
fill_in 'cluster_name', with: 'my-dev-cluster' fill_in 'cluster_name', with: 'my-dev-cluster'
fill_in 'cluster_platform_kubernetes_attributes_namespace', with: 'my-namespace' fill_in 'cluster_platform_kubernetes_attributes_namespace', with: 'my-namespace'
page.within('#js-cluster-details') { click_button 'Save changes' } page.within('.js-provider-details') { click_button 'Save changes' }
end end
it 'user sees the successful message' do it 'user sees the successful message' do
...@@ -103,6 +103,7 @@ describe 'User Cluster', :js do ...@@ -103,6 +103,7 @@ describe 'User Cluster', :js do
context 'when user destroys the cluster' do context 'when user destroys the cluster' do
before do before do
click_link 'Advanced Settings'
click_button 'Remove integration and resources' click_button 'Remove integration and resources'
fill_in 'confirm_cluster_name_input', with: cluster.name fill_in 'confirm_cluster_name_input', with: cluster.name
click_button 'Remove integration' click_button 'Remove integration'
......
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