From 4882c793019f4c46ca20e0c187dc97e10cf5a3ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matija=20=C4=8Cupi=C4=87?= Date: Thu, 30 Nov 2017 22:23:10 +0100 Subject: Remove cluster scope from ClustersController#index --- app/controllers/projects/clusters_controller.rb | 7 ++---- .../projects/clusters_controller_spec.rb | 28 ---------------------- 2 files changed, 2 insertions(+), 33 deletions(-) diff --git a/app/controllers/projects/clusters_controller.rb b/app/controllers/projects/clusters_controller.rb index 0907daacbc3..4a7879db313 100644 --- a/app/controllers/projects/clusters_controller.rb +++ b/app/controllers/projects/clusters_controller.rb @@ -8,11 +8,8 @@ class Projects::ClustersController < Projects::ApplicationController STATUS_POLLING_INTERVAL = 10_000 def index - @scope = params[:scope] || 'all' - @clusters = ClustersFinder.new(project, current_user, @scope).execute.page(params[:page]) - @active_count = ClustersFinder.new(project, current_user, :active).execute.count - @inactive_count = ClustersFinder.new(project, current_user, :inactive).execute.count - @all_count = @active_count + @inactive_count + clusters = ClustersFinder.new(project, current_user, :all).execute + @clusters = clusters.page(params[:page]).per(20) end def new diff --git a/spec/controllers/projects/clusters_controller_spec.rb b/spec/controllers/projects/clusters_controller_spec.rb index 280b7e4d8b9..a3b13647c92 100644 --- a/spec/controllers/projects/clusters_controller_spec.rb +++ b/spec/controllers/projects/clusters_controller_spec.rb @@ -27,13 +27,6 @@ describe Projects::ClustersController do expect(assigns(:clusters)).to match_array([enabled_cluster, disabled_cluster]) end - it 'assigns counters to correct values' do - go - - expect(assigns(:active_count)).to eq(1) - expect(assigns(:inactive_count)).to eq(1) - end - context 'when page is specified' do let(:last_page) { project.clusters.page.total_pages } @@ -48,20 +41,6 @@ describe Projects::ClustersController do expect(assigns(:clusters).current_page).to eq(last_page) end end - - context 'when only enabled clusters are requested' do - it 'returns only enabled clusters' do - get :index, namespace_id: project.namespace, project_id: project, scope: 'active' - expect(assigns(:clusters)).to all(have_attributes(enabled: true)) - end - end - - context 'when only disabled clusters are requested' do - it 'returns only disabled clusters' do - get :index, namespace_id: project.namespace, project_id: project, scope: 'inactive' - expect(assigns(:clusters)).to all(have_attributes(enabled: false)) - end - end end context 'when project does not have a cluster' do @@ -74,13 +53,6 @@ describe Projects::ClustersController do expect(response).to render_template(:index, partial: :empty_state) expect(assigns(:clusters)).to eq([]) end - - it 'assigns counters to zero' do - go - - expect(assigns(:active_count)).to eq(0) - expect(assigns(:inactive_count)).to eq(0) - end end end -- cgit v1.2.1 From eae1b8282bca1adac6289087edd7601e442edc8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matija=20=C4=8Cupi=C4=87?= Date: Thu, 30 Nov 2017 23:14:25 +0100 Subject: Remove tab navigation from clusters/index --- app/views/projects/clusters/_tabs.html.haml | 16 ---------------- app/views/projects/clusters/index.html.haml | 16 ++++++++-------- spec/features/projects/clusters_spec.rb | 11 ----------- 3 files changed, 8 insertions(+), 35 deletions(-) delete mode 100644 app/views/projects/clusters/_tabs.html.haml diff --git a/app/views/projects/clusters/_tabs.html.haml b/app/views/projects/clusters/_tabs.html.haml deleted file mode 100644 index c8120e806fa..00000000000 --- a/app/views/projects/clusters/_tabs.html.haml +++ /dev/null @@ -1,16 +0,0 @@ -.top-area.scrolling-tabs-container.inner-page-scroll-tabs - .fade-left= icon("angle-left") - .fade-right= icon("angle-right") - %ul.nav-links.scrolling-tabs - %li{ class: ('active' if @scope == 'active') }> - = link_to project_clusters_path(@project, scope: :active), class: "js-active-tab" do - = s_("ClusterIntegration|Active") - %span.badge= @active_count - %li{ class: ('active' if @scope == 'inactive') }> - = link_to project_clusters_path(@project, scope: :inactive), class: "js-inactive-tab" do - = s_("ClusterIntegration|Inactive") - %span.badge= @inactive_count - %li{ class: ('active' if @scope.nil? || @scope == 'all') }> - = link_to project_clusters_path(@project), class: "js-all-tab" do - = s_("ClusterIntegration|All") - %span.badge= @all_count diff --git a/app/views/projects/clusters/index.html.haml b/app/views/projects/clusters/index.html.haml index 104e39b0e06..4399905a7a1 100644 --- a/app/views/projects/clusters/index.html.haml +++ b/app/views/projects/clusters/index.html.haml @@ -2,8 +2,14 @@ - page_title "Clusters" .clusters-container - - if !@clusters.empty? - = render "tabs" + - if @clusters.empty? + = render "empty_state" + - else + .top-area.adjust + .nav-text + = s_("ClusterIntegration|Control your environments separately by adding multiple clusters to your project") + .pull-right.nav-bar-right + = link_to s_("ClusterIntegration|Add cluster"), new_project_cluster_path(@project), class: "btn btn-success disabled has-tooltip js-add-cluster", title: s_("ClusterIntegration|Multiple clusters are available in GitLab Entreprise Edition Premium and Ultimate") .ci-table.js-clusters-list .gl-responsive-table-row.table-row-header{ role: "row" } .table-section.section-30{ role: "rowheader" } @@ -16,9 +22,3 @@ - @clusters.each do |cluster| = render "cluster", cluster: cluster.present(current_user: current_user) = paginate @clusters, theme: "gitlab" - - elsif @scope == 'all' - = render "empty_state" - - else - = render "tabs" - .prepend-top-20.text-center - = s_("ClusterIntegration|There are no clusters to show") diff --git a/spec/features/projects/clusters_spec.rb b/spec/features/projects/clusters_spec.rb index 008bdf2044b..93929bf6814 100644 --- a/spec/features/projects/clusters_spec.rb +++ b/spec/features/projects/clusters_spec.rb @@ -35,17 +35,6 @@ feature 'Clusters', :js do expect(page).to have_selector('.gl-responsive-table-row', count: 2) end - it 'user sees navigation tabs' do - expect(page.find('.js-active-tab').text).to include('Active') - expect(page.find('.js-active-tab .badge').text).to include('1') - - expect(page.find('.js-inactive-tab').text).to include('Inactive') - expect(page.find('.js-inactive-tab .badge').text).to include('0') - - expect(page.find('.js-all-tab').text).to include('All') - expect(page.find('.js-all-tab .badge').text).to include('1') - end - context 'inline update of cluster' do it 'user can update cluster' do expect(page).to have_selector('.js-toggle-cluster-list') -- cgit v1.2.1 From d606062e9d1b38c6aeeac6fa3e23abfca10df59a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matija=20=C4=8Cupi=C4=87?= Date: Mon, 4 Dec 2017 13:26:03 +0100 Subject: Add CHANGELOG entry --- changelogs/unreleased/multiple-clusters-single-list.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 changelogs/unreleased/multiple-clusters-single-list.yml diff --git a/changelogs/unreleased/multiple-clusters-single-list.yml b/changelogs/unreleased/multiple-clusters-single-list.yml new file mode 100644 index 00000000000..55743f3c00e --- /dev/null +++ b/changelogs/unreleased/multiple-clusters-single-list.yml @@ -0,0 +1,5 @@ +--- +title: Present multiple clusters in a single list instead of a tabbed view +merge_request: 15669 +author: +type: changed -- cgit v1.2.1 From e292752bd265d347ec9803b558ecbfce1473c387 Mon Sep 17 00:00:00 2001 From: Chris Peressini Date: Mon, 4 Dec 2017 11:12:58 +0100 Subject: Change copy on list header --- app/views/projects/clusters/index.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/projects/clusters/index.html.haml b/app/views/projects/clusters/index.html.haml index 4399905a7a1..e71b2797b14 100644 --- a/app/views/projects/clusters/index.html.haml +++ b/app/views/projects/clusters/index.html.haml @@ -7,7 +7,7 @@ - else .top-area.adjust .nav-text - = s_("ClusterIntegration|Control your environments separately by adding multiple clusters to your project") + = s_("ClusterIntegration|Clusters can be used to deploy applications and to provide Review Apps for this project") .pull-right.nav-bar-right = link_to s_("ClusterIntegration|Add cluster"), new_project_cluster_path(@project), class: "btn btn-success disabled has-tooltip js-add-cluster", title: s_("ClusterIntegration|Multiple clusters are available in GitLab Entreprise Edition Premium and Ultimate") .ci-table.js-clusters-list -- cgit v1.2.1 From 5a1ebf1d93f3a8d1d486b091f5436440bed5a52b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matija=20=C4=8Cupi=C4=87?= Date: Wed, 6 Dec 2017 01:46:24 +0100 Subject: Remove Add Cluster button in clusters/index --- app/views/projects/clusters/index.html.haml | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/views/projects/clusters/index.html.haml b/app/views/projects/clusters/index.html.haml index e71b2797b14..bec512be91c 100644 --- a/app/views/projects/clusters/index.html.haml +++ b/app/views/projects/clusters/index.html.haml @@ -8,8 +8,6 @@ .top-area.adjust .nav-text = s_("ClusterIntegration|Clusters can be used to deploy applications and to provide Review Apps for this project") - .pull-right.nav-bar-right - = link_to s_("ClusterIntegration|Add cluster"), new_project_cluster_path(@project), class: "btn btn-success disabled has-tooltip js-add-cluster", title: s_("ClusterIntegration|Multiple clusters are available in GitLab Entreprise Edition Premium and Ultimate") .ci-table.js-clusters-list .gl-responsive-table-row.table-row-header{ role: "row" } .table-section.section-30{ role: "rowheader" } -- cgit v1.2.1