")}),t?window.show_modal("Issues loading this workflow","Please review the following issues, possibly resulting from tool upgrades or changes.
"+t+"
",{Continue:hide_modal}):hide_modal(),l.showWorkflowParameters()},beforeSubmit:function(e){show_message("Loading workflow","progress")}}),window.make_popupmenu&&make_popupmenu(e("#workflow-options-button"),{Save:u,"Save As":n,Run:function(){window.location=Galaxy.root+"workflows/run?id="+l.options.id},"Edit Attributes":function(){l.workflow.clear_active_node()},"Auto Re-layout":i,Close:d});var h=e.jStorage.get("overview-size");void 0!==h&&e("#overview-border").css({width:h,height:h}),e.jStorage.get("overview-off")?s():a(),e("#overview-border").bind("dragend",function(t,n){var i=e(this).offsetParent(),r=i.offset(),a=Math.max(i.width()-(n.offsetX-r.left),i.height()-(n.offsetY-r.top));e.jStorage.set("overview-size",a+"px")}),e("#close-viewport").click(function(){"0px"===e("#overview-border").css("right")?s():a()}),window.onbeforeunload=function(){if(workflow&&l.workflow.has_changes)return"There are unsaved changes to your workflow which will be lost."},this.options.workflows.length>0&&e("#left").find(".toolMenu").append(this._buildToolPanelWorkflows()),e("div.toolSectionBody").hide(),e("div.toolSectionTitle > span").wrap("");var p=null;e("div.toolSectionTitle").each(function(){var t=e(this).next("div.toolSectionBody");e(this).click(function(){t.is(":hidden")?(p&&p.slideUp("fast"),p=t,t.slideDown("fast")):(t.slideUp("fast"),p=null)})}),(0,k.default)("workflow-name","workflow-name",l.urls.rename_async,"new_name"),e("#workflow-tag").click(function(){return e(".tag-area").click(),!1}),(0,k.default)("workflow-annotation","workflow-annotation",l.urls.annotate_async,"new_annotation",25,!0,4)},_buildToolPanelWorkflows:function(){var t=this,n=e('
');return r.each(this.options.workflows,function(i){if(i.id!==t.options.id){var r=new w.default.ButtonIcon({icon:"fa fa-copy",cls:"ui-button-icon-plain",tooltip:"Copy and insert individual steps",onclick:function(){i.step_count<2?t.copy_into_workflow(i.id,i.name):Galaxy.modal.show({title:"Warning",body:"This will copy "+i.step_count+" new steps into your workflow.",buttons:{Cancel:function(){Galaxy.modal.hide()},Copy:function(){Galaxy.modal.hide(),t.copy_into_workflow(i.id,i.name)}}})}}),a=e("").attr("href","#").html(i.name).on("click",function(){t.add_node_for_subworkflow(i.latest_id,i.name)});n.find(".toolSectionBg").append(e("").addClass("toolTitle").append(a).append(r.$el))}}),n},copy_into_workflow:function(t){var n=this;this._workflowLoadAjax(t,{success:function(t){n.workflow.from_simple(t,!1);var i="";e.each(t.upgrade_messages,function(t,r){i+="
"}),i?window.show_modal("Subworkflow embedded with changes","Problems were encountered loading this workflow (possibly a result of tool upgrades). Please review the following parameters and then save.
"}),i.html(a),r.show()):(i.html(a),r.hide())},showAttributes:function(){e(".right-content").hide(),e("#edit-attributes").show()},showForm:function(t,n){var i="right-content",r=i+"-"+n.id,a=e("#"+i);if(t&&0==a.find("#"+r).length){var o=e('');if(t.node=n,t.workflow=this.workflow,t.datatypes=this.datatypes,t.icon=m.default[n.type],t.cls="ui-portlet-narrow",n){var s="tool"==n.type?"Tool":"Default";o.append(new y.default[s](t).form.$el),a.append(o)}else Galaxy.emit.debug("workflow-view::initialize()","Node not found in workflow.")}e("."+i).hide(),a.find("#"+r).show(),a.show(),a.scrollTop()},isSubType:function(e,t){return e=this.ext_to_type[e],t=this.ext_to_type[t],this.type_to_type[e]&&t in this.type_to_type[e]},prebuildNode:function(t,n,i){var r=this,a=e(""),o=e("
',"This folder is either empty or you do not have proper access permissions to see the contents. If you expected something to show up",' please consult the library security wikipage',' or visit the Galaxy support site.',"
"].join(""))}});t.default={FolderListView:h}}).call(t,n(2),n(1),n(0))},299:function(e,t,n){"use strict";(function(e,i,r){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(7),s=a(o),l=n(13),c=a(l),d=n(126),u=a(d),h=e.View.extend({events:{"click .undelete_dataset_btn":"undeleteDataset","click .undelete_folder_btn":"undeleteFolder","click .edit_folder_btn":"startModifications","click .cancel_folder_btn":"cancelModifications","click .save_folder_btn":"saveModifications"},defaults:{type:null,visibility_config:{edit_folder_btn:!1,save_folder_btn:!1,cancel_folder_btn:!1,permission_folder_btn:!1},edit_mode:!1},initialize:function(e){this.options=i.defaults(e||{},this.defaults),this.render(this.options)},render:function(e){this.options=i.extend(this.options,e);var t=this.options.model,n=null;return"folder"===t.get("type")||"LibraryFolder"===t.get("model_class")?(this.options.type="folder",this.prepareButtons(t),n=t.get("deleted")?this.templateRowDeletedFolder():this.templateRowFolder()):"file"===t.get("type")||"LibraryDatasetDatasetAssociation"===t.get("model_class")||"LibraryDataset"===t.get("model_class")?(this.options.type="file",n=t.get("deleted")?this.templateRowDeletedFile():this.templateRowFile()):(Galaxy.emit.error("Unknown library item type found."),Galaxy.emit.error(t.get("type")||t.get("model_class"))),this.setElement(n({content_item:t,edit_mode:this.options.edit_mode,button_config:this.options.visibility_config})),this.$el.show(),this},prepareButtons:function(e){var t=this.options.visibility_config;!1===this.options.edit_mode?(t.save_folder_btn=!1,t.cancel_folder_btn=!1,!0===e.get("deleted")?(t.edit_folder_btn=!1,t.permission_folder_btn=!1):!1===e.get("deleted")&&(t.save_folder_btn=!1,t.cancel_folder_btn=!1,!0===e.get("can_modify")&&(t.edit_folder_btn=!0),!0===e.get("can_manage")&&(t.permission_folder_btn=!0))):!0===this.options.edit_mode&&(t.edit_folder_btn=!1,t.permission_folder_btn=!1,t.save_folder_btn=!0,t.cancel_folder_btn=!0),this.options.visibility_config=t},showDatasetDetails:function(){Galaxy.libraries.datasetView=new u.default.LibraryDatasetView({id:this.id})},undeleteDataset:function(e){r(".tooltip").hide();var t=this,n=r(e.target).closest("tr").data("id"),i=Galaxy.libraries.folderListView.collection.get(n);i.url=i.urlRoot+i.id+"?undelete=true",i.destroy({success:function(e,i){Galaxy.libraries.folderListView.collection.remove(n);var r=new c.default.Item(i);Galaxy.libraries.folderListView.collection.add(r),Galaxy.libraries.folderListView.collection.sortFolder("name","asc"),s.default.success("Dataset undeleted. Click this to see it.","",{onclick:function(){var e=t.model.get("folder_id");window.location=Galaxy.root+"library/list#folders/"+e+"/datasets/"+t.id}})},error:function(e,t){void 0!==t.responseJSON?s.default.error("Dataset was not undeleted. "+t.responseJSON.err_msg):s.default.error("An error occured! Dataset was not undeleted. Please try again.")}})},undeleteFolder:function(e){r(".tooltip").hide();var t=r(e.target).closest("tr").data("id"),n=Galaxy.libraries.folderListView.collection.get(t);n.url=n.urlRoot+n.id+"?undelete=true",n.destroy({success:function(e,n){Galaxy.libraries.folderListView.collection.remove(t);var i=new c.default.FolderAsModel(n);Galaxy.libraries.folderListView.collection.add(i),Galaxy.libraries.folderListView.collection.sortFolder("name","asc"),s.default.success("Folder undeleted.")},error:function(e,t){void 0!==t.responseJSON?s.default.error("Folder was not undeleted. "+t.responseJSON.err_msg):s.default.error("An error occured! Folder was not undeleted. Please try again.")}})},startModifications:function(){this.options.edit_mode=!0,this.repaint()},cancelModifications:function(){this.options.edit_mode=!1,this.repaint()},saveModifications:function(){var e=Galaxy.libraries.folderListView.collection.get(this.$el.data("id")),t=!1,n=this.$el.find(".input_folder_name").val();if(void 0!==n&&n!==e.get("name")){if(!(n.length>2))return void s.default.warning("Folder name has to be at least 3 characters long.");e.set("name",n),t=!0}var i=this.$el.find(".input_folder_description").val();if(void 0!==i&&i!==e.get("description")&&(e.set("description",i),t=!0),t){var r=this;e.save(null,{patch:!0,success:function(e){r.options.edit_mode=!1,r.repaint(e),s.default.success("Changes to folder saved.")},error:function(e,t){void 0!==t.responseJSON?s.default.error(t.responseJSON.err_msg):s.default.error("An error occured while attempting to update the folder.")}})}else this.options.edit_mode=!1,this.repaint(e),s.default.info("Nothing has changed.")},repaint:function(){r(".tooltip").hide();var e=this.$el;this.render(),e.replaceWith(this.$el),this.$el.find("[data-toggle]").tooltip()},templateRowFolder:function(){return i.template(['
","<% }%>",""].join(""))}});t.default={LibraryListView:f}}).call(t,n(2),n(0))},301:function(e,t,n){"use strict";(function(e,i,r){Object.defineProperty(t,"__esModule",{value:!0});var a=n(7),o=function(e){return e&&e.__esModule?e:{default:e}}(a),s=e.View.extend({events:{"click .edit_library_btn":"edit_button_clicked","click .cancel_library_btn":"cancel_library_modification","click .save_library_btn":"save_library_modification","click .delete_library_btn":"delete_library","click .undelete_library_btn":"undelete_library"},edit_mode:!1,element_visibility_config:{upload_library_btn:!1,edit_library_btn:!1,permission_library_btn:!1,save_library_btn:!1,cancel_library_btn:!1,delete_library_btn:!1,undelete_library_btn:!1},initialize:function(e){this.render(e)},render:function(e){void 0===e&&(e=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id"))),this.prepareButtons(e);var t=this.templateRow();return this.setElement(t({library:e,button_config:this.element_visibility_config,edit_mode:this.edit_mode})),this.$el.show(),this},repaint:function(e){i(".tooltip").hide();var t=this.$el;this.render(),t.replaceWith(this.$el),this.$el.find("[data-toggle]").tooltip()},prepareButtons:function(e){var t=this.element_visibility_config;!1===this.edit_mode?(t.save_library_btn=!1,t.cancel_library_btn=!1,t.delete_library_btn=!1,!0===e.get("deleted")?(t.undelete_library_btn=!0,t.upload_library_btn=!1,t.edit_library_btn=!1,t.permission_library_btn=!1):!1===e.get("deleted")&&(t.save_library_btn=!1,t.cancel_library_btn=!1,t.undelete_library_btn=!1,!0===e.get("can_user_add")&&(t.upload_library_btn=!0),!0===e.get("can_user_modify")&&(t.edit_library_btn=!0),!0===e.get("can_user_manage")&&(t.permission_library_btn=!0))):!0===this.edit_mode&&(t.upload_library_btn=!1,t.edit_library_btn=!1,t.permission_library_btn=!1,t.save_library_btn=!0,t.cancel_library_btn=!0,t.delete_library_btn=!0,t.undelete_library_btn=!1),this.element_visibility_config=t},edit_button_clicked:function(){this.edit_mode=!0,this.repaint()},cancel_library_modification:function(){this.edit_mode=!1,this.repaint()},save_library_modification:function(){var e=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id")),t=!1,n=this.$el.find(".input_library_name").val();if(void 0!==n&&n!==e.get("name")){if(!(n.length>2))return void o.default.warning("Library name has to be at least 3 characters long.");e.set("name",n),t=!0}var i=this.$el.find(".input_library_description").val();void 0!==i&&i!==e.get("description")&&(e.set("description",i),t=!0);var r=this.$el.find(".input_library_synopsis").val();if(void 0!==r&&r!==e.get("synopsis")&&(e.set("synopsis",r),t=!0),t){var a=this;e.save(null,{patch:!0,success:function(e){a.edit_mode=!1,a.repaint(e),o.default.success("Changes to library saved.")},error:function(e,t){void 0!==t.responseJSON?o.default.error(t.responseJSON.err_msg):o.default.error("An error occured while attempting to update the library.")}})}else this.edit_mode=!1,this.repaint(e),o.default.info("Nothing has changed.")},delete_library:function(){var e=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id")),t=this;e.destroy({success:function(e){e.set("deleted",!0),Galaxy.libraries.libraryListView.collection.add(e),t.edit_mode=!1,!1===Galaxy.libraries.preferences.get("with_deleted")?(i(".tooltip").hide(),t.repaint(e),t.$el.remove()):!0===Galaxy.libraries.preferences.get("with_deleted")&&t.repaint(e),o.default.success("Library has been marked deleted.")},error:function(e,t){void 0!==t.responseJSON?o.default.error(t.responseJSON.err_msg):o.default.error("An error occured during deleting the library.")}})},undelete_library:function(){var e=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id")),t=this;e.url=e.urlRoot+e.id+"?undelete=true",e.destroy({success:function(e){e.set("deleted",!1),Galaxy.libraries.libraryListView.collection.add(e),t.edit_mode=!1,t.repaint(e),o.default.success("Library has been undeleted.")},error:function(e,t){void 0!==t.responseJSON?o.default.error(t.responseJSON.err_msg):o.default.error("An error occured while undeleting the library.")}})},templateRow:function(){return r.template(['
"].join(""))}});t.default={LibraryRowView:s}}).call(t,n(2),n(0),n(1))},302:function(e,t,n){"use strict";(function(e,i,r){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(7),s=a(o),l=n(13),c=a(l),d=e.View.extend({el:"#center",defaults:{search_term:""},events:{"click #create_new_library_btn":"createLibraryFromModal","click #include_deleted_chk":"includeDeletedChecked","click #exclude_restricted_chk":"excludeRestrictedChecked","click .page_size_prompt":"showPageSizePrompt","keyup .library-search-input":"searchLibraries"},initialize:function(e){this.options=i.defaults(this.options||{},e,this.defaults),this.render()},render:function(){var e=this.templateToolBar(),t=!1,n=!0;Galaxy.user&&(t=Galaxy.user.isAdmin(),n=Galaxy.user.isAnonymous()),this.$el.html(e({admin_user:t,anon_user:n})),t&&(this.$el.find("#include_deleted_chk")[0].checked=Galaxy.libraries.preferences.get("with_deleted"),this.$el.find("#exclude_restricted_chk")[0].checked=Galaxy.libraries.preferences.get("without_restricted"))},renderPaginator:function(e){this.options=i.extend(this.options,e);var t=this.templatePaginator();this.$el.find("#library_paginator").html(t({show_page:parseInt(this.options.show_page),page_count:parseInt(this.options.page_count),total_libraries_count:this.options.total_libraries_count,libraries_shown:this.options.libraries_shown,library_page_size:Galaxy.libraries.preferences.get("library_page_size")}))},createLibraryFromModal:function(e){e.preventDefault(),e.stopPropagation();var t=this;this.modal=Galaxy.modal,this.modal.show({closing_events:!0,title:"Create New Library",body:this.templateNewLibraryInModal(),buttons:{Create:function(){t.createNewLibrary()},Close:function(){t.modal.hide()}}})},createNewLibrary:function(){var e=this.serializeNewLibrary();if(this.validateNewLibrary(e)){var t=new c.default.Library,n=this;t.save(e,{success:function(e){Galaxy.libraries.libraryListView.collection.add(e),n.modal.hide(),n.clearLibraryModal(),Galaxy.libraries.libraryListView.render(),s.default.success("Library created.")},error:function(e,t){void 0!==t.responseJSON?s.default.error(t.responseJSON.err_msg):s.default.error("An error occured.")}})}else s.default.error("Library's name is missing.");return!1},showPageSizePrompt:function(e){e.preventDefault();var t=prompt("How many libraries per page do you want to see?",Galaxy.libraries.preferences.get("library_page_size"));null!=t&&t==parseInt(t)&&(Galaxy.libraries.preferences.set({library_page_size:parseInt(t)}),Galaxy.libraries.libraryListView.render({show_page:1}))},clearLibraryModal:function(){r("input[name='Name']").val(""),r("input[name='Description']").val(""),r("input[name='Synopsis']").val("")},serializeNewLibrary:function(){return{name:r("input[name='Name']").val(),description:r("input[name='Description']").val(),synopsis:r("input[name='Synopsis']").val()}},validateNewLibrary:function(e){return""!==e.name},includeDeletedChecked:function(e){e.target.checked?(Galaxy.libraries.preferences.set({with_deleted:!0}),Galaxy.libraries.libraryListView.fetchDeleted()):(Galaxy.libraries.preferences.set({with_deleted:!1}),Galaxy.libraries.libraryListView.render())},excludeRestrictedChecked:function(e){e.target.checked?Galaxy.libraries.preferences.set({without_restricted:!0}):Galaxy.libraries.preferences.set({without_restricted:!1}),Galaxy.libraries.libraryListView.render()},searchLibraries:function(e){var t=r(".library-search-input").val();this.options.search_term=t,Galaxy.libraries.libraryListView.searchLibraries(t)},templateToolBar:function(){return i.template(['
"].join(""))}});t.default={LibraryToolbarView:d}}).call(t,n(2),n(1),n(0))},303:function(e,t,n){"use strict";(function(e,i,r,a){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var s=n(3),l=o(s),c=n(7),d=o(c),u=n(13),h=o(u),f=n(10),p=o(f);n(127);var _=e.View.extend({el:"#center",events:{"click #toolbtn_create_folder":"createFolderFromModal","click #toolbtn_bulk_import":"modalBulkImport","click #include_deleted_datasets_chk":"checkIncludeDeleted","click #toolbtn_bulk_delete":"deleteSelectedItems","click .toolbtn-show-locinfo":"showLocInfo","click .page_size_prompt":"showPageSizePrompt"},defaults:{can_add_library_item:!1,contains_file_or_folder:!1,chain_call_control:{total_number:0,failed_number:0},disabled_jstree_element:"folders"},modal:null,jstree:null,histories:null,select_genome:null,select_extension:null,list_extensions:[],auto:{id:"auto",text:"Auto-detect",description:"This system will try to detect the file type automatically. If your file is not detected properly as one of the known formats, it most likely means that it has some format problems (e.g., different number of columns on different rows). You can still coerce the system to set your data to the format you think it should be. You can also upload compressed files, which will automatically be decompressed."},list_genomes:[],initialize:function(e){this.options=i.defaults(e||{},this.defaults),this.fetchExtAndGenomes(),this.render()},render:function(e){this.options=i.extend(this.options,e);var t=this.templateToolBar(),n={id:this.options.id,is_admin:!1,is_anonym:!0,mutiple_add_dataset_options:!1};Galaxy.user&&(n.is_admin=Galaxy.user.isAdmin(),n.is_anonym=Galaxy.user.isAnonymous(),null===Galaxy.config.user_library_import_dir&&!1===Galaxy.config.allow_library_path_paste&&null===Galaxy.config.library_import_dir||(n.mutiple_add_dataset_options=!0)),this.$el.html(t(n))},renderPaginator:function(e){this.options=i.extend(this.options,e);var t=this.templatePaginator();r("body").find(".folder-paginator").html(t({id:this.options.id,show_page:parseInt(this.options.show_page),page_count:parseInt(this.options.page_count),total_items_count:this.options.total_items_count,items_shown:this.options.items_shown,folder_page_size:Galaxy.libraries.preferences.get("folder_page_size")}))},configureElements:function(e){this.options=i.extend(this.options,e),!0===this.options.can_add_library_item?r(".add-library-items").show():r(".add-library-items").hide(),!0===this.options.contains_file_or_folder&&Galaxy.user?Galaxy.user.isAnonymous()?(r(".dataset-manipulation").show(),r(".logged-dataset-manipulation").hide()):(r(".logged-dataset-manipulation").show(),r(".dataset-manipulation").show()):(r(".logged-dataset-manipulation").hide(),r(".dataset-manipulation").hide()),this.$el.find("[data-toggle]").tooltip()},createFolderFromModal:function(e){e.preventDefault(),e.stopPropagation();var t=this,n=this.templateNewFolderInModal();this.modal=Galaxy.modal,this.modal.show({closing_events:!0,title:"Create New Folder",body:n(),buttons:{Create:function(){t.create_new_folder_event()},Close:function(){Galaxy.modal.hide()}}})},create_new_folder_event:function(){var t=this.serialize_new_folder();if(this.validate_new_folder(t)){var n,i=new h.default.FolderAsModel,r=e.history.fragment.split("/");n=r.indexOf("page")>-1?r[r.length-3]:r[r.length-1],i.url=i.urlRoot+n,i.save(t,{success:function(e){Galaxy.modal.hide(),d.default.success("Folder created."),e.set({type:"folder"}),Galaxy.libraries.folderListView.collection.add(e)},error:function(e,t){Galaxy.modal.hide(),void 0!==t.responseJSON?d.default.error(t.responseJSON.err_msg):d.default.error("An error occurred.")}})}else d.default.error("Folder's name is missing.");return!1},serialize_new_folder:function(){return{name:r("input[name='Name']").val(),description:r("input[name='Description']").val()}},validate_new_folder:function(e){return""!==e.name},modalBulkImport:function(){if(0===this.findCheckedRows().length)d.default.info("You must select some datasets first.");else{var e=this;this.histories=new h.default.GalaxyHistories,this.histories.fetch().done(function(){var t=e.templateBulkImportInModal();e.modal=Galaxy.modal,e.modal.show({closing_events:!0,title:"Import into History",body:t({histories:e.histories.models}),buttons:{Import:function(){e.importAllIntoHistory()},Close:function(){Galaxy.modal.hide()}}})}).fail(function(e,t){void 0!==t.responseJSON?d.default.error(t.responseJSON.err_msg):d.default.error("An error occurred.")})}},importAllIntoHistory:function(){this.modal.disableButton("Import");var e=this.modal.$("input[name=history_name]").val(),t=this;if(""!==e)r.post(Galaxy.root+"api/histories",{name:e}).done(function(e){t.options.last_used_history_id=e.id,t.processImportToHistory(e.id,e.name)}).fail(function(e,t,n){d.default.error("An error occurred.")}).always(function(){t.modal.enableButton("Import")});else{var n=r("select[name=dataset_import_bulk] option:selected").val();this.options.last_used_history_id=n;var i=r("select[name=dataset_import_bulk] option:selected").text();this.processImportToHistory(n,i),this.modal.enableButton("Import")}},processImportToHistory:function(e,t){var n=[],i=[];this.findCheckedRows().each(function(){var e=r(this).closest("tr").data("id");"F"==e.substring(0,1)?i.push(e):n.push(e)});for(var o=[],s=n.length-1;s>=0;s--){var l=n[s],c=new h.default.HistoryItem;c.url=c.urlRoot+e+"/contents",c.content=l,c.source="library",o.push(c)}for(var s=i.length-1;s>=0;s--){var d=i[s],c=new h.default.HistoryItem;c.url=c.urlRoot+e+"/contents",c.content=d,c.source="library_folder",o.push(c)}this.initChainCallControl({length:o.length,action:"to_history",history_name:t}),a.getJSON(Galaxy.root+"history/set_as_current?id="+e),this.chainCallImportingIntoHistory(o,t)},updateProgress:function(){this.progress+=this.progressStep,r(".progress-bar-import").width(Math.round(this.progress)+"%");var e=Math.round(this.progress)+"% Complete";r(".completion_span").text(e)},download:function(e,t){var n=[],i=[];this.findCheckedRows().each(function(){var e=r(this).closest("tr").data("id");"F"==e.substring(0,1)?i.push(e):n.push(e)});var a=Galaxy.root+"api/libraries/datasets/download/"+t,o={ld_ids:n,folder_ids:i};this.processDownload(a,o,"get")},processDownload:function(e,t,n){if(e&&t){t="string"==typeof t?t:r.param(t);var i="";r.each(t.split("&"),function(){var e=this.split("=");i+=''}),r('").appendTo("body").submit().remove(),d.default.info("Your download will begin soon.")}else d.default.error("An error occurred.")},addFilesFromHistoryModal:function(){this.histories=new h.default.GalaxyHistories;var e=this;this.histories.fetch().done(function(){e.modal=Galaxy.modal;var t=e.templateAddFilesFromHistory();e.modal.show({closing_events:!0,title:"Adding datasets from your history",body:t({histories:e.histories.models}),buttons:{Add:function(){e.addAllDatasetsFromHistory()},Close:function(){Galaxy.modal.hide()}},closing_callback:function(){Galaxy.libraries.library_router.navigate("folders/"+e.id,{trigger:!0})}}),e.fetchAndDisplayHistoryContents(e.histories.models[0].id),r("#dataset_add_bulk").change(function(t){e.fetchAndDisplayHistoryContents(t.target.value)})}).fail(function(e,t){void 0!==t.responseJSON?d.default.error(t.responseJSON.err_msg):d.default.error("An error occurred.")})},importFilesFromPathModal:function(){var e=this;this.modal=Galaxy.modal;var t=this.templateImportPathModal();this.modal.show({closing_events:!0,title:"Please enter paths to import",body:t({}),buttons:{Import:function(){e.importFromPathsClicked(e)},Close:function(){Galaxy.modal.hide()}},closing_callback:function(){Galaxy.libraries.library_router.navigate("folders/"+e.id,{trigger:!0})}}),this.renderSelectBoxes()},fetchExtAndGenomes:function(){var e=this;l.default.get({url:Galaxy.root+"api/datatypes?extension_only=False",success:function(t){e.list_extensions=[];for(var n in t)e.list_extensions.push({id:t[n].extension,text:t[n].extension,description:t[n].description,description_url:t[n].description_url});e.list_extensions.sort(function(e,t){return e.id>t.id?1:e.idt.id?1:e.id=0;u--){var h=l[u].trim();0!==h.length&&c.push(h)}this.initChainCallControl({length:c.length,action:"adding_datasets"}),this.chainCallImportingFolders({paths:c,preserve_dirs:e,link_data:t,space_to_tab:n,to_posix_lines:i,source:"admin_path",file_type:o,tag_using_filenames:a,dbkey:s})}else d.default.info("Please enter a path relative to Galaxy root.")},initChainCallControl:function(e){var t;switch(e.action){case"adding_datasets":t=this.templateAddingDatasetsProgressBar(),this.modal.$el.find(".modal-body").html(t({folder_name:this.options.folder_name}));break;case"deleting_datasets":t=this.templateDeletingItemsProgressBar(),this.modal.$el.find(".modal-body").html(t());break;case"to_history":t=this.templateImportIntoHistoryProgressBar(),this.modal.$el.find(".modal-body").html(t({history_name:e.history_name}));break;default:Galaxy.emit.error("Wrong action specified.","datalibs")}this.progress=0,this.progressStep=100/e.length,this.options.chain_call_control.total_number=e.length,this.options.chain_call_control.failed_number=0},importFromJstreePath:function(e,t){var n=r("#jstree_browser").jstree().get_selected(!0),a=i.filter(n,function(e){return 0==e.state.disabled}),o=this.modal.$el.find(".preserve-checkbox").is(":checked"),s=this.modal.$el.find(".link-checkbox").is(":checked"),l=this.modal.$el.find(".spacetab-checkbox").is(":checked"),c=this.modal.$el.find(".posix-checkbox").is(":checked"),u=this.select_extension.value(),h=this.select_genome.value(),f=this.modal.$el.find(".tag-files").is(":checked"),p=a[0].type,_=[];if(a.length<1)d.default.info("Please select some items first.");else{this.modal.disableButton("Import");for(var g=a.length-1;g>=0;g--)void 0!==a[g].li_attr.full_path&&_.push(a[g].li_attr.full_path);if(this.initChainCallControl({length:_.length,action:"adding_datasets"}),"folder"===p){var m=t.source+"_folder";this.chainCallImportingFolders({paths:_,preserve_dirs:o,link_data:s,space_to_tab:l,to_posix_lines:c,source:m,file_type:u,dbkey:h,tag_using_filenames:f})}else if("file"===p){var m=t.source+"_file";this.chainCallImportingUserdirFiles({paths:_,file_type:u,dbkey:h,link_data:s,space_to_tab:l,to_posix_lines:c,source:m,tag_using_filenames:f})}}},fetchAndDisplayHistoryContents:function(e){var t=new h.default.HistoryContents({id:e}),n=this;t.fetch({success:function(t){var i=n.templateHistoryContents();n.histories.get(e).set({contents:t}),n.modal.$el.find("#selected_history_content").html(i({history_contents:t.models.reverse()})),n.modal.$el.find(".history-import-select-all").bind("click",function(){r("#selected_history_content [type=checkbox]").prop("checked",!0)}),n.modal.$el.find(".history-import-unselect-all").bind("click",function(){r("#selected_history_content [type=checkbox]").prop("checked",!1)})},error:function(e,t){void 0!==t.responseJSON?d.default.error(t.responseJSON.err_msg):d.default.error("An error occurred.")}})},addAllDatasetsFromHistory:function(){var e=this.modal.$el.find("#selected_history_content").find(":checked"),t=[],n=[],i=[];if(e.length<1)d.default.info("You must select some datasets first.");else{this.modal.disableButton("Add"),e.each(function(){var e=r(this).closest("li").data("id");if(e){var i=r(this).closest("li").data("name");t.push(e),n.push(i)}});for(var a=t.length-1;a>=0;a--){var o=t[a],s=new h.default.Item;s.url=Galaxy.root+"api/folders/"+this.options.id+"/contents","collection"===n[a]?s.set({from_hdca_id:o}):s.set({from_hda_id:o}),i.push(s)}this.initChainCallControl({length:i.length,action:"adding_datasets"}),this.chainCallAddingHdas(i)}},chainCallImportingIntoHistory:function(e,t){var n=this,i=e.pop();if(void 0===i)return 0===this.options.chain_call_control.failed_number?d.default.success("Selected datasets imported into history. Click this to start analyzing it.","",{onclick:function(){window.location=Galaxy.root}}):this.options.chain_call_control.failed_number===this.options.chain_call_control.total_number?d.default.error("There was an error and no datasets were imported into history."):this.options.chain_call_control.failed_number=0;s--){var l=new h.default.Item({id:e[s]});o.push(l)}for(var s=t.length-1;s>=0;s--){var c=new h.default.FolderAsModel({id:t[s]});o.push(c)}this.options.chain_call_control.total_number=a,this.chainCallDeletingItems(o)}},showLocInfo:function(){var e=null,t=this;null!==Galaxy.libraries.libraryListView?(e=Galaxy.libraries.libraryListView.collection.get(this.options.parent_library_id),this.showLocInfoModal(e)):(e=new h.default.Library({id:this.options.parent_library_id}),e.fetch({success:function(){t.showLocInfoModal(e)},error:function(e,t){void 0!==t.responseJSON?d.default.error(t.responseJSON.err_msg):d.default.error("An error occurred.")}}))},showLocInfoModal:function(e){var t=this,n=this.templateLocInfoInModal();this.modal=Galaxy.modal,this.modal.show({closing_events:!0,title:"Location Details",body:n({library:e,options:t.options}),buttons:{Close:function(){Galaxy.modal.hide()}}})},showImportModal:function(e){switch(e.source){case"history":this.addFilesFromHistoryModal();break;case"importdir":this.importFilesFromGalaxyFolderModal({source:"importdir"});break;case"path":this.importFilesFromPathModal();break;case"userdir":this.importFilesFromGalaxyFolderModal({source:"userdir"});break;default:Galaxy.libraries.library_router.back(),d.default.error("Invalid import source.")}},showPageSizePrompt:function(e){e.preventDefault();var t=prompt("How many items per page do you want to see?",Galaxy.libraries.preferences.get("folder_page_size"));null!=t&&t==parseInt(t)&&(Galaxy.libraries.preferences.set({folder_page_size:parseInt(t)}),Galaxy.libraries.folderListView.render({id:this.options.id,show_page:1}))},findCheckedRows:function(){return r("#folder_list_body").find(":checked")},templateToolBar:function(){return i.template(['
',"<% if (is_admin) { %>","You are logged in as an administrator therefore you can manage any library on this Galaxy instance. Please make sure you understand the consequences.","<% } else { %>","You can assign any number of roles to any of the following permission types. However please read carefully the implications of such actions.","<% }%>","
",'
',"
Library permissions
","
Roles that can access the library
",'','
',"User with any of these roles can access this library. If there are no access roles set on the library it is considered unrestricted.","
","
Roles that can manage permissions on this library
",'','
',"User with any of these roles can manage permissions on this library (includes giving access).","
","
Roles that can add items to this library
",'','
',"User with any of these roles can add items to this library (folders and datasets).","
","
Roles that can modify this library
",'','
',"User with any of these roles can modify this library (name, synopsis, etc.).","
",'","
","
"].join(""))}});t.default={LibraryView:h}}).call(t,n(2),n(1),n(0))},305:function(e,t,n){"use strict";(function(e,i,r){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(7),s=a(o),l=n(13),c=a(l),d=n(10),u=a(d),h=e.View.extend({el:"#center",model:null,options:{},events:{"click .toolbtn_save_permissions":"savePermissions"},initialize:function(e){this.options=i.extend(this.options,e),this.options.id&&this.fetchFolder()},fetchFolder:function(e){this.options=i.extend(this.options,e),this.model=new c.default.FolderAsModel({id:this.options.id});var t=this;this.model.fetch({success:function(){t.options.show_permissions&&t.showPermissions()},error:function(e,t){void 0!==t.responseJSON?s.default.error(t.responseJSON.err_msg+" Click this to go back.","",{onclick:function(){Galaxy.libraries.library_router.back()}}):s.default.error("An error occurred. Click this to go back.","",{onclick:function(){Galaxy.libraries.library_router.back()}})}})},showPermissions:function(e){this.options=i.extend(this.options,e),r(".tooltip").remove();var t=!1;Galaxy.user&&(t=Galaxy.user.isAdmin());var n=this.templateFolderPermissions();this.$el.html(n({folder:this.model,is_admin:t}));var a=this;r.get(Galaxy.root+"api/folders/"+a.id+"/permissions?scope=current").done(function(e){a.prepareSelectBoxes({fetched_permissions:e})}).fail(function(){s.default.error("An error occurred while attempting to fetch folder permissions.")}),r("#center [data-toggle]").tooltip(),r("#center").css("overflow","auto")},_serializeRoles:function(e){for(var t=[],n=0;n=0;n--)t.push(e[n].id);return t},savePermissions:function(e){var t=this,n=this._extractIds(this.addSelectObject.$el.select2("data")),i=this._extractIds(this.manageSelectObject.$el.select2("data")),a=this._extractIds(this.modifySelectObject.$el.select2("data"));r.post(Galaxy.root+"api/folders/"+t.id+"/permissions?action=set_permissions",{"add_ids[]":n,"manage_ids[]":i,"modify_ids[]":a}).done(function(e){t.showPermissions({fetched_permissions:e}),s.default.success("Permissions saved.")}).fail(function(){s.default.error("An error occurred while attempting to set folder permissions.")})},templateFolderPermissions:function(){return i.template(['
',"<% if (is_admin) { %>","You are logged in as an administrator therefore you can manage any folder on this Galaxy instance. Please make sure you understand the consequences.","<% } else { %>","You can assign any number of roles to any of the following permission types. However please read carefully the implications of such actions.","<% }%>","
",'
',"
Folder permissions
","
","Roles that can manage permissions on this folder","
",'','
',"User with any of these roles can manage permissions on this folder.","
","
","Roles that can add items to this folder","
",'','
',"User with any of these roles can add items to this folder (folders and datasets).","
","
","Roles that can modify this folder","
",'','
',"User with any of these roles can modify this folder (name, etc.).","
")}),t?window.show_modal("Issues loading this workflow","Please review the following issues, possibly resulting from tool upgrades or changes.
"+t+"
",{Continue:hide_modal}):hide_modal(),l.showWorkflowParameters()},beforeSubmit:function(e){show_message("Loading workflow","progress")}}),window.make_popupmenu&&make_popupmenu(e("#workflow-options-button"),{Save:u,"Save As":n,Run:function(){window.location=Galaxy.root+"workflows/run?id="+l.options.id},"Edit Attributes":function(){l.workflow.clear_active_node()},"Auto Re-layout":i,Close:d});var h=e.jStorage.get("overview-size");void 0!==h&&e("#overview-border").css({width:h,height:h}),e.jStorage.get("overview-off")?s():a(),e("#overview-border").bind("dragend",function(t,n){var i=e(this).offsetParent(),r=i.offset(),a=Math.max(i.width()-(n.offsetX-r.left),i.height()-(n.offsetY-r.top));e.jStorage.set("overview-size",a+"px")}),e("#close-viewport").click(function(){"0px"===e("#overview-border").css("right")?s():a()}),window.onbeforeunload=function(){if(workflow&&l.workflow.has_changes)return"There are unsaved changes to your workflow which will be lost."},this.options.workflows.length>0&&e("#left").find(".toolMenu").append(this._buildToolPanelWorkflows()),e("div.toolSectionBody").hide(),e("div.toolSectionTitle > span").wrap("");var p=null;e("div.toolSectionTitle").each(function(){var t=e(this).next("div.toolSectionBody");e(this).click(function(){t.is(":hidden")?(p&&p.slideUp("fast"),p=t,t.slideDown("fast")):(t.slideUp("fast"),p=null)})}),(0,k.default)("workflow-name","workflow-name",l.urls.rename_async,"new_name"),e("#workflow-tag").click(function(){return e(".tag-area").click(),!1}),(0,k.default)("workflow-annotation","workflow-annotation",l.urls.annotate_async,"new_annotation",25,!0,4)},_buildToolPanelWorkflows:function(){var t=this,n=e('
');return r.each(this.options.workflows,function(i){if(i.id!==t.options.id){var r=new w.default.ButtonIcon({icon:"fa fa-copy",cls:"ui-button-icon-plain",tooltip:"Copy and insert individual steps",onclick:function(){i.step_count<2?t.copy_into_workflow(i.id,i.name):Galaxy.modal.show({title:"Warning",body:"This will copy "+i.step_count+" new steps into your workflow.",buttons:{Cancel:function(){Galaxy.modal.hide()},Copy:function(){Galaxy.modal.hide(),t.copy_into_workflow(i.id,i.name)}}})}}),a=e("").attr("href","#").html(i.name).on("click",function(){t.add_node_for_subworkflow(i.latest_id,i.name)});n.find(".toolSectionBg").append(e("").addClass("toolTitle").append(a).append(r.$el))}}),n},copy_into_workflow:function(t){var n=this;this._workflowLoadAjax(t,{success:function(t){n.workflow.from_simple(t,!1);var i="";e.each(t.upgrade_messages,function(t,r){i+="
"}),i?window.show_modal("Subworkflow embedded with changes","Problems were encountered loading this workflow (possibly a result of tool upgrades). Please review the following parameters and then save.
"}),i.html(a),r.show()):(i.html(a),r.hide())},showAttributes:function(){e(".right-content").hide(),e("#edit-attributes").show()},showForm:function(t,n){var i="right-content",r=i+"-"+n.id,a=e("#"+i);if(t&&0==a.find("#"+r).length){var o=e('');if(t.node=n,t.workflow=this.workflow,t.datatypes=this.datatypes,t.icon=m.default[n.type],t.cls="ui-portlet-narrow",n){var s="tool"==n.type?"Tool":"Default";o.append(new y.default[s](t).form.$el),a.append(o)}else Galaxy.emit.debug("workflow-view::initialize()","Node not found in workflow.")}e("."+i).hide(),a.find("#"+r).show(),a.show(),a.scrollTop()},isSubType:function(e,t){return e=this.ext_to_type[e],t=this.ext_to_type[t],this.type_to_type[e]&&t in this.type_to_type[e]},prebuildNode:function(t,n,i){var r=this,a=e(""),o=e("