Commit f8ab8d57 authored by Phil Hughes's avatar Phil Hughes

Merge branch 'jivanvl-move-cluster-health-frontend' into 'master'

[RUN AS-IF-FOSS] Move cluster_health to core

See merge request gitlab-org/gitlab!35787
parents 1b57ba65 6957cffc
import ClustersBundle from '~/clusters/clusters_bundle'; import ClustersBundle from '~/clusters/clusters_bundle';
import initClusterHealth from '~/pages/projects/clusters/show/cluster_health';
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
new ClustersBundle(); // eslint-disable-line no-new new ClustersBundle(); // eslint-disable-line no-new
initClusterHealth();
}); });
import ClustersBundle from '~/clusters/clusters_bundle'; import ClustersBundle from '~/clusters/clusters_bundle';
import initClusterHealth from '~/pages/projects/clusters/show/cluster_health';
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
new ClustersBundle(); // eslint-disable-line no-new new ClustersBundle(); // eslint-disable-line no-new
initClusterHealth();
}); });
import initCeBundle from '~/monitoring/monitoring_app'; import monitoringApp from '~/monitoring/monitoring_app';
export default () => { export default () => {
const el = document.getElementById('prometheus-graphs'); const el = document.getElementById('prometheus-graphs');
if (el && el.dataset) { if (el && el.dataset) {
initCeBundle({ monitoringApp({
...el.dataset, ...el.dataset,
showLegend: false, showLegend: false,
showHeader: false, showHeader: false,
......
import ClustersBundle from '~/clusters/clusters_bundle'; import ClustersBundle from '~/clusters/clusters_bundle';
import initGkeNamespace from '~/create_cluster/gke_cluster_namespace'; import initGkeNamespace from '~/create_cluster/gke_cluster_namespace';
import initClusterHealth from './cluster_health';
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
new ClustersBundle(); // eslint-disable-line no-new new ClustersBundle(); // eslint-disable-line no-new
initGkeNamespace(); initGkeNamespace();
initClusterHealth();
}); });
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
%ul.nav-links.mobile-separator.nav.nav-tabs{ role: 'tablist' } %ul.nav-links.mobile-separator.nav.nav-tabs{ role: 'tablist' }
= render 'details_tab' = render 'details_tab'
= render_if_exists 'clusters/clusters/environments_tab' = render_if_exists 'clusters/clusters/environments_tab'
= render_if_exists 'clusters/clusters/health_tab' = render 'clusters/clusters/health_tab'
= render 'applications_tab' = render 'applications_tab'
= render 'advanced_settings_tab' = render 'advanced_settings_tab'
......
import '~/pages/admin/clusters/show';
import initClusterHealth from '../../../projects/clusters/show/cluster_health';
document.addEventListener('DOMContentLoaded', initClusterHealth);
import '~/pages/projects/clusters/show';
import initClusterHealth from '../../../projects/clusters/show/cluster_health';
document.addEventListener('DOMContentLoaded', initClusterHealth);
import '~/pages/projects/clusters/show';
import initClusterHealth from './cluster_health';
document.addEventListener('DOMContentLoaded', initClusterHealth);
...@@ -135,10 +135,6 @@ module QA ...@@ -135,10 +135,6 @@ module QA
end end
module Operations module Operations
module Kubernetes
autoload :Show, 'qa/ee/page/project/operations/kubernetes/show'
end
module Metrics module Metrics
autoload :Show, 'qa/ee/page/project/operations/metrics/show' autoload :Show, 'qa/ee/page/project/operations/metrics/show'
end end
......
# frozen_string_literal: true
module QA
module EE
module Page
module Project
module Operations
module Kubernetes
module Show
extend QA::Page::PageConcern
def self.prepended(base)
super
base.class_eval do
view 'ee/app/views/clusters/clusters/_health.html.haml' do
element :cluster_health_section
end
view 'ee/app/views/clusters/clusters/_health_tab.html.haml' do
element :health, required: true
end
end
end
def wait_for_cluster_health
wait_until(max_duration: 120, sleep_interval: 3, reload: true) do
has_cluster_health_graphs?
end
end
def open_health
has_element?(:health, wait: 30)
click_element :health
end
def has_cluster_health_graphs?
within_cluster_health_section do
has_text?('CPU Usage')
end
end
def within_cluster_health_section
within_element :cluster_health_section do
yield
end
end
end
end
end
end
end
end
end
...@@ -29,6 +29,14 @@ module QA ...@@ -29,6 +29,14 @@ module QA
element :uninstall_button element :uninstall_button
end end
view 'app/views/clusters/clusters/_health.html.haml' do
element :cluster_health_section
end
view 'app/views/clusters/clusters/_health_tab.html.haml' do
element :health, required: true
end
def open_details def open_details
has_element?(:details, wait: 30) has_element?(:details, wait: 30)
click_element :details click_element :details
...@@ -71,11 +79,32 @@ module QA ...@@ -71,11 +79,32 @@ module QA
def save_domain def save_domain
click_element :save_changes_button, Page::Project::Operations::Kubernetes::Show click_element :save_changes_button, Page::Project::Operations::Kubernetes::Show
end end
def wait_for_cluster_health
wait_until(max_duration: 120, sleep_interval: 3, reload: true) do
has_cluster_health_graphs?
end end
end end
def open_health
has_element?(:health, wait: 30)
click_element :health
end end
def has_cluster_health_graphs?
within_cluster_health_section do
has_text?('CPU Usage')
end end
end end
end
QA::Page::Project::Operations::Kubernetes::Show.prepend_if_ee('QA::EE::Page::Project::Operations::Kubernetes::Show') def within_cluster_health_section
within_element :cluster_health_section do
yield
end
end
end
end
end
end
end
end
...@@ -64,6 +64,19 @@ module QA ...@@ -64,6 +64,19 @@ module QA
end end
end end
it 'observes cluster health graph' do
Page::Project::Menu.perform(&:go_to_operations_kubernetes)
Page::Project::Operations::Kubernetes::Index.perform do |cluster_list|
cluster_list.click_on_cluster(@cluster)
end
Page::Project::Operations::Kubernetes::Show.perform do |cluster_panel|
cluster_panel.open_health
cluster_panel.wait_for_cluster_health
end
end
private private
def deploy_project_with_prometheus def deploy_project_with_prometheus
......
...@@ -35,19 +35,6 @@ module QA ...@@ -35,19 +35,6 @@ module QA
end end
end end
it 'observes cluster health graph' do
Page::Project::Menu.perform(&:go_to_operations_kubernetes)
Page::Project::Operations::Kubernetes::Index.perform do |cluster_list|
cluster_list.click_on_cluster(@cluster)
end
Page::Project::Operations::Kubernetes::Show.perform do |cluster_panel|
cluster_panel.open_health
cluster_panel.wait_for_cluster_health
end
end
it 'creates and sets an incident template' do it 'creates and sets an incident template' do
create_incident_template create_incident_template
......
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