app/controllers/para/admin/imports_controller.rb in para-0.6.2 vs app/controllers/para/admin/imports_controller.rb in para-0.6.3
- old
+ new
@@ -1,42 +1,23 @@
module Para
module Admin
- class ImportsController < Para::Admin::ComponentController
- include Para::Admin::ResourceControllerConcerns
-
+ class ImportsController < Para::Admin::JobsController
layout false
before_action :load_importer
- def show
- @status = ActiveJob::Status.get(params[:id])
-
- respond_to do |format|
- format.json do
- if @status.failed?
- render json: { status: @status.status }, status: 422
- else
- render json: { status: @status.status, progress: @status.progress * 100 }
- end
- end
-
- format.html
- end
- end
-
def new
@file = Para::Library::File.new
@model = resource_model
end
def create
@file = Para::Library::File.new(file_params)
if @file.save
job = @importer.perform_later(@file)
- @status = ActiveJob::Status.get(job)
- render 'show'
+ track_job(job)
else
render 'new'
end
end