Skip to content

Commit

Permalink
Merge branch 'feat/dashboard-api' of github.com:DiUS/pact-broker-saas…
Browse files Browse the repository at this point in the history
… into feat/dashboard-api
  • Loading branch information
bethesque committed Jan 14, 2018
2 parents 9a89d07 + 77a8aa3 commit d4fc8a6
Show file tree
Hide file tree
Showing 15 changed files with 139 additions and 15 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
This project is a fork of the open source [Pact Broker](https://github.com/pact-foundation/pact_broker).
See [README_SAAS](./README_SAAS.md) for documentation on the SAAS Pact Broker.



# Pact Broker
[![Gem Version](https://badge.fury.io/rb/pact_broker.svg)](http://badge.fury.io/rb/pact_broker)
[![Build Status](https://travis-ci.org/pact-foundation/pact_broker.svg?branch=master)](https://travis-ci.org/pact-foundation/pact_broker) [![Join the chat at https://gitter.im/pact-foundation/pact_broker](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/pact-foundation/pact_broker?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
Expand Down
14 changes: 14 additions & 0 deletions README_SAAS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# SAAS Pact Broker

## Updating code from the open source repository

git remote add upstream [email protected]:pact-foundation/pact_broker.git
git pull upstream master #(or appropriate branch)
bundle exec rake
git push

Remember to merge the changes in to any WIP branches.

## Deploying

See the [RELEASING.md](https://github.com/DiUS/pact-broker-docker-private/blob/master/RELEASING.md) file in the pact-broker-docker-private project.
2 changes: 1 addition & 1 deletion example/Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source 'https://rubygems.org'

gem 'pact_broker'
gem 'pact_broker', path: '..'
gem 'sqlite3', '~>1.3' # Sqlite is just for testing, replace this with your choice of database driver
# gem 'pg' # Recommended production gem for postgres
gem 'thin', '~>1.7' # Keep, or replace with your choice of web server
Binary file modified example/pact_broker_database.sqlite3
Binary file not shown.
23 changes: 23 additions & 0 deletions lib/pact_broker/api/resources/dashboard.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
require 'pact_broker/api/resources/base_resource'

module PactBroker
module Api
module Resources

class Dashboard < BaseResource

def content_types_provided
[["application/hal+json", :to_json]]
end

def allowed_methods
["GET"]
end

def to_json

end
end
end
end
end
Empty file.
3 changes: 2 additions & 1 deletion lib/pact_broker/db.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ def self.connection

def self.run_migrations database_connection
Sequel.extension :migration
Sequel::TimestampMigrator.new(database_connection, PactBroker::DB::MIGRATIONS_DIR).run
options = { allow_missing_migration_files: true }
Sequel::TimestampMigrator.new(database_connection, PactBroker::DB::MIGRATIONS_DIR, options).run
end

def self.validate_connection_config
Expand Down
3 changes: 2 additions & 1 deletion lib/pact_broker/db/migrate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ module DB
class Migrate
def self.call database_connection, options = {}
db_migrations_dir = PactBroker.project_root.join('db','migrations')
default_options = { allow_missing_migration_files: true }
puts "Running migrations in directory #{db_migrations_dir}, target=#{options.fetch(:target, 'end')}"
Sequel::TimestampMigrator.new(database_connection, db_migrations_dir, options).run
Sequel::TimestampMigrator.new(database_connection, db_migrations_dir, default_options.merge(options)).run
end
end
end
Expand Down
12 changes: 12 additions & 0 deletions lib/pact_broker/domain/dashboard.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module PactBroker
module Domain
class Dashboard

def initialize *relationships

end


end
end
end
15 changes: 9 additions & 6 deletions lib/pact_broker/ui/views/index/show-with-tags.haml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@
%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'}
%nav.navbase-default.navbar-right{role: "navigation"}
.container
%ul
%li.navbar-right
%a{ href: '/hal-browser/browser.html' }
API Browser
.container
%nav.navbase-default{role: "navigation", id: "navigation"}
.container-fluid
.navbar-header
%a.navbar-brand{href: "#"}
%img{alt: "Brand", src: "/images/[email protected]", height: "24px"}
%ul.navbar-right
%li
%a{href: '/hal-browser/browser.html'}
API Browser
%h1.page-header
Pacts
%table.table.table-bordered.table-striped{ id: 'relationships' }
Expand Down
15 changes: 9 additions & 6 deletions lib/pact_broker/ui/views/index/show.haml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@
%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'}
%nav.navbase-default.navbar-right{role: "navigation"}
.container
%ul
%li.navbar-right
%a{ href: '/hal-browser/browser.html' }
API Browser
.container
%nav.navbase-default{role: "navigation", id: "navigation"}
.container-fluid
.navbar-header
%a.navbar-brand{href: "#"}
%img{alt: "Brand", src: "/images/[email protected]", height: "24px"}
%ul.navbar-right
%li
%a{href: '/hal-browser/browser.html'}
API Browser
%h1.page-header
Pacts
%table.table.table-bordered.table-striped{ id: 'relationships' }
Expand Down
Binary file added public/images/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions public/stylesheets/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,26 @@ span.pact svg path {
span.pact:hover svg path {
fill: #2a6496;
}

#navigation .container-fluid {
padding-left: 0px;
display: flex;
justify-content: space-between;
align-items: center;
}

#navigation .container-fluid .navbar-brand {
padding: 0px;
display: flex;
align-items: center;
}

#navigation .container-fluid:before {
content: '' !important;
display: none;
}

#navigation .container-fluid:after {
content: '' !important;
display: none;
}
23 changes: 23 additions & 0 deletions spec/features/get_dashboard_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
require 'spec/support/test_data_builder'

describe "Get dashboard" do

let(:path) { "/dashboard" }
let(:last_response_body) { JSON.parse(subject.body, symbolize_names: true) }

before do
TestDataBuilder.new
.create_consumer("Foo")
.create_provider("Bar")
.create_webhook
.create_consumer_version("1.2.3")
.create_pact
.create_verification
end

subject { get path; last_response }

it "returns a 200 HAL JSON response", pending: true do
expect(subject).to be_a_hal_json_success_response
end
end
16 changes: 16 additions & 0 deletions spec/lib/pact_broker/api/resources/dashboard_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
require 'pact_broker/api/resources/dashboard'

module PactBroker
module Api
module Resources

describe Dashboard do

let(:path) { "/dashboard" }
subject { get path; last_response }


end
end
end
end

0 comments on commit d4fc8a6

Please sign in to comment.