diff options
-rw-r--r-- | app/assets/javascripts/clusters.js | 11 | ||||
-rw-r--r-- | app/assets/stylesheets/pages/clusters.scss | 5 | ||||
-rw-r--r-- | app/views/layouts/nav/sidebar/_project.html.haml | 8 | ||||
-rw-r--r-- | app/views/projects/clusters/_form.html.haml | 2 | ||||
-rw-r--r-- | app/views/projects/clusters/_header.html.haml | 2 | ||||
-rw-r--r-- | app/views/projects/clusters/_sidebar.html.haml | 2 | ||||
-rw-r--r-- | app/views/projects/clusters/edit.html.haml | 60 |
7 files changed, 77 insertions, 13 deletions
diff --git a/app/assets/javascripts/clusters.js b/app/assets/javascripts/clusters.js new file mode 100644 index 00000000000..64bf22f48e2 --- /dev/null +++ b/app/assets/javascripts/clusters.js @@ -0,0 +1,11 @@ +document.addEventListener('DOMContentLoaded', () => { + + const toggleButton = document.querySelector('.js-toggle-cluster'); + // disable in case of no permissions + toggleButton.addEventListener(() => { + + // update text + }); + + // poll the status +}); diff --git a/app/assets/stylesheets/pages/clusters.scss b/app/assets/stylesheets/pages/clusters.scss new file mode 100644 index 00000000000..019ef5cb2f4 --- /dev/null +++ b/app/assets/stylesheets/pages/clusters.scss @@ -0,0 +1,5 @@ +.edit-cluster-form { + .clipboard-addon { + background-color: $white-light; + } +}
\ No newline at end of file diff --git a/app/views/layouts/nav/sidebar/_project.html.haml b/app/views/layouts/nav/sidebar/_project.html.haml index 8765b814405..ed032b145da 100644 --- a/app/views/layouts/nav/sidebar/_project.html.haml +++ b/app/views/layouts/nav/sidebar/_project.html.haml @@ -146,7 +146,7 @@ = number_with_delimiter(@project.open_merge_requests_count) - if project_nav_tab? :pipelines - = nav_link(controller: [:pipelines, :builds, :jobs, :pipeline_schedules, :environments, :artifacts]) do + = nav_link(controller: [:pipelines, :builds, :jobs, :pipeline_schedules, :environments, :artifacts, :clusters]) do = link_to project_pipelines_path(@project), class: 'shortcuts-pipelines' do .nav-icon-container = sprite_icon('pipeline') @@ -189,6 +189,12 @@ %span Charts + -# - if project_nav_tab? :clusters TODO @shinya @ayufan + = nav_link(controller: :clusters) do + = link_to project_clusters_path(@project), title: 'Clusters', class: 'shortcuts-clusters' do + %span + Clusters + - if project_nav_tab? :wiki = nav_link(controller: :wikis) do = link_to get_project_wiki_path(@project), class: 'shortcuts-wiki' do diff --git a/app/views/projects/clusters/_form.html.haml b/app/views/projects/clusters/_form.html.haml index d2a2bc0b6be..1951f1ab9eb 100644 --- a/app/views/projects/clusters/_form.html.haml +++ b/app/views/projects/clusters/_form.html.haml @@ -34,4 +34,4 @@ = field.submit s_('ClusterIntegration|Create cluster'), class: 'btn btn-save' -# TODO: Remove before merge - = link_to "Create on Google Container Engine", namespace_project_clusters_path(@project.namespace, @project, cluster: {cluster_name: "gke-test-creation#{Random.rand(100)}", gcp_project_id: 'gitlab-internal-153318', cluster_zone: 'us-central1-a', cluster_size: '1', project_namespace: 'aaa', machine_type: 'n1-standard-1'}), method: :post
\ No newline at end of file + = link_to "Create on Google Container Engine", namespace_project_clusters_path(@project.namespace, @project, cluster: {cluster_name: "gke-test-creation#{Random.rand(100)}", gcp_project_id: 'gitlab-internal-153318', cluster_zone: 'us-central1-a', cluster_size: '1', project_namespace: 'aaa', machine_type: 'n1-standard-1'}), method: :post diff --git a/app/views/projects/clusters/_header.html.haml b/app/views/projects/clusters/_header.html.haml index 52a123d603e..795299b0625 100644 --- a/app/views/projects/clusters/_header.html.haml +++ b/app/views/projects/clusters/_header.html.haml @@ -12,4 +12,4 @@ = s_('ClusterIntegration|Make sure your account %{link_to_requirements} to create clusters').html_safe % { link_to_requirements: link_to_requirements } %li - link_to_container_project = link_to(s_('ClusterIntegration|Google Container Engine project')) - = s_('ClusterIntegration|A %{link_to_container_project} must have been created under this account').html_safe % { link_to_container_project: link_to_container_project }
\ No newline at end of file + = s_('ClusterIntegration|A %{link_to_container_project} must have been created under this account').html_safe % { link_to_container_project: link_to_container_project } diff --git a/app/views/projects/clusters/_sidebar.html.haml b/app/views/projects/clusters/_sidebar.html.haml index f2f9e04f80e..4d19fa460c8 100644 --- a/app/views/projects/clusters/_sidebar.html.haml +++ b/app/views/projects/clusters/_sidebar.html.haml @@ -5,4 +5,4 @@ = s_('ClusterIntegration|With cluster integration you can take advantage of Kubernetes auto deployment.') %p - link = link_to(s_('ClusterIntegration|auto deployment'), help_page_path('TODO'), target: '_blank', rel: 'noopener noreferrer') - = s_('ClusterIntegration|Learn more about %{link_to_documentation} in GitLab').html_safe % { link_to_documentation: link }
\ No newline at end of file + = s_('ClusterIntegration|Learn more about %{link_to_documentation} in GitLab.').html_safe % { link_to_documentation: link } diff --git a/app/views/projects/clusters/edit.html.haml b/app/views/projects/clusters/edit.html.haml index fa5d14b514a..feea40cee0d 100644 --- a/app/views/projects/clusters/edit.html.haml +++ b/app/views/projects/clusters/edit.html.haml @@ -1,16 +1,58 @@ -edit/show cluster -%br -= @cluster.inspect -%br -= @cluster.service.inspect -%br -= form_errors(@cluster) +.row.prepend-top-default.edit-cluster-form + = render 'sidebar' + .col-lg-8 + %h4.prepend-top-0 + = s_('ClusterIntegration|Enable cluster integration') + %p + -#TODO: if can?(current_user, :update_cluster, @cluster) + -# if :enabled + = s_('ClusterIntegration|Disabling cluster integration will not affect your cluster. It will only temporarily turn off GitLab\'s conection to it.') + -# else + = s_('ClusterIntegration|Missing test/state in mockups.') + -# else !can?(current_user, :update_cluster, @cluster) + -# if :enabled + = s_('ClusterIntegration|Cluster integration is enabled for this project.') + -# else + = s_('ClusterIntegration|Cluster integration is disabled for this project.') + + %label.toggle-wrapper + %button{ type: 'button', class: 'js-toggle-cluster project-feature-toggle', aria: { label: 'Toggle' }, data: { 'enabled-text': 'Enable', 'disabled-text': 'disabled' } } + + + -# render errors TODO + #= form_errors(@cluster) + + -# if can?(current_user, :update_cluster, @cluster) + .form_group + %label + = s_('ClusterIntegration|Google container engine') + %p + - link_gke = link_to(s_('ClusterIntegration|Manage your cluster on GKE'), path: '', target: '_blank', rel: 'noopener noreferrer') + = s_('ClusterIntegration|This cluster was not set up on Google Container Engine. %{link_gke}').html_safe % { link_gke: link_gke } + + .form_group + %label + = s_('ClusterIntegration|Cluster name') + .input-group + %input.form-control{ value: @cluster.cluster_name, disabled: true} + %span.input-group-addon.clipboard-addon + = clipboard_button(text: @cluster.cluster_name, title: s_('ClusterIntegration|Copy cluster name')) + + %br + -# - if can?(current_user, :admin_cluster, @cluster) + .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') + + %br = link_to "Enable", namespace_project_cluster_path(@project.namespace, @project, @cluster.id, cluster: {enabled: 'true'}), method: :put %br = link_to "Disable", namespace_project_cluster_path(@project.namespace, @project, @cluster.id, cluster: {enabled: 'false'}), method: :put -%br -= link_to "Soft-delete the cluster", namespace_project_cluster_path(@project.namespace, @project, @cluster.id), method: :delete + %br -# status GET -# status: The current status of the operation. |