diff --git a/lib/pact_broker/ui/view_models/index_item.rb b/lib/pact_broker/ui/view_models/index_item.rb
index bb364995a..b8aa124b7 100644
--- a/lib/pact_broker/ui/view_models/index_item.rb
+++ b/lib/pact_broker/ui/view_models/index_item.rb
@@ -30,18 +30,16 @@ def provider_version_number
PactBroker::Versions::AbbreviateNumber.call(@relationship.provider_version_number)
end
- def tag_names
- latest_overall = @relationship.latest? ? "latest & " : ""
- @relationship.tag_names.any? ? " (#{latest_overall}latest #{@relationship.tag_names.join(', ')}) ": " (latest) "
+ def latest?
+ @relationship.latest?
end
- def verification_tag_names
- if @relationship.latest_verification_latest_tags.any?
- tag_names = @relationship.latest_verification_latest_tags.collect(&:name)
- " (latest #{tag_names.join(', ')})"
- else
- ""
- end
+ def consumer_version_latest_tag_names
+ @relationship.tag_names
+ end
+
+ def provider_version_latest_tag_names
+ @relationship.latest_verification_latest_tags.collect(&:name)
end
def consumer_group_url
diff --git a/lib/pact_broker/ui/views/index/show-with-tags.haml b/lib/pact_broker/ui/views/index/show-with-tags.haml
index c3967a3d0..0bdbf98e1 100644
--- a/lib/pact_broker/ui/views/index/show-with-tags.haml
+++ b/lib/pact_broker/ui/views/index/show-with-tags.haml
@@ -22,21 +22,23 @@
Consumer
%span.glyphicon.glyphicon-sort.relationships-sort
%th.consumer-version-number
- Version
+ Consumer
Version
%span.glyphicon.glyphicon-sort.relationships-sort
%th.pact{ style: 'width: 40px' }
%th.provider
Provider
%span.glyphicon.glyphicon-sort.relationships-sort
%th.provider-version-number
- Version
+ Provider
Version
%span.glyphicon.glyphicon-sort.relationships-sort
%th
Published
+ %span.glyphicon.glyphicon-sort.relationships-sort
%th
Webhook
status
%th
Last
verified
+ %span.glyphicon.glyphicon-sort.relationships-sort
%tbody
- index_items.each do | index_item |
@@ -45,9 +47,14 @@
%a{:href => index_item.consumer_group_url }
= index_item.consumer_name
%td.consumer-version-number
- = index_item.consumer_version_number
- %span{style: 'color:gray'}
- = index_item.tag_names
+ %div
+ = index_item.consumer_version_number
+ - if index_item.latest?
+ .tag.label.label-success
+ latest
+ - index_item.consumer_version_latest_tag_names.each do | tag_name |
+ .tag.label.label-primary
+ = tag_name
%td.pact
%span.pact
%a{ href: index_item.pact_url, title: "View pact" }
@@ -58,8 +65,9 @@
= index_item.provider_name
%td.provider-version-number
= index_item.provider_version_number
- %span{style: 'color:gray'}
- = index_item.verification_tag_names
+ - index_item.provider_version_latest_tag_names.each do | tag_name |
+ .tag.label.label-primary
+ = tag_name
%td
= index_item.publication_date_of_latest_pact.gsub("about ", "")
%td{ class: index_item.webhook_status }
diff --git a/public/stylesheets/index.css b/public/stylesheets/index.css
index b4927f893..189dbd6a8 100644
--- a/public/stylesheets/index.css
+++ b/public/stylesheets/index.css
@@ -12,7 +12,7 @@
}
table#relationships {
- table-layout: fixed;
+ /*table-layout: fixed;*/
}
table#relationships td,
@@ -105,3 +105,12 @@ span.pact:hover svg path, span.pact-matrix:hover svg path {
#top-left-menu li{
list-style: none;
}
+
+table#relationships .label {
+ word-wrap: break-word;
+ white-space: normal;
+}
+
+div.tag {
+ display: inline-block;
+}
\ No newline at end of file
diff --git a/spec/lib/pact_broker/ui/view_models/index_item_spec.rb b/spec/lib/pact_broker/ui/view_models/index_item_spec.rb
index ec2af2e53..355a14c8b 100644
--- a/spec/lib/pact_broker/ui/view_models/index_item_spec.rb
+++ b/spec/lib/pact_broker/ui/view_models/index_item_spec.rb
@@ -114,30 +114,24 @@ module ViewDomain
end
end
- describe "tag_names" do
- context "when the pact is the overall latest and it has no tag names" do
- its(:tag_names) { is_expected.to eq " (latest) " }
+ describe "latest?" do
+ context "when the pact is the overall latest" do
+ its(:latest?) { is_expected.to be true }
end
- context "when the pact is the overall latest and also has tag names" do
- let(:tags) { ["master", "prod"] }
- its(:tag_names) { is_expected.to eq " (latest & latest master, prod) " }
- end
-
- context "when the pact is not the latest and has tag names" do
+ context "when the pact is not the latest" do
let(:latest) { false }
- let(:tags) { ["master", "prod"] }
- its(:tag_names) { is_expected.to eq " (latest master, prod) " }
+ its(:latest?) { is_expected.to be false }
end
end
- describe "verification_tag_names" do
- its(:verification_tag_names) { is_expected.to eq " (latest dev, prod)"}
+ describe "consumer_version_latest_tag_names" do
+ let(:tags) { ["master", "prod"] }
+ its(:consumer_version_latest_tag_names) { is_expected.to eq ["master", "prod"] }
+ end
- context "when there are no tags" do
- let(:latest_verification_latest_tags) { [] }
- its(:verification_tag_names) { is_expected.to eq "" }
- end
+ describe "provider_version_latest_tag_names" do
+ its(:provider_version_latest_tag_names) { is_expected.to eq ["dev", "prod"] }
end
describe "<=>" do