Commit 4ee1eb38 authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch '53771-move-cluster-type-description' into 'master'

Move description of cluster type to presenter

Closes #53771

See merge request gitlab-org/gitlab-ce!23789
parents a0fd6828 45975892
......@@ -12,6 +12,14 @@ module Clusters
can?(current_user, :update_cluster, cluster) && created?
end
def cluster_type_description
if cluster.project_type?
s_("ClusterIntegration|Project cluster")
elsif cluster.group_type?
s_("ClusterIntegration|Group cluster")
end
end
def show_path
if cluster.project_type?
project_cluster_path(project, cluster)
......
......@@ -13,4 +13,4 @@
.table-mobile-header{ role: "rowheader" }
.table-mobile-content
%span.badge.badge-light
= cluster.project_type? ? s_("ClusterIntegration|Project cluster") : s_("ClusterIntegration|Group cluster")
= cluster.cluster_type_description
......@@ -74,6 +74,20 @@ describe Clusters::ClusterPresenter do
end
end
describe '#cluster_type_description' do
subject { described_class.new(cluster).cluster_type_description }
context 'project_type cluster' do
it { is_expected.to eq('Project cluster') }
end
context 'group_type cluster' do
let(:cluster) { create(:cluster, :provided_by_gcp, :group) }
it { is_expected.to eq('Group cluster') }
end
end
describe '#show_path' do
subject { described_class.new(cluster).show_path }
......
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