Skip to content

Commit

Permalink
feat: add link to matrix from HTML pact page
Browse files Browse the repository at this point in the history
  • Loading branch information
bethesque committed Apr 5, 2018
1 parent 766f7c0 commit f9e3c23
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/pact_broker/api/pact_broker_urls.rb
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,14 @@ def triggered_webhook_logs_url triggered_webhook, base_url
"#{base_url}/webhooks/#{triggered_webhook.webhook_uuid}/trigger/#{triggered_webhook.trigger_uuid}/logs"
end

def badge_url_for_latest_pact pact, base_url = ''
def badge_url_for_latest_pact pact, base_url = ''
"#{latest_pact_url(base_url, pact)}/badge.svg"
end

def matrix_url_from_params params, base_url = ''
"#{base_url}/matrix/provider/#{url_encode(params.fetch(:provider_name))}/consumer/#{url_encode(params.fetch(:consumer_name))}"
end

def hal_browser_url target_url
"/hal-browser/browser.html#" + target_url
end
Expand Down
7 changes: 7 additions & 0 deletions lib/pact_broker/api/renderers/html_pact_renderer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ def pact_metadata
<li>
<a href=\"#{json_url}\">View in API Browser</a>
</li>
<li>
<a href=\"#{matrix_url}\">View Matrix</a>
</li>
<li>
<a href=\"/\">Home</a>
</li>
Expand Down Expand Up @@ -120,6 +123,10 @@ def pact_url
PactBroker::Api::PactBrokerUrls.pact_url '', @pact
end

def matrix_url
PactBroker::Api::PactBrokerUrls.matrix_url_from_params consumer_name: @pact.consumer_name, provider_name: @pact.provider_name
end

def badge_target_url
base_url
end
Expand Down

0 comments on commit f9e3c23

Please sign in to comment.