Skip to content
This repository has been archived by the owner on Oct 4, 2018. It is now read-only.

Commit

Permalink
Merge reporting branch into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
bgadoury committed Jun 4, 2014
1 parent b12d69e commit 3556c59
Show file tree
Hide file tree
Showing 35 changed files with 803 additions and 16 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ config/unicorn.rb
public/robots.txt
.*install_done
.bundle/config

9 changes: 7 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,15 @@ gem 'pg', :require => 'pg'
gem 'sqlite3'
gem 'devise', '2.1.2'
gem 'jquery-rails'
gem 'jquery-ui-rails'
gem 'dpla_search_api_v1', :path => 'v1'
gem 'dpla_contentqa', :path => 'contentqa'
gem 'delayed_job_active_record'
gem 'jquery-tablesorter'
gem 'daemons'

# twitter-bootstrap-rails can have problems finding itself when it is in the assets group
gem 'twitter-bootstrap-rails', '~> 2.2.8'

group :assets do
gem 'sass-rails', '~> 3.2.3'
Expand All @@ -18,8 +25,6 @@ group :assets do
gem 'less-rails'
end

# twitter-bootstrap-rails can have problems finding itself when it is in the assets group
gem 'twitter-bootstrap-rails', '~> 2.2.8'
gem 'rspec-rails', :group => [:test, :development]

group :test do
Expand Down
29 changes: 23 additions & 6 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ PATH
remote: contentqa
specs:
dpla_contentqa (0.0.1)
couchrest (= 1.1.3)
delayed_job (~> 3.0.4)
delayed_job_active_record (~> 0.3.0)
httparty
rails (~> 3.2.11)
twitter-bootstrap-rails
Expand Down Expand Up @@ -72,7 +75,7 @@ GEM
mime-types (~> 1.15)
multi_json (~> 1.0)
rest-client (~> 1.6.1)
cucumber (1.3.10)
cucumber (1.3.5)
builder (>= 2.1.2)
diff-lcs (>= 1.1.3)
gherkin (~> 2.12)
Expand All @@ -83,8 +86,14 @@ GEM
cucumber (>= 1.2.0)
nokogiri (>= 1.5.0)
rails (>= 3.0.0)
dalli (2.7.2)
database_cleaner (1.2.0)
daemons (1.1.9)
dalli (2.6.4)
database_cleaner (1.0.1)
delayed_job (3.0.5)
activesupport (~> 3.0)
delayed_job_active_record (0.3.3)
activerecord (>= 2.1.0, < 4)
delayed_job (~> 3.0)
devise (2.1.2)
bcrypt-ruby (~> 3.0)
orm_adapter (~> 0.1)
Expand All @@ -106,11 +115,15 @@ GEM
jquery-rails (3.1.0)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
jquery-tablesorter (1.9.3)
railties (>= 3.1, < 5)
jquery-ui-rails (4.1.0)
railties (>= 3.1.0)
json (1.8.1)
kgio (2.9.2)
less (2.4.0)
commonjs (~> 0.2.7)
less-rails (2.4.2)
less-rails (2.3.3)
actionpack (>= 3.1)
less (~> 2.4.0)
libv8 (3.16.14.3)
Expand All @@ -126,7 +139,7 @@ GEM
mini_portile (~> 0.5.0)
orm_adapter (0.5.0)
pg (0.17.1)
polyglot (0.3.4)
polyglot (0.3.5)
rack (1.4.5)
rack-cache (1.2)
rack (>= 0.4)
Expand All @@ -150,7 +163,7 @@ GEM
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
raindrops (0.13.0)
rake (10.3.1)
rake (10.3.2)
rdoc (3.12.2)
json (~> 1.4)
ref (1.0.5)
Expand Down Expand Up @@ -222,11 +235,15 @@ PLATFORMS
DEPENDENCIES
coffee-rails (~> 3.2.1)
cucumber-rails
daemons
database_cleaner
delayed_job_active_record
devise (= 2.1.2)
dpla_contentqa!
dpla_search_api_v1!
jquery-rails
jquery-tablesorter
jquery-ui-rails
less-rails
pg
rails (~> 3.2.15)
Expand Down
6 changes: 6 additions & 0 deletions bin/camp-restart-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ es_options_file="${camp_dir}/tmp/.elasticsearch_options"
couch_pidfile="${camp_dir}/var/run/couchdb/couchdb.pid"
couch_cmd="/usr/local/bin/couchdb -a ${camp_dir}/v1/config/couchdb.ini -p $couch_pidfile"

# Delayed job
dj_start="${camp_dir}/script/delayed_job start"
dj_stop="${camp_dir}/script/delayed_job stop"

function start {
if [ -a $es_options_file ] ; then
# Use this file to set camp-specific ElasticSearch options such as ES_HEAP_SIZE
Expand All @@ -25,6 +29,7 @@ function start {

$couch_cmd -b -o /dev/null -e /dev/null
$es_cmd $es_options
$dj_start
}

function stop {
Expand All @@ -34,6 +39,7 @@ function stop {
if [ -e $couch_pidfile ] ; then
$couch_cmd -d
fi
$dj_stop
}

function restart {
Expand Down
2 changes: 2 additions & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
require 'rails/all'
require 'v1'
require 'contentqa'
require 'delayed_job'

if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Expand All @@ -22,6 +23,7 @@ class Application < Rails::Application
# Custom directories with classes and modules you want to be autoloadable.
# config.autoload_paths += %W(#{config.root}/lib)
config.autoload_paths += Dir["#{config.root}/lib/**/"]
config.autoload_paths += Dir["#{config.root}/contentqa/lib/**/"]

# Set cache_store based on dpla.yml settings
config.cache_store = V1::Config.cache_store
Expand Down
3 changes: 3 additions & 0 deletions config/environment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@

# Initialize the rails application
Dpla::Application.initialize!

# Imortant: delayed job requires some attributes to be accessible - make sure they are
Delayed::Job.attr_accessible :priority, :payload_object, :handler, :run_at, :failed_at, :queue
10 changes: 9 additions & 1 deletion contentqa/README.rdoc
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
= Contentqa

This project rocks and uses MIT-LICENSE.
The report generation is done with delayed_job. To install run:

$ bundle
$ rails generate delayed_job:active_record
$ rake db:migrate

To start delayed_job in a camp use:

$ rake jobs:work
2 changes: 2 additions & 0 deletions contentqa/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,5 @@ end


task :default => :test

require Bundler.load.gems.find{|i| i.name == 'delayed_job'}.gem_dir + "/lib/delayed/tasks"
2 changes: 2 additions & 0 deletions contentqa/app/assets/javascripts/contentqa/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@
//
//= require jquery
//= require jquery_ujs
//= require jquery.ui.all
//= require jquery-tablesorter
//= require_tree .
81 changes: 81 additions & 0 deletions contentqa/app/assets/javascripts/contentqa/reporting.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
// Place all the behaviors and hooks related to the matching controller here.
// All this logic will automatically be available in application.js.

// index page
$(".sortable").tablesorter({
headers: {
2: {sorter: false},
3: {sorter: false},
4: {sorter: false},
5: {sorter: false},
6: {sorter: false},
7: {sorter: false},
8: {sorter: false}
}
});

// errors page
$(".error_table:first").show();

$(".error_link").bind("click", function() {
$(".error_table").hide();
$("#" + $(this).attr("id") + "_table").show();
});

// provider/gloabl page
$('#check_all').on("click", function() {
var checked = this.checked;
$('input[name="reports[]"]:enabled').map(function() {
$(this).prop("checked", checked);
})
});

$('.generate_reports').on("click", function() {
var report_types = $('input[name="reports[]"]:checked').map(function() {
return $(this).val();
}).get();
if (report_types.length) {
$(this).prop("disabled", true);
$('#check_all').prop("disabled", true);
var ingest_id = $('#id').val();
var provider = $('#provider').val();
var count = 0;
var total = report_types.length;
report_types.forEach(function(report_type) {
$.ajax({
url: "/qa/reporting/create",
data: {id: ingest_id, report_type: report_type},
success: function() {
count++;
$("." + report_type + "_link").html("Generating.");
if (count == total) {
if (provider == "global") {
window.location.replace("/qa/reporting/global?id=" + ingest_id);
}
else {
window.location.replace("/qa/reporting/provider?id=" + ingest_id);
}
}
}
});
});
}
});

if ($('.running').length) {
setInterval(function() {
var ingest_id = $('#id').val();
var provider = $('#provider').val();
var url;
if (provider == "global") {
url = "/qa/reporting/global"
}
else {
url = "/qa/reporting/provider"
}
$.ajax({
url: url,
data: {id: ingest_id}
});
}, 5000);
}
1 change: 1 addition & 0 deletions contentqa/app/assets/stylesheets/contentqa/application.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* You're free to add application-wide styles to this file and they'll appear at the top of the
* compiled file, but it's generally better to create a new file per style scope.
*
*= require jquery.ui.all
*= require_self
*= require_tree .
*/
Expand Down
25 changes: 25 additions & 0 deletions contentqa/app/assets/stylesheets/contentqa/tablesorter.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/* header */
.sortable .header,
.sortable .tablesorter-header {
background-image: url(data:image/gif;base64,R0lGODlhFQAJAIAAACMtMP///yH5BAEAAAEALAAAAAAVAAkAAAIXjI+AywnaYnhUMoqt3gZXPmVg94yJVQAAOw==);
background-position: center right;
background-repeat: no-repeat;
cursor: pointer;
white-space: normal;
}
.sortable thead .headerSortUp,
.sortable thead .tablesorter-headerSortUp,
.sortable thead .tablesorter-headerAsc {
background-image: url(data:image/gif;base64,R0lGODlhFQAEAIAAACMtMP///yH5BAEAAAEALAAAAAAVAAQAAAINjI8Bya2wnINUMopZAQA7);
border-bottom: #000 2px solid;
}
.sortable thead .headerSortDown,
.sortable thead .tablesorter-headerSortDown,
.sortable thead .tablesorter-headerDesc {
background-image: url(data:image/gif;base64,R0lGODlhFQAEAIAAACMtMP///yH5BAEAAAEALAAAAAAVAAQAAAINjB+gC+jP2ptn0WskLQA7);
border-bottom: #000 2px solid;
}
.sortable thead .sorter-false {
background-image: none;
cursor: default;
}
2 changes: 1 addition & 1 deletion contentqa/app/controllers/contentqa/compare_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require_dependency "contentqa/application_controller"
#require_dependency "contentqa/application_controller"

module Contentqa
class CompareController < ApplicationController
Expand Down
Loading

0 comments on commit 3556c59

Please sign in to comment.