Class: Dradis::Plugins::CSV::UploadController
- Inherits:
-
AuthenticatedController
- Object
- AuthenticatedController
- Dradis::Plugins::CSV::UploadController
- Includes:
- ProjectScoped
- Defined in:
- app/controllers/dradis/plugins/csv/upload_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
-
#new ⇒ Object
Reached after the standard upload flow has already run the file through Importer#import.
Instance Method Details
#create ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/controllers/dradis/plugins/csv/upload_controller.rb', line 22 def create save_mapping job_logger.write 'Enqueueing job to start in the background.' MappingImportJob.perform_later( default_user_id: current_user.id, file: @attachment.fullpath.to_s, headers: csv_headers, mappings: mappings_params[:field_attributes].to_h, project_id: current_project.id, state: state, uid: params[:log_uid].to_i ) end |
#new ⇒ Object
Reached after the standard upload flow has already run the file through Importer#import. If a saved mapping matched, that import already happened (see importer.rb) and there's nothing left to map.
12 13 14 15 16 17 18 19 20 |
# File 'app/controllers/dradis/plugins/csv/upload_controller.rb', line 12 def new if saved_mapping? return redirect_to main_app.project_issues_path(current_project), notice: 'CSV imported using its saved mapping.' end @default_columns = ['Column Header', 'Entity', 'Dradis Field'] @log_uid = Log.new.uid end |