Skip to content

Commit f9e3c23

Browse files
committed
feat: add link to matrix from HTML pact page
1 parent 766f7c0 commit f9e3c23

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

lib/pact_broker/api/pact_broker_urls.rb

+5-1
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,14 @@ def triggered_webhook_logs_url triggered_webhook, base_url
160160
"#{base_url}/webhooks/#{triggered_webhook.webhook_uuid}/trigger/#{triggered_webhook.trigger_uuid}/logs"
161161
end
162162

163-
def badge_url_for_latest_pact pact, base_url = ''
163+
def badge_url_for_latest_pact pact, base_url = ''
164164
"#{latest_pact_url(base_url, pact)}/badge.svg"
165165
end
166166

167+
def matrix_url_from_params params, base_url = ''
168+
"#{base_url}/matrix/provider/#{url_encode(params.fetch(:provider_name))}/consumer/#{url_encode(params.fetch(:consumer_name))}"
169+
end
170+
167171
def hal_browser_url target_url
168172
"/hal-browser/browser.html#" + target_url
169173
end

lib/pact_broker/api/renderers/html_pact_renderer.rb

+7
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ def pact_metadata
6363
<li>
6464
<a href=\"#{json_url}\">View in API Browser</a>
6565
</li>
66+
<li>
67+
<a href=\"#{matrix_url}\">View Matrix</a>
68+
</li>
6669
<li>
6770
<a href=\"/\">Home</a>
6871
</li>
@@ -120,6 +123,10 @@ def pact_url
120123
PactBroker::Api::PactBrokerUrls.pact_url '', @pact
121124
end
122125

126+
def matrix_url
127+
PactBroker::Api::PactBrokerUrls.matrix_url_from_params consumer_name: @pact.consumer_name, provider_name: @pact.provider_name
128+
end
129+
123130
def badge_target_url
124131
base_url
125132
end

0 commit comments

Comments
 (0)