diff options
author | Thong Kuah <tkuah@gitlab.com> | 2018-11-01 13:39:01 +1300 |
---|---|---|
committer | Thong Kuah <tkuah@gitlab.com> | 2018-11-01 19:37:33 +1300 |
commit | 1a1fdf8efe1923ba781e978e858c009264020e72 (patch) | |
tree | df98af221d7a722e4c67db450b78a5488bff6a3c /app/views/clusters | |
parent | 28dabc67f4db8271ac20c0db458ae2c86a906eee (diff) | |
download | gitlab-ce-1a1fdf8efe1923ba781e978e858c009264020e72.tar.gz |
Resolve controller sharing concern
Use ClustersController as base while having Projects::ClustersController
to inform what `clusterable` is. Thanks @ayufan for the great suggestion
!
- View changes to work with new approach
- Fix javascript for new approach
- Fix feature specs for new approach
- Fix QA
Diffstat (limited to 'app/views/clusters')
-rw-r--r-- | app/views/clusters/clusters/_advanced_settings.html.haml (renamed from app/views/clusters/_advanced_settings.html.haml) | 2 | ||||
-rw-r--r-- | app/views/clusters/clusters/_banner.html.haml (renamed from app/views/clusters/_banner.html.haml) | 0 | ||||
-rw-r--r-- | app/views/clusters/clusters/_cluster.html.haml (renamed from app/views/clusters/_cluster.html.haml) | 2 | ||||
-rw-r--r-- | app/views/clusters/clusters/_empty_state.html.haml (renamed from app/views/clusters/_empty_state.html.haml) | 0 | ||||
-rw-r--r-- | app/views/clusters/clusters/_gcp_signup_offer_banner.html.haml (renamed from app/views/clusters/_gcp_signup_offer_banner.html.haml) | 0 | ||||
-rw-r--r-- | app/views/clusters/clusters/_integration_form.html.haml (renamed from app/views/clusters/_integration_form.html.haml) | 2 | ||||
-rw-r--r-- | app/views/clusters/clusters/_sidebar.html.haml (renamed from app/views/clusters/_sidebar.html.haml) | 0 | ||||
-rw-r--r-- | app/views/clusters/clusters/gcp/_form.html.haml (renamed from app/views/clusters/gcp/_form.html.haml) | 2 | ||||
-rw-r--r-- | app/views/clusters/clusters/gcp/_header.html.haml (renamed from app/views/clusters/gcp/_header.html.haml) | 0 | ||||
-rw-r--r-- | app/views/clusters/clusters/gcp/_show.html.haml (renamed from app/views/clusters/gcp/_show.html.haml) | 2 | ||||
-rw-r--r-- | app/views/clusters/clusters/index.html.haml (renamed from app/views/clusters/index.html.haml) | 0 | ||||
-rw-r--r-- | app/views/clusters/clusters/new.html.haml (renamed from app/views/clusters/new.html.haml) | 8 | ||||
-rw-r--r-- | app/views/clusters/clusters/show.html.haml (renamed from app/views/clusters/show.html.haml) | 16 | ||||
-rw-r--r-- | app/views/clusters/clusters/user/_form.html.haml (renamed from app/views/clusters/user/_form.html.haml) | 2 | ||||
-rw-r--r-- | app/views/clusters/clusters/user/_header.html.haml (renamed from app/views/clusters/user/_header.html.haml) | 0 | ||||
-rw-r--r-- | app/views/clusters/clusters/user/_show.html.haml (renamed from app/views/clusters/user/_show.html.haml) | 2 |
16 files changed, 19 insertions, 19 deletions
diff --git a/app/views/clusters/_advanced_settings.html.haml b/app/views/clusters/clusters/_advanced_settings.html.haml index e25076248d2..7037c80aa6b 100644 --- a/app/views/clusters/_advanced_settings.html.haml +++ b/app/views/clusters/clusters/_advanced_settings.html.haml @@ -12,4 +12,4 @@ = s_('ClusterIntegration|Remove Kubernetes cluster integration') %p = s_("ClusterIntegration|Remove this Kubernetes cluster's configuration from this project. This will not delete your actual Kubernetes cluster.") - = link_to(s_('ClusterIntegration|Remove integration'), cluster_path(@cluster, clusterable.clusterable_params), method: :delete, class: 'btn btn-danger', data: { confirm: s_("ClusterIntegration|Are you sure you want to remove this Kubernetes cluster's integration? This will not delete your actual Kubernetes cluster.")}) + = link_to(s_('ClusterIntegration|Remove integration'), clusterable.cluster_path(@cluster), method: :delete, class: 'btn btn-danger', data: { confirm: s_("ClusterIntegration|Are you sure you want to remove this Kubernetes cluster's integration? This will not delete your actual Kubernetes cluster.")}) diff --git a/app/views/clusters/_banner.html.haml b/app/views/clusters/clusters/_banner.html.haml index 73cfea0ef92..73cfea0ef92 100644 --- a/app/views/clusters/_banner.html.haml +++ b/app/views/clusters/clusters/_banner.html.haml diff --git a/app/views/clusters/_cluster.html.haml b/app/views/clusters/clusters/_cluster.html.haml index 709d6711f33..facbcb7fc59 100644 --- a/app/views/clusters/_cluster.html.haml +++ b/app/views/clusters/clusters/_cluster.html.haml @@ -16,7 +16,7 @@ class: "#{'is-checked' if cluster.enabled?} #{'is-disabled' if !cluster.can_toggle_cluster?}", "aria-label": s_("ClusterIntegration|Toggle Kubernetes Cluster"), disabled: !cluster.can_toggle_cluster?, - data: { endpoint: cluster_path(cluster, clusterable.clusterable_params.merge(format: :json)) } } + data: { endpoint: clusterable.cluster_path(cluster, format: :json) } } %input.js-project-feature-toggle-input{ type: "hidden", value: cluster.enabled? } = icon("spinner spin", class: "loading-icon") %span.toggle-icon diff --git a/app/views/clusters/_empty_state.html.haml b/app/views/clusters/clusters/_empty_state.html.haml index 800e76d92ef..800e76d92ef 100644 --- a/app/views/clusters/_empty_state.html.haml +++ b/app/views/clusters/clusters/_empty_state.html.haml diff --git a/app/views/clusters/_gcp_signup_offer_banner.html.haml b/app/views/clusters/clusters/_gcp_signup_offer_banner.html.haml index 73b11d509d3..73b11d509d3 100644 --- a/app/views/clusters/_gcp_signup_offer_banner.html.haml +++ b/app/views/clusters/clusters/_gcp_signup_offer_banner.html.haml diff --git a/app/views/clusters/_integration_form.html.haml b/app/views/clusters/clusters/_integration_form.html.haml index 4b259f02abb..0792ad0085c 100644 --- a/app/views/clusters/_integration_form.html.haml +++ b/app/views/clusters/clusters/_integration_form.html.haml @@ -1,4 +1,4 @@ -= form_for @cluster, url: cluster_path(@cluster), as: :cluster do |field| += form_for @cluster, url: clusterable.cluster_path(@cluster), as: :cluster do |field| = form_errors(@cluster) = hidden_clusterable_fields .form-group diff --git a/app/views/clusters/_sidebar.html.haml b/app/views/clusters/clusters/_sidebar.html.haml index 3d10348212f..3d10348212f 100644 --- a/app/views/clusters/_sidebar.html.haml +++ b/app/views/clusters/clusters/_sidebar.html.haml diff --git a/app/views/clusters/gcp/_form.html.haml b/app/views/clusters/clusters/gcp/_form.html.haml index 56a5eb630cf..cff5cf335dc 100644 --- a/app/views/clusters/gcp/_form.html.haml +++ b/app/views/clusters/clusters/gcp/_form.html.haml @@ -12,7 +12,7 @@ %p= link_to('Select a different Google account', @authorize_url) -= form_for @gcp_cluster, html: { class: 'js-gke-cluster-creation prepend-top-20', data: { token: token_in_session } }, url: create_gcp_clusters_path, as: :cluster do |field| += form_for @gcp_cluster, html: { class: 'js-gke-cluster-creation prepend-top-20', data: { token: token_in_session } }, url: clusterable.create_gcp_clusters_path, as: :cluster do |field| = form_errors(@gcp_cluster) = hidden_clusterable_fields .form-group diff --git a/app/views/clusters/gcp/_header.html.haml b/app/views/clusters/clusters/gcp/_header.html.haml index a2ad3cd64df..a2ad3cd64df 100644 --- a/app/views/clusters/gcp/_header.html.haml +++ b/app/views/clusters/clusters/gcp/_header.html.haml diff --git a/app/views/clusters/gcp/_show.html.haml b/app/views/clusters/clusters/gcp/_show.html.haml index d5f9ec8ee66..e0159cee4a3 100644 --- a/app/views/clusters/gcp/_show.html.haml +++ b/app/views/clusters/clusters/gcp/_show.html.haml @@ -6,7 +6,7 @@ %span.input-group-append = clipboard_button(text: @cluster.name, title: s_('ClusterIntegration|Copy Kubernetes cluster name'), class: 'input-group-text btn-default') -= form_for @cluster, url: cluster_path(@cluster), as: :cluster do |field| += form_for @cluster, url: clusterable.cluster_path(@cluster), as: :cluster do |field| = form_errors(@cluster) = hidden_clusterable_fields diff --git a/app/views/clusters/index.html.haml b/app/views/clusters/clusters/index.html.haml index a55de84b5cd..a55de84b5cd 100644 --- a/app/views/clusters/index.html.haml +++ b/app/views/clusters/clusters/index.html.haml diff --git a/app/views/clusters/new.html.haml b/app/views/clusters/clusters/new.html.haml index 57cdbcd2d38..eeeef6bd824 100644 --- a/app/views/clusters/new.html.haml +++ b/app/views/clusters/clusters/new.html.haml @@ -19,9 +19,9 @@ .tab-content.gitlab-tab-content .tab-pane{ id: 'create-gcp-cluster-pane', class: active_when(active_tab == 'gcp'), role: 'tabpanel' } - = render 'clusters/gcp/header' + = render 'clusters/clusters/gcp/header' - if @valid_gcp_token - = render 'clusters/gcp/form' + = render 'clusters/clusters/gcp/form' - elsif @authorize_url .signin-with-google = link_to(image_tag('auth_buttons/signin_with_google.png', width: '191px'), @authorize_url) @@ -32,5 +32,5 @@ = s_('Google authentication is not %{link_to_documentation}. Ask your GitLab administrator if you want to use this service.').html_safe % { link_to_documentation: link } .tab-pane{ id: 'add-user-cluster-pane', class: active_when(active_tab == 'user'), role: 'tabpanel' } - = render 'clusters/user/header' - = render 'clusters/user/form' + = render 'clusters/clusters/user/header' + = render 'clusters/clusters/user/form' diff --git a/app/views/clusters/show.html.haml b/app/views/clusters/clusters/show.html.haml index c0169fbf5a2..1e1157c34bd 100644 --- a/app/views/clusters/show.html.haml +++ b/app/views/clusters/clusters/show.html.haml @@ -6,13 +6,13 @@ - expanded = Rails.env.test? -- status_path = status_cluster_path(@cluster.id, clusterable.clusterable_params.merge(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, - install_helm_path: install_applications_cluster_path(@cluster, :helm, clusterable.clusterable_params), - install_ingress_path: install_applications_cluster_path(@cluster, :ingress, clusterable.clusterable_params), - install_prometheus_path: install_applications_cluster_path(@cluster, :prometheus, clusterable.clusterable_params), - install_runner_path: install_applications_cluster_path(@cluster, :runner, clusterable.clusterable_params), - install_jupyter_path: install_applications_cluster_path(@cluster, :jupyter, clusterable.clusterable_params), + install_helm_path: clusterable.install_applications_cluster_path(@cluster, :helm), + install_ingress_path: clusterable.install_applications_cluster_path(@cluster, :ingress), + install_prometheus_path: clusterable.install_applications_cluster_path(@cluster, :prometheus), + install_runner_path: clusterable.install_applications_cluster_path(@cluster, :runner), + install_jupyter_path: clusterable.install_applications_cluster_path(@cluster, :jupyter), toggle_status: @cluster.enabled? ? 'true': 'false', cluster_status: @cluster.status_name, cluster_status_reason: @cluster.status_reason, @@ -39,9 +39,9 @@ %p= s_('ClusterIntegration|See and edit the details for your Kubernetes cluster') .settings-content - if @cluster.managed? - = render 'clusters/gcp/show' + = render 'clusters/clusters/gcp/show' - else - = render 'clusters/user/show' + = render 'clusters/clusters/user/show' %section.settings.no-animate#js-cluster-advanced-settings{ class: ('expanded' if expanded) } .settings-header diff --git a/app/views/clusters/user/_form.html.haml b/app/views/clusters/clusters/user/_form.html.haml index 05462d27b99..43c15274180 100644 --- a/app/views/clusters/user/_form.html.haml +++ b/app/views/clusters/clusters/user/_form.html.haml @@ -1,4 +1,4 @@ -= form_for @user_cluster, url: create_user_clusters_path, as: :cluster do |field| += form_for @user_cluster, url: clusterable.create_user_clusters_path, as: :cluster do |field| = form_errors(@user_cluster) = hidden_clusterable_fields .form-group diff --git a/app/views/clusters/user/_header.html.haml b/app/views/clusters/clusters/user/_header.html.haml index 749177fa6c1..749177fa6c1 100644 --- a/app/views/clusters/user/_header.html.haml +++ b/app/views/clusters/clusters/user/_header.html.haml diff --git a/app/views/clusters/user/_show.html.haml b/app/views/clusters/clusters/user/_show.html.haml index 57f6cd1f43d..4eae08d1250 100644 --- a/app/views/clusters/user/_show.html.haml +++ b/app/views/clusters/clusters/user/_show.html.haml @@ -1,4 +1,4 @@ -= form_for @cluster, url: cluster_path(@cluster), as: :cluster do |field| += form_for @cluster, url: clusterable.cluster_path(@cluster), as: :cluster do |field| = form_errors(@cluster) = hidden_clusterable_fields .form-group |