Skip to content

Commit

Permalink
feat(matrix): preselect the consumer version when clicking through to…
Browse files Browse the repository at this point in the history
… matrix page from integration dashboard
  • Loading branch information
bethesque committed Oct 5, 2021
1 parent cdaf7f6 commit b550b47
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions lib/pact_broker/ui/helpers/url_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ def group_url pacticipant_name, base_url = ""
def matrix_url consumer_name, provider_name, base_url = ""
"#{base_url}/matrix/provider/#{ERB::Util.url_encode(provider_name)}/consumer/#{ERB::Util.url_encode(consumer_name)}"
end

def matrix_url_for_consumer_version consumer_name, consumer_version_number, provider_name, base_url = ""
query = {
q:
[
{ pacticipant: consumer_name, version: consumer_version_number },
{ pacticipant: provider_name }
],
latestby: "cvpv"
}
"#{base_url}/matrix?" + Rack::Utils.build_nested_query(query)
end
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/pact_broker/ui/view_models/index_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def pact_url
end

def pact_matrix_url
Helpers::URLHelper.matrix_url(consumer_name, provider_name, base_url)
Helpers::URLHelper.matrix_url_for_consumer_version(consumer_name, consumer_version_number, provider_name, base_url)
end

def any_webhooks?
Expand Down

0 comments on commit b550b47

Please sign in to comment.