aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZakaria BOUZIANE2015-04-27 15:47:14 +0200
committerZakaria BOUZIANE2015-04-27 15:47:14 +0200
commita6171536fe1fbf61c6be54b300c9404c7dcd6349 (patch)
treec6b079f774e06d1fdb616ee55e0c06cb91d633f7
parent21d594f9772b71cee9c95eae1f0e3b469c50388e (diff)
downloadchouette-core-a6171536fe1fbf61c6be54b300c9404c7dcd6349.tar.bz2
Validation to ComplianceCheckTask
-rw-r--r--app/controllers/compliance_check_results_controller.rb25
-rw-r--r--app/controllers/compliance_check_tasks_controller.rb47
-rw-r--r--app/controllers/validation_results_controller.rb35
-rw-r--r--app/controllers/validations_controller.rb102
-rw-r--r--app/models/compliance_check_result.rb85
-rw-r--r--app/models/compliance_check_service.rb (renamed from app/models/validation_service.rb)6
-rw-r--r--app/models/compliance_check_task.rb191
-rw-r--r--app/models/compliance_check_task_export.rb8
-rw-r--r--app/models/validation.rb157
-rw-r--r--app/models/validation_export.rb54
-rw-r--r--app/models/validation_report.rb64
-rw-r--r--app/models/validation_task.rb173
-rw-r--r--app/models/validation_type.rb7
-rw-r--r--app/views/compliance_check_results/index.html.erb49
-rw-r--r--app/views/compliance_check_tasks/_compliance_check_task.html.erb13
-rw-r--r--app/views/compliance_check_tasks/_compliance_check_tasks.html.erb2
-rw-r--r--app/views/compliance_check_tasks/detailed_errors_index.csv.erb4
-rw-r--r--app/views/compliance_check_tasks/show.html.erb12
-rw-r--r--app/views/compliance_check_tasks/show.js.coffee28
-rw-r--r--app/views/compliance_check_tasks/summary_errors_index.csv.erb4
-rw-r--r--app/views/shared/_header.erb2
-rw-r--r--app/views/validation_results/_validation_result.erb21
-rw-r--r--app/views/validation_results/index.html.erb75
-rw-r--r--app/views/validation_results/index.js.coffee8
-rw-r--r--app/views/validations/_results_dashboard.html.erb35
-rw-r--r--app/views/validations/_validation.erb29
-rw-r--r--app/views/validations/_validations.html.erb9
-rw-r--r--app/views/validations/detailed_errors_index.csv.erb2
-rw-r--r--app/views/validations/index.html.erb12
-rw-r--r--app/views/validations/index.js.erb1
-rw-r--r--app/views/validations/show.html.erb65
-rw-r--r--app/views/validations/show.js.coffee50
-rw-r--r--app/views/validations/summary_errors_index.csv.erb3
-rw-r--r--config/locales/compliance_check_results.yml4
-rw-r--r--config/routes.rb14
35 files changed, 288 insertions, 1108 deletions
diff --git a/app/controllers/compliance_check_results_controller.rb b/app/controllers/compliance_check_results_controller.rb
index a39c79ea7..2829ab749 100644
--- a/app/controllers/compliance_check_results_controller.rb
+++ b/app/controllers/compliance_check_results_controller.rb
@@ -1,23 +1,36 @@
class ComplianceCheckResultsController < ChouetteController
+
+ defaults :resource_class => ComplianceCheckResult
respond_to :json
respond_to :js, :only => :index
- belongs_to :compliance_check_task
-
+
def index
+ #puts "params = #{params.inspect}"
index! do |format|
format.html { render :layout => false }
end
end
+
+ protected
+
+ def compliance_check_service
+ ComplianceCheckService.new(@referential)
+ end
+
+ def compliance_check_task
+ @compliance_check_task ||= compliance_check_service.find( params[:compliance_check_task_id] )
+ end
+
+ def compliance_check_result
+ @compliance_check_result ||= compliance_check_task.compliance_check_result
+ end
def collection
- wheres = [:status, :severity].map{|key| params.has_key?(key) ? {key => params[key]} : {} }\
- .inject({}){|hash, injected| hash.merge!(injected)}
- @compliance_check_results ||= end_of_association_chain.where(wheres).order(:rule_code)
+ @compliance_check_results ||= compliance_check_result.all(params[:status], params[:severity]) #.paginate(:page => params[:page])
end
def rule_parameter_set
@rule_parameter_set = RuleParameterSet.new.tap { |rps| rps.parameters = resource.parameter_set }
end
-
end
diff --git a/app/controllers/compliance_check_tasks_controller.rb b/app/controllers/compliance_check_tasks_controller.rb
index 773ea1ed7..d7db5c912 100644
--- a/app/controllers/compliance_check_tasks_controller.rb
+++ b/app/controllers/compliance_check_tasks_controller.rb
@@ -1,3 +1,5 @@
+require 'will_paginate/array'
+
class ComplianceCheckTasksController < ChouetteController
defaults :resource_class => ComplianceCheckTask
@@ -5,7 +7,18 @@ class ComplianceCheckTasksController < ChouetteController
respond_to :zip, :only => :export
belongs_to :referential
-
+ def index
+ begin
+ index! do
+ build_breadcrumb :index
+ end
+ rescue Ievkit::Error => error
+ logger.error("Iev failure : #{error.message}")
+ flash[:error] = t('iev.failure')
+ redirect_to referential_path(@referential)
+ end
+ end
+
def references
@references = referential.send(params[:type]).where("name ilike ?", "%#{params[:q]}%")
respond_to do |format|
@@ -29,30 +42,28 @@ class ComplianceCheckTasksController < ChouetteController
def export
respond_to do |format|
- format.zip { send_file ComplianceCheckTaskExport.new(compliance_check_task, request).export, :type => :zip }
+ format.zip { send_file ComplianceCheckTaskExport.new(resource, @referential.id, request).export, :type => :zip }
end
end
protected
-
+
alias_method :compliance_check_task, :resource
-
- def create_resource( object )
- if object.save
- object.delayed_validate
- end
+
+ def compliance_check_service
+ ComplianceCheckService.new(@referential)
end
-
- def build_resource
- super.tap do |export|
- compliance_check_task.assign_attributes referential_id: @referential.id,
- user_id: current_user.id,
- user_name: current_user.name
- end
+
+ def build_resource(attributes = {})
+ @compliance_check_task ||= ComplianceCheckTask.new
end
-
+
+ def resource
+ @compliance_check_task ||= compliance_check_service.find(params[:id] )
+ end
+
def collection
- @compliance_check_tasks ||= end_of_association_chain.order('created_at DESC').paginate(page: params[:page])
+ @compliance_check_tasks ||= compliance_check_service.all.paginate(:page => params[:page])
end
-
+
end
diff --git a/app/controllers/validation_results_controller.rb b/app/controllers/validation_results_controller.rb
deleted file mode 100644
index dde9bcbd2..000000000
--- a/app/controllers/validation_results_controller.rb
+++ /dev/null
@@ -1,35 +0,0 @@
-class ValidationResultsController < ChouetteController
-
- defaults :resource_class => ValidationReport
-
- respond_to :json
- respond_to :js, :only => :index
-
- def index
- index! do |format|
- format.html { render :layout => false }
- end
- end
-
- protected
-
- def validation_service
- ValidationService.new(@referential)
- end
-
- def validation
- @validation ||= validation_service.find( params[:validation_id] )
- end
-
- def validation_report
- @validation_report ||= validation.report
- end
-
- def collection
- @validation_results ||= validation_report.all(params[:status], params[:severity]) #.paginate(:page => params[:page])
- end
-
- def rule_parameter_set
- @rule_parameter_set = RuleParameterSet.new.tap { |rps| rps.parameters = resource.parameter_set }
- end
-end
diff --git a/app/controllers/validations_controller.rb b/app/controllers/validations_controller.rb
deleted file mode 100644
index f25e8763b..000000000
--- a/app/controllers/validations_controller.rb
+++ /dev/null
@@ -1,102 +0,0 @@
-require 'will_paginate/array'
-
-class ValidationsController < ChouetteController
- defaults :resource_class => Validation
-
- respond_to :html, :only => [:show, :index, :new, :create, :delete]
- respond_to :js, :only => [:show, :index]
- belongs_to :referential
-
- # create => curl -F "file=@Citura.zip;filename=Citura.zip" -F "file=@parameters.json;filename=parameters.json" http://localhost:8080/chouette_iev/referentials/test/validator/neptune
- # index curl http://localhost:8080/mobi.chouette.api/referentials/test/jobs
- # show curl http://localhost:8080/mobi.chouette.api/referentials/test/jobs
-
-
- def index
- begin
- index! do
- build_breadcrumb :index
- end
- rescue Ievkit::Error => error
- logger.error("Iev failure : #{error.message}")
- flash[:error] = t('iev.failure')
- redirect_to referential_path(@referential)
- end
- end
-
- def show
- begin
- show! do
- build_breadcrumb :show
- end
- rescue Ievkit::Error => error
- logger.error("Iev failure : #{error.message}")
- flash[:error] = t('iev.failure')
- redirect_to referential_path(@referential)
- end
- end
-
- def new
- begin
- new! do
- puts "OK"
- end
- rescue Ievkit::Error => error
- logger.error("Iev failure : #{error.message}")
- flash[:error] = t('iev.failure')
- redirect_to referential_path(@referential)
- end
- end
-
- def create
- begin
- create! do
- puts "OK"
- end
- rescue Ievkit::Error => error
- logger.error("Iev failure : #{error.message}")
- flash[:error] = t('iev.failure')
- redirect_to referential_path(@referential)
- end
- end
-
- def delete
- begin
- delete! do
- validation_service.delete(@validation.id)
- redirect_to referential_validations_path(@referential)
- end
- rescue Ievkit::Error => error
- logger.error("Iev failure : #{error.message}")
- flash[:error] = t('iev.failure')
- redirect_to referential_path(@referential)
- end
- end
-
- def export
- respond_to do |format|
- format.zip { send_file ValidationExport.new(resource, @referential.id, request).export, :type => :zip }
- end
- end
-
- protected
-
- alias_method :validation, :resource
-
- def validation_service
- ValidationService.new(@referential)
- end
-
- def build_resource(attributes = {})
- @validation ||= ValidationTask.new
- end
-
- def resource
- @validation ||= validation_service.find(params[:id] )
- end
-
- def collection
- @validations ||= validation_service.all.paginate(:page => params[:page])
- end
-
-end
diff --git a/app/models/compliance_check_result.rb b/app/models/compliance_check_result.rb
index f34cf7911..8eb7b82aa 100644
--- a/app/models/compliance_check_result.rb
+++ b/app/models/compliance_check_result.rb
@@ -1,51 +1,64 @@
-class ComplianceCheckResult < ActiveRecord::Base
- scope :warning, -> { where severity: 'warning' }
- scope :error, -> { where severity: 'error' }
- scope :improvment, -> { where severity: 'improvment' }
-
- scope :ok, -> { where status: 'ok' }
- scope :nok, -> { where status: 'nok' }
- scope :na, -> { where status: 'na' }
-
- #attr_accessible :violation_count
- belongs_to :compliance_check_task
-
- validates_presence_of :rule_code
- validates_inclusion_of :severity, :in => %w{warning error improvment}
- validates_inclusion_of :status, :in => %w{na ok nok}
-
- serialize :detail, JSON
-
- def error_severity_failure?
- severity == "error" && status == "nok"
+class ComplianceCheckResult
+ extend ActiveModel::Naming
+ extend ActiveModel::Translation
+ include ActiveModel::Model
+
+ attr_reader :datas
+
+ def initialize(response)
+ @datas = response[:validation_report].tests.sort_by { |hash| [ hash[:severity], hash[:result], hash[:test_id]] }
end
- def indice
- return nil unless rule_code
-
- rule_code.match( /\d+-\w+-\w+-(\d+)/ )[1].to_i
+ def ok_error
+ @datas.select { |test| (test[:result] == "OK" && test[:severity] == "ERROR") }
+ end
+
+ def nok_error
+ @datas.select { |test| (test[:result] == "NOK" && test[:severity] == "ERROR")}
+ end
+
+ def na_error
+ @datas.select { |test| (test[:result] == "UNCHECK" && test[:severity] == "ERROR")}
end
- def data_type
- return nil unless rule_code
-
- rule_code.match( /\d+-\w+-(\w+)-\d+/ )[1]
+ def ok_warning
+ @datas.select { |test| (test[:result] == "OK" && test[:severity] == "WARNING")}
+ end
+
+ def nok_warning
+ @datas.select { |test| (test[:result] == "NOK" && test[:severity] == "WARNING")}
+ end
+
+ def na_warning
+ @datas.select { |test| (test[:result] == "UNCHECK" && test[:severity] == "WARNING")}
+ end
+
+ def mandatory_tests
+ @datas.select { |test| test[:severity] == "ERROR"}
end
- def format
- return nil unless rule_code
+ def optional_tests
+ @datas.select { |test| test[:severity] == "WARNING"}
+ end
- rule_code.match( /\d+-(\w+)-\w+-\d+/ )[1]
+ def ok_tests
+ @datas.select { |test| test[:result] == "OK"}
end
- def level
- return nil unless rule_code
+ def nok_tests
+ @datas.select { |test| test[:result] == "NOK"}
+ end
- rule_code.match( /(\d+)-\w+-\w+-\d+/ )[1].to_i
+ def uncheck_tests
+ @datas.select { |test| test[:result] == "UNCHECK"}
end
- def rule_code_formatted
- rule_code.gsub("-", "_").downcase if rule_level
+ def all(status, severity)
+ @datas.select { |test| ( test[:result] == status && test[:severity] == severity ) }
end
+ def results
+ return @datas
+ end
+
end
diff --git a/app/models/validation_service.rb b/app/models/compliance_check_service.rb
index 44b36091f..e254ac3d5 100644
--- a/app/models/validation_service.rb
+++ b/app/models/compliance_check_service.rb
@@ -1,4 +1,4 @@
-class ValidationService
+class ComplianceCheckService
attr_reader :referential
@@ -8,14 +8,14 @@ class ValidationService
# Find a validation whith this id
def find(id)
- Validation.new(Ievkit.scheduled_job(referential.slug, id, { :action => "validator" }))
+ ComplianceCheckTask.new(Ievkit.scheduled_job(referential.slug, id, { :action => "validator" }))
end
# Find all validations
def all
[].tap do |jobs|
Ievkit.jobs(referential.slug, { :action => "validator" }).each do |job|
- jobs << Validation.new(job)
+ jobs << ComplianceCheckTask.new(job)
end
end
end
diff --git a/app/models/compliance_check_task.rb b/app/models/compliance_check_task.rb
index ef35fcbdc..7a344066f 100644
--- a/app/models/compliance_check_task.rb
+++ b/app/models/compliance_check_task.rb
@@ -1,104 +1,153 @@
-class ComplianceCheckTask < ActiveRecord::Base
+class ComplianceCheckTask
+ extend Enumerize
+ extend ActiveModel::Naming
+ extend ActiveModel::Translation
+ include ActiveModel::Model
+ attr_reader :datas
- attr_accessor :rule_parameter_set_id
-
- belongs_to :referential
- belongs_to :import_task
-
- validates_presence_of :referential
- validates_presence_of :user_id
- validates_presence_of :user_name
- validates_inclusion_of :status, :in => %w{ pending processing completed failed }
-
- has_many :compliance_check_results, -> { order([ :severity , :status ]) }
-
- serialize :parameter_set, JSON
-
- include ::TypeIdsModelable
-
- def any_error_severity_failure?
- return false if compliance_check_results.empty? || compliance_check_results.nil?
-
- compliance_check_results.any? { |r| r.error_severity_failure? }
+ def initialize(response)
+ @datas = response
end
-
- def failed?
- status == "failed"
+
+ def compliance_check_result
+ report_path = datas.links.select{ |link| link["rel"] == "validation_report"}.first.href
+ if report_path
+ response = Ievkit.get(report_path)
+ ComplianceCheckResult.new(response)
+ else
+ raise Ievkit::IevError("Impossible to access report path link for validation")
+ end
end
- def chouette_command
- Chouette::Command.new(:schema => referential.slug)
+ def import_task
+ if datas.action == "importer"
+ Import.new(Ievkit.scheduled_job(referential_name, id, { :action => "importer" }) )
+ end
end
- before_validation :define_default_attributes, :on => :create
- def define_default_attributes
- self.status ||= "pending"
- if self.rule_parameter_set
- self.parameter_set = self.rule_parameter_set.parameters
- self.parameter_set_name = self.rule_parameter_set.name
+ def export_task
+ if datas.action == "exporter"
+ Export.new(Ievkit.scheduled_job(referential_name, id, { :action => "exporter" }) )
end
end
- @@references_types = [ Chouette::Line, Chouette::Network, Chouette::Company, Chouette::GroupOfLine ]
- cattr_reader :references_types
-
- #validates_inclusion_of :references_type, :in => references_types.map(&:to_s), :allow_blank => true, :allow_nil => true
+ def rule_parameter_set
+ rule_parameter_set = datas.links.select{ |link| link["rel"] == "validation_params"}.first.href
+ if rule_parameter_set
+ response = Ievkit.get(rule_parameter_set)
+ rule_parameter_set = RuleParameterSet.new.tap { |rps| rps.parameters = response.validation }
+ else
+ raise Ievkit::Error("Impossible to access rule parameter set link for validation")
+ end
+ end
+
+ def compliance_check
+ compliance_check_path = datas.links.select{ |link| link["rel"] == "validation_report"}.first.href
+ if compliance_check_path
+ response = Ievkit.get(compliance_check_path)
+ ComplianceCheck.new(response)
+ else
+ raise Ievkit::Error("Impossible to access compliance check path link for validation")
+ end
+ end
- after_destroy :destroy_import_task
- def destroy_import_task
- import_task.destroy if import_task
+ def delete
+ delete_path = datas.links.select{ |link| link["rel"] == "delete"}.first.href
+ if delete_path
+ Ievkit.delete(delete_path)
+ else
+ raise Ievkit::Error("Impossible to access delete path link for validation")
+ end
end
- def delayed_validate
- delay.validate if import_task.blank?
+ def cancel
+ cancel_path = datas.links.select{ |link| link["rel"] == "cancel"}.first.href
+ if cancel_path
+ Ievkit.delete(cancel_path)
+ else
+ raise Ievkit::Error("Impossible to access cancel path link for validation")
+ end
end
- def name
- "#{self.class.model_name.human} #{id}"
+ def id
+ datas.id
end
- def levels
- [].tap do |l|
- l.concat( [1 , 2]) if self.import_task
- l << 3 if self.parameter_set
+ def status
+ # pending processing completed failed
+ # CREATED, SCHEDULED, STARTED, TERMINATED, CANCELED, ABORTED, DELETED
+ if datas.status == "CREATED"
+ "pending"
+ elsif datas.status == "SCHEDULED"
+ "pending"
+ elsif datas.status == "STARTED"
+ "processing"
+ elsif datas.status == "TERMINATED"
+ "completed"
+ elsif datas.status == "CANCELED"
+ "failed"
+ elsif datas.status == "ABORTED"
+ "failed"
+ elsif datas.status == "DELETED"
+ "failed"
end
end
- def level1?
- levels.include?( 1)
+ def format
+ datas.type
end
- def level2?
- levels.include?( 2)
+ # def filename
+ # datas.links.select{ |link| link["rel"] == "data"}.first.href.gsub( /\/.*\//, "" )
+ # end
+
+ # def filename_extension
+ # File.extname(filename) if filename
+ # end
+
+ def percentage_progress
+ if %w{created}.include? status
+ 0
+ elsif %w{ terminated canceled aborted }.include? status
+ 100
+ else
+ 20
+ end
end
- def level3?
- levels.include?( 3)
+ def referential_id
+ Referential.where(:slug => referential_name).id
+ end
+
+ def referential_name
+ datas.referential
+ end
+
+ def name
+ datas.action_parameters.name
+ end
+
+ def user_name
+ datas.action_parameters.user_name
end
- def rule_parameter_set_archived
- return nil unless parameter_set
- RuleParameterSet.new( :name => parameter_set_name).tap do |rs|
- rs.parameters = parameter_set
- end
+ def no_save
+ datas.action_parameters.no_save
end
- def rule_parameter_set
- return nil if self.rule_parameter_set_id.blank?
- RuleParameterSet.find( self.rule_parameter_set_id)
+ def created_at?
+ datas.created?
+ end
+
+ def created_at
+ Time.at(datas.created.to_i / 1000) if created_at?
end
- def chouette_command_args
- {:c => "validate", :id => id}
+ def updated_at?
+ datas.updated?
end
- def validate
- begin
- chouette_command.run! chouette_command_args
- update_attribute :status, "completed"
- rescue => e
- Rails.logger.error "Validation #{id} failed : #{e}, #{e.backtrace}"
- update_attribute :status, "failed"
- end
+ def updated_at
+ Time.at(datas.updated.to_i / 1000) if updated_at?
end
end
diff --git a/app/models/compliance_check_task_export.rb b/app/models/compliance_check_task_export.rb
index 9828cffc4..34d210db5 100644
--- a/app/models/compliance_check_task_export.rb
+++ b/app/models/compliance_check_task_export.rb
@@ -2,22 +2,24 @@ require 'tempfile'
class ComplianceCheckTaskExport
include ERB::Util
+ include ValidationResultsHelper
require 'zip'
attr_accessor :template, :detailed_errors_template, :request
attr_reader :compliance_check_task
- def initialize(compliance_check_task, request)
+ def initialize(compliance_check_task, referential_id, request)
@request = request
@compliance_check_task = compliance_check_task
+ @referential_id = referential_id
@template = File.open('app/views/compliance_check_tasks/summary_errors_index.csv.erb' ) { |f| f.read }
@detailed_errors_template = File.open('app/views/compliance_check_tasks/detailed_errors_index.csv.erb' ) { |f| f.read }
end
def export
begin
- Dir.mktmpdir("#{I18n.t('compliance_check_results.file.zip_name_prefix')}_#{@compliance_check_task.referential_id}_#{@compliance_check_task.id}_", Dir.tmpdir) { |temp_dir|
+ Dir.mktmpdir("#{I18n.t('compliance_check_results.file.zip_name_prefix')}_#{@referential_id}_#{@compliance_check_task.id}_", Dir.tmpdir) { |temp_dir|
File.open(temp_dir + "/#{I18n.t('compliance_check_results.file.summary_errors_file_prefix')}" , "a") do |f|
f.write(render)
@@ -29,7 +31,7 @@ class ComplianceCheckTaskExport
f.flush
end
- zip_file = Tempfile.new(["#{I18n.t('compliance_check_results.file.zip_name_prefix')}_#{@compliance_check_task.referential_id}_#{@compliance_check_task.id}_", ".zip"])
+ zip_file = Tempfile.new(["#{I18n.t('compliance_check_results.file.zip_name_prefix')}_#{@referential_id}_#{@compliance_check_task.id}_", ".zip"])
::Zip::File.open(zip_file.path, ::Zip::File::CREATE) do |zipfile|
Dir[File.join(temp_dir, '*.csv')].each do |f|
diff --git a/app/models/validation.rb b/app/models/validation.rb
deleted file mode 100644
index d97d854cc..000000000
--- a/app/models/validation.rb
+++ /dev/null
@@ -1,157 +0,0 @@
-class Validation
- extend Enumerize
- extend ActiveModel::Naming
- extend ActiveModel::Translation
- include ActiveModel::Model
-
- # enumerize :status, in: %w{created scheduled terminated canceled aborted}, default: "created", predicates: true
- # enumerize :format, in: %w{neptune netex gtfs}, default: "neptune", predicates: true
-
- attr_reader :datas
-
- def initialize(response)
- @datas = response
- end
-
- def report
- report_path = datas.links.select{ |link| link["rel"] == "validation_report"}.first.href
- if report_path
- response = Ievkit.get(report_path)
- ValidationReport.new(response)
- else
- raise Ievkit::IevError("Impossible to access report path link for validation")
- end
- end
-
- def import
- if datas.action == "importer"
- Import.new(Ievkit.scheduled_job(referential_name, id, { :action => "importer" }) )
- end
- end
-
- def export
- if datas.action == "exporter"
- Export.new(Ievkit.scheduled_job(referential_name, id, { :action => "exporter" }) )
- end
- end
-
- def rule_parameter_set
- rule_parameter_set = datas.links.select{ |link| link["rel"] == "validation_params"}.first.href
- if rule_parameter_set
- response = Ievkit.get(rule_parameter_set)
- rule_parameter_set = RuleParameterSet.new.tap { |rps| rps.parameters = response.validation }
- else
- raise Ievkit::Error("Impossible to access rule parameter set link for validation")
- end
- end
-
- def compliance_check
- compliance_check_path = datas.links.select{ |link| link["rel"] == "validation_report"}.first.href
- if compliance_check_path
- response = Ievkit.get(compliance_check_path)
- ComplianceCheck.new(response)
- else
- raise Ievkit::Error("Impossible to access compliance check path link for validation")
- end
- end
-
- def delete
- delete_path = datas.links.select{ |link| link["rel"] == "delete"}.first.href
- if delete_path
- Ievkit.delete(delete_path)
- else
- raise Ievkit::Error("Impossible to access delete path link for validation")
- end
- end
-
- def cancel
- cancel_path = datas.links.select{ |link| link["rel"] == "cancel"}.first.href
- if cancel_path
- Ievkit.delete(cancel_path)
- else
- raise Ievkit::Error("Impossible to access cancel path link for validation")
- end
- end
-
- def id
- datas.id
- end
-
- def status
- # pending processing completed failed
- # CREATED, SCHEDULED, STARTED, TERMINATED, CANCELED, ABORTED, DELETED
- if datas.status == "CREATED"
- "pending"
- elsif datas.status == "SCHEDULED"
- "pending"
- elsif datas.status == "STARTED"
- "processing"
- elsif datas.status == "TERMINATED"
- "completed"
- elsif datas.status == "CANCELED"
- "failed"
- elsif datas.status == "ABORTED"
- "failed"
- elsif datas.status == "DELETED"
- "failed"
- end
- end
-
- def format
- datas.type
- end
-
- # def filename
- # datas.links.select{ |link| link["rel"] == "data"}.first.href.gsub( /\/.*\//, "" )
- # end
-
- # def filename_extension
- # File.extname(filename) if filename
- # end
-
- def percentage_progress
- if %w{created}.include? status
- 0
- elsif %w{ terminated canceled aborted }.include? status
- 100
- else
- 20
- end
- end
-
- def referential_id
- Referential.where(:slug => referential_name).id
- end
-
- def referential_name
- datas.referential
- end
-
- def name
- datas.action_parameters.name
- end
-
- def user_name
- datas.action_parameters.user_name
- end
-
- def no_save
- datas.action_parameters.no_save
- end
-
- def created_at?
- datas.created?
- end
-
- def created_at
- Time.at(datas.created.to_i / 1000) if created_at?
- end
-
- def updated_at?
- datas.updated?
- end
-
- def updated_at
- Time.at(datas.updated.to_i / 1000) if updated_at?
- end
-end
diff --git a/app/models/validation_export.rb b/app/models/validation_export.rb
deleted file mode 100644
index 86ff2c477..000000000
--- a/app/models/validation_export.rb
+++ /dev/null
@@ -1,54 +0,0 @@
-require 'tempfile'
-
-class ValidationExport
- include ERB::Util
- include ValidationResultsHelper
-
- require 'zip'
-
- attr_accessor :template, :detailed_errors_template, :request
- attr_reader :validation
-
- def initialize(validation, referential_id, request)
- @request = request
- @validation = validation
- @referential_id = referential_id
- @template = File.open('app/views/validations/summary_errors_index.csv.erb' ) { |f| f.read }
- @detailed_errors_template = File.open('app/views/validations/detailed_errors_index.csv.erb' ) { |f| f.read }
- end
-
- def export
- begin
- Dir.mktmpdir("#{I18n.t('validation_results.file.zip_name_prefix')}_#{@referential_id}_#{@validation.id}_", Dir.tmpdir) { |temp_dir|
-
- File.open(temp_dir + "/#{I18n.t('validation_results.file.summary_errors_file_prefix')}" , "a") do |f|
- f.write(render)
- f.flush
- end
-
- File.open(temp_dir + "/#{I18n.t('validation_results.file.detailed_errors_file_prefix')}" , "a") do |f|
- f.write(detailed_errors_render)
- f.flush
- end
-
- zip_file = Tempfile.new(["#{I18n.t('validation_results.file.zip_name_prefix')}_#{@referential_id}_#{@validation.id}_", ".zip"])
-
- ::Zip::File.open(zip_file.path, ::Zip::File::CREATE) do |zipfile|
- Dir[File.join(temp_dir, '*.csv')].each do |f|
- zipfile.add(File.basename(f), f)
- end
- end
- return zip_file
- }
- end
- end
-
- def render()
- ERB.new(@template).result(binding)
- end
-
- def detailed_errors_render()
- ERB.new(@detailed_errors_template).result(binding)
- end
-
-end
diff --git a/app/models/validation_report.rb b/app/models/validation_report.rb
deleted file mode 100644
index 7f9b8366d..000000000
--- a/app/models/validation_report.rb
+++ /dev/null
@@ -1,64 +0,0 @@
-class ValidationReport
- extend ActiveModel::Naming
- extend ActiveModel::Translation
- include ActiveModel::Model
-
- attr_reader :datas
-
- def initialize(response)
- @datas = response[:validation_report].tests.sort_by { |hash| [ hash[:severity], hash[:result], hash[:test_id]] }
- end
-
- def ok_error
- @datas.select { |test| (test[:result] == "OK" && test[:severity] == "ERROR") }
- end
-
- def nok_error
- @datas.select { |test| (test[:result] == "NOK" && test[:severity] == "ERROR")}
- end
-
- def na_error
- @datas.select { |test| (test[:result] == "UNCHECK" && test[:severity] == "ERROR")}
- end
-
- def ok_warning
- @datas.select { |test| (test[:result] == "OK" && test[:severity] == "WARNING")}
- end
-
- def nok_warning
- @datas.select { |test| (test[:result] == "NOK" && test[:severity] == "WARNING")}
- end
-
- def na_warning
- @datas.select { |test| (test[:result] == "UNCHECK" && test[:severity] == "WARNING")}
- end
-
- def mandatory_tests
- @datas.select { |test| test[:severity] == "ERROR"}
- end
-
- def optional_tests
- @datas.select { |test| test[:severity] == "WARNING"}
- end
-
- def ok_tests
- @datas.select { |test| test[:result] == "OK"}
- end
-
- def nok_tests
- @datas.select { |test| test[:result] == "NOK"}
- end
-
- def uncheck_tests
- @datas.select { |test| test[:result] == "UNCHECK"}
- end
-
- def all(status, severity)
- @datas.select { |test| ( test[:result] == status && test[:severity] == severity ) }
- end
-
- def validation_results
- return @datas
- end
-
-end
diff --git a/app/models/validation_task.rb b/app/models/validation_task.rb
deleted file mode 100644
index aa02e386b..000000000
--- a/app/models/validation_task.rb
+++ /dev/null
@@ -1,173 +0,0 @@
-class ValidationTask < ActiveRecord::Base
- attr_accessor :resources, :rule_parameter_set_id
-
- belongs_to :referential
-
- has_one :user
- has_one :compliance_check_task, :dependent => :delete
-
- serialize :parameter_set, JSON
- serialize :result, JSON
-
- validates_presence_of :referential_id
- validates_presence_of :resources
- validates_presence_of :user_id
- validates_presence_of :user_name
- validates_inclusion_of :status, :in => %w{ pending processing completed failed }
-
- def references_types
- []
- end
-
- protected
-
- def self.option(name, type=nil)
- name = name.to_s
-
- define_method(name) do
- self.parameter_set and self.parameter_set[name]
- end
-
- if type.to_s == "boolean"
- define_method("#{name}=") do |prefix|
- (self.parameter_set ||= {})[name] = (prefix=="1" || prefix==true)
- end
- else
- define_method("#{name}=") do |prefix|
- (self.parameter_set ||= {})[name] = prefix
- end
- end
- end
-
- public
-
- def self.formats
- %w{Neptune Csv Gtfs Netex}
- end
-
- def self.format_label(format)
- I18n.t 'exchange.format.'+format.downcase
- end
-
- def delayed_validation
- delay.validation
- end
-
- def save_requested?
- !parameter_set["no_save"]
- end
-
- protected
-
- option :no_save, :boolean
- option :format
- option :file_path
- option :references_type
-
- validates_inclusion_of :no_save, :in => [ true, false]
- validates_inclusion_of :format, :in => self.formats
-
- def chouette_command
- Chouette::Command.new(:schema => referential.slug)
- end
-
- before_validation :define_default_attributes, :on => :create
- def define_default_attributes
- self.status ||= "pending"
- end
-
- @@root = "#{Rails.root}/tmp/validations"
- cattr_accessor :root
-
- def compliance_check_task_attributes
- {:referential_id => referential.id,
- :user_id => user_id,
- :user_name => user_name,
- :rule_parameter_set_id => rule_parameter_set_id}
- end
-
- after_create :update_info, :save_resources
- def update_info
- self.file_path = saved_resources
- self.update_attribute :parameter_set, self.parameter_set
-
- self.create_compliance_check_task( self.compliance_check_task_attributes)
- end
-
- def save_resources
- # resources is a required attribute
- FileUtils.mkdir_p root
- FileUtils.cp resources.path, saved_resources
- end
-
- after_destroy :destroy_resources
- def destroy_resources
- FileUtils.rm file_path if File.exists? file_path
- end
-
- def saved_resources
- raise Exception.new("Illegal call") if self.new_record?
- "#{root}/#{id}#{File.extname(resources.original_filename)}"
- end
-
- def chouette_command_args
- {:c => "validation", :id => id}
- end
-
- public
-
- def failed?
- status == "failed"
- end
-
- def completed?
- status == "completed"
- end
-
- def file_path_extension
- extension = File.extname( self.file_path )
- if extension == ".xml"
- "xml"
- elsif extension == ".zip"
- "zip"
- else
- "basic"
- end
- end
-
- def name
- "#{ValidationTask.model_name.human} #{self.format} #{self.id}"
- end
-
- def full_name
- return name unless no_save
- "#{name} - #{I18n.t('activerecord.attributes.validation_task.no_save')}"
- end
-
- # Create ValidationTask and ComplianceCheckTask associated and give validation id to Chouette Loader
- def validation
- return nil if self.new_record?
-
- begin
- chouette_command.run! chouette_command_args
- reload
- update_attribute :status, "completed"
- compliance_check_task.update_attribute :status, "completed"
- rescue => e
- Rails.logger.error "Validation #{id} failed : #{e}, #{e.backtrace}"
- reload
- update_attribute :status, "failed"
- compliance_check_task.update_attribute :status, "failed"
- end
- end
-
- def self.new(attributes = {}, parameter_set = {}, &block)
- if self == ValidationTask
- attributes[:format] = "Neptune" unless attributes[:format]
- Object.const_get( attributes[:format] + "Validation").new(attributes, parameter_set)
- else
- super
- end
- end
-
-end
diff --git a/app/models/validation_type.rb b/app/models/validation_type.rb
deleted file mode 100644
index 35660beec..000000000
--- a/app/models/validation_type.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-class ValidationType < ActiveEnum::Base
- value :id => 'Neptune', :name => 'Neptune'
- value :id => 'Csv', :name => 'Csv'
- value :id => 'Gtfs', :name => 'GTFS'
- value :id => 'Netex', :name => 'NeTEx'
- value :id => 'Hub', :name => 'Hub'
-end
diff --git a/app/views/compliance_check_results/index.html.erb b/app/views/compliance_check_results/index.html.erb
index da139fc93..dd28a531b 100644
--- a/app/views/compliance_check_results/index.html.erb
+++ b/app/views/compliance_check_results/index.html.erb
@@ -5,7 +5,7 @@
<th><%= ComplianceCheckResult.human_attribute_name(:status) %></th>
<th><%= ComplianceCheckResult.human_attribute_name(:severity) %></th>
<th><%= ComplianceCheckResult.human_attribute_name(:rule_code) %></th>
- <% if @compliance_check_results && @compliance_check_results.first.status == "nok" %>
+ <% if @compliance_check_results && @compliance_check_results.first.result == "NOK" %>
<th><%= ComplianceCheckResult.human_attribute_name(:detail) %></th>
<% end %>
</tr>
@@ -14,32 +14,37 @@
<% @compliance_check_results.each_with_index do |compliance_check_result, index| %>
<tr>
<td><%= index + 1 %></td>
- <td><%= status_icon( compliance_check_result.status, compliance_check_result.severity ) %> </td>
- <td><%= t compliance_check_result.severity, :scope => "compliance_check_result.severities" %></td>
+ <td><%= status_icon( compliance_check_result.result, compliance_check_result.severity ) %> </td>
+ <td><%= t("compliance_check_result.severities." + compliance_check_result.severity.downcase + "_txt") %></td>
<td>
- <button data-content='<%= ComplianceCheckResult.human_attribute_name(compliance_check_result.rule_code) %>' data-title='<%= t("activerecord.attributes.compliance_check_result.title") %>' rel="popover" data-toggle="popover" class="notice btn btn-info btn-xs" ><i class="fa fa-info"></i></button>
- <%= link_to compliance_check_result.rule_code, test_definition(compliance_check_result.rule_code), :title => ComplianceCheckResult.human_attribute_name(compliance_check_result.rule_code), :target => "validation" %></td>
- <% if @compliance_check_results && @compliance_check_results.first.status == "nok" %>
+ <% data_content = t ( "activemodel.attributes.compliance_check_result." + compliance_check_result.test_id ) %>
+ <% data_title = t ( "activemodel.attributes.compliance_check_result.title" ) %>
+ <button data-content='<%= data_content %>' data-title='<%= data_title %>' rel="popover" data-toggle="popover" class="notice btn btn-info btn-xs" ><i class="fa fa-info"></i></button>
+ <%= link_to compliance_check_result.test_id, test_definition(compliance_check_result.test_id), :title => ComplianceCheckResult.human_attribute_name(compliance_check_result.test_id), :target => "compliance_check_task" %></td>
+ <% if @compliance_check_results && @compliance_check_results.first.result == "NOK" %>
<td class="td_error">
- <% if compliance_check_result.detail.present? %>
+ <% if compliance_check_result.errors.present? %>
<span class="title_error">
- <i class="fa fa-plus-square"></i><%= compliance_check_result.violation_count.to_s + " " + ComplianceCheckResult.human_attribute_name(:violation_count) %>
+ <i class="fa fa-plus-square"></i><%= compliance_check_result.error_count.to_s + " " + ComplianceCheckResult.human_attribute_name(:violation_count) %>
</span>
<div class="details_error">
- <% compliance_check_result.detail["detail"].first(10).each do |error| %>
+ <% compliance_check_result.errors.first(10).each do |error| %>
<p class="detail_error">
- <% if error["messageArgs"] %>
- |- <button data-content='<%= ComplianceCheckResult.human_attribute_name(compliance_check_result.rule_code) + t("compliance_check_result.details." + error["messageKey"], error["messageArgs"].symbolize_keys ) %>' data-title='<%= t("activerecord.attributes.compliance_check_result.detail") %>' data-toggle="popover" class="notice btn btn-info btn-xs"><i class="fa fa-info"></i></button>
- <% else %>
- |- <button data-content='<%= ComplianceCheckResult.human_attribute_name(compliance_check_result.rule_code) + t("compliance_check_result.details." + error["messageKey"] ) %>' data-title='<%= t("activerecord.attributes.compliance_check_result.detail") %>' data-toggle="popover" class="notice btn btn-info btn-xs"><i class="fa fa-info"></i></button>
- <% end %>
- <% if error["location"]["url"].present? %>
- <%= link_to error["objectId"], referential_path(@referential) + "/" + error["location"]["url"] %>
- <% elsif error["location"]["filename"].present? %>
- <%= error["objectId"] %><br>
- <span class="file_error"> <%= File.basename(error["location"]["filename"]) %>
- <%= t("compliance_check_results.index.column") %>: <%= error["location"]["columnNumber"] %>, <%= t("compliance_check_results.index.line") %>: <%= error["location"]["lineNumber"] %></span>
- <% end %>
+ <% if error["source"].present? %>
+ <% if error["source"].objectid.present? %>
+ <% data_content_1 = t("activemodel.attributes.compliance_check_result." + compliance_check_result.test_id) + ". " +
+ t("compliance_check_result.details.detail_" + error[:error_id], object_labels_hash(error) ) %>
+ <% data_title_1 = t("activemodel.attributes.compliance_check_result.detail") %>
+ |- <button data-content='<%= data_content_1 %>' data-title='<%= data_title_1 %>' data-toggle="popover" class="notice btn btn-info btn-xs"><i class="fa fa-info"></i></button>
+ <% else %>
+ <% data_content_2 = ValidationReport.human_attribute_name(validation_result.test_id) + t("validation_result.details." + error[:error_id] ) %>
+ <% data_title_2 = t("activemodel.attributes.validation_result.detail") %>
+ |- <button data-content='<%= data_content_2 %>' data-title='<%= data_title_2 %>' data-toggle="popover" class="notice btn btn-info btn-xs"><i class="fa fa-info"></i></button>
+ <% end %>
+ <% if error[:source].object_path.present? %>
+ <%= link_to error[:source].label, object_url(@referential.id, error) %>
+ <% end %>
+ <% end %>
</p>
<% end %>
</div>
@@ -50,5 +55,5 @@
<% end %>
</tbody>
</table>
-<%= javascript_include_tag referential_compliance_check_task_compliance_check_results_path(@compliance_check_task.referential, @compliance_check_task, :format => :js) %>
+<%= javascript_include_tag referential_compliance_check_task_compliance_check_results_path(@referential, @compliance_check_task.id, :format => :js) %>
diff --git a/app/views/compliance_check_tasks/_compliance_check_task.html.erb b/app/views/compliance_check_tasks/_compliance_check_task.html.erb
index 40a265731..4a7278b11 100644
--- a/app/views/compliance_check_tasks/_compliance_check_task.html.erb
+++ b/app/views/compliance_check_tasks/_compliance_check_task.html.erb
@@ -1,13 +1,16 @@
<div id="index_item" class="panel panel-default">
<div class="panel-heading">
<div class="panel-title clearfix">
- <span class="pull-right">
- <%= link_to referential_compliance_check_task_path(@referential, compliance_check_task), :method => :delete, :data => {:confirm => t('compliance_check_tasks.actions.destroy_confirm')}, :class => "btn btn-danger btn-sm" do %>
+ <span class="pull-right">
+ <% location = compliance_check_task.datas.links.select { |link| link["rel"] == "location" } %>
+ <% location = location.first if location %>
+ <% location = location.href if location %>
+ <%= link_to "#{location}", :method => :delete, :data => {:confirm => t('compliance_check_tasks.actions.destroy_confirm')}, :class => "btn btn-danger btn-sm" do %>
<span class="fa fa-trash-o"></span>
<% end %>
</span>
<h5>
- <%= link_to( referential_compliance_check_task_path(@referential, compliance_check_task), :class => "preview", :title => "#{ComplianceCheckTask.model_name.human.capitalize} #{compliance_check_task.name}") do %>
+ <%= link_to( referential_compliance_check_task_path(@referential, compliance_check_task.id), :class => "preview", :title => "#{ComplianceCheckTask.model_name.human.capitalize} #{compliance_check_task.name}") do %>
<span class="name">
<%= truncate(compliance_check_task.name, :length => 20) %>
</span>
@@ -19,8 +22,8 @@
<% if compliance_check_task.import_task.present? %>
<p><%= link_to( image_tag('icons/link_page.png') + t("compliance_check_tasks.import_task"), referential_import_task_path(@referential, compliance_check_task.import_task)) %></p>
<% end %>
- <% if compliance_check_task.parameter_set %>
- <p><%= link_to( image_tag('icons/link_page.png') + t("compliance_check_tasks.actions.rule_parameter_set"), rule_parameter_set_referential_compliance_check_task_path(@referential, compliance_check_task)) %></p>
+ <% if compliance_check_task.rule_parameter_set %>
+ <p><%= link_to( image_tag('icons/link_page.png') + t("compliance_check_tasks.actions.rule_parameter_set"), rule_parameter_set_referential_compliance_check_task_path(@referential, compliance_check_task.id)) %></p>
<% end %>
</div>
<div class="panel-footer">
diff --git a/app/views/compliance_check_tasks/_compliance_check_tasks.html.erb b/app/views/compliance_check_tasks/_compliance_check_tasks.html.erb
index 9cb805b90..33c08ffe7 100644
--- a/app/views/compliance_check_tasks/_compliance_check_tasks.html.erb
+++ b/app/views/compliance_check_tasks/_compliance_check_tasks.html.erb
@@ -2,7 +2,7 @@
<span class="search"> <%= t("will_paginate.page_entries_info.search") %></span> <%= page_entries_info @compliance_check_tasks %>
</div>
<div class="compliance_check_tasks paginated_content">
- <%= paginated_content @compliance_check_tasks %>
+ <%= paginated_content @compliance_check_tasks, "compliance_check_tasks/compliance_check_task" %>
</div>
<div class="pagination">
<%= will_paginate @compliance_check_tasks, :container => false, renderer: RemoteBootstrapPaginationLinkRenderer %>
diff --git a/app/views/compliance_check_tasks/detailed_errors_index.csv.erb b/app/views/compliance_check_tasks/detailed_errors_index.csv.erb
index 3e526e29e..f5748ffc6 100644
--- a/app/views/compliance_check_tasks/detailed_errors_index.csv.erb
+++ b/app/views/compliance_check_tasks/detailed_errors_index.csv.erb
@@ -1,2 +1,2 @@
-<%= ComplianceCheckResult.human_attribute_name(:severity) %>;<%= ComplianceCheckResult.human_attribute_name(:rule_code) %>;<%= ComplianceCheckResult.human_attribute_name(:object) %>;<%= ComplianceCheckResult.human_attribute_name(:resource) %>;<%= ComplianceCheckResult.human_attribute_name(:title) %>;<%= ComplianceCheckResult.human_attribute_name(:detail) %>
-<% @compliance_check_task.compliance_check_results.each do |r| %><% if r.detail.present? %><% r.detail["detail"].first(10).each do |error| %><% case r.severity %><% when "warning" %><%= I18n.t "compliance_check_result.severities.warning_txt" %><% when "error" %><%= I18n.t "compliance_check_result.severities.error_txt" %><% end %>;<%= r.rule_code %>;<% if error["messageArgs"] %><%= error["messageArgs"]["objectId"] %><% end %>;<% if error["location"]["url"].present? %><%= "http://#{request.host}:#{request.port}#{request.fullpath.sub(/(compliance_check_tasks.*)/, '')}" + error["location"]["url"] %><% elsif error["location"]["filename"].present? %><%= error["objectId"] + " - " %><%= File.basename(error["location"]["filename"]) +" - " %><%= I18n.t "compliance_check_results.index.column" %>: <%= error["location"]["columnNumber"] %>,<%= I18n.t "compliance_check_results.index.line" %>: <%= error["location"]["lineNumber"] %><% end %>;<%= ComplianceCheckResult.human_attribute_name(r.rule_code) %>;<% if error["messageArgs"] %><%= I18n.t("compliance_check_result.details." + error["messageKey"], error["messageArgs"].symbolize_keys ) %><% else %><%= I18n.t("compliance_check_result.details." + error["messageKey"] ) %><% end %><%= "\n" %><% end %><% end %><% end %> \ No newline at end of file
+<%= I18n.t("activemodel.attributes.compliance_check_result.severity") %>;<%= I18n.t("activemodel.attributes.compliance_check_result.rule_code") %>;<%= I18n.t("activemodel.attributes.compliance_check_result.object") %>;<%= I18n.t("activemodel.attributes.compliance_check_result.resource") %>;<%= I18n.t("activemodel.attributes.compliance_check_result.title") %>;<%= I18n.t("activemodel.attributes.compliance_check_result.detail") %>
+<% @compliance_check_task.compliance_check_result.results.each do |r| %><% if r.errors.present? %><% r.errors.first(10).each do |error| %><% case r.severity %><% when "WARNING" %><%= I18n.t "compliance_check_result.severities.warning_txt" %><% when "ERROR" %><%= I18n.t "compliance_check_result.severities.error_txt" %><% end %>;<%= r.test_id %>;<% if error["source"].present? %><%= error["source"]["objectid"] if error["source"]["objectid"].present? %>;<% if error["source"]["object_path"].present? %><%= object_url(@referential_id, error) %><% elsif error["source"]["file"].present? %><%= File.basename(error["source"]["file"]["filename"]) +" - " %><%= I18n.t "compliance_check_results.index.column" %>:<%= error["source"]["file"]["column_number"] %>,<%= I18n.t "compliance_check_results.index.line" %>:<%= error["source"]["file"]["line_number"] %><% end %>;<% else %>;;<% end %><%= I18n.t("activemodel.attributes.compliance_check_result."+r.test_id) %>;<%= I18n.t("compliance_check_result.details.detail_" + error["error_id"], object_labels_hash(error) )%><%= "\n" %><% end %><% end %><% end %> \ No newline at end of file
diff --git a/app/views/compliance_check_tasks/show.html.erb b/app/views/compliance_check_tasks/show.html.erb
index a59844378..7d786f1b1 100644
--- a/app/views/compliance_check_tasks/show.html.erb
+++ b/app/views/compliance_check_tasks/show.html.erb
@@ -4,17 +4,17 @@
<div class="compliance_check_task_show">
<div class="links">
<% if @compliance_check_task.import_task %>
- <%= link_to image_tag('icons/link_page.png') + t("compliance_check_tasks.import_task"), referential_import_task_path(@compliance_check_task.referential, @compliance_check_task.import_task) %>
+ <%= link_to image_tag('icons/link_page.png') + t("compliance_check_tasks.import_task"), referential_import_task_path(@referential, @compliance_check_task.import_task) %>
<% end %>
- <% if @compliance_check_task.rule_parameter_set_archived %>
- <%= link_to image_tag('icons/link_page.png') + t("compliance_check_tasks.rule_parameter_set"), rule_parameter_set_referential_compliance_check_task_path(@compliance_check_task.referential, @compliance_check_task) %>
+ <% if @compliance_check_task.rule_parameter_set %>
+ <%= link_to image_tag('icons/link_page.png') + t("compliance_check_tasks.rule_parameter_set"), rule_parameter_set_referential_compliance_check_task_path(@referential, @compliance_check_task.id) %>
<% end %>
<div class="btn-group pull-right">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<%= t(".export") %> <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
- <li><%= link_to t(".export_csv"), export_referential_compliance_check_task_path(@compliance_check_task.referential, @compliance_check_task) %></li>
+ <li><%= link_to t(".export_csv"), export_referential_compliance_check_task_path(@referential, @compliance_check_task.id) %></li>
</ul>
</div>
</div>
@@ -35,11 +35,11 @@
<div class="report"></div>
<% end %>
- <%= javascript_include_tag referential_compliance_check_task_path(@compliance_check_task.referential, @compliance_check_task,:format => :js) %>
+ <%= javascript_include_tag referential_compliance_check_task_path(@referential, @compliance_check_task.id,:format => :js) %>
</div>
<% content_for :sidebar do %>
<ul class="actions">
- <li><%= link_to t('compliance_check_tasks.actions.destroy'), referential_compliance_check_task_path(@referential, @compliance_check_task), :method => :delete, :data => {:confirm => t('compliance_check_tasks.actions.destroy_confirm')}, :class => "remove" %></li>
+ <li><%= link_to t('compliance_check_tasks.actions.destroy'), referential_compliance_check_task_path(@referential, @compliance_check_task.id), :method => :delete, :data => {:confirm => t('compliance_check_tasks.actions.destroy_confirm')}, :class => "remove" %></li>
</ul>
<%= history_tag(@compliance_check_task) %>
diff --git a/app/views/compliance_check_tasks/show.js.coffee b/app/views/compliance_check_tasks/show.js.coffee
index ae9daa6d8..88d1faf55 100644
--- a/app/views/compliance_check_tasks/show.js.coffee
+++ b/app/views/compliance_check_tasks/show.js.coffee
@@ -16,37 +16,37 @@ jQuery ->
Morris.Donut({
element: 'error',
data: [
- {label: "<%= t 'nok', :scope => 'compliance_check_result.statuses' %>", value: <%= @compliance_check_task.compliance_check_results.nok.error.count %>},
- {label: "<%= t 'na', :scope => 'compliance_check_result.statuses' %>", value: <%= @compliance_check_task.compliance_check_results.na.error.count %>},
- {label: "<%= t 'ok', :scope => 'compliance_check_result.statuses' %>", value: <%= @compliance_check_task.compliance_check_results.ok.error.count %>}
+ {label: "<%= t 'nok', :scope => 'compliance_check_result.statuses' %>", value: <%= @compliance_check_task.compliance_check_result.nok_error.count %>},
+ {label: "<%= t 'na', :scope => 'compliance_check_result.statuses' %>", value: <%= @compliance_check_task.compliance_check_result.na_error.count %>},
+ {label: "<%= t 'ok', :scope => 'compliance_check_result.statuses' %>", value: <%= @compliance_check_task.compliance_check_result.ok_error.count %>}
]
colors: [ "#e22b1b", "#898e7f", "#8fc861" ]
}).on('click', update = (i, row) ->
switch i
- when 0 then get_compliance_check_results( $(".report"), "nok", "error")
- when 1 then get_compliance_check_results( $(".report"), "na", "error")
- when 2 then get_compliance_check_results( $(".report"), "ok", "error")
+ when 0 then get_compliance_check_results( $(".report"), "NOK", "ERROR")
+ when 1 then get_compliance_check_results( $(".report"), "UNCHECK", "ERROR")
+ when 2 then get_compliance_check_results( $(".report"), "OK", "ERROR")
else console.log "Error no other value for donut chart")
Morris.Donut({
element: 'warning',
data: [
- {label: "<%= t 'nok', :scope => 'compliance_check_result.statuses' %>", value: <%= @compliance_check_task.compliance_check_results.nok.warning.count %>},
- {label: "<%= t 'na', :scope => 'compliance_check_result.statuses' %>", value: <%= @compliance_check_task.compliance_check_results.na.warning.count %>},
- {label: "<%= t 'ok', :scope => 'compliance_check_result.statuses' %>", value: <%= @compliance_check_task.compliance_check_results.ok.warning.count %>}
+ {label: "<%= t 'nok', :scope => 'compliance_check_result.statuses' %>", value: <%= @compliance_check_task.compliance_check_result.nok_warning.count %>},
+ {label: "<%= t 'na', :scope => 'compliance_check_result.statuses' %>", value: <%= @compliance_check_task.compliance_check_result.na_warning.count %>},
+ {label: "<%= t 'ok', :scope => 'compliance_check_result.statuses' %>", value: <%= @compliance_check_task.compliance_check_result.ok_warning.count %>}
]
colors: [ "#ffbd2b", "#898e7f", "#8fc861" ]
}).on('click', update = (i, row) ->
switch i
- when 0 then get_compliance_check_results( $(".report"), "nok", "warning")
- when 1 then get_compliance_check_results( $(".report"), "na", "warning")
- when 2 then get_compliance_check_results( $(".report"), "ok", "warning")
+ when 0 then get_compliance_check_results( $(".report"), "NOK", "WARNING")
+ when 1 then get_compliance_check_results( $(".report"), "UNCHECK", "WARNING")
+ when 2 then get_compliance_check_results( $(".report"), "OK", "WARNING")
else console.log "Error no other value for donut chart")
$(".resume .col1 .caption").click ->
- get_compliance_check_results( $(".report"), null, "error")
+ get_compliance_check_results( $(".report"), null, "ERROR")
$(".resume .col2 .caption").click ->
- get_compliance_check_results( $(".report"), null, "warning")
+ get_compliance_check_results( $(".report"), null, "WARNING")
diff --git a/app/views/compliance_check_tasks/summary_errors_index.csv.erb b/app/views/compliance_check_tasks/summary_errors_index.csv.erb
index 354a3a620..451be4276 100644
--- a/app/views/compliance_check_tasks/summary_errors_index.csv.erb
+++ b/app/views/compliance_check_tasks/summary_errors_index.csv.erb
@@ -1,3 +1,3 @@
-<%= ComplianceCheckResult.human_attribute_name(:severity) %>;<%= ComplianceCheckResult.human_attribute_name(:status) %>;<%= ComplianceCheckResult.human_attribute_name(:rule_code) %>;<%= ComplianceCheckResult.human_attribute_name(:title) %>;<%= ComplianceCheckResult.human_attribute_name(:url) %>;<%= ComplianceCheckResult.human_attribute_name(:violation_count_txt) %>;<%= ComplianceCheckResult.human_attribute_name(:objects) %>
-<% @compliance_check_task.compliance_check_results.each do |r| %><% case r.severity %><% when "warning" %><%= I18n.t "compliance_check_result.severities.warning_txt" %><% when "error" %><%= I18n.t "compliance_check_result.severities.error_txt" %><% end %>;<%= r.status %>;<%= r.rule_code %>;<%= ComplianceCheckResult.human_attribute_name(r.rule_code) %>;<%= Rails.application.config.validation_spec + I18n.locale.to_s + "/" + r.rule_code + ".html" %>;<%= r.violation_count %><% if r.violation_count > 0 %><% if r.detail.present? %>;<% r.detail["detail"].first(10).each do |error| %><% if error["messageArgs"] %><%= error["messageArgs"]["objectId"] + " " %><% else %><%= " " %><% end %><% end %><% end %><% end %>
+<%= I18n.t("activemodel.attributes.compliance_check_result.severity") %>;<%= I18n.t("activemodel.attributes.compliance_check_result.status") %>;<%= I18n.t("activemodel.attributes.compliance_check_result.rule_code") %>;<%= I18n.t("activemodel.attributes.compliance_check_result.title") %>;<%= I18n.t("activemodel.attributes.compliance_check_result.url") %>;<%= I18n.t("activemodel.attributes.compliance_check_result.violation_count_txt") %>;<%= I18n.t("activemodel.attributes.compliance_check_result.objects") %>
+<% @compliance_check_task.compliance_check_result.results.each do |r| %><% case r.severity %><% when "WARNING" %><%= I18n.t "compliance_check_result.severities.warning_txt" %><% when "ERROR" %><%= I18n.t "compliance_check_result.severities.error_txt" %><% end %>;<%= r.result %>;<%= r.test_id %>;<%= I18n.t("activemodel.attributes.compliance_check_result."+r.test_id) %>;<%= Rails.application.config.validation_spec + I18n.locale.to_s + "/" + r.test_id + ".html" %>;<%= r.error_count %><% if r.error_count > 0 %><% if r.errors.present? %>;<% r.errors.first(10).each do |error| %><% if error["source"] %><%= error["source"]["objectid"] + " " %><% else %><%= " " %><% end %><% end %><% end %><% end %>
<% end %> \ No newline at end of file
diff --git a/app/views/shared/_header.erb b/app/views/shared/_header.erb
index 1d8b3ca66..cd43eb528 100644
--- a/app/views/shared/_header.erb
+++ b/app/views/shared/_header.erb
@@ -69,7 +69,7 @@
</li>
<li><%= link_to Referential.human_attribute_name("imports"), referential_imports_path(@referential) %></li>
<li><%= link_to Referential.human_attribute_name("export_tasks"), referential_exports_path(@referential) %></li>
- <li><%= link_to Referential.human_attribute_name("validations"), referential_validations_path(@referential) %></li>
+ <li><%= link_to Referential.human_attribute_name("validations"), referential_compliance_check_tasks_path(@referential) %></li>
<% end %>
</ul>
<ul class="nav navbar-nav navbar-right">
diff --git a/app/views/validation_results/_validation_result.erb b/app/views/validation_results/_validation_result.erb
deleted file mode 100644
index 43baf0a0e..000000000
--- a/app/views/validation_results/_validation_result.erb
+++ /dev/null
@@ -1,21 +0,0 @@
- <div class="severity_<%= validation_result.severity %> status_<%= validation_result.status %>">
- <div class="status_icon">
- <%= image_tag "icons/status_#{validation_result.status}.png", :class => "status" %>
- </div>
- <div class="status_text">
- <div class="code">
- <%= validation_result.rule_code %>
- </div>
- <div class="severity">
- [ <%= ValidationReport.human_attribute_name(:severity) %> : <%= t validation_result.severity, :scope => "validation_result.severities" %> ]
- </div>
- <div class="explanation">
- <%= ValidationReport.human_attribute_name(validation_result.rule_code) %>
- </div>
- <div class="attributes">
- <% if validation_result.violation_count > 0 %>
- <%= ValidationReport.human_attribute_name(:violation_count) %> :
- <% end %>
- </div>
- </div>
-</div>
diff --git a/app/views/validation_results/index.html.erb b/app/views/validation_results/index.html.erb
deleted file mode 100644
index c93f8f2bd..000000000
--- a/app/views/validation_results/index.html.erb
+++ /dev/null
@@ -1,75 +0,0 @@
-<table class="table table-hover">
- <thead>
- <tr>
- <th>#</th>
- <th><%= t("activemodel.attributes.validation_result.status") %></th>
- <th><%= t("activemodel.attributes.validation_result.severity") %></th>
- <th><%= t("activemodel.attributes.validation_result.rule_code") %></th>
- <% if @validation_results && @validation_results.first.result == "NOK" %>
- <th><%= t("activemodel.attributes.validation_result.detail") %></th>
- <% end %>
- </tr>
- </thead>
- <tbody>
- <% @validation_results.each_with_index do |validation_result, index| %>
- <tr>
- <td><%= index + 1 %></td>
- <td><%= status_icon( validation_result.result, validation_result.severity ) %> </td>
- <td><%= t("validation_result.severities." + validation_result.severity.downcase + "_txt") %></td>
- <td>
- <% data_content = t ( "activemodel.attributes.validation_result." + validation_result.test_id ) %>
- <% data_title = t ( "activemodel.attributes.validation_result.title" ) %>
- <button data-content='<%= data_content %>' data-title='<%= data_title %>' rel="popover" data-toggle="popover" class="notice btn btn-info btn-xs" >
- <i class="fa fa-info"></i>
- </button>
- <%= link_to validation_result.test_id, test_definition(validation_result.test_id), :title => ValidationReport.human_attribute_name(validation_result.test_id), :target => "validation" %>
- </td>
- <% if @validation_results && @validation_results.first.result == "NOK" %>
- <td class="td_error">
- <% if validation_result.errors.present? %>
- <span class="title_error">
- <i class="fa fa-plus-square"></i>
- <%= validation_result.error_count.to_s + " " + ValidationReport.human_attribute_name("validation_result.violation_count") %>
- </span>
- <div class="details_error">
- <% validation_result.errors.first(10).each do |error| %>
- <p class="detail_error">
- <% if error[:source].objectid %>
- <!-- % data_content_1 = ValidationReport.human_attribute_name(validation_result.test_id) + t("validation_result.details." + error[:error_id]) % --> <!--, error[:source].objectid ) % -->
- <% data_content_1 = t("activemodel.attributes.validation_result." + validation_result.test_id) + ". " +
- t("validation_result.details.detail_" + error[:error_id], object_labels_hash(error) ) %>
- <% data_title_1 = t("activemodel.attributes.validation_result.detail") %>
- |- <button data-content='<%= data_content_1 %>' data-title='<%= data_title_1 %>' data-toggle="popover" class="notice btn btn-info btn-xs"><i class="fa fa-info"></i></button>
- <% else %>
- <!-- % data_content_2 = ValidationReport.human_attribute_name(validation_result.test_id) + t("validation_result.detailss." + error[:error_id] ) % -->
- <% data_content_2 = ValidationReport.human_attribute_name(validation_result.test_id) + t("validation_result.details." + error[:error_id] ) %>
- <% data_title_2 = t("activemodel.attributes.validation_result.detail") %>
- |- <button data-content='<%= data_content_2 %>' data-title='<%= data_title_2 %>' data-toggle="popover" class="notice btn btn-info btn-xs"><i class="fa fa-info"></i></button>
- <% end %>
- <% if error[:source].object_path.present? %>
- <%= link_to error[:source].label, object_url(@referential.id, error) %>
- <% end %>
- <!-- %= link_to error["objectId"], referential_path(@referential) + "/" + error["location"]["url"] % -->
- <!-- % elsif error["location"]["filename"].present? % -->
- <!-- %= error["objectId"] % --><br>
- <span class="file_error">
- <%= error[:source].objectid %>
- <!-- %= File.basename(error["location"]["filename"]) % -->
- <!-- %= t("validation_results.index.column") % -->:
- <!-- %= error["location"]["columnNumber"] % -->,
- <!-- %= t("validation_results.index.line") % -->:
- <!-- %= error["location"]["lineNumber"] % -->
- </span>
- <!-- % end % -->
- </p>
- <% end %>
- </div>
- <% end %>
- </td>
- <% end %>
- </tr>
- <% end %>
- </tbody>
-</table>
-<%= javascript_include_tag referential_validation_validation_results_path(@referential, @validation.id, :format => :js) %>
-
diff --git a/app/views/validation_results/index.js.coffee b/app/views/validation_results/index.js.coffee
deleted file mode 100644
index 10821a031..000000000
--- a/app/views/validation_results/index.js.coffee
+++ /dev/null
@@ -1,8 +0,0 @@
-jQuery ->
- $(".notice").popover({ container: "body", html: false, trigger: "focus", placement: "bottom" })
-
- # Hide and show error details
- $(".title_error").each ->
- $( this ).click ->
- $(this).next(".details_error").toggle()
- $(this).children("i").toggleClass("fa-plus-square fa-minus-square") \ No newline at end of file
diff --git a/app/views/validations/_results_dashboard.html.erb b/app/views/validations/_results_dashboard.html.erb
deleted file mode 100644
index 30015df7c..000000000
--- a/app/views/validations/_results_dashboard.html.erb
+++ /dev/null
@@ -1,35 +0,0 @@
-<div class="resume row">
- <div class="col-md-4">
- <!-- % file_title = (@validation.filename_extension==".zip") ? t("validations.show.graph.files.title_zip") : t("validations.show.graph.files.title_default", :extension => @validation.filename_extension)% -->
- <div class="caption"><!-- %= file_title % --></div>
- <div id="files_statistics"></div>
- </div>
- <div class="col-md-8">
- <div class="caption"><%= t "validations.show.graph.lines.title" %></div>
- <div id="objects_statistics"></div>
- </div>
-</div>
-
-<div class="report">
- <div class="lines">
- <table class="table table-hover table-striped">
- <thead>
- <tr>
- <th><%= t("validation_tasks.show.table.line.name") %></th>
- <th><%= t("validation_tasks.show.table.line.save") %></th>
- </tr>
- </thead>
- <tbody>
- <% @validation.report.line_items.each_with_index do |line_item, index| %>
- <% tr_class = (line_item.status == "saved") ? '' : 'class=\'danger\''%>
- <tr <%= tr_class %>>
- <td><%= line_item.name %></td>
- <td><%= t("validation_tasks.show.table.line." + line_item.status ) %></td>
- </tr>
- <% end %>
- </tbody>
- </table>
- </div>
-</div>
-<%= javascript_include_tag referential_validation_path(@referential, @validation.id,:format => :js) %>
-
diff --git a/app/views/validations/_validation.erb b/app/views/validations/_validation.erb
deleted file mode 100644
index 85e1b3101..000000000
--- a/app/views/validations/_validation.erb
+++ /dev/null
@@ -1,29 +0,0 @@
-<div id="index_item" class="panel panel-default">
- <div class="panel-heading">
- <div class="panel-title clearfix">
- <span class="pull-right">
- <% location = validation.datas.links.select { |link| link["rel"] == "location" } %>
- <% location = location.first if location %>
- <% location = location.href if location %>
- <%= link_to "#{location}", :method => :delete, :data => {:confirm => t('validation_tasks.actions.destroy_confirm')}, :class => "btn btn-danger btn-sm" do %>
- <span class="fa fa-trash-o"></span>
- <% end %>
- </span>
- <h5>
- <%= link_to( referential_validation_path(@referential, validation.id), :class => "preview", :title => "#{ValidationTask.model_name.human.capitalize} #{validation.name}") do %>
- <span class="name">
- <% if !validation.no_save %><i class="fa fa-save"></i><% end %> <%= truncate(validation.name, :length => 20) %>
- </span>
- <% end %>
- </h5>
- </div>
- </div>
- <div class="panel-body">
- </div>
- <div class="panel-footer">
- <%= validation_progress_bar_tag(validation) %>
- <div class="history">
- <%= validation.created_at %> | <%= validation.user_name %>
- </div>
- </div>
-</div>
diff --git a/app/views/validations/_validations.html.erb b/app/views/validations/_validations.html.erb
deleted file mode 100644
index 9490519a0..000000000
--- a/app/views/validations/_validations.html.erb
+++ /dev/null
@@ -1,9 +0,0 @@
-<div class="page_info">
- <span class="search"> <%= t("will_paginate.page_entries_info.search") %></span> <%= page_entries_info @validations %>
-</div>
-<div class="validations paginated_content">
- <%= paginated_content @validations, "validations/validation" %>
-</div>
-<div class="pagination">
- <%= will_paginate @validations, :container => false, renderer: RemoteBootstrapPaginationLinkRenderer %>
-</div>
diff --git a/app/views/validations/detailed_errors_index.csv.erb b/app/views/validations/detailed_errors_index.csv.erb
deleted file mode 100644
index 3c727f9a4..000000000
--- a/app/views/validations/detailed_errors_index.csv.erb
+++ /dev/null
@@ -1,2 +0,0 @@
-<%= I18n.t("activemodel.attributes.validation_result.severity") %>;<%= I18n.t("activemodel.attributes.validation_result.rule_code") %>;<%= I18n.t("activemodel.attributes.validation_result.object") %>;<%= I18n.t("activemodel.attributes.validation_result.resource") %>;<%= I18n.t("activemodel.attributes.validation_result.title") %>;<%= I18n.t("activemodel.attributes.validation_result.detail") %>
-<% @validation.report.validation_results.each do |r| %><% if r.errors.present? %><% r.errors.first(10).each do |error| %><% case r.severity %><% when "WARNING" %><%= I18n.t "validation_result.severities.warning_txt" %><% when "ERROR" %><%= I18n.t "validation_result.severities.error_txt" %><% end %>;<%= r.test_id %>;<% if error["source"].present? %><%= error["source"]["objectid"] if error["source"]["objectid"].present? %>;<% if error["source"]["object_path"].present? %><%= object_url(@referential_id, error) %><% elsif error["source"]["file"].present? %><%= File.basename(error["source"]["file"]["filename"]) +" - " %><%= I18n.t "validation_results.index.column" %>:<%= error["source"]["file"]["column_number"] %>,<%= I18n.t "validation_results.index.line" %>:<%= error["source"]["file"]["line_number"] %><% end %>;<% else %>;;<% end %><%= I18n.t("activemodel.attributes.validation_result."+r.test_id) %>;<%= I18n.t("validation_result.details.detail_" + error["error_id"], object_labels_hash(error) )%><%= "\n" %><% end %><% end %><% end %> \ No newline at end of file
diff --git a/app/views/validations/index.html.erb b/app/views/validations/index.html.erb
deleted file mode 100644
index b11911791..000000000
--- a/app/views/validations/index.html.erb
+++ /dev/null
@@ -1,12 +0,0 @@
-<%= title_tag t('.title') %>
-<div class="warning"><%= t('.warning') %> </div>
-
-<div id="validations"><%= render 'validations' %></div>
-
-
-<% content_for :sidebar do %>
- <ul class="actions">
- <li><%= link_to t('validations.actions.new'), new_referential_validation_path(@referential), :class => "add" %></li>
- <li><%= link_to t('rule_parameter_sets.actions.index'), referential_rule_parameter_sets_path(@referential), :class => "link" %></li>
- </ul>
-<% end %>
diff --git a/app/views/validations/index.js.erb b/app/views/validations/index.js.erb
deleted file mode 100644
index 67844d1f4..000000000
--- a/app/views/validations/index.js.erb
+++ /dev/null
@@ -1 +0,0 @@
-$('#validations').html('<%= escape_javascript(render("validations")) %>'); \ No newline at end of file
diff --git a/app/views/validations/show.html.erb b/app/views/validations/show.html.erb
deleted file mode 100644
index d0537c81b..000000000
--- a/app/views/validations/show.html.erb
+++ /dev/null
@@ -1,65 +0,0 @@
-<%= title_tag "#{@validation.name} <span class='status status_#{@validation.status}'>#{ t('validations.show.'+@validation.status) }</span>" %>
-<% @title = "#{@validation.name}" %>
-
-<div class="validation_show">
- <div class="links">
- <% if @validation.import %>
- <%= link_to image_tag('icons/link_page.png') + t("compliance_check_tasks.import_task"), referential_import_path(@referential, @validation.import) %>
- <% elsif @validation.export %>
- <%= link_to image_tag('icons/link_page.png') + t("compliance_check_tasks.export_task"), referential_export_path(@referential, @validation.export) %>
- <% end %>
- <%= link_to image_tag('icons/link_page.png') + t("compliance_check_tasks.rule_parameter_set"), organisation_rule_parameter_set_path(@referential.organisation, @validation.rule_parameter_set) %>
- <div class="btn-group pull-right">
- <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
- <%= t(".export") %> <span class="caret"></span>
- </button>
- <ul class="dropdown-menu" role="menu">
- <li><%= link_to t(".export_csv"), export_referential_validation_path(@referential, @validation.id) %></li>
- </ul>
- </div>
-
- <!-- % if @validation.status == 'completed'% -->
- <div class="resume">
- <div class="col1">
- <div class="caption">
- <%= t "validation_result.severities.error" %>
- </div>
- <div class="graph" id="error">
- </div>
- </div>
- <div class="col2">
- <div class="caption">
- <%= t "validation_result.severities.warning" %>
- </div>
- <div class="graph" id="warning">
- </div>
- </div>
- </div>
- <div class="order" style="display: none;">
- Filtre : <%= select_tag "order", ("<option value='severity'>" + ComplianceCheckResult.human_attribute_name(:severity) +"</option><option value='status'>" + ComplianceCheckResult.human_attribute_name(:status) + "</option>").html_safe, :include_blank => false %>
- </div>
-
- <div class="report">
- </div>
- <!-- % end % -->
- <%= javascript_include_tag referential_validation_path(@referential, @validation.id, :format => :js) %>
- </div>
-</div>
-
-
-<!-- div class="validation_show" -->
- <!-- %= render( :partial => "results_dashboard", :locals => { :referential => @referential} ) % -->
-<!-- /div -->
-
-<% content_for :sidebar do %>
- <ul class="actions">
- <li>
- <% unless (@validation.import || @validation.export) %>
- <%= link_to t('validations.actions.destroy'), referential_validation_path(@referential, @validation.id), :method => :delete, :data => {:confirm => t('validations.actions.destroy_confirm')}, :class => "remove" %>
- <% end %>
- </li>
- </ul>
-
- <%= history_tag(@validation) %>
-
-<% end %>
diff --git a/app/views/validations/show.js.coffee b/app/views/validations/show.js.coffee
deleted file mode 100644
index 19455f4c7..000000000
--- a/app/views/validations/show.js.coffee
+++ /dev/null
@@ -1,50 +0,0 @@
-jQuery ->
-
- get_validation_results = (html_container, status, severity) ->
- h = new Object()
- h["status"] = status if status
- h["severity"] = severity if severity
-
- $.get(
- "<%= @validation.id %>/validation_results",
- h,
- update = (data) ->
- html_container.empty()
- html_container.append(data)
- )
-
- Morris.Donut({
- element: 'error',
- data: [
- {label: "<%= t 'nok', :scope => 'validation_result.statuses' %>", value: <%= @validation.report.nok_error.count %>},
- {label: "<%= t 'na', :scope => 'validation_result.statuses' %>", value: <%= @validation.report.na_error.count %>},
- {label: "<%= t 'ok', :scope => 'validation_result.statuses' %>", value: <%= @validation.report.ok_error.count %>}
- ]
- colors: [ "#e22b1b", "#898e7f", "#8fc861" ]
- }).on('click', update = (i, row) ->
- switch i
- when 0 then get_validation_results( $(".report"), "NOK", "ERROR")
- when 1 then get_validation_results( $(".report"), "UNCHECK", "ERROR")
- when 2 then get_validation_results( $(".report"), "OK", "ERROR")
- else console.log "Error no other value for donut chart")
-
- Morris.Donut({
- element: 'warning',
- data: [
- {label: "<%= t 'nok', :scope => 'validation_result.statuses' %>", value: <%= @validation.report.nok_warning.count %>},
- {label: "<%= t 'na', :scope => 'validation_result.statuses' %>", value: <%= @validation.report.na_warning.count %>},
- {label: "<%= t 'ok', :scope => 'validation_result.statuses' %>", value: <%= @validation.report.ok_warning.count %>}
- ]
- colors: [ "#ffbd2b", "#898e7f", "#8fc861" ]
- }).on('click', update = (i, row) ->
- switch i
- when 0 then get_validation_results( $(".report"), "NOK", "WARNING")
- when 1 then get_validation_results( $(".report"), "UNCHECK", "WARNING")
- when 2 then get_validation_results( $(".report"), "OK", "WARNING")
- else console.log "Error no other value for donut chart")
-
- $(".resume .col1 .caption").click ->
- get_validation_results( $(".report"), null, "ERROR")
-
- $(".resume .col2 .caption").click ->
- get_validation_results( $(".report"), null, "warning")
diff --git a/app/views/validations/summary_errors_index.csv.erb b/app/views/validations/summary_errors_index.csv.erb
deleted file mode 100644
index cec4d2e09..000000000
--- a/app/views/validations/summary_errors_index.csv.erb
+++ /dev/null
@@ -1,3 +0,0 @@
-<%= I18n.t("activemodel.attributes.validation_result.severity") %>;<%= I18n.t("activemodel.attributes.validation_result.status") %>;<%= I18n.t("activemodel.attributes.validation_result.rule_code") %>;<%= I18n.t("activemodel.attributes.validation_result.title") %>;<%= I18n.t("activemodel.attributes.validation_result.url") %>;<%= I18n.t("activemodel.attributes.validation_result.violation_count_txt") %>;<%= I18n.t("activemodel.attributes.validation_result.objects") %>
-<% @validation.report.validation_results.each do |r| %><% case r.severity %><% when "WARNING" %><%= I18n.t "validation_result.severities.warning_txt" %><% when "ERROR" %><%= I18n.t "validation_result.severities.error_txt" %><% end %>;<%= r.result %>;<%= r.test_id %>;<%= I18n.t("activemodel.attributes.validation_result."+r.test_id) %>;<%= Rails.application.config.validation_spec + I18n.locale.to_s + "/" + r.test_id + ".html" %>;<%= r.error_count %><% if r.error_count > 0 %><% if r.errors.present? %>;<% r.errors.first(10).each do |error| %><% if error["source"] %><%= error["source"]["objectid"] + " " %><% else %><%= " " %><% end %><% end %><% end %><% end %>
-<% end %> \ No newline at end of file
diff --git a/config/locales/compliance_check_results.yml b/config/locales/compliance_check_results.yml
index e348cb5c8..c439b64d9 100644
--- a/config/locales/compliance_check_results.yml
+++ b/config/locales/compliance_check_results.yml
@@ -195,7 +195,7 @@ en:
detail_4_vehiclejourney_1_pattern: "L'attribut %{reference_value} de la course %{source_label} (%{source_objectid}) n'est pas au bon format (%{error_value})"
detail_4_vehiclejourney_1_unique: "L'attribut %{reference_value} de la course %{source_label} (%{source_objectid}) a une valeur partagée avec la course %{target_0_label} (%{target_0_objectid})"
detail_4_vehiclejourney_2: "La course %{source_label} (%{source_objectid}) a un mode de transport interdit %{error_value}"
- activerecord:
+ activemodel:
models:
compliance_check_result:
zero: "Validation"
@@ -539,7 +539,7 @@ fr:
detail_4_vehiclejourney_1_pattern: "L'attribut %{reference_value} de la course %{source_label} (%{source_objectid}) n'est pas au bon format (%{error_value})"
detail_4_vehiclejourney_1_unique: "L'attribut %{reference_value} de la course %{source_label} (%{source_objectid}) a une valeur partagée avec la course %{target_0_label} (%{target_0_objectid})"
detail_4_vehiclejourney_2: "La course %{source_label} (%{source_objectid}) a un mode de transport interdit %{error_value}"
- activerecord:
+ activemodel:
models:
compliance_check_result:
zero: "Validation"
diff --git a/config/routes.rb b/config/routes.rb
index af126e0e5..ed8fad125 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -92,20 +92,6 @@ ChouetteIhm::Application.routes.draw do
get 'references'
end
end
-
- resources :validations do
- member do
- get 'export', defaults: { format: 'zip' }
- end
- member do
- get 'rule_parameter_set'
- end
- collection do
- get 'references'
- end
-
- resources :validation_results
- end
resources :compliance_check_tasks do
member do