Skip to content

Commit

Permalink
feat(ui): display repository URL on the pacticipant relationships page
Browse files Browse the repository at this point in the history
  • Loading branch information
bethesque committed Feb 27, 2020
1 parent 58dea9a commit 5d285e9
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/pact_broker/test/test_data_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def create_tag_with_hierarchy pacticipant_name, pacticipant_version, tag_name

def create_pacticipant pacticipant_name, params = {}
params.delete(:comment)
@pacticipant = PactBroker::Domain::Pacticipant.create({ :name => pacticipant_name }.merge(params))
@pacticipant = PactBroker::Domain::Pacticipant.create({ :name => pacticipant_name, repository_url: "https://github.com/example-organization/#{pacticipant_name}" }.merge(params))
self
end

Expand Down
9 changes: 6 additions & 3 deletions lib/pact_broker/ui/controllers/groups.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@ class Groups < Base
include PactBroker::Services

get ":name" do
pacticipant = pacticipant_service.find_pacticipant_by_name(params[:name])
erb :'groups/show.html', {
locals: {
csv_path: "/groups/#{params[:name]}.csv",
pacticipant_name: params[:name]}
locals: {
csv_path: "/groups/#{params[:name]}.csv",
pacticipant_name: params[:name],
repository_url: pacticipant&.repository_url
}
}, {
layout: 'layouts/main'
}
Expand Down
15 changes: 15 additions & 0 deletions lib/pact_broker/ui/views/groups/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<% require 'sanitize' %>

<!DOCTYPE html>
<html lang="en">
<head>
Expand Down Expand Up @@ -30,6 +32,19 @@ body{
</head>
<body>
<h1>Network graph of <%= pacticipant_name %> relationships</h1>

<% if repository_url %>
<p>Repository URL:

<%
repository_link = "<a href='#{repository_url}'>#{escape_html(repository_url)}</a>"
%>
<%= Sanitize.fragment(repository_link, Sanitize::Config::BASIC) %>
<% end %>


<script type="text/javascript">
var windowWidth, windowHeight, svg;

Expand Down
1 change: 1 addition & 0 deletions pact_broker.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ Gem::Specification.new do |gem|
gem.add_runtime_dependency 'dry-logic', '0.4.2' # Later version cases ArgumentError: wrong number of arguments
gem.add_runtime_dependency 'table_print', '~> 1.5'
gem.add_runtime_dependency 'semantic_logger', '~> 4.3'
gem.add_runtime_dependency 'sanitize', '~> 5.1'

gem.add_development_dependency 'pact', '~>1.14'
gem.add_development_dependency 'rspec-pact-matchers', '~>0.1'
Expand Down

0 comments on commit 5d285e9

Please sign in to comment.