From c6dcb47ac1e7feb6c8a82a17f65d19f31b740e3e Mon Sep 17 00:00:00 2001 From: Luc Donnet Date: Tue, 10 Mar 2015 10:40:11 +0100 Subject: Add show for import --- Gemfile | 5 +- Gemfile.lock | 17 +++- app/assets/javascripts/application.js | 2 +- app/assets/stylesheets/application.css.scss.erb | 2 +- .../main/compliance_check_tasks.css.scss | 19 ++-- app/assets/stylesheets/main/import_tasks.css.scss | 87 ----------------- app/assets/stylesheets/main/imports.css.scss | 92 ++++++++++++++++++ app/controllers/imports_controller.rb | 66 ++++++++++++- app/helpers/breadcrumb_helper.rb | 4 +- app/models/import.rb | 14 ++- app/models/import_report.rb | 103 ++++++++++++++++++++- app/views/imports/_results_dashboard.html.erb | 61 ++++++------ app/views/imports/show.html.erb | 6 +- app/views/imports/show.js.coffee | 42 +++++---- config/locales/iev.en.yml | 4 + config/locales/iev.fr.yml | 4 + config/locales/imports.yml | 14 +-- 17 files changed, 360 insertions(+), 182 deletions(-) delete mode 100644 app/assets/stylesheets/main/import_tasks.css.scss create mode 100644 app/assets/stylesheets/main/imports.css.scss create mode 100644 config/locales/iev.en.yml create mode 100644 config/locales/iev.fr.yml diff --git a/Gemfile b/Gemfile index a2f81cf28..03b9b1be3 100644 --- a/Gemfile +++ b/Gemfile @@ -44,6 +44,7 @@ gem 'faraday', '~> 0.9.1' gem 'faraday_middleware', '~> 0.9.1' gem 'kleisli' gem 'hashie' +gem 'hashie_rails', '~> 0.0.2' platforms :jruby do gem 'activerecord-jdbcpostgresql-adapter', '~> 1.3.3' @@ -82,8 +83,8 @@ gem 'RedCloth' # Javascript gem "modernizr-rails", "~> 2.0.6" -gem 'morrisjs-rails' -gem 'raphael-rails' +gem 'rails-assets-morrisjs', "~> 0.5.1" +gem 'rails-assets-raphael', "~> 2.1.3" # Use twitter bootstrap resources gem 'rails-assets-bootstrap-sass-official', '~> 3.3.0' diff --git a/Gemfile.lock b/Gemfile.lock index 13bbe6635..3d58935e9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -179,6 +179,9 @@ GEM actionpack (>= 3.2, < 5) activesupport (>= 3.2, < 5) hashie (3.4.0) + hashie_rails (0.0.2) + activesupport (~> 4.0) + hashie (>= 3.0) highline (1.6.15) hike (1.2.3) hitimes (1.2.2) @@ -233,8 +236,6 @@ GEM mini_portile (0.6.2) minitest (5.5.1) modernizr-rails (2.0.6) - morrisjs-rails (0.4.3) - railties (> 3.1, < 5) multi_json (1.10.1) multipart-post (2.0.0) nenv (0.1.1) @@ -298,7 +299,13 @@ GEM rails-assets-jquery (2.1.1) rails-assets-jquery-tokeninput (1.7.0) rails-assets-jquery (>= 1.5) + rails-assets-mocha (1.17.1) rails-assets-moment (2.8.3) + rails-assets-morrisjs (0.5.1) + rails-assets-jquery (>= 2.1.0) + rails-assets-mocha (~> 1.17.1) + rails-assets-raphael (>= 2.0) + rails-assets-raphael (2.1.3) rails-assets-respond (1.4.2) rails-assets-tagmanager (3.0.1) rails-assets-jquery (>= 1.0.0) @@ -328,7 +335,6 @@ GEM activesupport (>= 3.0) i18n polyamorous (~> 1.1) - raphael-rails (2.1.2) rb-fsevent (0.9.4) rb-inotify (0.9.5) ffi (>= 0.5.0) @@ -478,6 +484,7 @@ DEPENDENCIES guard guard-rspec hashie + hashie_rails (~> 0.0.2) inherited_resources jbuilder (~> 2.0) jquery-rails @@ -491,7 +498,6 @@ DEPENDENCIES map_layers (= 0.0.4) meta_request modernizr-rails (~> 2.0.6) - morrisjs-rails ninoxe! pg poltergeist @@ -500,6 +506,8 @@ DEPENDENCIES rails-assets-bootstrap-sass-official (~> 3.3.0) rails-assets-eonasdan-bootstrap-datetimepicker (~> 3.1.3) rails-assets-jquery-tokeninput (~> 1.7.0) + rails-assets-morrisjs (~> 0.5.1) + rails-assets-raphael (~> 2.1.3) rails-assets-respond rails-assets-tagmanager (~> 3.0.1.0) rails-assets-typeahead.js (~> 0.10.5) @@ -507,7 +515,6 @@ DEPENDENCIES rails-erd rails-i18n (~> 4.0.0) ransack - raphael-rails rb-fsevent rb-inotify roo diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 07fc8694c..d138ec187 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -10,7 +10,7 @@ //= require modernizr //= require cocoon //= require raphael -//= require morris +//= require morrisjs //= require bootstrap-sass-official //= require typeahead.js //= require jquery-tokeninput diff --git a/app/assets/stylesheets/application.css.scss.erb b/app/assets/stylesheets/application.css.scss.erb index af43d97a6..66217204a 100644 --- a/app/assets/stylesheets/application.css.scss.erb +++ b/app/assets/stylesheets/application.css.scss.erb @@ -24,7 +24,7 @@ $body-bg: #eee; @import "font-awesome-sprockets"; @import "font-awesome"; @import "jquery.ui.all"; -@import "morris"; +@import "morrisjs"; @import "formtastic"; @import 'eonasdan-bootstrap-datetimepicker'; diff --git a/app/assets/stylesheets/main/compliance_check_tasks.css.scss b/app/assets/stylesheets/main/compliance_check_tasks.css.scss index 13ab1e674..f64a01b34 100644 --- a/app/assets/stylesheets/main/compliance_check_tasks.css.scss +++ b/app/assets/stylesheets/main/compliance_check_tasks.css.scss @@ -1,19 +1,18 @@ - -.status { - margin-left: 10px; -} - -.status_failed { color: #a94442;} -.status_pending { color: #31708f;} -.status_processing { color: #31708f;} -.status_completed { color: #3c763d;} - #workspace.compliance_check_tasks.index { } #workspace.compliance_check_tasks.show { + .status { + margin-left: 10px; + } + + .status_failed { color: #a94442;} + .status_pending { color: #31708f;} + .status_processing { color: #31708f;} + .status_completed { color: #3c763d;} + .links{ margin: 0px 0 20px 0; diff --git a/app/assets/stylesheets/main/import_tasks.css.scss b/app/assets/stylesheets/main/import_tasks.css.scss deleted file mode 100644 index 198f83129..000000000 --- a/app/assets/stylesheets/main/import_tasks.css.scss +++ /dev/null @@ -1,87 +0,0 @@ -#workspace.import_tasks.index -{ -} - -#workspace.import_tasks.show { - - .links{ - margin: 0 0 20px 0; - img{ margin: 0 5px 0 15px; } - } - - .resume { - &:after{ - content: " "; - display: block; - height: 0; - clear: both; - visibility: hidden; - } - - .col1 { - float: left; - width: 45%; - } - - .col2 { - margin-left: 10px; - float: left; - width: 45%; - } - - #files_statistics { height: 200px; } - #objects_statistics { height: 200px; } - - .caption { - text-align :center; - font-weight: bold; - } - } - - .report { - margin-top: 20px; - - .files { - img { - margin-right: 5px; - } - - .file_name{ - font-weight: bold; - margin-right: 30px; - } - } - - .files_error{ - color: #e22b1b; - display: none; - } - - .files_ignored{ - color: #898e7f; - display: none; - } - - .files_ok{ - color: #8fc861; - display: none; - } - - .lines{ display: none; } - } -} - -#workspace.import_tasks.new #workspace.import_tasks.create form.import_task_new { - padding: 0.5em 0; - margin-top: -0.5em; - margin-bottom: 1em; - - label { - display: block; - width: 25%; - float: left; - } - select { - width: 25%; - } -} diff --git a/app/assets/stylesheets/main/imports.css.scss b/app/assets/stylesheets/main/imports.css.scss new file mode 100644 index 000000000..93fb499f9 --- /dev/null +++ b/app/assets/stylesheets/main/imports.css.scss @@ -0,0 +1,92 @@ +#workspace.imports.index +{ +} + +#workspace.imports.show { + + .status { + margin-left: 10px; + } + + .status_aborted,.status_canceled { color: #a94442;} + .status_created { color: #31708f;} + .status_scheduled { color: #31708f;} + .status_terminated { color: #3c763d;} + + .links{ + margin: 0 0 20px 0; + img{ margin: 0 5px 0 15px; } + } + + .resume { + &:after{ + content: " "; + display: block; + height: 0; + clear: both; + visibility: hidden; + } + + #files_statistics { height: 225px; } + #objects_statistics { height: 225px; } + + .caption { + text-align :center; + font-weight: bold; + } + } + + .report { + margin-top: 20px; + + .files { + img { + margin-right: 5px; + } + + .file_name{ + font-weight: bold; + margin-right: 30px; + } + } + + .files_error{ + color: #e22b1b; + display: none; + } + + .files_ignored{ + color: #898e7f; + display: none; + } + + .files_ok{ + color: #8fc861; + display: none; + } + + .lines{ + display: none; + + td{ + text-align: center; + } + + } + } +} + +#workspace.imports.new #workspace.imports.create form.import_new { + padding: 0.5em 0; + margin-top: -0.5em; + margin-bottom: 1em; + + label { + display: block; + width: 25%; + float: left; + } + select { + width: 25%; + } +} diff --git a/app/controllers/imports_controller.rb b/app/controllers/imports_controller.rb index 7bf4897ce..71aade7f1 100644 --- a/app/controllers/imports_controller.rb +++ b/app/controllers/imports_controller.rb @@ -1,7 +1,9 @@ require 'will_paginate/array' class ImportsController < ChouetteController - respond_to :html, :xml, :json + defaults :resource_class => Import + + respond_to :html, :only => [:show, :index, :new, :create, :delete] respond_to :js, :only => [:show, :index] belongs_to :referential @@ -9,15 +11,65 @@ class ImportsController < ChouetteController # index curl http://localhost:8080/mobi.chouette.api/referentials/test/jobs # show curl http://localhost:8080/mobi.chouette.api/referentials/test/jobs + def index - index! do - build_breadcrumb :index + begin + index! do + build_breadcrumb :index + end + rescue IevError => error + logger.error("Iev failure : #{error.message}") + flash[:error] = t('iev.failure') + redirect_to referential_path(@referential) end end def show - show! do - build_breadcrumb :show + begin + show! do + build_breadcrumb :show + end + rescue IevError => 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 IevError => 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 IevError => error + logger.error("Iev failure : #{error.message}") + flash[:error] = t('iev.failure') + redirect_to referential_path(@referential) + end + end + + def delete + begin + delete! do + import_service.delete(@import.id) + redirect_to referential_imports_path(@referential) + end + rescue IevError => error + logger.error("Iev failure : #{error.message}") + flash[:error] = t('iev.failure') + redirect_to referential_path(@referential) end end @@ -27,6 +79,10 @@ class ImportsController < ChouetteController ImportService.new(@referential) end + def build_resource(attributes = {}) + @import ||= ImportTask.new + end + def resource @import ||= import_service.find( params[:id] ) end diff --git a/app/helpers/breadcrumb_helper.rb b/app/helpers/breadcrumb_helper.rb index 34e03383c..05300bce2 100644 --- a/app/helpers/breadcrumb_helper.rb +++ b/app/helpers/breadcrumb_helper.rb @@ -30,7 +30,7 @@ module BreadcrumbHelper time_table_breadcrumb action when "StopAreaCopy" stop_area_copy_breadcrumb action - when "ImportTask" + when "Import" import_breadcrumb action when "Export" export_breadcrumb action @@ -134,7 +134,7 @@ module BreadcrumbHelper def import_breadcrumb (action) referential_breadcrumb - add_breadcrumb Referential.human_attribute_name("import_tasks"), referential_import_tasks_path(@referential) unless action == :index + add_breadcrumb Referential.human_attribute_name("imports"), referential_imports_path(@referential) unless action == :index end def export_breadcrumb (action) diff --git a/app/models/import.rb b/app/models/import.rb index 7b2405db2..f1d6169f1 100644 --- a/app/models/import.rb +++ b/app/models/import.rb @@ -9,20 +9,28 @@ class Import attr_reader :datas, :report def initialize( options = Hashie::Mash.new ) - puts "options #{options.inspect}" @datas = options @status = @datas.status.downcase if @datas.status? @format = @datas.type.downcase if @datas.type? end def report - ImportReport.new( IevApi.job(referential_name, id,{ :action => "importer" }) ) + result = IevApi.job(referential_name, id,{ :action => "importer" }) + ImportReport.new( result ) end def id @datas.id end + def filename + @datas.filename + end + + def filename_extension + File.extname(filename) if filename + end + def percentage_progress if %w{created}.include? status 0 @@ -38,7 +46,7 @@ class Import end def referential_name - @datas.parameters.referential + @datas.referential end def name diff --git a/app/models/import_report.rb b/app/models/import_report.rb index 8ec112dc3..50857b4e7 100644 --- a/app/models/import_report.rb +++ b/app/models/import_report.rb @@ -1,7 +1,4 @@ class ImportReport - extend Enumerize - extend ActiveModel::Naming - include ActiveModel::Model attr_reader :datas @@ -9,4 +6,104 @@ class ImportReport @datas = options end + def zip_file + datas.zip_file + end + + def error_files + datas.files.select{ |file| file[:status] == "ERROR"} + end + + def ignored_files + datas.files.select{ |file| file[:status] == "IGNORED"} + end + + def ok_files + datas.files.select{ |file| file[:status] == "OK"} + end + + def files + datas.files + end + + def line_items + [].tap do |line_items| + datas.lines.each do |line| + line_items << LineItem.new(line) + end + end + end + + def lines + 1 #datas.stats.line_count if datas.stats_.line_count? + end + + def routes + datas.stats.route_count if datas.stats_.route_count? + end + + def connection_links + datas.stats.connection_link_count if datas.stats_.connection_link_count? + end + + def time_tables + datas.stats.time_table_count if datas.stats_.time_table_count? + end + + def stop_areas + datas.stats.stop_area_count if datas.stats_.stop_area_count? + end + + def access_points + datas.stats.access_point_count if datas.stats_.access_point_count? + end + + def vehicle_journeys + datas.stats.vehicle_journey_count if datas.stats_.vehicle_journey_count? + end + + def journey_patterns + datas.stats.journey_pattern_count if datas.stats_.journey_pattern_count? + end + + class LineItem + attr_reader :name, :status, :stats + + def initialize( options = Hashie::Mash.new ) + @name = options.name if options.name? + @status = options.status if options.status? + @stats = options.stats if options.stats? + end + + def routes + stats.route_count + end + + def connection_links + stats.connection_link_count + end + + def time_tables + stats.time_table_count + end + + def stop_areas + stats.stop_area_count + end + + def access_points + stats.access_point_count + end + + def vehicle_journeys + stats.vehicle_journey_count + end + + def journey_patterns + stats.journey_pattern_count + end + + end + end + diff --git a/app/views/imports/_results_dashboard.html.erb b/app/views/imports/_results_dashboard.html.erb index bde732f73..e873e8902 100644 --- a/app/views/imports/_results_dashboard.html.erb +++ b/app/views/imports/_results_dashboard.html.erb @@ -1,38 +1,40 @@ -
-
- <% file_title = (@import_task.file_path_extension=="zip") ? t( "import_tasks.show.graph.files.title_zip") : t( "import_tasks.show.graph.files.title_default", :extension => @import_task.file_path_extension)%> +
+
+ <% file_title = (@import.filename_extension=="zip") ? t( "imports.show.graph.files.title_zip") : t( "imports.show.graph.files.title_default", :extension => @import.filename_extension)%>
<%= file_title %>
-
-
<%= t "import_tasks.show.graph.lines.title" %>
+
+
<%= t "imports.show.graph.lines.title" %>
-
+
- <% @files_list["error"].each_with_index do |error, index| %> - <% index += 1 %> - <%= image_tag "icons/file_xml_md.png" %><%= truncate(error["name"], :length => 20) %> <% if index%4 == 0 %>
<% end %> + <% @import.report.error_files.each_with_index do |file, index| %> +
+ <%= image_tag "icons/file_xml_md.png" %><%= truncate(file.name, :length => 40) %> +
<% end %>
- <% @files_list["ignored"].each_with_index do |ignored, index| %> - <% index += 1 %> - <%= image_tag "icons/file_xml_md.png" %><%= truncate(ignored["name"], :length => 20) %> <% if index%4 == 0 %>
<% end %> + <% @import.report.ignored_files.each_with_index do |file, index| %> +
+ <%= image_tag "icons/file_xml_md.png" %><%= truncate(file.name, :length => 40) %> +
<% end %>
- <% @files_list["ok"].each_with_index do |ok, index| %> - <% index += 1 %> - <%= image_tag "icons/file_xml_md.png" %><%= truncate(ok["name"], :length => 20) %> <% if index%4 == 0 %>
<% end %> + <% @import.report.ok_files.each_with_index do |file, index| %> +
+ <%= image_tag "icons/file_xml_md.png" %><%= truncate(file.name, :length => 40) %> +
<% end %>
- +
- @@ -45,24 +47,23 @@ - <% @lines_list.each_with_index do |line, index| %> - <% tr_class = (line["status"]=="saved") ? '' : 'class=\'danger\''%> + <% @import.report.line_items.each_with_index do |line_item, index| %> + <% tr_class = (line_item.status == "saved") ? '' : 'class=\'danger\''%> > - - - - - - - - - - + + + + + + + + + <% end %>
# <%= t("import_tasks.show.table.line.name") %> <%= t("import_tasks.show.table.line.save") %> <%= t("import_tasks.show.table.line.routes") %>
<%= index + 1 %><%= line["name"] %><%= t("import_tasks.show.table.line." + line["status"] ) %><%= line["stats"]["route_count"] %><%= line["stats"]["connection_link_count"] %><%= line["stats"]["time_table_count"] %><%= line["stats"]["stop_area_count"] %><%= line["stats"]["acces_point_count"] %><%= line["stats"]["vehicle_journey_count"] %><%= line["stats"]["journey_pattern_count"] %><%= line_item.name %><%= t("import_tasks.show.table.line." + line_item.status ) %><%= line_item.routes %><%= line_item.connection_links %><%= line_item.time_tables %><%= line_item.stop_areas %><%= line_item.access_points %><%= line_item.vehicle_journeys %><%= line_item.journey_patterns %>
- <%= javascript_include_tag referential_import_task_path(@import_task.referential, @import_task,:format => :js) %> + <%= javascript_include_tag referential_import_path(@referential, @import.id,:format => :js) %> diff --git a/app/views/imports/show.html.erb b/app/views/imports/show.html.erb index 41b04d22b..e87292b85 100644 --- a/app/views/imports/show.html.erb +++ b/app/views/imports/show.html.erb @@ -1,8 +1,10 @@ +
<% title = @import.no_save ? "": "" %> -<%= title_tag "#{title} #{@import.name} #{ t('imports.show.'+ @import.status) }" %> +<%= title_tag "#{title} #{@import.name} #{ t('imports.statuses.'+ @import.status) }" %> +
- + <%= render( :partial => "results_dashboard", :locals => { :referential => @referential} ) %>
<% content_for :sidebar do %> diff --git a/app/views/imports/show.js.coffee b/app/views/imports/show.js.coffee index c856154fa..e2416e967 100644 --- a/app/views/imports/show.js.coffee +++ b/app/views/imports/show.js.coffee @@ -1,5 +1,5 @@ jQuery -> - + get_import_results = (html_container, html_element) -> html_container.children().each -> if( $( this ).is(html_element) ) @@ -10,32 +10,36 @@ jQuery -> Morris.Donut({ element: 'files_statistics', data: [ - {label: "<%= t 'import_tasks.show.graph.files.error' %>", value: <%= @files_stats["error_count"] %> }, - {label: "<%= t 'import_tasks.show.graph.files.ignored' %>", value: <%= @files_stats["ignored_count"] %> }, - {label: "<%= t 'import_tasks.show.graph.files.ok' %>", value: <%= @files_stats["ok_count"] %> } + {label: "<%= t 'imports.show.graph.files.error' %>", value: <%= @import.report.error_files.count %> }, + {label: "<%= t 'imports.show.graph.files.ignored' %>", value: <%= @import.report.ignored_files.count %> }, + {label: "<%= t 'imports.show.graph.files.ok' %>", value: <%= @import.report.ok_files.count %> } ] colors: [ "#e22b1b", "#898e7f", "#8fc861" ] }).on('click', update = (i, row) -> - switch i - when 0 then get_import_results( $(".report"), $(".files_error")) - when 1 then get_import_results( $(".report"), $(".files_ignored")) - when 2 then get_import_results( $(".report"), $(".files_ok")) - else console.log "Error no other value for donut chart") + switch i + when 0 then get_import_results( $(".report"), $(".files_error")) + when 1 then get_import_results( $(".report"), $(".files_ignored")) + when 2 then get_import_results( $(".report"), $(".files_ok")) + else console.log "Error no other value for donut chart") Morris.Bar({ element: 'objects_statistics', data: [ - { object: "<%= t("import_tasks.show.graph.lines.lines_stats") %>", value: <%= @lines_stats["line_count"] %> }, - { object: "<%= t("import_tasks.show.graph.lines.routes_stats") %>", value: <%= @lines_stats["route_count"] %> }, - { object: "<%= t("import_tasks.show.graph.lines.connection_links_stats") %>", value: <%= @lines_stats["connection_link_count"] %> }, - { object: "<%= t("import_tasks.show.graph.lines.time_tables_stats") %>", value: <%= @lines_stats["time_table_count"] %> }, - { object: "<%= t("import_tasks.show.graph.lines.stop_areas_stats") %>", value: <%= @lines_stats["stop_area_count"] %> }, - { object: "<%= t("import_tasks.show.graph.lines.access_points_stats") %>", value: <%= @lines_stats["access_point_count"] %> }, - { object: "<%= t("import_tasks.show.graph.lines.vehicle_journeys_stats") %>", value: <%= @lines_stats["vehicle_journey_count"] %> }, - { object: "<%= t("import_tasks.show.graph.lines.journey_patterns_stats") %>", value: <%= @lines_stats["journey_pattern_count"] %> }, + { object: "<%= t("imports.show.graph.lines.lines_stats").html_safe %>", value: <%= @import.report.lines %> }, + { object: "<%= t("imports.show.graph.lines.routes_stats").html_safe %>", value: <%= @import.report.routes %> }, + { object: "<%= t("imports.show.graph.lines.connection_links_stats").html_safe %>", value: <%= @import.report.connection_links %> }, + { object: "<%= t("imports.show.graph.lines.time_tables_stats").html_safe %>", value: <%= @import.report.time_tables %> }, + { object: "<%= t("imports.show.graph.lines.stop_areas_stats").html_safe %>", value: <%= @import.report.stop_areas %> }, + { object: "<%= t("imports.show.graph.lines.access_points_stats").html_safe %>", value: <%= @import.report.access_points %> }, + { object: "<%= t("imports.show.graph.lines.vehicle_journeys_stats").html_safe %>", value: <%= @import.report.vehicle_journeys %> }, + { object: "<%= t("imports.show.graph.lines.journey_patterns_stats").html_safe %>", value: <%= @import.report.journey_patterns %> }, ], xkey: 'object', ykeys: ['value'], - labels: ['<%= t "import_tasks.show.graph.lines.objects_label" %>'] + labels: ['<%= t "imports.show.graph.lines.objects_label" %>'] + xLabelAngle: 40, + xAxisLabelTopPadding: 7, + padding: 40, + hideHover: true }).on('click', update = (i, row) -> - get_import_results( $(".report"), $(".lines")) ) \ No newline at end of file + get_import_results( $(".report"), $(".lines")) ) \ No newline at end of file diff --git a/config/locales/iev.en.yml b/config/locales/iev.en.yml new file mode 100644 index 000000000..d7b7088bf --- /dev/null +++ b/config/locales/iev.en.yml @@ -0,0 +1,4 @@ +en: + iev: + failure: "Impossible to access IEV service" + \ No newline at end of file diff --git a/config/locales/iev.fr.yml b/config/locales/iev.fr.yml new file mode 100644 index 000000000..5a7070c90 --- /dev/null +++ b/config/locales/iev.fr.yml @@ -0,0 +1,4 @@ +fr: + iev: + failure: "Impossible d'accéder au service IEV" + \ No newline at end of file diff --git a/config/locales/imports.yml b/config/locales/imports.yml index e49263520..f9356aa4a 100644 --- a/config/locales/imports.yml +++ b/config/locales/imports.yml @@ -15,12 +15,7 @@ en: warning: "" show: report: "Report" - not_yet_started: "On queue" imported_file: "Imported file" - completed: "[ Completed ]" - failed: "[ Failed ]" - pending: "[ In the treatment queue ]" - processing: "[ In progress... ]" graph: files: title_zip: "Import results for files in zip" @@ -112,12 +107,7 @@ fr: warning: "" show: report: "Rapport" - not_yet_started: "En file d'attente" imported_file: "Fichier importé" - completed: "[ Terminé ]" - failed: "[ Echoué ]" - pending: "[ En file d'attente ]" - processing: "[ En progression... ]" graph: files: title_zip: "Résultat d'import des fichiers du zip" @@ -151,8 +141,8 @@ fr: saved: "Sauvé" save_error: "Sauvegarde en erreur" statuses: - created: "En attente ..." - scheduled: "En cours ..." + created: "En file d'attente..." + scheduled: "En cours..." terminated: "Achevé" canceled: "Annulé" aborted: "Echoué" -- cgit v1.2.3 From dc6fc17f5ea46c871154e398037fab3bb741504e Mon Sep 17 00:00:00 2001 From: Luc Donnet Date: Tue, 10 Mar 2015 10:44:45 +0100 Subject: Fix call for IevError class in import controller --- app/controllers/imports_controller.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/imports_controller.rb b/app/controllers/imports_controller.rb index 71aade7f1..2af6a57d6 100644 --- a/app/controllers/imports_controller.rb +++ b/app/controllers/imports_controller.rb @@ -17,7 +17,7 @@ class ImportsController < ChouetteController index! do build_breadcrumb :index end - rescue IevError => error + rescue IevApi::IevError => error logger.error("Iev failure : #{error.message}") flash[:error] = t('iev.failure') redirect_to referential_path(@referential) @@ -29,7 +29,7 @@ class ImportsController < ChouetteController show! do build_breadcrumb :show end - rescue IevError => error + rescue IevApi::IevError => error logger.error("Iev failure : #{error.message}") flash[:error] = t('iev.failure') redirect_to referential_path(@referential) @@ -41,7 +41,7 @@ class ImportsController < ChouetteController new! do puts "OK" end - rescue IevError => error + rescue IevApi::IevError => error logger.error("Iev failure : #{error.message}") flash[:error] = t('iev.failure') redirect_to referential_path(@referential) @@ -53,7 +53,7 @@ class ImportsController < ChouetteController create! do puts "OK" end - rescue IevError => error + rescue IevApi::IevError => error logger.error("Iev failure : #{error.message}") flash[:error] = t('iev.failure') redirect_to referential_path(@referential) @@ -66,7 +66,7 @@ class ImportsController < ChouetteController import_service.delete(@import.id) redirect_to referential_imports_path(@referential) end - rescue IevError => error + rescue IevApi::IevError => error logger.error("Iev failure : #{error.message}") flash[:error] = t('iev.failure') redirect_to referential_path(@referential) -- cgit v1.2.3