Commit 96f5df20 authored by Michael Kozono's avatar Michael Kozono

Merge branch '22392-update-cluster-settings-provider-link' into 'master'

Update external link to provider in cluster settings

See merge request gitlab-org/gitlab!20425
parents f166222a ef65a887
...@@ -18,8 +18,20 @@ module Clusters ...@@ -18,8 +18,20 @@ module Clusters
end end
end end
def gke_cluster_url def provider_label
"https://console.cloud.google.com/kubernetes/clusters/details/#{provider.zone}/#{name}" if gcp? if aws?
s_('ClusterIntegration|Elastic Kubernetes Service')
elsif gcp?
s_('ClusterIntegration|Google Kubernetes Engine')
end
end
def provider_management_url
if aws?
"https://console.aws.amazon.com/eks/home?region=#{provider.region}\#/clusters/#{name}"
elsif gcp?
"https://console.cloud.google.com/kubernetes/clusters/details/#{provider.zone}/#{name}"
end
end end
def can_read_cluster? def can_read_cluster?
......
...@@ -8,10 +8,10 @@ ...@@ -8,10 +8,10 @@
- unless @cluster.provided_by_user? - unless @cluster.provided_by_user?
.append-bottom-20 .append-bottom-20
%label.append-bottom-10 %label.append-bottom-10
= s_('ClusterIntegration|Google Kubernetes Engine') = @cluster.provider_label
%p %p
- link_gke = link_to(s_('ClusterIntegration|Google Kubernetes Engine'), @cluster.gke_cluster_url, target: '_blank', rel: 'noopener noreferrer') - provider_link = link_to(@cluster.provider_label, @cluster.provider_management_url, target: '_blank', rel: 'noopener noreferrer')
= s_('ClusterIntegration|Manage your Kubernetes cluster by visiting %{link_gke}').html_safe % { link_gke: link_gke } = s_('ClusterIntegration|Manage your Kubernetes cluster by visiting %{provider_link}').html_safe % { provider_link: provider_link }
= form_for @cluster, url: clusterable.cluster_path(@cluster), as: :cluster, html: { class: 'cluster_management_form' } do |field| = form_for @cluster, url: clusterable.cluster_path(@cluster), as: :cluster, html: { class: 'cluster_management_form' } do |field|
......
---
title: Update external link to provider in cluster settings
merge_request: 20425
author:
type: fixed
...@@ -3673,6 +3673,9 @@ msgstr "" ...@@ -3673,6 +3673,9 @@ msgstr ""
msgid "ClusterIntegration|Did you know?" msgid "ClusterIntegration|Did you know?"
msgstr "" msgstr ""
msgid "ClusterIntegration|Elastic Kubernetes Service"
msgstr ""
msgid "ClusterIntegration|Elastic Stack" msgid "ClusterIntegration|Elastic Stack"
msgstr "" msgstr ""
...@@ -3904,7 +3907,7 @@ msgstr "" ...@@ -3904,7 +3907,7 @@ msgstr ""
msgid "ClusterIntegration|Make sure your account %{link_to_requirements} to create Kubernetes clusters" msgid "ClusterIntegration|Make sure your account %{link_to_requirements} to create Kubernetes clusters"
msgstr "" msgstr ""
msgid "ClusterIntegration|Manage your Kubernetes cluster by visiting %{link_gke}" msgid "ClusterIntegration|Manage your Kubernetes cluster by visiting %{provider_link}"
msgstr "" msgstr ""
msgid "ClusterIntegration|No IAM Roles found" msgid "ClusterIntegration|No IAM Roles found"
......
...@@ -153,11 +153,42 @@ describe Clusters::ClusterPresenter do ...@@ -153,11 +153,42 @@ describe Clusters::ClusterPresenter do
end end
end end
describe '#gke_cluster_url' do describe '#provider_label' do
subject { described_class.new(cluster).gke_cluster_url } let(:cluster) { create(:cluster, provider_type: provider_type) }
it { is_expected.to include(cluster.provider.zone) } subject { described_class.new(cluster).provider_label }
it { is_expected.to include(cluster.name) }
context 'AWS provider' do
let(:provider_type) { :aws }
it { is_expected.to eq('Elastic Kubernetes Service') }
end
context 'GCP provider' do
let(:provider_type) { :gcp }
it { is_expected.to eq('Google Kubernetes Engine') }
end
end
describe '#provider_management_url' do
let(:cluster) { provider.cluster }
subject { described_class.new(cluster).provider_management_url }
context 'AWS provider' do
let(:provider) { create(:cluster_provider_aws) }
it { is_expected.to include(provider.region) }
it { is_expected.to include(cluster.name) }
end
context 'GCP provider' do
let(:provider) { create(:cluster_provider_gcp) }
it { is_expected.to include(provider.zone) }
it { is_expected.to include(cluster.name) }
end
end end
describe '#cluster_type_description' do describe '#cluster_type_description' do
......
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