From f9e3c2379ef641135d60cabb90ddc9ccb93dd839 Mon Sep 17 00:00:00 2001 From: Beth Skurrie Date: Thu, 5 Apr 2018 10:33:52 +1000 Subject: [PATCH] feat: add link to matrix from HTML pact page --- lib/pact_broker/api/pact_broker_urls.rb | 6 +++++- lib/pact_broker/api/renderers/html_pact_renderer.rb | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/pact_broker/api/pact_broker_urls.rb b/lib/pact_broker/api/pact_broker_urls.rb index 2b5ca18cf..0637dce8e 100644 --- a/lib/pact_broker/api/pact_broker_urls.rb +++ b/lib/pact_broker/api/pact_broker_urls.rb @@ -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 diff --git a/lib/pact_broker/api/renderers/html_pact_renderer.rb b/lib/pact_broker/api/renderers/html_pact_renderer.rb index 81870d474..6b48f7dc7 100644 --- a/lib/pact_broker/api/renderers/html_pact_renderer.rb +++ b/lib/pact_broker/api/renderers/html_pact_renderer.rb @@ -63,6 +63,9 @@ def pact_metadata
  • View in API Browser
  • +
  • + View Matrix +
  • Home
  • @@ -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