Commit ef65a887 authored by Tiger's avatar Tiger

Update external link to provider in cluster settings

https://gitlab.com/gitlab-org/gitlab/merge_requests/20425
parent 25df3e13
......@@ -18,8 +18,20 @@ module Clusters
end
end
def gke_cluster_url
"https://console.cloud.google.com/kubernetes/clusters/details/#{provider.zone}/#{name}" if gcp?
def provider_label
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
def can_read_cluster?
......
......@@ -8,10 +8,10 @@
- unless @cluster.provided_by_user?
.append-bottom-20
%label.append-bottom-10
= s_('ClusterIntegration|Google Kubernetes Engine')
= @cluster.provider_label
%p
- link_gke = link_to(s_('ClusterIntegration|Google Kubernetes Engine'), @cluster.gke_cluster_url, target: '_blank', rel: 'noopener noreferrer')
= s_('ClusterIntegration|Manage your Kubernetes cluster by visiting %{link_gke}').html_safe % { link_gke: link_gke }
- provider_link = link_to(@cluster.provider_label, @cluster.provider_management_url, target: '_blank', rel: 'noopener noreferrer')
= 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|
......
---
title: Update external link to provider in cluster settings
merge_request: 20425
author:
type: fixed
......@@ -3661,6 +3661,9 @@ msgstr ""
msgid "ClusterIntegration|Did you know?"
msgstr ""
msgid "ClusterIntegration|Elastic Kubernetes Service"
msgstr ""
msgid "ClusterIntegration|Elastic Stack"
msgstr ""
......@@ -3892,7 +3895,7 @@ msgstr ""
msgid "ClusterIntegration|Make sure your account %{link_to_requirements} to create Kubernetes clusters"
msgstr ""
msgid "ClusterIntegration|Manage your Kubernetes cluster by visiting %{link_gke}"
msgid "ClusterIntegration|Manage your Kubernetes cluster by visiting %{provider_link}"
msgstr ""
msgid "ClusterIntegration|No IAM Roles found"
......
......@@ -153,12 +153,43 @@ describe Clusters::ClusterPresenter do
end
end
describe '#gke_cluster_url' do
subject { described_class.new(cluster).gke_cluster_url }
describe '#provider_label' do
let(:cluster) { create(:cluster, provider_type: provider_type) }
it { is_expected.to include(cluster.provider.zone) }
subject { described_class.new(cluster).provider_label }
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
describe '#cluster_type_description' do
subject { described_class.new(cluster).cluster_type_description }
......
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