Commit 13ee246a authored by Paul Slaughter's avatar Paul Slaughter

Merge branch '208223-provider-icon-haml' into 'master'

Add provider icon to cluster list

Closes #208223

See merge request gitlab-org/gitlab!31134
parents 5ffc5a1b f6c6da53
...@@ -17,6 +17,17 @@ module ClustersHelper ...@@ -17,6 +17,17 @@ module ClustersHelper
end end
end end
def provider_icon(provider = nil)
case provider
when 'aws'
image_tag 'illustrations/logos/amazon_eks.svg', alt: s_('ClusterIntegration|Amazon EKS'), class: 'gl-h-full'
when 'gcp'
image_tag 'illustrations/logos/google_gke.svg', alt: s_('ClusterIntegration|Google GKE'), class: 'gl-h-full'
else
image_tag 'illustrations/logos/kubernetes.svg', alt: _('Kubernetes Cluster'), class: 'gl-h-full'
end
end
def render_gcp_signup_offer def render_gcp_signup_offer
return if Gitlab::CurrentSettings.current_application_settings.hide_third_party_offers? return if Gitlab::CurrentSettings.current_application_settings.hide_third_party_offers?
return unless show_gcp_signup_offer? return unless show_gcp_signup_offer?
......
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
.card-body.gl-responsive-table-row .card-body.gl-responsive-table-row
.table-section.section-60 .table-section.section-60
.table-mobile-header{ role: "rowheader" }= s_("ClusterIntegration|Kubernetes cluster") .table-mobile-header{ role: "rowheader" }= s_("ClusterIntegration|Kubernetes cluster")
.table-mobile-content .table-mobile-content.gl-display-flex.gl-align-items-center.gl-justify-content-end.gl-justify-content-md-start
.gl-w-6.gl-h-6.gl-mr-3.gl-display-flex.gl-align-items-center= provider_icon(cluster.provider_type)
= cluster.item_link(clusterable, html_options: { data: { qa_selector: 'cluster', qa_cluster_name: cluster.name } }) = cluster.item_link(clusterable, html_options: { data: { qa_selector: 'cluster', qa_cluster_name: cluster.name } })
- if cluster.status_name == :creating - if cluster.status_name == :creating
.spinner.ml-2.align-middle.has-tooltip{ title: s_("ClusterIntegration|Cluster being created") } .spinner.ml-2.align-middle.has-tooltip{ title: s_("ClusterIntegration|Cluster being created") }
......
---
title: Added provider icon to cluster index display
merge_request: 31134
author:
type: added
...@@ -59,6 +59,32 @@ describe ClustersHelper do ...@@ -59,6 +59,32 @@ describe ClustersHelper do
end end
end end
describe '#provider_icon' do
it 'will return GCP logo with gcp argument' do
logo = helper.provider_icon('gcp')
expect(logo).to match(%r(img alt="Google GKE" data-src="|/illustrations/logos/google_gke|svg))
end
it 'will return AWS logo with aws argument' do
logo = helper.provider_icon('aws')
expect(logo).to match(%r(img alt="Amazon EKS" data-src="|/illustrations/logos/amazon_eks|svg))
end
it 'will return default logo with unknown provider' do
logo = helper.provider_icon('unknown')
expect(logo).to match(%r(img alt="Kubernetes Cluster" data-src="|/illustrations/logos/kubernetes|svg))
end
it 'will return default logo when provider is empty' do
logo = helper.provider_icon
expect(logo).to match(%r(img alt="Kubernetes Cluster" data-src="|/illustrations/logos/kubernetes|svg))
end
end
describe '#cluster_type_label' do describe '#cluster_type_label' do
subject { helper.cluster_type_label(cluster_type) } subject { helper.cluster_type_label(cluster_type) }
......
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