added some changes for import threading

This commit is contained in:
Harry Bomrah 2014-06-16 18:52:08 +08:00
parent e2dea41af7
commit 5a88f5dd47
2 changed files with 30 additions and 3 deletions

View File

@ -262,6 +262,7 @@ class Admin::ImportController < OrbitAdminController
end end
end end
@@thread.join
@@thread.abort_on_exception = true @@thread.abort_on_exception = true
render :json => {"success"=>true}.to_json render :json => {"success"=>true}.to_json
end end
@ -346,6 +347,7 @@ class Admin::ImportController < OrbitAdminController
end end
end end
end end
@@thread.join
@@thread.abort_on_exception = true @@thread.abort_on_exception = true
render :json => {"success" => true}.to_json render :json => {"success" => true}.to_json
end end
@ -390,6 +392,7 @@ class Admin::ImportController < OrbitAdminController
end end
I18n.locale = current_locale I18n.locale = current_locale
end end
@@thread.join
@@thread.abort_on_exception = true @@thread.abort_on_exception = true
render :json => {"success" => true}.to_json render :json => {"success" => true}.to_json
end end

View File

@ -217,8 +217,12 @@
url: '<%= admin_import_rss2_pages_path %>', url: '<%= admin_import_rss2_pages_path %>',
data : {"url" : url+'?module='+module} data : {"url" : url+'?module='+module}
}).done(function(){ }).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(){ var importLinks = function(){
@ -230,8 +234,12 @@
url: '<%= admin_import_rss2_links_path %>', url: '<%= admin_import_rss2_links_path %>',
data : {"url" : url+'?module='+module} data : {"url" : url+'?module='+module}
}).done(function(){ }).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(){ var importGallery = function(){
@ -243,8 +251,12 @@
url: '<%= admin_import_rss2_galleries_path %>', url: '<%= admin_import_rss2_galleries_path %>',
data : {"url" : url+'?module='+module} data : {"url" : url+'?module='+module}
}).done(function(){ }).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(){ var startCheckinglinksImportStatus = function(){
@ -278,6 +290,10 @@
$("#alert-msg").text("Error importing link " + status.current_link_name + " ID : " + status.current_link_id) $("#alert-msg").text("Error importing link " + status.current_link_name + " ID : " + status.current_link_id)
$(".alert-danger").removeClass("hide").show(); $(".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-msg").text("Error importing page " + status.current_page_name + " ID : " + status.current_page)
$(".alert-danger").removeClass("hide").show(); $(".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-msg").text("Error importing album " + status.current_album_name + " ID : " + status.current_album_id)
$(".alert-danger").removeClass("hide").show(); $(".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();
}) })
} }