diff --git a/app/controllers/admin/import_controller.rb b/app/controllers/admin/import_controller.rb index ecfae1f..6027b46 100644 --- a/app/controllers/admin/import_controller.rb +++ b/app/controllers/admin/import_controller.rb @@ -262,6 +262,7 @@ class Admin::ImportController < OrbitAdminController end end + @@thread.join @@thread.abort_on_exception = true render :json => {"success"=>true}.to_json end @@ -346,6 +347,7 @@ class Admin::ImportController < OrbitAdminController end end end + @@thread.join @@thread.abort_on_exception = true render :json => {"success" => true}.to_json end @@ -390,6 +392,7 @@ class Admin::ImportController < OrbitAdminController end I18n.locale = current_locale end + @@thread.join @@thread.abort_on_exception = true render :json => {"success" => true}.to_json end diff --git a/app/views/admin/import/index.html.erb b/app/views/admin/import/index.html.erb index ce62863..f75c837 100644 --- a/app/views/admin/import/index.html.erb +++ b/app/views/admin/import/index.html.erb @@ -217,8 +217,12 @@ url: '<%= admin_import_rss2_pages_path %>', data : {"url" : url+'?module='+module} }).done(function(){ - startCheckingImportStatus(); + }).fail(function(){ + $("#import-progress-text").html("Importing failed, click on start to try again."); + $("#alert-msg").text("There was an unknown error"); + $(".alert-danger").removeClass("hide").show(); }) + startCheckingImportStatus(); } var importLinks = function(){ @@ -230,8 +234,12 @@ url: '<%= admin_import_rss2_links_path %>', data : {"url" : url+'?module='+module} }).done(function(){ - startCheckinglinksImportStatus(); + }).fail(function(){ + $("#import-progress-text").html("Importing failed, click on start to try again."); + $("#alert-msg").text("There was an unknown error"); + $(".alert-danger").removeClass("hide").show(); }) + startCheckinglinksImportStatus(); } var importGallery = function(){ @@ -243,8 +251,12 @@ url: '<%= admin_import_rss2_galleries_path %>', data : {"url" : url+'?module='+module} }).done(function(){ - startCheckingGalleryImportStatus(); + }).fail(function(){ + $("#import-progress-text").html("Importing failed, click on start to try again."); + $("#alert-msg").text("There was an unknown error"); + $(".alert-danger").removeClass("hide").show(); }) + startCheckingGalleryImportStatus(); } var startCheckinglinksImportStatus = function(){ @@ -278,6 +290,10 @@ $("#alert-msg").text("Error importing link " + status.current_link_name + " ID : " + status.current_link_id) $(".alert-danger").removeClass("hide").show(); } + }).fail(function(){ + $("#import-progress-text").html("Importing failed, click on start to try again."); + $("#alert-msg").text("There was an unknown error"); + $(".alert-danger").removeClass("hide").show(); }) } @@ -307,6 +323,10 @@ $("#alert-msg").text("Error importing page " + status.current_page_name + " ID : " + status.current_page) $(".alert-danger").removeClass("hide").show(); } + }).fail(function(){ + $("#import-progress-text").html("Importing failed, click on start to try again."); + $("#alert-msg").text("There was an unknown error"); + $(".alert-danger").removeClass("hide").show(); }) } @@ -335,6 +355,10 @@ $("#alert-msg").text("Error importing album " + status.current_album_name + " ID : " + status.current_album_id) $(".alert-danger").removeClass("hide").show(); } + }).fail(function(){ + $("#import-progress-text").html("Importing failed, click on start to try again."); + $("#alert-msg").text("There was an unknown error"); + $(".alert-danger").removeClass("hide").show(); }) }