Skip to content

Commit de179d7

Browse files
committed
feat: add latest provider version tag names to dashboard UI
1 parent a3aea48 commit de179d7

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

lib/pact_broker/ui/view_models/index_item.rb

+9
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,15 @@ def tag_names
3434
@relationship.tag_names.any? ? " (#{latest_overall}latest #{@relationship.tag_names.join(', ')}) ": " (latest) "
3535
end
3636

37+
def verification_tag_names
38+
if @relationship.latest_verification_latest_tags.any?
39+
tag_names = @relationship.latest_verification_latest_tags.collect(&:name)
40+
" (latest #{tag_names.join(', ')})"
41+
else
42+
""
43+
end
44+
end
45+
3746
def consumer_group_url
3847
Helpers::URLHelper.group_url consumer_name
3948
end

lib/pact_broker/ui/views/index/show-with-tags.haml

+2
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@
5656
= index_item.provider_name
5757
%td.provider-version-number
5858
= index_item.provider_version_number
59+
%span{style: 'color:gray'}
60+
= index_item.verification_tag_names
5961
%td
6062
= index_item.publication_date_of_latest_pact.gsub("about ", "")
6163
%td{ class: index_item.webhook_status }

spec/lib/pact_broker/ui/view_models/index_item_spec.rb

+12-1
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@ module ViewDomain
1111
let(:provider) { instance_double("PactBroker::Domain::Pacticipant", name: 'Provider Name')}
1212
let(:latest_pact) { instance_double("PactBroker::Domain::Pact") }
1313
let(:latest_verification) { instance_double("PactBroker::Domain::Verification") }
14-
let(:domain_relationship) { PactBroker::Domain::IndexItem.new(consumer, provider, latest_pact, latest, latest_verification, [], [], tags)}
14+
let(:domain_relationship) { PactBroker::Domain::IndexItem.new(consumer, provider, latest_pact, latest, latest_verification, [], [], tags, latest_verification_latest_tags)}
1515
let(:tags) { [] }
16+
let(:verification_tag_1) { instance_double("PactBroker::Tags::TagWithLatestFlag", name: 'dev') }
17+
let(:verification_tag_2) { instance_double("PactBroker::Tags::TagWithLatestFlag", name: 'prod') }
18+
let(:latest_verification_latest_tags) { [verification_tag_1, verification_tag_2] }
1619
let(:latest) { true }
1720

1821
subject { IndexItem.new(domain_relationship) }
@@ -125,7 +128,15 @@ module ViewDomain
125128
let(:tags) { ["master", "prod"] }
126129
its(:tag_names) { is_expected.to eq " (latest master, prod) " }
127130
end
131+
end
132+
133+
describe "verification_tag_names" do
134+
its(:verification_tag_names) { is_expected.to eq " (latest dev, prod)"}
128135

136+
context "when there are no tags" do
137+
let(:latest_verification_latest_tags) { [] }
138+
its(:verification_tag_names) { is_expected.to eq "" }
139+
end
129140
end
130141

131142
describe "<=>" do

0 commit comments

Comments
 (0)