forked from pact-foundation/pact_broker
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
104 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
require 'pact_broker/ui/controllers/base_controller' | ||
require 'pact_broker/ui/view_models/matrix_line' | ||
require 'haml' | ||
|
||
module PactBroker | ||
module UI | ||
module Controllers | ||
class Matrix < Base | ||
|
||
include PactBroker::Services | ||
|
||
get "/provider/:provider_name/consumer/:consumer_name" do | ||
lines = matrix_service.find consumer_name: params[:consumer_name], provider_name: params[:provider_name] | ||
lines = lines.collect{|line| PactBroker::UI::ViewDomain::MatrixLine.new(line)} | ||
locals = { | ||
lines: lines, | ||
title: "The Matrix", | ||
consumer_name: params[:consumer_name], | ||
provider_name: params[:provider_name] | ||
} | ||
haml :'matrix/show', {locals: locals, layout: :'layouts/main'} | ||
end | ||
|
||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
require 'pact_broker/api/pact_broker_urls' | ||
require 'pact_broker/ui/helpers/url_helper' | ||
require 'pact_broker/date_helper' | ||
|
||
module PactBroker | ||
module UI | ||
module ViewDomain | ||
class MatrixLine | ||
|
||
include PactBroker::Api::PactBrokerUrls | ||
|
||
def initialize line | ||
@line = line | ||
end | ||
|
||
def consumer_version_number | ||
@line[:consumer_version_number] | ||
end | ||
|
||
def provider_version_number | ||
@line[:provider_version] | ||
end | ||
|
||
def verification_status | ||
case @line[:success] | ||
when true then "Verified" | ||
when false then "Failed" | ||
else '' | ||
end | ||
end | ||
|
||
def verification_status_class | ||
case @line[:success] | ||
when true then 'success' | ||
when false then 'danger' | ||
else '' | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
%body | ||
%link{rel: 'stylesheet', href: '/css/bootstrap.min.css'} | ||
%link{rel: 'stylesheet', href: '/stylesheets/relationships.css'} | ||
%script{type: 'text/javascript', src:'/javascripts/jquery-2.1.1.min.js'} | ||
%script{type: 'text/javascript', src:'/javascripts/jquery.tablesorter.min.js'} | ||
%script{type: 'text/javascript', src:'/js/bootstrap.min.js'} | ||
|
||
.container | ||
%h1.page-header | ||
= title | ||
%table.table.table-bordered.table-striped{id: 'relationships'} | ||
%thead | ||
%th.consumer | ||
= "#{consumer_name} version" | ||
%span.glyphicon.glyphicon-sort.sort | ||
%th.provider | ||
= "#{provider_name} version" | ||
%span.glyphicon.glyphicon-sort.sort | ||
%th.verification-result | ||
Verification | ||
%tbody | ||
- lines.each do | line | | ||
%tr | ||
%td.consumer-version | ||
= line.consumer_version_number | ||
%td.provider | ||
= line.provider_version_number | ||
%td.verification-result{class: line.verification_status_class} | ||
= line.verification_status | ||
|