diff --git a/client/galaxy/scripts/apps/admin.js b/client/galaxy/scripts/apps/admin.js index 569dffc330f..41597424892 100644 --- a/client/galaxy/scripts/apps/admin.js +++ b/client/galaxy/scripts/apps/admin.js @@ -39,8 +39,7 @@ window.app = function app(options, bootstrapped) { this.page.display( new GridView({ url_base: `${Galaxy.root}admin/users_list`, - url_data: Galaxy.params, - dict_format: true + url_data: Galaxy.params }) ); }, @@ -49,8 +48,7 @@ window.app = function app(options, bootstrapped) { this.page.display( new GridView({ url_base: `${Galaxy.root}admin/roles_list`, - url_data: Galaxy.params, - dict_format: true + url_data: Galaxy.params }) ); }, @@ -59,8 +57,7 @@ window.app = function app(options, bootstrapped) { this.page.display( new GridView({ url_base: `${Galaxy.root}admin/groups_list`, - url_data: Galaxy.params, - dict_format: true + url_data: Galaxy.params }) ); }, @@ -69,8 +66,7 @@ window.app = function app(options, bootstrapped) { this.page.display( new GridView({ url_base: `${Galaxy.root}admin_toolshed/browse_repositories`, - url_data: Galaxy.params, - dict_format: true + url_data: Galaxy.params }) ); }, @@ -79,8 +75,7 @@ window.app = function app(options, bootstrapped) { this.page.display( new GridView({ url_base: `${Galaxy.root}admin/tool_versions_list`, - url_data: Galaxy.params, - dict_format: true + url_data: Galaxy.params }) ); }, @@ -89,8 +84,7 @@ window.app = function app(options, bootstrapped) { this.page.display( new GridView({ url_base: `${Galaxy.root}admin/quotas_list`, - url_data: Galaxy.params, - dict_format: true + url_data: Galaxy.params }) ); }, @@ -105,8 +99,7 @@ window.app = function app(options, bootstrapped) { this.page.display( new GridView({ url_base: `${Galaxy.root}forms/forms_list`, - url_data: Galaxy.params, - dict_format: true + url_data: Galaxy.params }) ); }, diff --git a/client/galaxy/scripts/apps/analysis.js b/client/galaxy/scripts/apps/analysis.js index 2be9e2a39c5..db946e372e8 100644 --- a/client/galaxy/scripts/apps/analysis.js +++ b/client/galaxy/scripts/apps/analysis.js @@ -47,6 +47,7 @@ window.app = function app(options, bootstrapped) { "(/)tours(/)(:tour_id)": "show_tours", "(/)user(/)": "show_user", "(/)user(/)(:form_id)": "show_user_form", + "(/)openids(/)list": "show_openids", "(/)pages(/)create(/)": "show_pages_create", "(/)pages(/)edit(/)": "show_pages_edit", "(/)pages(/)(:action_id)": "show_pages", @@ -115,8 +116,7 @@ window.app = function app(options, bootstrapped) { show_workflows_published: function() { this.page.display( new GridView({ - url_base: `${Galaxy.root}workflow/list_published`, - dict_format: true + url_base: `${Galaxy.root}workflow/list_published` }) ); }, @@ -157,11 +157,18 @@ window.app = function app(options, bootstrapped) { ); }, + show_openids: function() { + this.page.display( + new GridView({ + url_base: `${Galaxy.root}user/openids_list` + }) + ); + }, + show_datasets: function() { this.page.display( new GridView({ - url_base: `${Galaxy.root}dataset/list`, - dict_format: true + url_base: `${Galaxy.root}dataset/list` }) ); }, diff --git a/client/galaxy/scripts/galaxy.pages.js b/client/galaxy/scripts/galaxy.pages.js index ed673e70037..c5af3df58b0 100644 --- a/client/galaxy/scripts/galaxy.pages.js +++ b/client/galaxy/scripts/galaxy.pages.js @@ -328,7 +328,6 @@ WYMeditor.editor.prototype.dialog = function(dialogType, dialogFeatures, bodyHtm var grid = new GridView({ url_base: item_info.list_ajax_url, - dict_format: true, embedded: true }); Galaxy.modal.show({ @@ -422,7 +421,6 @@ WYMeditor.editor.prototype.dialog = function(dialogType, dialogFeatures, bodyHtm var grid = new GridView({ url_base: item_info.list_ajax_url, - dict_format: true, embedded: true }); Galaxy.modal.show({ diff --git a/client/galaxy/scripts/legacy/grid/grid-model.js b/client/galaxy/scripts/legacy/grid/grid-model.js new file mode 100644 index 00000000000..f25a4313abe --- /dev/null +++ b/client/galaxy/scripts/legacy/grid/grid-model.js @@ -0,0 +1,114 @@ +// legacy grid model, used by reports and toolshed +export default Backbone.Model.extend({ + defaults: { + url_base: "", + async: false, + async_ops: [], + categorical_filters: [], + filters: {}, + sort_key: null, + show_item_checkboxes: false, + advanced_search: false, + cur_page: 1, + num_pages: 1, + operation: undefined, + item_ids: undefined + }, + + /** + * Return true if operation can be done asynchronously. + */ + can_async_op: function(op) { + return _.indexOf(this.attributes.async_ops, op) !== -1; + }, + + /** + * Add filtering criterion. + */ + add_filter: function(key, value, append) { + // Update URL arg with new condition. + if (append) { + // Update or append value. + var cur_val = this.attributes.filters[key]; + + var new_val; + if (cur_val === null || cur_val === undefined) { + new_val = value; + } else if (typeof cur_val == "string") { + if (cur_val == "All" || cur_val == value) { + new_val = value; + } else { + // Replace string with array. + var values = []; + values[0] = cur_val; + values[1] = value; + new_val = values; + } + } else { + // Current value is an array. + new_val = cur_val; + if (new_val.indexOf(value) === -1) { + new_val.push(value); + } + } + this.attributes.filters[key] = new_val; + } else { + // Replace value. + this.attributes.filters[key] = value; + } + }, + + /** + * Remove filtering criterion. + */ + remove_filter: function(key, condition) { + var cur_val = this.attributes.filters[key]; + if (cur_val === null || cur_val === undefined) { + return false; + } + + if (typeof cur_val === "string") { + // overwrite/remove condition. + this.attributes.filters[key] = ""; + } else { + // filter contains an array of conditions. + var condition_index = _.indexOf(cur_val, condition); + if (condition_index !== -1) { + cur_val[condition_index] = ""; + } + } + }, + + /** + * Returns URL data for obtaining a new grid. + */ + get_url_data: function() { + var url_data = { + async: this.attributes.async, + sort: this.attributes.sort_key, + page: this.attributes.cur_page, + show_item_checkboxes: this.attributes.show_item_checkboxes, + advanced_search: this.attributes.advanced_search + }; + + // Add operation, item_ids only if they have values. + if (this.attributes.operation) { + url_data.operation = this.attributes.operation; + } + if (this.attributes.item_ids) { + url_data.id = this.attributes.item_ids; + } + + // Add filter arguments to data, placing "f-" in front of all arguments. + var self = this; + _.each(_.pairs(self.attributes.filters), k => { + url_data[`f-${k[0]}`] = k[1]; + }); + return url_data; + }, + + // Return URL for obtaining a new grid + get_url: function(args) { + return `${this.get("url_base")}?${$.param(this.get_url_data())}&${$.param(args)}`; + } +}); diff --git a/client/galaxy/scripts/legacy/grid/grid-template.js b/client/galaxy/scripts/legacy/grid/grid-template.js new file mode 100644 index 00000000000..e5fda7d790f --- /dev/null +++ b/client/galaxy/scripts/legacy/grid/grid-template.js @@ -0,0 +1,547 @@ +// dependencies +import Utils from "utils/utils"; +// grid view templates +export default { + // template + grid: function(options) { + var tmpl = ""; + if (options.embedded) { + tmpl = this.grid_header(options) + this.grid_table(options); + } else { + tmpl = `
${this.grid_header( + options + )}
${this.grid_table( + options + )}`; + } + + // add info text + if (options.info_text) { + tmpl += `
${options.info_text}
`; + } + + // return + return tmpl; + }, + + // template + grid_table: function() { + return ` +
+ + + + +
+
`; + }, + + // template + grid_header: function(options) { + var tmpl = '
'; + if (!options.embedded) { + tmpl += `

${options.title}

`; + } + if (options.global_actions) { + tmpl += '"; + } + if (options.insert) { + tmpl += options.insert; + } + + // add grid filters + tmpl += this.grid_filters(options); + tmpl += "
"; + + // return template + return tmpl; + }, + + // template + header: function(options) { + // start + var tmpl = ""; + + // add checkbox + if (options.show_item_checkboxes) { + tmpl += ""; + if (options.items.length > 0) { + tmpl += + '' + + ''; + } + tmpl += ""; + } + + // create header elements + for (let column of options.columns) { + if (column.visible) { + tmpl += ``; + if (column.href) { + tmpl += `${column.label}`; + } else { + tmpl += column.label; + } + tmpl += `${column.extra}`; + } + } + + // finalize + tmpl += ""; + + // return template + return tmpl; + }, + + // template + body: function(options) { + // initialize + var tmpl = ""; + var items_length = options.items.length; + + // empty grid? + if (items_length === 0) { + // No results. + tmpl += 'No Items'; + } + + // create rows + for (let item of options.items) { + // Tag current + tmpl += "`; + } + + // Data columns + for (let column of options.columns) { + if (column.visible) { + // Nowrap + var nowrap = ""; + if (column.nowrap) { + nowrap = 'style="white-space:nowrap;"'; + } + + // get column settings + var column_settings = item.column_config[column.label]; + + // load attributes + var link = column_settings.link; + var value = column_settings.value; + var target = column_settings.target; + + // unescape value + if (jQuery.type(value) === "string") { + value = value.replace(/\/\//g, "/"); + } + + // Attach popup menu? + var id = ""; + var cls = ""; + if (column.attach_popup) { + id = `grid-${item.encode_id}-popup`; + cls = "menubutton"; + if (link !== "") { + cls += " split"; + } + cls += " popup"; + } + + // Check for row wrapping + tmpl += ``; + + // Link + if (link) { + if (options.operations.length !== 0) { + tmpl += `
`; + } + tmpl += `${value}`; + if (options.operations.length !== 0) { + tmpl += "
"; + } + } else { + tmpl += `
`; + } + tmpl += ""; + } + } + tmpl += ""; + } + return tmpl; + }, + + // template + footer: function(options) { + // create template string + var tmpl = ""; + + // paging + if (options.use_paging && options.num_pages > 1) { + // get configuration + var num_page_links = options.num_page_links; + var cur_page_num = options.cur_page_num; + var num_pages = options.num_pages; + + // First pass on min page. + var page_link_range = num_page_links / 2; + var min_page = cur_page_num - page_link_range; + var min_offset = 0; + if (min_page <= 0) { + // Min page is too low. + min_page = 1; + min_offset = page_link_range - (cur_page_num - min_page); + } + + // Set max page. + var max_range = page_link_range + min_offset; + var max_page = cur_page_num + max_range; + var max_offset; + if (max_page <= num_pages) { + // Max page is fine. + max_offset = 0; + } else { + // Max page is too high. + max_page = num_pages; + // +1 to account for the +1 in the loop below. + max_offset = max_range - (max_page + 1 - cur_page_num); + } + + // Second and final pass on min page to add any unused + // offset from max to min. + if (max_offset !== 0) { + min_page -= max_offset; + if (min_page < 1) { + min_page = 1; + } + } + + // template header + tmpl += ''; + if (options.show_item_checkboxes) { + tmpl += ""; + } + tmpl += '' + '' + "Page:"; + + if (min_page > 1) { + tmpl += + '1 ...'; + } + + // create page urls + for (var page_index = min_page; page_index < max_page + 1; page_index++) { + if (page_index == options.cur_page_num) { + tmpl += `${page_index}`; + } else { + tmpl += `${page_index}`; + } + } + + // show last page + if (max_page < num_pages) { + tmpl += `...${num_pages}`; + } + tmpl += ""; + + // Show all link + tmpl += ` + | Show All + + `; + } + + // Grid operations for multiple items. + if (options.show_item_checkboxes) { + // start template + tmpl += ` + + + + + For selected items: + `; + + // configure buttons for operations + for (let operation of options.operations) { + if (operation.allow_multiple) { + tmpl += ` `; + } + } + + // finalize template + tmpl += "" + ""; + } + + // count global operations + var found_global = false; + for (let operation of options.operations) { + if (operation.global_operation) { + found_global = true; + break; + } + } + + // add global operations + if (found_global) { + tmpl += "" + ''; + for (let operation of options.operations) { + if (operation.global_operation) { + tmpl += `${operation.label}`; + } + } + tmpl += "" + ""; + } + + // add legend + if (options.legend) { + tmpl += `${options.legend}`; + } + + // return + return tmpl; + }, + + // template + message: function(options) { + var status = options.status; + if (["success", "ok"].indexOf(status) != -1) { + status = "done"; + } + return `

${_.escape( + options.message + )}

`; + }, + + // template + grid_filters: function(options) { + // get filters + var default_filter_dict = options.default_filter_dict; + var filters = options.filters; + + // show advanced search if flag set or if there are filters for advanced search fields + var advanced_search_display = "none"; + if (options.advanced_search) { + advanced_search_display = "block"; + } + + // identify columns with advanced filtering + var show_advanced_search_link = false; + for (let column of options.columns) { + if (column.filterable == "advanced") { + var column_key = column.key; + var f_key = filters[column_key]; + var d_key = default_filter_dict[column_key]; + if (f_key && d_key && f_key != d_key) { + advanced_search_display = "block"; + } + show_advanced_search_link = true; + } + } + + // hide standard search if advanced is shown + var standard_search_display = "block"; + if (advanced_search_display == "block") { + standard_search_display = "none"; + } + + // + // standard search + // + var tmpl = `"; + + // + // advanced search + // + tmpl += `"; + + // return template + return tmpl; + }, + + // template + grid_column_filter: function(options, column) { + // collect parameters + var filters = options.filters; + var column_label = column.label; + var column_key = column.key; + if (column.filterable == "advanced") { + column_label = column_label.toLowerCase(); + } + + // start + var tmpl = ""; + + if (column.filterable == "advanced") { + tmpl += `${column_label}:`; + } + tmpl += ''; + if (column.is_text) { + tmpl += `
`; + // Carry forward filtering criteria with hidden inputs. + for (let column of options.columns) { + var filter_value = filters[column.key]; + if (filter_value) { + if (filter_value != "All") { + if (column.is_text) { + filter_value = JSON.stringify(filter_value); + } + tmpl += ``; + } + } + } + // Print current filtering criteria and links to delete. + tmpl += ``; + + // add filters + var column_filter = filters[column_key]; + if (column_filter) { + // identify type + var type = jQuery.type(column_filter); + + // single filter value + if (type == "string") { + if (column_filter != "All") { + // append template + tmpl += this.filter_element(column_key, column_filter); + } + } + + // multiple filter values + if (type == "array") { + for (let i in column_filter) { + // copy filters and remove entry + var params = column_filter; + params = params.slice(i); + + // append template + tmpl += this.filter_element(column_key, column_filter[i]); + } + } + } + + // close span + tmpl += ""; + + // Set value, size of search input field. Minimum size is 20 characters. + var value = ""; + var size = 20; + if (column.filterable == "standard") { + value = column.label.toLowerCase(); + if (value.length < 20) { + size = value.length; + } + // +4 to account for space after placeholder + size = size + 4; + } + + // print input field for column + tmpl += ` + + + + +
`; + } else { + // filter criteria + tmpl += ``; + + // add category filters + var seperator = false; + for (var cf_label in options.categorical_filters[column_key]) { + // get category filter + var cf = options.categorical_filters[column_key][cf_label]; + + // each filter will have only a single argument, so get that single argument + var cf_key = ""; + var cf_arg = ""; + for (var key in cf) { + cf_key = key; + cf_arg = cf[key]; + } + + // add seperator + if (seperator) { + tmpl += " | "; + } + seperator = true; + + // add category + var filter = filters[column_key]; + if (filter && cf[column_key] && filter == cf_arg) { + tmpl += `${cf_label}`; + } else { + tmpl += `${cf_label}`; + } + } + tmpl += ""; + } + tmpl += "" + ""; + + // return template + return tmpl; + }, + + // template for filter items + filter_element: function(filter_key, filter_value) { + filter_value = Utils.sanitize(filter_value); + return `${filter_value}`; + } +}; diff --git a/client/galaxy/scripts/legacy/grid/grid-view.js b/client/galaxy/scripts/legacy/grid/grid-view.js new file mode 100644 index 00000000000..05e82077321 --- /dev/null +++ b/client/galaxy/scripts/legacy/grid/grid-view.js @@ -0,0 +1,677 @@ +// This is necessary so that, when nested arrays are used in ajax/post/get methods, square brackets ('[]') are +// not appended to the identifier of a nested array. +jQuery.ajaxSettings.traditional = true; + +// dependencies +import Utils from "utils/utils"; +import GridModel from "legacy/grid/grid-model"; +import Templates from "legacy/grid/grid-template"; +import PopupMenu from "mvc/ui/popup-menu"; +// grid view +export default Backbone.View.extend({ + // model + grid: null, + + // Initialize + initialize: function(grid_config) { + this.grid = new GridModel(); + this.dict_format = grid_config.dict_format; + this.title = grid_config.title; + var self = this; + window.add_tag_to_grid_filter = (tag_name, tag_value) => { + // Put tag name and value together. + var tag = tag_name + (tag_value !== undefined && tag_value !== "" ? `:${tag_value}` : ""); + var advanced_search = $("#advanced-search").is(":visible"); + if (!advanced_search) { + $("#standard-search").slideToggle("fast"); + $("#advanced-search").slideToggle("fast"); + } + self.add_filter_condition("tags", tag); + }; + + // set element + if (this.dict_format) { + this.setElement("
"); + if (grid_config.url_base && !grid_config.items) { + var url_data = grid_config.url_data || {}; + _.each(grid_config.filters, (v, k) => { + url_data[`f-${k}`] = v; + }); + $.ajax({ + url: `${grid_config.url_base}?${$.param(url_data)}`, + success: function(response) { + response.embedded = grid_config.embedded; + response.filters = grid_config.filters || {}; + self.init_grid(response); + } + }); + } else { + this.init_grid(grid_config); + } + } else { + this.setElement("#grid-container"); + this.init_grid(grid_config); + } + + // fix padding + if (grid_config.use_panels) { + $("#center").css({ + padding: "10px", + overflow: "auto" + }); + } + }, + + // refresh frames + handle_refresh: function(refresh_frames) { + if (refresh_frames) { + if ($.inArray("history", refresh_frames) > -1) { + if (window.top.Galaxy && window.top.Galaxy.currHistoryPanel) { + window.top.Galaxy.currHistoryPanel.loadCurrentHistory(); + } + } + } + }, + + // Initialize + init_grid: function(grid_config) { + this.grid.set(grid_config); + + // get options + var options = this.grid.attributes; + + if (this.allow_title_display && options.title) { + Utils.setWindowTitle(options.title); + } + // handle refresh requests + this.handle_refresh(options.refresh_frames); + + // strip protocol and domain + var url = this.grid.get("url_base"); + url = url.replace(/^.*\/\/[^\/]+/, ""); + this.grid.set("url_base", url); + + // append main template + this.$el.html(Templates.grid(options)); + + // update div contents + this.$el.find("#grid-table-header").html(Templates.header(options)); + this.$el.find("#grid-table-body").html(Templates.body(options)); + this.$el.find("#grid-table-footer").html(Templates.footer(options)); + + // update message + if (options.message) { + this.$el.find("#grid-message").html(Templates.message(options)); + var self = this; + if (options.use_hide_message) { + setTimeout(() => { + self.$el.find("#grid-message").html(""); + }, 5000); + } + } + + // configure elements + this.init_grid_elements(); + this.init_grid_controls(); + + // attach global event handler + // TODO: redundant (the onload/standard page handlers do this) - but needed because these are constructed after page ready + if (window.init_refresh_on_change) { + window.init_refresh_on_change(); + } + }, + + // Initialize grid controls + init_grid_controls: function() { + // link + var self = this; + + // Initialize grid operation button. + this.$el.find(".operation-button").each(function() { + $(this).off(); + $(this).click(function() { + self.submit_operation(this); + return false; + }); + }); + + // Initialize text filters to select text on click and use normal font when user is typing. + this.$el.find("input[type=text]").each(function() { + $(this).off(); + $(this) + .click(function() { + $(this).select(); + }) + .keyup(function() { + $(this).css("font-style", "normal"); + }); + }); + + // Initialize sort links. + this.$el.find(".sort-link").each(function() { + $(this).off(); + $(this).click(function() { + self.set_sort_condition($(this).attr("sort_key")); + return false; + }); + }); + + // Initialize text filters. + this.$el.find(".text-filter-form").each(function() { + $(this).off(); + $(this).submit(function() { + var column_key = $(this).attr("column_key"); + var text_input_obj = $(`#input-${column_key}-filter`); + var text_input = text_input_obj.val(); + text_input_obj.val(""); + self.add_filter_condition(column_key, text_input); + return false; + }); + }); + + // Initialize categorical filters. + this.$el.find(".text-filter-val > a").each(function() { + $(this).off(); + $(this).click(function() { + // Remove visible element. + $(this) + .parent() + .remove(); + + // Remove filter condition. + self.remove_filter_condition($(this).attr("filter_key"), $(this).attr("filter_val")); + + // Return + return false; + }); + }); + + // Initialize categorical filters. + this.$el.find(".categorical-filter > a").each(function() { + $(this).off(); + $(this).click(function() { + self.set_categorical_filter($(this).attr("filter_key"), $(this).attr("filter_val")); + return false; + }); + }); + + // Initialize standard, advanced search toggles. + this.$el.find(".advanced-search-toggle").each(function() { + $(this).off(); + $(this).click(() => { + self.$el.find("#standard-search").slideToggle("fast"); + self.$el.find("#advanced-search").slideToggle("fast"); + return false; + }); + }); + + // Add event to check all box + this.$el.find("#check_all").off(); + this.$el.find("#check_all").on("click", () => { + self.check_all_items(); + }); + }, + + // Initialize grid elements. + init_grid_elements: function() { + // Initialize grid selection checkboxes. + this.$el.find(".grid").each(function() { + var checkboxes = $(this).find("input.grid-row-select-checkbox"); + var check_count = $(this).find("span.grid-selected-count"); + var update_checked = () => { + check_count.text($(checkboxes).filter(":checked").length); + }; + + $(checkboxes).each(function() { + $(this).change(update_checked); + }); + update_checked(); + }); + + // Initialize ratings. + if (this.$el.find(".community_rating_star").length !== 0) this.$el.find(".community_rating_star").rating({}); + + // get options + var options = this.grid.attributes; + var self = this; + + // + // add page click events + // + this.$el.find(".page-link > a").each(function() { + $(this).click(function() { + self.set_page($(this).attr("page_num")); + return false; + }); + }); + + // + // add inbound/outbound events + // + this.$el.find(".use-target").each(function() { + $(this).click(function() { + self.execute({ + href: $(this).attr("href"), + target: $(this).attr("target") + }); + return false; + }); + }); + + // empty grid? + var items_length = options.items.length; + if (items_length === 0) { + return; + } + + // add operation popup menus + _.each(options.items, (item, index) => { + var button = self.$(`#grid-${item.encode_id}-popup`).off(); + var popup = new PopupMenu(button); + _.each(options.operations, operation => { + self._add_operation(popup, operation, item); + }); + }); + }, + + /** Add an operation to the items menu */ + _add_operation: function(popup, operation, item) { + var self = this; + var settings = item.operation_config[operation.label]; + if (settings.allowed && operation.allow_popup) { + popup.addItem({ + html: operation.label, + href: settings.url_args, + target: settings.target, + confirmation_text: operation.confirm, + func: function(e) { + e.preventDefault(); + var label = $(e.target).html(); + if (operation.onclick) { + operation.onclick(item.encode_id); + } else { + self.execute(this.findItemByHtml(label)); + } + } + }); + } + }, + + // Add a condition to the grid filter; this adds the condition and refreshes the grid. + add_filter_condition: function(name, value) { + // Do nothing is value is empty. + if (value === "") { + return false; + } + + // Add condition to grid. + this.grid.add_filter(name, value, true); + + // Add button that displays filter and provides a button to delete it. + var t = $(Templates.filter_element(name, value)); + var self = this; + t.click(function() { + // Remove visible element. + $(this).remove(); + + // Remove filter condition. + self.remove_filter_condition(name, value); + }); + + // append to container + var container = this.$el.find(`#${name}-filtering-criteria`); + container.append(t); + + // execute + this.go_page_one(); + this.execute(); + }, + + // Remove a condition to the grid filter; this adds the condition and refreshes the grid. + remove_filter_condition: function(name, value) { + // Remove filter condition. + this.grid.remove_filter(name, value); + + // Execute + this.go_page_one(); + this.execute(); + }, + + // Set sort condition for grid. + set_sort_condition: function(col_key) { + // Set new sort condition. New sort is col_key if sorting new column; if reversing sort on + // currently sorted column, sort is reversed. + var cur_sort = this.grid.get("sort_key"); + var new_sort = col_key; + if (cur_sort.indexOf(col_key) !== -1) { + // Reverse sort. + if (cur_sort.substring(0, 1) !== "-") { + new_sort = `-${col_key}`; + } + } + + // Remove sort arrows elements. + this.$el.find(".sort-arrow").remove(); + + // Add sort arrow element to new sort column. + var sort_arrow = new_sort.substring(0, 1) == "-" ? "↑" : "↓"; + var t = $(`${sort_arrow}`).addClass("sort-arrow"); + + // Add to header + this.$el.find(`#${col_key}-header`).append(t); + + // Update grid. + this.grid.set("sort_key", new_sort); + this.go_page_one(); + this.execute(); + }, + + // Set new value for categorical filter. + set_categorical_filter: function(name, new_value) { + // Update filter hyperlinks to reflect new filter value. + var category_filter = this.grid.get("categorical_filters")[name]; + + var cur_value = this.grid.get("filters")[name]; + var self = this; + this.$el.find(`.${name}-filter`).each(function() { + var text = $.trim($(this).text()); + var filter = category_filter[text]; + var filter_value = filter[name]; + if (filter_value == new_value) { + // Remove filter link since grid will be using this filter. It is assumed that + // this element has a single child, a hyperlink/anchor with text. + $(this).empty(); + $(this).addClass("current-filter"); + $(this).append(text); + } else if (filter_value == cur_value) { + // Add hyperlink for this filter since grid will no longer be using this filter. It is assumed that + // this element has a single child, a hyperlink/anchor. + $(this).empty(); + var t = $(`${text}`); + t.click(() => { + self.set_categorical_filter(name, filter_value); + }); + $(this).removeClass("current-filter"); + $(this).append(t); + } + }); + + // Update grid. + this.grid.add_filter(name, new_value); + this.go_page_one(); + this.execute(); + }, + + // Set page to view. + set_page: function(new_page) { + // Update page hyperlink to reflect new page. + var self = this; + this.$el.find(".page-link").each(function() { + var id = $(this).attr("id"); + + var // Id has form 'page-link- + page_num = parseInt(id.split("-")[2], 10); + + var cur_page = self.grid.get("cur_page"); + var text; + if (page_num === new_page) { + // Remove link to page since grid will be on this page. It is assumed that + // this element has a single child, a hyperlink/anchor with text. + text = $(this) + .children() + .text(); + $(this).empty(); + $(this).addClass("inactive-link"); + $(this).text(text); + } else if (page_num === cur_page) { + // Add hyperlink to this page since grid will no longer be on this page. It is assumed that + // this element has a single child, a hyperlink/anchor. + text = $(this).text(); + $(this).empty(); + $(this).removeClass("inactive-link"); + var t = $(`${text}`); + t.click(() => { + self.set_page(page_num); + }); + $(this).append(t); + } + }); + + if (new_page === "all") { + this.grid.set("cur_page", new_page); + } else { + this.grid.set("cur_page", parseInt(new_page, 10)); + } + this.execute(); + }, + + // confirmation/submission of operation request + submit_operation: function(operation_button, confirmation_text) { + // identify operation + var operation_name = $(operation_button).val(); + + // verify any item is selected + var number_of_checked_ids = this.$el.find('input[name="id"]:checked').length; + if (number_of_checked_ids < 1) { + return false; + } + + // Check to see if there's grid confirmation text for this operation + var operation = _.findWhere(this.grid.attributes.operations, { + label: operation_name + }); + if (operation && !confirmation_text) { + confirmation_text = operation.confirm || ""; + } + + // collect ids + var item_ids = []; + this.$el.find("input[name=id]:checked").each(function() { + item_ids.push($(this).val()); + }); + + // execute operation + var options = { + operation: operation_name, + id: item_ids, + confirmation_text: confirmation_text + }; + if (operation.target == "top" || operation.target == "center") { + options = _.extend(options, { + href: operation.href, + target: operation.target + }); + } + this.execute(options); + return true; + }, + + check_all_items: function() { + var check = this.$(".grid-row-select-checkbox"); + var state = this.$("#check_all").prop("checked"); + _.each(check, c => { + $(c).prop("checked", state); + }); + this.init_grid_elements(); + }, + + // Go back to page one; this is useful when a filter is applied. + go_page_one: function() { + // Need to go back to page 1 if not showing all. + var cur_page = this.grid.get("cur_page"); + if (cur_page !== null && cur_page !== undefined && cur_page !== "all") { + this.grid.set("cur_page", 1); + } + }, + + // + // execute operations and hyperlink requests + // + execute: function(options) { + // get url + var id = null; + var href = null; + var operation = null; + var confirmation_text = null; + var target = null; + + // check for options + if (options) { + // get options + href = options.href; + operation = options.operation; + id = options.id; + confirmation_text = options.confirmation_text; + target = options.target; + + // check if input contains the operation tag + if (href !== undefined && href.indexOf("operation=") != -1) { + // Get operation, id in hyperlink's href. + var href_parts = href.split("?"); + if (href_parts.length > 1) { + var href_parms_str = href_parts[1]; + var href_parms = href_parms_str.split("&"); + for (var index = 0; index < href_parms.length; index++) { + if (href_parms[index].indexOf("operation") != -1) { + // Found operation parm; get operation value. + operation = href_parms[index].split("=")[1]; + operation = operation.replace(/\+/g, " "); + } else if (href_parms[index].indexOf("id") != -1) { + // Found id parm; get id value. + id = href_parms[index].split("=")[1]; + } + } + } + } + } + + // check for operation details + if (operation && id) { + // show confirmation box + if ( + confirmation_text && + confirmation_text !== "" && + confirmation_text != "None" && + confirmation_text != "null" + ) + if (!confirm(confirmation_text)) return false; + + // use small characters for operation?! + operation = operation.toLowerCase(); + + // Update grid. + this.grid.set({ + operation: operation, + item_ids: id + }); + + // Do operation. If operation cannot be performed asynchronously, redirect to location. + if (target == "top") { + window.top.location = `${href}?${$.param(this.grid.get_url_data())}`; + } else if (target == "center") { + $("#galaxy_main").attr("src", `${href}?${$.param(this.grid.get_url_data())}`); + } else if (this.grid.can_async_op(operation) || this.dict_format) { + this.update_grid(); + } else { + this.go_to(target, href); + } + + // done + return false; + } + + // refresh grid + if (href) { + this.go_to(target, href); + return false; + } + + // refresh grid + if (this.grid.get("async") || this.dict_format) { + this.update_grid(); + } else { + this.go_to(target, href); + } + + // done + return false; + }, + + // go to url + go_to: function(target, href) { + // get aysnc status + var async = this.grid.get("async"); + this.grid.set("async", false); + + // get slide status + var advanced_search = this.$el.find("#advanced-search").is(":visible"); + this.grid.set("advanced_search", advanced_search); + + // get default url + if (!href) { + href = `${this.grid.get("url_base")}?${$.param(this.grid.get_url_data())}`; + } + + // clear grid of transient request attributes. + this.grid.set({ + operation: undefined, + item_ids: undefined, + async: async + }); + switch (target) { + case "center": + $("#galaxy_main").attr("src", href); + break; + case "top": + window.top.location = href; + break; + default: + window.location = href; + } + }, + + // Update grid. + update_grid: function() { + // If there's an operation, do POST; otherwise, do GET. + var method = this.grid.get("operation") ? "POST" : "GET"; + + // Show overlay to indicate loading and prevent user actions. + this.$el.find(".loading-elt-overlay").show(); + var self = this; + $.ajax({ + type: method, + url: self.grid.get("url_base"), + data: self.grid.get_url_data(), + error: function() { + alert("Grid refresh failed"); + }, + success: function(response_text) { + // backup + var embedded = self.grid.get("embedded"); + var insert = self.grid.get("insert"); + var advanced_search = self.$el.find("#advanced-search").is(":visible"); + + // request new configuration + var json = self.dict_format ? response_text : $.parseJSON(response_text); + + // update + json.embedded = embedded; + json.insert = insert; + json.advanced_search = advanced_search; + + // Initialize new grid config + self.init_grid(json); + + // Hide loading overlay. + self.$el.find(".loading-elt-overlay").hide(); + }, + complete: function() { + // Clear grid of transient request attributes. + self.grid.set({ + operation: undefined, + item_ids: undefined + }); + } + }); + } +}); diff --git a/client/galaxy/scripts/mvc/grid/grid-model.js b/client/galaxy/scripts/mvc/grid/grid-model.js index 6e3fc1698f9..bd4b3c99350 100644 --- a/client/galaxy/scripts/mvc/grid/grid-model.js +++ b/client/galaxy/scripts/mvc/grid/grid-model.js @@ -17,13 +17,6 @@ export default Backbone.Model.extend({ item_ids: undefined }, - /** - * Return true if operation can be done asynchronously. - */ - can_async_op: function(op) { - return _.indexOf(this.attributes.async_ops, op) !== -1; - }, - /** * Add filtering criterion. */ diff --git a/client/galaxy/scripts/mvc/grid/grid-shared.js b/client/galaxy/scripts/mvc/grid/grid-shared.js index a2eebe703a7..34cb89f75f3 100644 --- a/client/galaxy/scripts/mvc/grid/grid-shared.js +++ b/client/galaxy/scripts/mvc/grid/grid-shared.js @@ -10,7 +10,6 @@ var View = Backbone.View.extend({ $.ajax({ url: `${Galaxy.root + this.item}/${this.model.get("action_id")}?${$.param(Galaxy.params)}`, success: function(response) { - response["dict_format"] = true; self.model.set(response); self.render(); } diff --git a/client/galaxy/scripts/mvc/grid/grid-template.js b/client/galaxy/scripts/mvc/grid/grid-template.js index 5299ab1a87f..e5fda7d790f 100644 --- a/client/galaxy/scripts/mvc/grid/grid-template.js +++ b/client/galaxy/scripts/mvc/grid/grid-template.js @@ -112,14 +112,12 @@ export default { body: function(options) { // initialize var tmpl = ""; - var num_rows_rendered = 0; var items_length = options.items.length; // empty grid? if (items_length === 0) { // No results. tmpl += 'No Items'; - num_rows_rendered = 1; } // create rows @@ -193,7 +191,6 @@ export default { } } tmpl += ""; - num_rows_rendered++; } return tmpl; }, diff --git a/client/galaxy/scripts/mvc/grid/grid-view.js b/client/galaxy/scripts/mvc/grid/grid-view.js index 26d66e6a2db..87e4aef2980 100644 --- a/client/galaxy/scripts/mvc/grid/grid-view.js +++ b/client/galaxy/scripts/mvc/grid/grid-view.js @@ -15,7 +15,6 @@ export default Backbone.View.extend({ // Initialize initialize: function(grid_config) { this.grid = new GridModel(); - this.dict_format = grid_config.dict_format; this.title = grid_config.title; var self = this; window.add_tag_to_grid_filter = (tag_name, tag_value) => { @@ -30,26 +29,21 @@ export default Backbone.View.extend({ }; // set element - if (this.dict_format) { - this.setElement("
"); - if (grid_config.url_base && !grid_config.items) { - var url_data = grid_config.url_data || {}; - _.each(grid_config.filters, (v, k) => { - url_data[`f-${k}`] = v; - }); - $.ajax({ - url: `${grid_config.url_base}?${$.param(url_data)}`, - success: function(response) { - response.embedded = grid_config.embedded; - response.filters = grid_config.filters || {}; - self.init_grid(response); - } - }); - } else { - this.init_grid(grid_config); - } + this.setElement("
"); + if (grid_config.url_base && !grid_config.items) { + var url_data = grid_config.url_data || {}; + _.each(grid_config.filters, (v, k) => { + url_data[`f-${k}`] = v; + }); + $.ajax({ + url: `${grid_config.url_base}?${$.param(url_data)}`, + success: function(response) { + response.embedded = grid_config.embedded; + response.filters = grid_config.filters || {}; + self.init_grid(response); + } + }); } else { - this.setElement("#grid-container"); this.init_grid(grid_config); } @@ -570,10 +564,8 @@ export default Backbone.View.extend({ window.top.location = `${href}?${$.param(this.grid.get_url_data())}`; } else if (target == "center") { $("#galaxy_main").attr("src", `${href}?${$.param(this.grid.get_url_data())}`); - } else if (this.grid.can_async_op(operation) || this.dict_format) { - this.update_grid(); } else { - this.go_to(target, href); + this.update_grid(); } // done @@ -587,11 +579,7 @@ export default Backbone.View.extend({ } // refresh grid - if (this.grid.get("async") || this.dict_format) { - this.update_grid(); - } else { - this.go_to(target, href); - } + this.update_grid(); // done return false; @@ -599,10 +587,6 @@ export default Backbone.View.extend({ // go to url go_to: function(target, href) { - // get aysnc status - var async = this.grid.get("async"); - this.grid.set("async", false); - // get slide status var advanced_search = this.$el.find("#advanced-search").is(":visible"); this.grid.set("advanced_search", advanced_search); @@ -615,8 +599,7 @@ export default Backbone.View.extend({ // clear grid of transient request attributes. this.grid.set({ operation: undefined, - item_ids: undefined, - async: async + item_ids: undefined }); switch (target) { case "center": @@ -652,7 +635,7 @@ export default Backbone.View.extend({ var advanced_search = self.$el.find("#advanced-search").is(":visible"); // request new configuration - var json = self.dict_format ? response_text : $.parseJSON(response_text); + var json = response_text; // update json.embedded = embedded; diff --git a/client/galaxy/scripts/mvc/history/history-list.js b/client/galaxy/scripts/mvc/history/history-list.js index a46dfbcd44a..98f0ad17f6f 100644 --- a/client/galaxy/scripts/mvc/history/history-list.js +++ b/client/galaxy/scripts/mvc/history/history-list.js @@ -60,7 +60,6 @@ var View = Backbone.View.extend({ Utils.get({ url: `${Galaxy.root}history/${options.action_id}?${$.param(Galaxy.params)}`, success: function(response) { - response.dict_format = true; self.model.set(response); self.render(); } diff --git a/client/galaxy/scripts/mvc/toolshed/repository-view.js b/client/galaxy/scripts/mvc/toolshed/repository-view.js index d31a5364fc3..5cb378cd3dc 100644 --- a/client/galaxy/scripts/mvc/toolshed/repository-view.js +++ b/client/galaxy/scripts/mvc/toolshed/repository-view.js @@ -478,7 +478,7 @@ var ToolShedRepositoryView = Backbone.View.extend({ "<% _.each(shed_tool_confs.options, function(conf) { %>", '', "<% }); %>", - '', + "", '
Select the file whose tool_path setting you want used for installing repositories.
', "
", "
" diff --git a/client/galaxy/scripts/mvc/user/user-preferences.js b/client/galaxy/scripts/mvc/user/user-preferences.js index 277b9618515..ea92b5dfb50 100644 --- a/client/galaxy/scripts/mvc/user/user-preferences.js +++ b/client/galaxy/scripts/mvc/user/user-preferences.js @@ -62,7 +62,7 @@ var Model = Backbone.Model.extend({ description: _l("Associate OpenIDs with your account."), icon: "fa-openid", onclick: function() { - window.location.href = `${Galaxy.root}user/openid_manage?cntrller=user&use_panels=True`; + window.location.href = `${Galaxy.root}openids/list`; } }, custom_builds: { diff --git a/client/galaxy/scripts/reports_webapp/run_stats.js b/client/galaxy/scripts/reports/run_stats.js similarity index 100% rename from client/galaxy/scripts/reports_webapp/run_stats.js rename to client/galaxy/scripts/reports/run_stats.js diff --git a/client/galaxy/scripts/viz/trackster.js b/client/galaxy/scripts/viz/trackster.js index c8fe566fef7..88e49e2142c 100644 --- a/client/galaxy/scripts/viz/trackster.js +++ b/client/galaxy/scripts/viz/trackster.js @@ -459,7 +459,6 @@ var TracksterView = Backbone.View.extend({ view_in_saved: function(dataset_params) { var tracks_grid = new GridView({ url_base: `${Galaxy.root}visualization/list_tracks`, - dict_format: true, embedded: true }); Galaxy.modal.show({ diff --git a/client/galaxy/scripts/viz/visualization.js b/client/galaxy/scripts/viz/visualization.js index 0b25339cf82..7ba8c775ad3 100644 --- a/client/galaxy/scripts/viz/visualization.js +++ b/client/galaxy/scripts/viz/visualization.js @@ -46,14 +46,12 @@ var select_datasets = (filters, success_fn) => { var history_grid = new GridView({ url_base: `${Galaxy.root}visualization/list_history_datasets`, filters: filters, - dict_format: true, embedded: true }); // library dataset selection tab var library_grid = new GridView({ url_base: `${Galaxy.root}visualization/list_library_datasets`, - dict_format: true, embedded: true }); diff --git a/lib/galaxy/web/base/controller.py b/lib/galaxy/web/base/controller.py index 9cc3a9564a7..78b7478990f 100644 --- a/lib/galaxy/web/base/controller.py +++ b/lib/galaxy/web/base/controller.py @@ -1289,21 +1289,6 @@ class UsesFormDefinitionsMixin: else: return [fdc.latest_form for fdc in fdc_list if fdc.latest_form.type == form_type] - def field_param_values_ok(self, widget_name, widget_type, **kwd): - # Make sure required fields have contents, etc - params = util.Params(kwd) - if widget_type == 'AddressField': - if not util.restore_text(params.get('%s_short_desc' % widget_name, '')) \ - or not util.restore_text(params.get('%s_name' % widget_name, '')) \ - or not util.restore_text(params.get('%s_institution' % widget_name, '')) \ - or not util.restore_text(params.get('%s_address' % widget_name, '')) \ - or not util.restore_text(params.get('%s_city' % widget_name, '')) \ - or not util.restore_text(params.get('%s_state' % widget_name, '')) \ - or not util.restore_text(params.get('%s_postal_code' % widget_name, '')) \ - or not util.restore_text(params.get('%s_country' % widget_name, '')): - return False - return True - def save_widget_field(self, trans, field_obj, widget_name, **kwd): # Save a form_builder field object params = util.Params(kwd) diff --git a/lib/galaxy/web/framework/helpers/grids.py b/lib/galaxy/web/framework/helpers/grids.py index fbfc11faf38..69354b891d8 100644 --- a/lib/galaxy/web/framework/helpers/grids.py +++ b/lib/galaxy/web/framework/helpers/grids.py @@ -10,7 +10,6 @@ from galaxy.model.item_attrs import RuntimeException, UsesAnnotations, UsesItemR from galaxy.util import restore_text, sanitize_text, unicodify from galaxy.util.odict import odict from galaxy.web.framework import decorators, url_for -from galaxy.web.framework.helpers import iff log = logging.getLogger(__name__) @@ -21,12 +20,8 @@ class Grid(object): Specifies the content and format of a grid (data table). """ title = "" - exposed = True model_class = None show_item_checkboxes = False - template = "grid_base.mako" - async_template = "grid_base_async.mako" - use_async = False use_hide_message = True global_actions = [] columns = [] @@ -35,14 +30,12 @@ class Grid(object): # Any columns that are filterable (either standard or advanced) should have a default value set in the default filter. default_filter = {} default_sort_key = None - preserve_state = False use_paging = False num_rows_per_page = 25 num_page_links = 10 # Set preference names. cur_filter_pref_name = ".filter" cur_sort_key_pref_name = ".sort_key" - pass_through_operations = {} legend = None info_text = None @@ -65,7 +58,6 @@ class Grid(object): # FIXME: pretty sure this is only here to pass along, can likely be eliminated status = kwargs.get('status', None) message = kwargs.get('message', None) - dict_format = kwargs.get('dict_format', False) # Build a base filter and sort key that is the combination of the saved state and defaults. # Saved state takes preference over defaults. base_filter = {} @@ -73,14 +65,6 @@ class Grid(object): # default_filter is a dictionary that provides a default set of filters based on the grid's columns. base_filter = self.default_filter.copy() base_sort_key = self.default_sort_key - if self.preserve_state: - pref_name = text_type(self.__class__.__name__ + self.cur_filter_pref_name) - if pref_name in trans.get_user().preferences: - saved_filter = loads(trans.get_user().preferences[pref_name]) - base_filter.update(saved_filter) - pref_name = text_type(self.__class__.__name__ + self.cur_sort_key_pref_name) - if pref_name in trans.get_user().preferences: - base_sort_key = loads(trans.get_user().preferences[pref_name]) # Build initial query query = self.build_initial_query(trans, **kwargs) query = self.apply_query_filter(trans, query, **kwargs) @@ -228,26 +212,11 @@ class Grid(object): # There are some places in grid templates where it's useful for a grid # to have its current filter. self.cur_filter_dict = cur_filter_dict - # Preserve grid state: save current filter and sort key. - if self.preserve_state: - pref_name = text_type(self.__class__.__name__ + self.cur_filter_pref_name) - trans.get_user().preferences[pref_name] = text_type(dumps(cur_filter_dict)) - if sort_key: - pref_name = text_type(self.__class__.__name__ + self.cur_sort_key_pref_name) - trans.get_user().preferences[pref_name] = text_type(dumps(sort_key)) - trans.sa_session.flush() + # Log grid view. context = text_type(self.__class__.__name__) params = cur_filter_dict.copy() params['sort'] = sort_key - params['async'] = ('async' in kwargs) - - # TODO:?? - # commenting this out; when this fn calls session.add( action ) and session.flush the query from this fn - # is effectively 'wiped' out. Nate believes it has something to do with our use of session( autocommit=True ) - # in mapping.py. If you change that to False, the log_action doesn't affect the query - # Below, I'm rendering the template first (that uses query), then calling log_action, then returning the page - # trans.log_action( trans.get_user(), text_type( "grid.view" ), context, params ) # Render grid. def url(*args, **kwargs): @@ -280,43 +249,14 @@ class Grid(object): self.use_panels = (kwargs.get('use_panels', False) in [True, 'True', 'true']) self.advanced_search = (kwargs.get('advanced_search', False) in [True, 'True', 'true']) - async_request = ((self.use_async) and (kwargs.get('async', False) in [True, 'True', 'true'])) # Currently, filling the template returns a str object; this requires decoding the string into a # unicode object within mako templates. What probably should be done is to return the template as # utf-8 unicode; however, this would require encoding the object as utf-8 before returning the grid # results via a controller method, which is require substantial changes. Hence, for now, return grid # as str. - if not dict_format: - page = trans.fill_template(iff(async_request, self.async_template, self.template), - grid=self, - query=query, - cur_page_num=page_num, - num_pages=num_pages, - num_page_links=self.num_page_links, - default_filter_dict=self.default_filter, - cur_filter_dict=cur_filter_dict, - sort_key=sort_key, - current_item=current_item, - ids=kwargs.get('id', []), - url=url, - status=status, - message=message, - info_text=self.info_text, - use_panels=self.use_panels, - use_hide_message=self.use_hide_message, - advanced_search=self.advanced_search, - show_item_checkboxes=(self.show_item_checkboxes or - kwargs.get('show_item_checkboxes', '') in ['True', 'true']), - # Pass back kwargs so that grid template can set and use args without - # grid explicitly having to pass them. - kwargs=kwargs) - trans.log_action(trans.get_user(), text_type("grid.view"), context, params) - return page - grid_config = { 'title' : self.title, 'url_base' : trans.request.path_url, - 'async' : self.use_async, 'async_ops' : [], 'categorical_filters' : {}, 'filters' : cur_filter_dict, diff --git a/lib/galaxy/webapps/galaxy/buildapp.py b/lib/galaxy/webapps/galaxy/buildapp.py index 04f56c0fd5f..db3ac23a267 100644 --- a/lib/galaxy/webapps/galaxy/buildapp.py +++ b/lib/galaxy/webapps/galaxy/buildapp.py @@ -106,6 +106,7 @@ def app_factory(global_conf, load_app_kwds={}, **kwargs): webapp.add_client_route('/tours/{tour_id}') webapp.add_client_route('/user') webapp.add_client_route('/user/{form_id}') + webapp.add_client_route('/openids/list') webapp.add_client_route('/visualizations/list_published') webapp.add_client_route('/visualizations/list') webapp.add_client_route('/visualizations/edit') diff --git a/lib/galaxy/webapps/galaxy/controllers/admin.py b/lib/galaxy/webapps/galaxy/controllers/admin.py index 1de539d9785..4941f9941a9 100644 --- a/lib/galaxy/webapps/galaxy/controllers/admin.py +++ b/lib/galaxy/webapps/galaxy/controllers/admin.py @@ -154,7 +154,6 @@ class UserListGrid(grids.Grid): grids.GridColumnFilter("All", args=dict(deleted='All')) ] num_rows_per_page = 50 - preserve_state = False use_paging = True def get_current_item(self, trans, **kwargs): @@ -255,7 +254,6 @@ class RoleListGrid(grids.Grid): grids.GridColumnFilter("All", args=dict(deleted='All')) ] num_rows_per_page = 50 - preserve_state = False use_paging = True def apply_query_filter(self, trans, query, **kwargs): @@ -335,7 +333,6 @@ class GroupListGrid(grids.Grid): grids.GridColumnFilter("All", args=dict(deleted='All')) ] num_rows_per_page = 50 - preserve_state = False use_paging = True @@ -447,7 +444,6 @@ class QuotaListGrid(grids.Grid): grids.GridColumnFilter("All", args=dict(deleted='All')) ] num_rows_per_page = 50 - preserve_state = False use_paging = True @@ -499,7 +495,6 @@ class ToolVersionListGrid(grids.Grid): standard_filters = [] default_filter = {} num_rows_per_page = 50 - preserve_state = False use_paging = True def build_initial_query(self, trans, **kwd): @@ -559,7 +554,6 @@ class AdminGalaxy(controller.JSAppLauncher, AdminActions, UsesQuotaMixin, QuotaP if message and status: kwd['message'] = util.sanitize_text(message) kwd['status'] = status - kwd['dict_format'] = True return self.user_list_grid(trans, **kwd) @web.expose_api @@ -592,7 +586,6 @@ class AdminGalaxy(controller.JSAppLauncher, AdminActions, UsesQuotaMixin, QuotaP if message: kwargs['message'] = util.sanitize_text(message) kwargs['status'] = status or 'done' - kwargs['dict_format'] = True return self.quota_list_grid(trans, **kwargs) @web.expose_api @@ -902,7 +895,6 @@ class AdminGalaxy(controller.JSAppLauncher, AdminActions, UsesQuotaMixin, QuotaP @web.expose_api @web.require_admin def tool_versions_list(self, trans, **kwd): - kwd['dict_format'] = True return self.tool_version_list_grid(trans, **kwd) @web.expose @@ -923,7 +915,6 @@ class AdminGalaxy(controller.JSAppLauncher, AdminActions, UsesQuotaMixin, QuotaP message, status = self._undelete_role(trans, ids) elif operation == 'purge': message, status = self._purge_role(trans, ids) - kwargs['dict_format'] = True if message and status: kwargs['message'] = util.sanitize_text(message) kwargs['status'] = status @@ -1168,7 +1159,6 @@ class AdminGalaxy(controller.JSAppLauncher, AdminActions, UsesQuotaMixin, QuotaP message, status = self._undelete_group(trans, ids) elif operation == 'purge': message, status = self._purge_group(trans, ids) - kwargs['dict_format'] = True if message and status: kwargs['message'] = util.sanitize_text(message) kwargs['status'] = status diff --git a/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py b/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py index c8d2c278d41..e4045f8508f 100644 --- a/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py +++ b/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py @@ -88,7 +88,6 @@ class AdminToolshed(AdminGalaxy): if message and status: kwd['message'] = util.sanitize_text(message) kwd['status'] = 'success' if status in ['ok', 'done', 'success'] else 'error' - kwd['dict_format'] = True return self.installed_repository_grid(trans, **kwd) @web.expose diff --git a/lib/galaxy/webapps/galaxy/controllers/dataset.py b/lib/galaxy/webapps/galaxy/controllers/dataset.py index 5f8c142eedd..c21cee44b9a 100644 --- a/lib/galaxy/webapps/galaxy/controllers/dataset.py +++ b/lib/galaxy/webapps/galaxy/controllers/dataset.py @@ -87,8 +87,6 @@ class HistoryDatasetAssociationListGrid(grids.Grid): ] standard_filters = [] default_filter = dict(name="All", deleted="False", tags="All") - preserve_state = False - use_async = True use_paging = True num_rows_per_page = 50 @@ -572,7 +570,6 @@ class DatasetInterface(BaseUIController, UsesAnnotations, UsesItemRatings, UsesE kwargs['refresh_frames'] = ['history'] # Render the list view - kwargs['dict_format'] = True return self.stored_list_grid(trans, status=status, message=message, **kwargs) @web.expose diff --git a/lib/galaxy/webapps/galaxy/controllers/forms.py b/lib/galaxy/webapps/galaxy/controllers/forms.py index 0142d8044fd..bea7e5311b9 100644 --- a/lib/galaxy/webapps/galaxy/controllers/forms.py +++ b/lib/galaxy/webapps/galaxy/controllers/forms.py @@ -39,7 +39,6 @@ class FormsGrid(grids.Grid): model_class = model.FormDefinitionCurrent default_sort_key = "-update_time" num_rows_per_page = 50 - preserve_state = True use_paging = True default_filter = dict(deleted="False") columns = [ @@ -99,7 +98,6 @@ class Forms(BaseUIController): if message and status: kwd['message'] = util.sanitize_text(message) kwd['status'] = status - kwd['dict_format'] = True return self.forms_grid(trans, **kwd) @web.expose_api diff --git a/lib/galaxy/webapps/galaxy/controllers/history.py b/lib/galaxy/webapps/galaxy/controllers/history.py index 38a28e85359..64772493454 100644 --- a/lib/galaxy/webapps/galaxy/controllers/history.py +++ b/lib/galaxy/webapps/galaxy/controllers/history.py @@ -130,8 +130,6 @@ class HistoryListGrid(grids.Grid): ] default_filter = dict(name="All", deleted="False", tags="All", sharing="All") num_rows_per_page = 15 - preserve_state = False - use_async = True use_paging = True info_text = "Histories that have been deleted for more than a time period specified by the Galaxy administrator(s) may be permanently deleted." @@ -194,7 +192,6 @@ class HistoryAllPublishedGrid(grids.Grid): default_filter = dict(public_url="All", username="All", tags="All") use_paging = True num_rows_per_page = 50 - use_async = True columns = [ NameURLColumn("Name", key="name", filterable="advanced"), grids.OwnerAnnotationColumn("Annotation", key="annotation", model_annotation_association_class=model.HistoryAnnotationAssociation, filterable="advanced"), @@ -246,7 +243,6 @@ class HistoryController(BaseUIController, SharableMixin, UsesAnnotations, UsesIt @web.expose @web.json def list_published(self, trans, **kwargs): - kwargs['dict_format'] = True return self.published_list_grid(trans, **kwargs) @web.expose_api @@ -316,7 +312,6 @@ class HistoryController(BaseUIController, SharableMixin, UsesAnnotations, UsesIt trans.sa_session.flush() # Render the list view - kwargs['dict_format'] = True if message and status: kwargs['message'] = sanitize_text(message) kwargs['status'] = status @@ -454,7 +449,6 @@ class HistoryController(BaseUIController, SharableMixin, UsesAnnotations, UsesIt message = "Unshared %d shared histories" % len(ids) status = 'done' # Render the list view - kwargs['dict_format'] = True return self.shared_list_grid(trans, status=status, message=message, **kwargs) @web.expose diff --git a/lib/galaxy/webapps/galaxy/controllers/page.py b/lib/galaxy/webapps/galaxy/controllers/page.py index df1fe46b64d..8f9ff09a41d 100644 --- a/lib/galaxy/webapps/galaxy/controllers/page.py +++ b/lib/galaxy/webapps/galaxy/controllers/page.py @@ -62,7 +62,6 @@ class PageListGrid(grids.Grid): class PageAllPublishedGrid(grids.Grid): # Grid definition use_panels = True - use_async = True title = "Published Pages" model_class = model.Page default_sort_key = "update_time" @@ -104,7 +103,6 @@ class ItemSelectionGrid(grids.Grid): show_item_checkboxes = True default_filter = {"deleted": "False", "sharing": "All"} default_sort_key = "-update_time" - use_async = True use_paging = True num_rows_per_page = 10 @@ -322,7 +320,6 @@ class PageController(BaseUIController, SharableMixin, session.flush() # Build grid dictionary. - kwargs['dict_format'] = True grid = self._page_list(trans, *args, **kwargs) grid['shared_by_others'] = self._get_shared(trans) return grid @@ -330,7 +327,6 @@ class PageController(BaseUIController, SharableMixin, @web.expose @web.json def list_published(self, trans, *args, **kwargs): - kwargs['dict_format'] = True grid = self._all_published_list(trans, *args, **kwargs) grid['shared_by_others'] = self._get_shared(trans) return grid @@ -700,7 +696,6 @@ class PageController(BaseUIController, SharableMixin, @web.require_login("select a history from saved histories") def list_histories_for_selection(self, trans, **kwargs): """ Returns HTML that enables a user to select one or more histories. """ - kwargs['dict_format'] = True return self._history_selection_grid(trans, **kwargs) @web.expose @@ -708,7 +703,6 @@ class PageController(BaseUIController, SharableMixin, @web.require_login("select a workflow from saved workflows") def list_workflows_for_selection(self, trans, **kwargs): """ Returns HTML that enables a user to select one or more workflows. """ - kwargs['dict_format'] = True return self._workflow_selection_grid(trans, **kwargs) @web.expose @@ -716,7 +710,6 @@ class PageController(BaseUIController, SharableMixin, @web.require_login("select a visualization from saved visualizations") def list_visualizations_for_selection(self, trans, **kwargs): """ Returns HTML that enables a user to select one or more visualizations. """ - kwargs['dict_format'] = True return self._visualization_selection_grid(trans, **kwargs) @web.expose @@ -724,7 +717,6 @@ class PageController(BaseUIController, SharableMixin, @web.require_login("select a page from saved pages") def list_pages_for_selection(self, trans, **kwargs): """ Returns HTML that enables a user to select one or more pages. """ - kwargs['dict_format'] = True return self._page_selection_grid(trans, **kwargs) @web.expose @@ -732,7 +724,6 @@ class PageController(BaseUIController, SharableMixin, @web.require_login("select a dataset from saved datasets") def list_datasets_for_selection(self, trans, **kwargs): """ Returns HTML that enables a user to select one or more datasets. """ - kwargs['dict_format'] = True return self._datasets_selection_grid(trans, **kwargs) @web.expose diff --git a/lib/galaxy/webapps/galaxy/controllers/root.py b/lib/galaxy/webapps/galaxy/controllers/root.py index 67a549722f3..ca727ea6889 100644 --- a/lib/galaxy/webapps/galaxy/controllers/root.py +++ b/lib/galaxy/webapps/galaxy/controllers/root.py @@ -57,7 +57,7 @@ class RootController(controller.JSAppLauncher, UsesAnnotations): 'toolbox' : app.toolbox.to_dict(trans, in_panel=False), 'toolbox_in_panel' : app.toolbox.to_dict(trans), 'message_box_visible' : app.config.message_box_visible, - 'show_inactivity_warning' : app.config.user_activation_on and trans.user and not trans.user.active, + 'show_inactivity_warning' : app.config.user_activation_on and trans.user and not trans.user.active } # TODO: move to user diff --git a/lib/galaxy/webapps/galaxy/controllers/user.py b/lib/galaxy/webapps/galaxy/controllers/user.py index 316d9ba6964..5d2a0eae80d 100644 --- a/lib/galaxy/webapps/galaxy/controllers/user.py +++ b/lib/galaxy/webapps/galaxy/controllers/user.py @@ -62,16 +62,17 @@ can also copy and paste it into your browser. class UserOpenIDGrid(grids.Grid): - use_panels = False title = "OpenIDs linked to your account" model_class = model.UserOpenID - template = '/user/openid_manage.mako' default_filter = {"openid": "All"} default_sort_key = "-create_time" columns = [ grids.TextColumn("OpenID URL", key="openid", link=(lambda x: dict(action='openid_auth', login_button="Login", openid_url=x.openid if not x.provider else '', openid_provider=x.provider, auto_associate=True))), grids.GridColumn("Created", key="create_time", format=time_ago), ] + global_actions = [ + grids.GridAction("Add new account", url_args=dict(action="create_openid"), target="center") + ] operations = [ grids.GridOperation("Delete", async_compatible=True), ] @@ -138,8 +139,10 @@ class User(BaseUIController, UsesFormDefinitionsMixin, CreatesUsersMixin, Create return trans.show_error_message('OpenID authentication is not enabled in this instance of Galaxy') auto_associate = util.string_as_bool(kwd.get('auto_associate', False)) action = 'login' + controller = 'user' if trans.user: - action = 'openid_manage' + action = 'openids' + controller = 'list' if trans.app.config.support_url is not None: contact = 'support' % trans.app.config.support_url else: @@ -153,7 +156,7 @@ class User(BaseUIController, UsesFormDefinitionsMixin, CreatesUsersMixin, Create openid_provider = kwd.get('openid_provider', None) if info.status == trans.app.openid_manager.FAILURE and display_identifier: message = "Login via OpenID failed. The technical reason for this follows, please include this message in your email if you need to %s to resolve this problem: %s" % (contact, info.message) - return trans.response.send_redirect(url_for(controller='user', + return trans.response.send_redirect(url_for(controller=controller, action=action, use_panels=True, redirect=redirect, @@ -208,8 +211,8 @@ class User(BaseUIController, UsesFormDefinitionsMixin, CreatesUsersMixin, Create message = '%s
Click here to return to the page you were previously viewing.' % (message, escape(self.__get_redirect_url(redirect))) if redirect and status != "error": return trans.response.send_redirect(self.__get_redirect_url(redirect)) - return trans.response.send_redirect(url_for(controller='user', - action='openid_manage', + return trans.response.send_redirect(url_for(controller='openids', + action='list', use_panels=True, redirect=redirect, message=message, @@ -300,18 +303,14 @@ class User(BaseUIController, UsesFormDefinitionsMixin, CreatesUsersMixin, Create for openid in openid_objs: message = '%s
  • %s
  • ' % (message, url_for(controller='user', action='openid_auth', openid_provider=openid.id, redirect=redirect, auto_associate=True), openid.name) message = "%s" % (message) - return trans.response.send_redirect(url_for(controller='user', - action='openid_manage', - use_panels=use_panels, - redirect=redirect, + return trans.response.send_redirect(url_for(controller='openids', + action='list', message=message, status='info')) if redirect: return trans.response.send_redirect(redirect) - return trans.response.send_redirect(url_for(controller='user', - action='openid_manage', - use_panels=use_panels, - redirect=redirect, + return trans.response.send_redirect(url_for(controller='openids', + action='list', message=message, status='info')) if kwd.get('create_user_button', False): @@ -352,18 +351,14 @@ class User(BaseUIController, UsesFormDefinitionsMixin, CreatesUsersMixin, Create for openid in openid_objs: message = '%s
  • %s
  • ' % (message, url_for(controller='user', action='openid_auth', openid_provider=openid.id, redirect=redirect, auto_associate=True), openid.name) message = "%s" % (message) - return trans.response.send_redirect(url_for(controller='user', - action='openid_manage', - use_panels=True, - redirect=redirect, + return trans.response.send_redirect(url_for(controller='openids', + action='list', message=message, status='info')) if redirect: return trans.response.send_redirect(redirect) - return trans.response.send_redirect(url_for(controller='user', - action='openid_manage', - use_panels=use_panels, - redirect=redirect, + return trans.response.send_redirect(url_for(controller='openids', + action='list', message=message, status='info')) else: @@ -386,63 +381,53 @@ class User(BaseUIController, UsesFormDefinitionsMixin, CreatesUsersMixin, Create openids=openids) @web.expose - @web.require_login('manage OpenIDs') - def openid_disassociate(self, trans, **kwd): - '''Disassociates a user with an OpenID''' - if not trans.app.config.enable_openid: - return trans.show_error_message('OpenID authentication is not enabled in this instance of Galaxy') - params = util.Params(kwd) - ids = params.get('id', None) - message = params.get('message', None) - status = params.get('status', None) - use_panels = params.get('use_panels', False) - user_openids = [] - if not ids: - message = 'You must select at least one OpenID to disassociate from your Galaxy account.' - status = 'error' - else: - ids = util.listify(params.id) - for id in ids: - id = trans.security.decode_id(id) - user_openid = trans.sa_session.query(trans.app.model.UserOpenID).get(int(id)) - if not user_openid or (trans.user.id != user_openid.user_id): - message = 'The selected OpenID(s) are not associated with your Galaxy account.' - status = 'error' - user_openids = [] - break - user_openids.append(user_openid) - if user_openids: - deleted_urls = [] - for user_openid in user_openids: - trans.sa_session.delete(user_openid) - deleted_urls.append(user_openid.openid) - trans.sa_session.flush() - for deleted_url in deleted_urls: - trans.log_event("User disassociated OpenID: %s" % deleted_url) - message = '%s OpenIDs were disassociated from your Galaxy account.' % len(ids) - status = 'done' - return trans.response.send_redirect(url_for(controller='user', - action='openid_manage', - use_panels=use_panels, - message=message, - status=status)) + @web.require_login('create OpenIDs') + def create_openid(self, trans, **kwd): + return trans.fill_template('/user/openid_manage.mako', + openid_providers=trans.app.openid_providers, + redirect=kwd.get('redirect', url_for(controller='openids', action='list')).strip()) - @web.expose + @web.expose_api @web.require_login('manage OpenIDs') - def openid_manage(self, trans, **kwd): - '''Manage OpenIDs for user''' + def openids_list(self, trans, **kwd): + '''List of availabel OpenIDs for user''' + message = kwd.get('message', '') + status = kwd.get('status', '') if not trans.app.config.enable_openid: - return trans.show_error_message('OpenID authentication is not enabled in this instance of Galaxy') - use_panels = kwd.get('use_panels', False) + message = 'OpenID authentication is not enabled in this instance of Galaxy.' + status = 'error' if 'operation' in kwd: operation = kwd['operation'].lower() - if operation == "delete": - return trans.response.send_redirect(url_for(controller='user', - action='openid_disassociate', - use_panels=use_panels, - id=kwd['id'])) - kwd['redirect'] = kwd.get('redirect', url_for(controller='user', action='openid_manage', use_panels=True)).strip() - kwd['openid_providers'] = trans.app.openid_providers + ids = util.listify(kwd.get('id')) + if operation == 'delete': + if not ids: + message = 'You must select at least one OpenID to disassociate from your Galaxy account.' + status = 'error' + else: + user_openids = [] + for id in ids: + id = trans.security.decode_id(id) + user_openid = trans.sa_session.query(trans.app.model.UserOpenID).get(int(id)) + if not user_openid or (trans.user.id != user_openid.user_id): + message = 'The selected OpenID(s) are not associated with your Galaxy account.' + status = 'error' + user_openids = [] + break + user_openids.append(user_openid) + if user_openids: + deleted_urls = [] + for user_openid in user_openids: + trans.sa_session.delete(user_openid) + deleted_urls.append(user_openid.openid) + trans.sa_session.flush() + for deleted_url in deleted_urls: + trans.log_event('User disassociated OpenID: %s' % deleted_url) + message = '%s OpenIDs were disassociated from your Galaxy account.' % len(ids) + status = 'done' + if message and status: + kwd['message'] = util.sanitize_text(message) + kwd['status'] = status + kwd['dict_format'] = True return self.user_openid_grid(trans, **kwd) @web.expose diff --git a/lib/galaxy/webapps/galaxy/controllers/visualization.py b/lib/galaxy/webapps/galaxy/controllers/visualization.py index c172cb3d1f1..4e0aa904e2d 100644 --- a/lib/galaxy/webapps/galaxy/controllers/visualization.py +++ b/lib/galaxy/webapps/galaxy/controllers/visualization.py @@ -118,7 +118,6 @@ class TracksterSelectionGrid(grids.Grid): title = "Insert into visualization" model_class = model.Visualization default_sort_key = "-update_time" - use_async = True use_paging = False show_item_checkboxes = True columns = [ @@ -193,7 +192,6 @@ class VisualizationListGrid(grids.Grid): class VisualizationAllPublishedGrid(grids.Grid): # Grid definition use_panels = True - use_async = True title = "Published Visualizations" model_class = model.Visualization default_sort_key = "update_time" @@ -242,7 +240,6 @@ class VisualizationController(BaseUIController, SharableMixin, UsesVisualization @web.require_login("see all available libraries") def list_libraries(self, trans, **kwargs): """List all libraries that can be used for selecting datasets.""" - kwargs['dict_format'] = True return self._libraries_grid(trans, **kwargs) @web.expose @@ -251,7 +248,6 @@ class VisualizationController(BaseUIController, SharableMixin, UsesVisualization def list_history_datasets(self, trans, **kwargs): """List a history's datasets that can be added to a visualization.""" kwargs['show_item_checkboxes'] = 'True' - kwargs['dict_format'] = True return self._history_datasets_grid(trans, **kwargs) @web.expose @@ -260,19 +256,16 @@ class VisualizationController(BaseUIController, SharableMixin, UsesVisualization def list_library_datasets(self, trans, **kwargs): """List a library's datasets that can be added to a visualization.""" kwargs['show_item_checkboxes'] = 'True' - kwargs['dict_format'] = True return self._library_datasets_grid(trans, **kwargs) @web.expose @web.json def list_tracks(self, trans, **kwargs): - kwargs['dict_format'] = True return self._tracks_grid(trans, **kwargs) @web.expose @web.json def list_published(self, trans, *args, **kwargs): - kwargs['dict_format'] = True grid = self._published_list_grid(trans, **kwargs) grid['shared_by_others'] = self._get_shared(trans) return grid @@ -294,7 +287,6 @@ class VisualizationController(BaseUIController, SharableMixin, UsesVisualization self.copy(trans, **kwargs) session.flush() kwargs['embedded'] = True - kwargs['dict_format'] = True if message and status: kwargs['message'] = sanitize_text(message) kwargs['status'] = status diff --git a/lib/galaxy/webapps/galaxy/controllers/workflow.py b/lib/galaxy/webapps/galaxy/controllers/workflow.py index d45a11add7b..e5b9ba020f6 100644 --- a/lib/galaxy/webapps/galaxy/controllers/workflow.py +++ b/lib/galaxy/webapps/galaxy/controllers/workflow.py @@ -102,7 +102,6 @@ class StoredWorkflowAllPublishedGrid(grids.Grid): model_class = model.StoredWorkflow default_sort_key = "update_time" default_filter = dict(public_url="All", username="All", tags="All") - use_async = True columns = [ grids.PublicURLColumn("Name", key="name", filterable="advanced", attach_popup=True), grids.OwnerAnnotationColumn("Annotation", @@ -202,7 +201,6 @@ class WorkflowController(BaseUIController, SharableMixin, UsesStoredWorkflowMixi @web.expose @web.json def list_published(self, trans, **kwargs): - kwargs['dict_format'] = True return self.published_list_grid(trans, **kwargs) @web.expose diff --git a/lib/galaxy/webapps/reports/controllers/jobs.py b/lib/galaxy/webapps/reports/controllers/jobs.py index 73804c3fa16..6ec5384568e 100644 --- a/lib/galaxy/webapps/reports/controllers/jobs.py +++ b/lib/galaxy/webapps/reports/controllers/jobs.py @@ -17,8 +17,8 @@ from sqlalchemy import and_, not_, or_ from galaxy import model, util from galaxy.web.base.controller import BaseUIController, web -from galaxy.web.framework.helpers import grids from galaxy.webapps.reports.controllers.query import ReportQueryBuilder +from galaxy.webapps.reports.framework import grids log = logging.getLogger(__name__) @@ -179,7 +179,6 @@ class SpecifiedDateListGrid(grids.Grid): use_async = False model_class = model.Job title = "Jobs" - template = '/webapps/reports/grid.mako' default_sort_key = "id" columns = [ JobIdColumn("Id", @@ -223,7 +222,6 @@ class SpecifiedDateListGrid(grids.Grid): standard_filters = [] default_filter = {'specified_date': 'All'} num_rows_per_page = 50 - preserve_state = False use_paging = True def build_initial_query(self, trans, **kwd): diff --git a/lib/galaxy/webapps/reports/controllers/workflows.py b/lib/galaxy/webapps/reports/controllers/workflows.py index fe6e06dfac0..ff17c2b00d4 100644 --- a/lib/galaxy/webapps/reports/controllers/workflows.py +++ b/lib/galaxy/webapps/reports/controllers/workflows.py @@ -18,12 +18,12 @@ from sqlalchemy import and_ from galaxy import model, util from galaxy.web.base.controller import BaseUIController, web -from galaxy.web.framework.helpers import grids from galaxy.webapps.reports.controllers.jobs import ( get_spark_time, sorter ) from galaxy.webapps.reports.controllers.query import ReportQueryBuilder +from galaxy.webapps.reports.framework import grids log = logging.getLogger(__name__) @@ -81,7 +81,6 @@ class SpecifiedDateListGrid(grids.Grid): use_async = False model_class = model.StoredWorkflow title = "Workflows" - template = '/webapps/reports/grid.mako' default_sort_key = "name" columns = [ WorkflowNameColumn("Name", @@ -113,7 +112,6 @@ class SpecifiedDateListGrid(grids.Grid): standard_filters = [] default_filter = {'specified_date': 'All'} num_rows_per_page = 50 - preserve_state = False use_paging = True def build_initial_query(self, trans, **kwd): diff --git a/lib/galaxy/webapps/reports/framework/__init__.py b/lib/galaxy/webapps/reports/framework/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/lib/galaxy/webapps/reports/framework/grids.py b/lib/galaxy/webapps/reports/framework/grids.py new file mode 100644 index 00000000000..1cd9c69a135 --- /dev/null +++ b/lib/galaxy/webapps/reports/framework/grids.py @@ -0,0 +1,854 @@ +import logging +import math +from json import dumps, loads + +from markupsafe import escape +from six import string_types, text_type +from sqlalchemy.sql.expression import and_, false, func, null, or_, true + +from galaxy.model.item_attrs import RuntimeException, UsesAnnotations, UsesItemRatings +from galaxy.util import sanitize_text, unicodify +from galaxy.util.odict import odict +from galaxy.web.framework import decorators, url_for +from galaxy.web.framework.helpers import iff + + +log = logging.getLogger(__name__) + + +class Grid(object): + """ + Specifies the content and format of a grid (data table). + """ + title = "" + model_class = None + show_item_checkboxes = False + template = "legacy/grid_base.mako" + async_template = "legacy/grid_base_async.mako" + use_async = False + use_hide_message = True + global_actions = [] + columns = [] + operations = [] + standard_filters = [] + # Any columns that are filterable (either standard or advanced) should have a default value set in the default filter. + default_filter = {} + default_sort_key = None + use_paging = False + num_rows_per_page = 25 + num_page_links = 10 + # Set preference names. + cur_filter_pref_name = ".filter" + cur_sort_key_pref_name = ".sort_key" + legend = None + info_text = None + + def __init__(self): + # Determine if any multiple row operations are defined + self.has_multiple_item_operations = False + for operation in self.operations: + if operation.allow_multiple: + self.has_multiple_item_operations = True + break + + # If a column does not have a model class, set the column's model class + # to be the grid's model class. + for column in self.columns: + if not column.model_class: + column.model_class = self.model_class + + def __call__(self, trans, **kwargs): + # Get basics. + # FIXME: pretty sure this is only here to pass along, can likely be eliminated + status = kwargs.get('status', None) + message = kwargs.get('message', None) + # Build a base filter and sort key that is the combination of the saved state and defaults. + # Saved state takes preference over defaults. + base_filter = {} + if self.default_filter: + # default_filter is a dictionary that provides a default set of filters based on the grid's columns. + base_filter = self.default_filter.copy() + base_sort_key = self.default_sort_key + # Build initial query + query = self.build_initial_query(trans, **kwargs) + query = self.apply_query_filter(trans, query, **kwargs) + # Maintain sort state in generated urls + extra_url_args = {} + # Determine whether use_default_filter flag is set. + use_default_filter_str = kwargs.get('use_default_filter') + use_default_filter = False + if use_default_filter_str: + use_default_filter = (use_default_filter_str.lower() == 'true') + # Process filtering arguments to (a) build a query that represents the filter and (b) build a + # dictionary that denotes the current filter. + cur_filter_dict = {} + for column in self.columns: + if column.key: + # Get the filter criterion for the column. Precedence is (a) if using default filter, only look there; otherwise, + # (b) look in kwargs; and (c) look in base filter. + column_filter = None + if use_default_filter: + if self.default_filter: + column_filter = self.default_filter.get(column.key) + elif "f-" + column.model_class.__name__ + ".%s" % column.key in kwargs: + # Queries that include table joins cannot guarantee unique column names. This problem is + # handled by setting the column_filter value to .. + column_filter = kwargs.get("f-" + column.model_class.__name__ + ".%s" % column.key) + elif "f-" + column.key in kwargs: + column_filter = kwargs.get("f-" + column.key) + elif column.key in base_filter: + column_filter = base_filter.get(column.key) + + # Method (1) combines a mix of strings and lists of strings into a single string and (2) attempts to de-jsonify all strings. + def loads_recurse(item): + decoded_list = [] + if isinstance(item, string_types): + try: + # Not clear what we're decoding, so recurse to ensure that we catch everything. + decoded_item = loads(item) + if isinstance(decoded_item, list): + decoded_list = loads_recurse(decoded_item) + else: + decoded_list = [text_type(decoded_item)] + except ValueError: + decoded_list = [text_type(item)] + elif isinstance(item, list): + for element in item: + a_list = loads_recurse(element) + decoded_list = decoded_list + a_list + return decoded_list + # If column filter found, apply it. + if column_filter is not None: + # TextColumns may have a mix of json and strings. + if isinstance(column, TextColumn): + column_filter = loads_recurse(column_filter) + if len(column_filter) == 1: + column_filter = column_filter[0] + # Interpret ',' as a separator for multiple terms. + if isinstance(column_filter, string_types) and column_filter.find(',') != -1: + column_filter = column_filter.split(',') + + # Check if filter is empty + if isinstance(column_filter, list): + # Remove empty strings from filter list + column_filter = [x for x in column_filter if x != ''] + if len(column_filter) == 0: + continue + elif isinstance(column_filter, string_types): + # If filter criterion is empty, do nothing. + if column_filter == '': + continue + + # Update query. + query = column.filter(trans, trans.user, query, column_filter) + # Upate current filter dict. + # Column filters are rendered in various places, sanitize them all here. + cur_filter_dict[column.key] = sanitize_text(column_filter) + # Carry filter along to newly generated urls; make sure filter is a string so + # that we can encode to UTF-8 and thus handle user input to filters. + if isinstance(column_filter, list): + # Filter is a list; process each item. + column_filter = [text_type(_).encode('utf-8') if not isinstance(_, string_types) else _ for _ in column_filter] + extra_url_args["f-" + column.key] = dumps(column_filter) + else: + # Process singleton filter. + if not isinstance(column_filter, string_types): + column_filter = text_type(column_filter) + extra_url_args["f-" + column.key] = column_filter.encode("utf-8") + # Process sort arguments. + sort_key = None + if 'sort' in kwargs: + sort_key = kwargs['sort'] + elif base_sort_key: + sort_key = base_sort_key + if sort_key: + ascending = not(sort_key.startswith("-")) + # Queries that include table joins cannot guarantee unique column names. This problem is + # handled by setting the column_filter value to .. + table_name = None + if sort_key.find('.') > -1: + a_list = sort_key.split('.') + if ascending: + table_name = a_list[0] + else: + table_name = a_list[0][1:] + column_name = a_list[1] + elif ascending: + column_name = sort_key + else: + column_name = sort_key[1:] + # Sort key is a column key. + for column in self.columns: + if column.key and column.key.find('.') > -1: + column_key = column.key.split('.')[1] + else: + column_key = column.key + if (table_name is None or table_name == column.model_class.__name__) and column_key == column_name: + query = column.sort(trans, query, ascending, column_name=column_name) + break + extra_url_args['sort'] = sort_key + # There might be a current row + current_item = self.get_current_item(trans, **kwargs) + # Process page number. + if self.use_paging: + if 'page' in kwargs: + if kwargs['page'] == 'all': + page_num = 0 + else: + page_num = int(kwargs['page']) + else: + page_num = 1 + if page_num == 0: + # Show all rows in page. + total_num_rows = query.count() + page_num = 1 + num_pages = 1 + else: + # Show a limited number of rows. Before modifying query, get the total number of rows that query + # returns so that the total number of pages can be computed. + total_num_rows = query.count() + query = query.limit(self.num_rows_per_page).offset((page_num - 1) * self.num_rows_per_page) + num_pages = int(math.ceil(float(total_num_rows) / self.num_rows_per_page)) + else: + # Defaults. + page_num = 1 + num_pages = 1 + # There are some places in grid templates where it's useful for a grid + # to have its current filter. + self.cur_filter_dict = cur_filter_dict + + # Log grid view. + context = text_type(self.__class__.__name__) + params = cur_filter_dict.copy() + params['sort'] = sort_key + params['async'] = ('async' in kwargs) + + # TODO:?? + # commenting this out; when this fn calls session.add( action ) and session.flush the query from this fn + # is effectively 'wiped' out. Nate believes it has something to do with our use of session( autocommit=True ) + # in mapping.py. If you change that to False, the log_action doesn't affect the query + # Below, I'm rendering the template first (that uses query), then calling log_action, then returning the page + # trans.log_action( trans.get_user(), text_type( "grid.view" ), context, params ) + + # Render grid. + def url(*args, **kwargs): + route_name = kwargs.pop('__route_name__', None) + # Only include sort/filter arguments if not linking to another + # page. This is a bit of a hack. + if 'action' in kwargs: + new_kwargs = dict() + else: + new_kwargs = dict(extra_url_args) + # Extend new_kwargs with first argument if found + if len(args) > 0: + new_kwargs.update(args[0]) + new_kwargs.update(kwargs) + # We need to encode item ids + if 'id' in new_kwargs: + id = new_kwargs['id'] + if isinstance(id, list): + new_kwargs['id'] = [trans.security.encode_id(i) for i in id] + else: + new_kwargs['id'] = trans.security.encode_id(id) + # The url_for invocation *must* include a controller and action. + if 'controller' not in new_kwargs: + new_kwargs['controller'] = trans.controller + if 'action' not in new_kwargs: + new_kwargs['action'] = trans.action + if route_name: + return url_for(route_name, **new_kwargs) + return url_for(**new_kwargs) + + self.use_panels = (kwargs.get('use_panels', False) in [True, 'True', 'true']) + self.advanced_search = (kwargs.get('advanced_search', False) in [True, 'True', 'true']) + async_request = ((self.use_async) and (kwargs.get('async', False) in [True, 'True', 'true'])) + # Currently, filling the template returns a str object; this requires decoding the string into a + # unicode object within mako templates. What probably should be done is to return the template as + # utf-8 unicode; however, this would require encoding the object as utf-8 before returning the grid + # results via a controller method, which is require substantial changes. Hence, for now, return grid + # as str. + page = trans.fill_template(iff(async_request, self.async_template, self.template), + grid=self, + query=query, + cur_page_num=page_num, + num_pages=num_pages, + num_page_links=self.num_page_links, + default_filter_dict=self.default_filter, + cur_filter_dict=cur_filter_dict, + sort_key=sort_key, + current_item=current_item, + ids=kwargs.get('id', []), + url=url, + status=status, + message=message, + info_text=self.info_text, + use_panels=self.use_panels, + use_hide_message=self.use_hide_message, + advanced_search=self.advanced_search, + show_item_checkboxes=(self.show_item_checkboxes or + kwargs.get('show_item_checkboxes', '') in ['True', 'true']), + # Pass back kwargs so that grid template can set and use args without + # grid explicitly having to pass them. + kwargs=kwargs) + trans.log_action(trans.get_user(), text_type("grid.view"), context, params) + return page + + def get_ids(self, **kwargs): + id = [] + if 'id' in kwargs: + id = kwargs['id'] + # Coerce ids to list + if not isinstance(id, list): + id = id.split(",") + # Ensure ids are integers + try: + id = list(map(int, id)) + except Exception: + decorators.error("Invalid id") + return id + + # ---- Override these ---------------------------------------------------- + def handle_operation(self, trans, operation, ids, **kwargs): + pass + + def get_current_item(self, trans, **kwargs): + return None + + def build_initial_query(self, trans, **kwargs): + return trans.sa_session.query(self.model_class) + + def apply_query_filter(self, trans, query, **kwargs): + # Applies a database filter that holds for all items in the grid. + # (gvk) Is this method necessary? Why not simply build the entire query, + # including applying filters in the build_initial_query() method? + return query + + +class GridColumn(object): + def __init__(self, label, key=None, model_class=None, method=None, format=None, + link=None, attach_popup=False, visible=True, nowrap=False, + # Valid values for filterable are ['standard', 'advanced', None] + filterable=None, sortable=True, label_id_prefix=None, target=None): + """Create a grid column.""" + self.label = label + self.key = key + self.model_class = model_class + self.method = method + self.format = format + self.link = link + self.target = target + self.nowrap = nowrap + self.attach_popup = attach_popup + self.visible = visible + self.filterable = filterable + # Column must have a key to be sortable. + self.sortable = (self.key is not None and sortable) + self.label_id_prefix = label_id_prefix or '' + + def get_value(self, trans, grid, item): + if self.method: + value = getattr(grid, self.method)(trans, item) + elif self.key: + value = getattr(item, self.key) + else: + value = None + if self.format: + value = self.format(value) + return escape(unicodify(value)) + + def get_link(self, trans, grid, item): + if self.link and self.link(item): + return self.link(item) + return None + + def filter(self, trans, user, query, column_filter): + """ Modify query to reflect the column filter. """ + if column_filter == "All": + pass + if column_filter == "True": + query = query.filter_by(**{self.key: True}) + elif column_filter == "False": + query = query.filter_by(**{self.key: False}) + return query + + def get_accepted_filters(self): + """ Returns a list of accepted filters for this column. """ + accepted_filters_vals = ["False", "True", "All"] + accepted_filters = [] + for val in accepted_filters_vals: + args = {self.key: val} + accepted_filters.append(GridColumnFilter(val, args)) + return accepted_filters + + def sort(self, trans, query, ascending, column_name=None): + """Sort query using this column.""" + if column_name is None: + column_name = self.key + if ascending: + query = query.order_by(self.model_class.table.c.get(column_name).asc()) + else: + query = query.order_by(self.model_class.table.c.get(column_name).desc()) + return query + + +class ReverseSortColumn(GridColumn): + """ Column that reverses sorting; this is useful when the natural sort is descending. """ + + def sort(self, trans, query, ascending, column_name=None): + return GridColumn.sort(self, trans, query, (not ascending), column_name=column_name) + + +class TextColumn(GridColumn): + """ Generic column that employs freetext and, hence, supports freetext, case-independent filtering. """ + + def filter(self, trans, user, query, column_filter): + """ Modify query to filter using free text, case independence. """ + if column_filter == "All": + pass + elif column_filter: + query = query.filter(self.get_filter(trans, user, column_filter)) + return query + + def get_filter(self, trans, user, column_filter): + """ Returns a SQLAlchemy criterion derived from column_filter. """ + if isinstance(column_filter, string_types): + return self.get_single_filter(user, column_filter) + elif isinstance(column_filter, list): + clause_list = [] + for filter in column_filter: + clause_list.append(self.get_single_filter(user, filter)) + return and_(*clause_list) + + def get_single_filter(self, user, a_filter): + """ + Returns a SQLAlchemy criterion derived for a single filter. Single filter + is the most basic filter--usually a string--and cannot be a list. + """ + # Queries that include table joins cannot guarantee that table column names will be + # unique, so check to see if a_filter is of type .. + if self.key.find('.') > -1: + a_key = self.key.split('.')[1] + else: + a_key = self.key + model_class_key_field = getattr(self.model_class, a_key) + return func.lower(model_class_key_field).like("%" + a_filter.lower() + "%") + + def sort(self, trans, query, ascending, column_name=None): + """Sort column using case-insensitive alphabetical sorting.""" + if column_name is None: + column_name = self.key + if ascending: + query = query.order_by(func.lower(self.model_class.table.c.get(column_name)).asc()) + else: + query = query.order_by(func.lower(self.model_class.table.c.get(column_name)).desc()) + return query + + +class DateTimeColumn(TextColumn): + def sort(self, trans, query, ascending, column_name=None): + """Sort query using this column.""" + return GridColumn.sort(self, trans, query, ascending, column_name=column_name) + + +class BooleanColumn(TextColumn): + def sort(self, trans, query, ascending, column_name=None): + """Sort query using this column.""" + return GridColumn.sort(self, trans, query, ascending, column_name=column_name) + + def get_single_filter(self, user, a_filter): + if self.key.find('.') > -1: + a_key = self.key.split('.')[1] + else: + a_key = self.key + model_class_key_field = getattr(self.model_class, a_key) + return model_class_key_field == a_filter + + +class IntegerColumn(TextColumn): + """ + Integer column that employs freetext, but checks that the text is an integer, + so support filtering on integer values. + + IMPORTANT NOTE: grids that use this column type should not include the column + in the cols_to_filter list of MulticolFilterColumn ( i.e., searching on this + column type should not be performed in the grid's standard search - it won't + throw exceptions, but it also will not find what you're looking for ). Grids + that search on this column should use 'filterable="advanced"' so that searching + is only performed in the advanced search component, restricting the search to + the specific column. + + This is useful for searching on object ids or other integer columns. See the + JobIdColumn column in the SpecifiedDateListGrid class in the jobs controller of + the reports webapp for an example. + """ + + def get_single_filter(self, user, a_filter): + model_class_key_field = getattr(self.model_class, self.key) + assert int(a_filter), "The search entry must be an integer" + return model_class_key_field == int(a_filter) + + def sort(self, trans, query, ascending, column_name=None): + """Sort query using this column.""" + return GridColumn.sort(self, trans, query, ascending, column_name=column_name) + + +class CommunityRatingColumn(GridColumn, UsesItemRatings): + """ Column that displays community ratings for an item. """ + + def get_value(self, trans, grid, item): + ave_item_rating, num_ratings = self.get_ave_item_rating_data(trans.sa_session, item, webapp_model=trans.model) + return trans.fill_template("tool_shed_rating.mako", + ave_item_rating=ave_item_rating, + num_ratings=num_ratings, + item_id=trans.security.encode_id(item.id)) + + def sort(self, trans, query, ascending, column_name=None): + def get_foreign_key(source_class, target_class): + """ Returns foreign key in source class that references target class. """ + target_fk = None + for fk in source_class.table.foreign_keys: + if fk.references(target_class.table): + target_fk = fk + break + if not target_fk: + raise RuntimeException("No foreign key found between objects: %s, %s" % source_class.table, target_class.table) + return target_fk + # Get the columns that connect item's table and item's rating association table. + item_rating_assoc_class = getattr(trans.model, '%sRatingAssociation' % self.model_class.__name__) + foreign_key = get_foreign_key(item_rating_assoc_class, self.model_class) + fk_col = foreign_key.parent + referent_col = foreign_key.get_referent(self.model_class.table) + # Do sorting using a subquery. + # Subquery to get average rating for each item. + ave_rating_subquery = trans.sa_session.query(fk_col, + func.avg(item_rating_assoc_class.table.c.rating).label('avg_rating')) \ + .group_by(fk_col).subquery() + # Integrate subquery into main query. + query = query.outerjoin((ave_rating_subquery, referent_col == ave_rating_subquery.columns[fk_col.name])) + # Sort using subquery results; use coalesce to avoid null values. + if not ascending: # TODO: for now, reverse sorting b/c first sort is ascending, and that should be the natural sort. + query = query.order_by(func.coalesce(ave_rating_subquery.c.avg_rating, 0).asc()) + else: + query = query.order_by(func.coalesce(ave_rating_subquery.c.avg_rating, 0).desc()) + return query + + +class OwnerAnnotationColumn(TextColumn, UsesAnnotations): + """ Column that displays and filters item owner's annotations. """ + + def __init__(self, col_name, key, model_class=None, model_annotation_association_class=None, filterable=None): + GridColumn.__init__(self, col_name, key=key, model_class=model_class, filterable=filterable) + self.sortable = False + self.model_annotation_association_class = model_annotation_association_class + + def get_value(self, trans, grid, item): + """ Returns first 150 characters of annotation. """ + annotation = self.get_item_annotation_str(trans.sa_session, item.user, item) + if annotation: + ann_snippet = annotation[:155] + if len(annotation) > 155: + ann_snippet = ann_snippet[:ann_snippet.rfind(' ')] + ann_snippet += "..." + else: + ann_snippet = "" + return escape(ann_snippet) + + def get_single_filter(self, user, a_filter): + """ Filter by annotation and annotation owner. """ + return self.model_class.annotations.any( + and_(func.lower(self.model_annotation_association_class.annotation).like("%" + a_filter.lower() + "%"), + # TODO: not sure why, to filter by owner's annotations, we have to do this rather than + # 'self.model_class.user==self.model_annotation_association_class.user' + self.model_annotation_association_class.table.c.user_id == self.model_class.table.c.user_id)) + + +class CommunityTagsColumn(TextColumn): + """ Column that supports community tags. """ + + def __init__(self, col_name, key, model_class=None, model_tag_association_class=None, filterable=None, grid_name=None): + GridColumn.__init__(self, col_name, key=key, model_class=model_class, nowrap=True, filterable=filterable, sortable=False) + self.model_tag_association_class = model_tag_association_class + # Column-specific attributes. + self.grid_name = grid_name + + def get_value(self, trans, grid, item): + return trans.fill_template("/tagging_common.mako", tag_type="community", trans=trans, user=trans.get_user(), tagged_item=item, elt_context=self.grid_name, + in_form=True, input_size="20", tag_click_fn="add_tag_to_grid_filter", use_toggle_link=True) + + def filter(self, trans, user, query, column_filter): + """ Modify query to filter model_class by tag. Multiple filters are ANDed. """ + if column_filter == "All": + pass + elif column_filter: + query = query.filter(self.get_filter(trans, user, column_filter)) + return query + + def get_filter(self, trans, user, column_filter): + # Parse filter to extract multiple tags. + if isinstance(column_filter, list): + # Collapse list of tags into a single string; this is redundant but effective. TODO: fix this by iterating over tags. + column_filter = ",".join(column_filter) + raw_tags = trans.app.tag_handler.parse_tags(column_filter.encode("utf-8")) + clause_list = [] + for name, value in raw_tags: + if name: + # Filter by all tags. + clause_list.append(self.model_class.tags.any(func.lower(self.model_tag_association_class.user_tname).like("%" + name.lower() + "%"))) + if value: + # Filter by all values. + clause_list.append(self.model_class.tags.any(func.lower(self.model_tag_association_class.user_value).like("%" + value.lower() + "%"))) + return and_(*clause_list) + + +class IndividualTagsColumn(CommunityTagsColumn): + """ Column that supports individual tags. """ + + def get_value(self, trans, grid, item): + return trans.fill_template("/tagging_common.mako", + tag_type="individual", + user=trans.user, + tagged_item=item, + elt_context=self.grid_name, + in_form=True, + input_size="20", + tag_click_fn="add_tag_to_grid_filter", + use_toggle_link=True) + + def get_filter(self, trans, user, column_filter): + # Parse filter to extract multiple tags. + if isinstance(column_filter, list): + # Collapse list of tags into a single string; this is redundant but effective. TODO: fix this by iterating over tags. + column_filter = ",".join(column_filter) + raw_tags = trans.app.tag_handler.parse_tags(column_filter.encode("utf-8")) + clause_list = [] + for name, value in raw_tags: + if name: + # Filter by individual's tag names. + clause_list.append(self.model_class.tags.any(and_(func.lower(self.model_tag_association_class.user_tname).like("%" + name.lower() + "%"), self.model_tag_association_class.user == user))) + if value: + # Filter by individual's tag values. + clause_list.append(self.model_class.tags.any(and_(func.lower(self.model_tag_association_class.user_value).like("%" + value.lower() + "%"), self.model_tag_association_class.user == user))) + return and_(*clause_list) + + +class MulticolFilterColumn(TextColumn): + """ Column that performs multicolumn filtering. """ + + def __init__(self, col_name, cols_to_filter, key, visible, filterable="default"): + GridColumn.__init__(self, col_name, key=key, visible=visible, filterable=filterable) + self.cols_to_filter = cols_to_filter + + def filter(self, trans, user, query, column_filter): + """ Modify query to filter model_class by tag. Multiple filters are ANDed. """ + if column_filter == "All": + return query + if isinstance(column_filter, list): + clause_list = [] + for filter in column_filter: + part_clause_list = [] + for column in self.cols_to_filter: + part_clause_list.append(column.get_filter(trans, user, filter)) + clause_list.append(or_(*part_clause_list)) + complete_filter = and_(*clause_list) + else: + clause_list = [] + for column in self.cols_to_filter: + clause_list.append(column.get_filter(trans, user, column_filter)) + complete_filter = or_(*clause_list) + return query.filter(complete_filter) + + +class OwnerColumn(TextColumn): + """ Column that lists item's owner. """ + + def get_value(self, trans, grid, item): + return item.user.username + + def sort(self, trans, query, ascending, column_name=None): + """ Sort column using case-insensitive alphabetical sorting on item's username. """ + if ascending: + query = query.order_by(func.lower(self.model_class.username).asc()) + else: + query = query.order_by(func.lower(self.model_class.username).desc()) + return query + + +class PublicURLColumn(TextColumn): + """ Column displays item's public URL based on username and slug. """ + + def get_link(self, trans, grid, item): + if item.user.username and item.slug: + return dict(action='display_by_username_and_slug', username=item.user.username, slug=item.slug) + elif not item.user.username: + # TODO: provide link to set username. + return None + elif not item.user.slug: + # TODO: provide link to set slug. + return None + + +class DeletedColumn(GridColumn): + """ Column that tracks and filters for items with deleted attribute. """ + + def get_accepted_filters(self): + """ Returns a list of accepted filters for this column. """ + accepted_filter_labels_and_vals = {"active" : "False", "deleted" : "True", "all": "All"} + accepted_filters = [] + for label, val in accepted_filter_labels_and_vals.items(): + args = {self.key: val} + accepted_filters.append(GridColumnFilter(label, args)) + return accepted_filters + + def filter(self, trans, user, query, column_filter): + """Modify query to filter self.model_class by state.""" + if column_filter == "All": + pass + elif column_filter in ["True", "False"]: + query = query.filter(self.model_class.deleted == (column_filter == "True")) + return query + + +class StateColumn(GridColumn): + """ + Column that tracks and filters for items with state attribute. + + IMPORTANT NOTE: self.model_class must have a states Bunch or dict if + this column type is used in the grid. + """ + + def get_value(self, trans, grid, item): + return item.state + + def filter(self, trans, user, query, column_filter): + """Modify query to filter self.model_class by state.""" + if column_filter == "All": + pass + elif column_filter in [v for k, v in self.model_class.states.items()]: + query = query.filter(self.model_class.state == column_filter) + return query + + def get_accepted_filters(self): + """Returns a list of accepted filters for this column.""" + all = GridColumnFilter('all', {self.key : 'All'}) + accepted_filters = [all] + for k, v in self.model_class.states.items(): + args = {self.key: v} + accepted_filters.append(GridColumnFilter(v, args)) + return accepted_filters + + +class SharingStatusColumn(GridColumn): + """ Grid column to indicate sharing status. """ + + def get_value(self, trans, grid, item): + # Delete items cannot be shared. + if item.deleted: + return "" + # Build a list of sharing for this item. + sharing_statuses = [] + if item.users_shared_with: + sharing_statuses.append("Shared") + if item.importable: + sharing_statuses.append("Accessible") + if item.published: + sharing_statuses.append("Published") + return ", ".join(sharing_statuses) + + def get_link(self, trans, grid, item): + if not item.deleted and (item.users_shared_with or item.importable or item.published): + return dict(operation="share or publish", id=item.id) + return None + + def filter(self, trans, user, query, column_filter): + """ Modify query to filter histories by sharing status. """ + if column_filter == "All": + pass + elif column_filter: + if column_filter == "private": + query = query.filter(self.model_class.users_shared_with == null()) + query = query.filter(self.model_class.importable == false()) + elif column_filter == "shared": + query = query.filter(self.model_class.users_shared_with != null()) + elif column_filter == "accessible": + query = query.filter(self.model_class.importable == true()) + elif column_filter == "published": + query = query.filter(self.model_class.published == true()) + return query + + def get_accepted_filters(self): + """ Returns a list of accepted filters for this column. """ + accepted_filter_labels_and_vals = odict() + accepted_filter_labels_and_vals["private"] = "private" + accepted_filter_labels_and_vals["shared"] = "shared" + accepted_filter_labels_and_vals["accessible"] = "accessible" + accepted_filter_labels_and_vals["published"] = "published" + accepted_filter_labels_and_vals["all"] = "All" + accepted_filters = [] + for label, val in accepted_filter_labels_and_vals.items(): + args = {self.key: val} + accepted_filters.append(GridColumnFilter(label, args)) + return accepted_filters + + +class GridOperation(object): + def __init__(self, label, key=None, condition=None, allow_multiple=True, allow_popup=True, + target=None, url_args=None, async_compatible=False, confirm=None, + global_operation=None): + self.label = label + self.key = key + self.allow_multiple = allow_multiple + self.allow_popup = allow_popup + self.condition = condition + self.target = target + self.url_args = url_args + self.async_compatible = async_compatible + # if 'confirm' is set, then ask before completing the operation + self.confirm = confirm + # specify a general operation that acts on the full grid + # this should be a function returning a dictionary with parameters + # to pass to the URL, similar to GridColumn links: + # global_operation=(lambda: dict(operation="download") + self.global_operation = global_operation + + def get_url_args(self, item): + if self.url_args: + if hasattr(self.url_args, '__call__'): + url_args = self.url_args(item) + else: + url_args = dict(self.url_args) + url_args['id'] = item.id + return url_args + else: + return dict(operation=self.label, id=item.id) + + def allowed(self, item): + if self.condition: + return bool(self.condition(item)) + else: + return True + + +class DisplayByUsernameAndSlugGridOperation(GridOperation): + """ Operation to display an item by username and slug. """ + + def get_url_args(self, item): + return {'action' : 'display_by_username_and_slug', 'username' : item.user.username, 'slug' : item.slug} + + +class GridAction(object): + def __init__(self, label=None, url_args=None, target=None): + self.label = label + self.url_args = url_args + self.target = target + + +class GridColumnFilter(object): + def __init__(self, label, args=None): + self.label = label + self.args = args + + def get_url_args(self): + rval = {} + for k, v in self.args.items(): + rval["f-" + k] = v + return rval diff --git a/lib/galaxy/webapps/tool_shed/controllers/repository.py b/lib/galaxy/webapps/tool_shed/controllers/repository.py index 22e69f8d7c7..04bc147abe0 100644 --- a/lib/galaxy/webapps/tool_shed/controllers/repository.py +++ b/lib/galaxy/webapps/tool_shed/controllers/repository.py @@ -21,7 +21,7 @@ from galaxy import ( from galaxy.tools.repositories import ValidationContext from galaxy.web.base.controller import BaseUIController from galaxy.web.form_builder import CheckboxField, SelectField -from galaxy.web.framework.helpers import grids +from galaxy.webapps.reports.framework import grids from galaxy.webapps.tool_shed.util import ratings_util from tool_shed.capsule import capsule_manager from tool_shed.dependencies.repository import relation_builder diff --git a/lib/tool_shed/galaxy_install/grids/admin_toolshed_grids.py b/lib/tool_shed/galaxy_install/grids/admin_toolshed_grids.py index b20b6f89ca9..6d5a45ec8e3 100644 --- a/lib/tool_shed/galaxy_install/grids/admin_toolshed_grids.py +++ b/lib/tool_shed/galaxy_install/grids/admin_toolshed_grids.py @@ -215,7 +215,6 @@ class InstalledRepositoryGrid(grids.Grid): standard_filters = [] default_filter = dict(deleted="False") num_rows_per_page = 50 - preserve_state = False use_paging = False def build_initial_query(self, trans, **kwd): diff --git a/lib/tool_shed/grids/admin_grids.py b/lib/tool_shed/grids/admin_grids.py index 5f5310a2c77..64d45388466 100644 --- a/lib/tool_shed/grids/admin_grids.py +++ b/lib/tool_shed/grids/admin_grids.py @@ -3,7 +3,8 @@ import logging from markupsafe import escape from sqlalchemy import and_ -from galaxy.web.framework.helpers import grids, time_ago +from galaxy.web.framework.helpers import time_ago +from galaxy.webapps.reports.framework import grids from galaxy.webapps.tool_shed import model from tool_shed.grids.repository_grids import CategoryGrid, RepositoryGrid from tool_shed.util import hg_util diff --git a/lib/tool_shed/grids/repository_grids.py b/lib/tool_shed/grids/repository_grids.py index d4228adb59e..ac222ded950 100644 --- a/lib/tool_shed/grids/repository_grids.py +++ b/lib/tool_shed/grids/repository_grids.py @@ -7,7 +7,7 @@ from sqlalchemy import and_, false, or_, true import tool_shed.grids.util as grids_util import tool_shed.repository_types.util as rt_util import tool_shed.util.shed_util_common as suc -from galaxy.web.framework.helpers import grids +from galaxy.webapps.reports.framework import grids from galaxy.webapps.tool_shed import model from tool_shed.util import hg_util, metadata_util, repository_util @@ -62,7 +62,6 @@ class CategoryGrid(grids.Grid): operations = [] standard_filters = [] num_rows_per_page = 50 - preserve_state = False use_paging = False @@ -236,7 +235,6 @@ class RepositoryGrid(grids.Grid): standard_filters = [] default_filter = dict(deleted="False") num_rows_per_page = 50 - preserve_state = False use_paging = False def build_initial_query(self, trans, **kwd): @@ -358,7 +356,6 @@ class MatchedRepositoryGrid(grids.Grid): standard_filters = [] default_filter = {} num_rows_per_page = 50 - preserve_state = False use_paging = False def build_initial_query(self, trans, **kwd): @@ -457,7 +454,6 @@ class RepositoriesByUserGrid(RepositoryGrid): standard_filters = [] default_filter = dict(deleted="False") num_rows_per_page = 50 - preserve_state = False use_paging = False def build_initial_query(self, trans, **kwd): @@ -978,7 +974,6 @@ class RepositoryMetadataGrid(grids.Grid): standard_filters = [] default_filter = dict(malicious="False") num_rows_per_page = 50 - preserve_state = False use_paging = False def build_initial_query(self, trans, **kwd): @@ -1298,7 +1293,6 @@ class ValidCategoryGrid(CategoryGrid): operations = [] standard_filters = [] num_rows_per_page = 50 - preserve_state = False use_paging = False diff --git a/lib/tool_shed/grids/repository_review_grids.py b/lib/tool_shed/grids/repository_review_grids.py index 95b6881d557..0f9996456d8 100644 --- a/lib/tool_shed/grids/repository_review_grids.py +++ b/lib/tool_shed/grids/repository_review_grids.py @@ -3,7 +3,7 @@ import logging from markupsafe import escape from sqlalchemy import and_, false, null, or_, true -from galaxy.web.framework.helpers import grids +from galaxy.webapps.reports.framework import grids from galaxy.webapps.tool_shed import model from tool_shed.grids.repository_grids import RepositoryGrid from tool_shed.util import hg_util, metadata_util @@ -45,7 +45,6 @@ class ComponentGrid(grids.Grid): operations = [] standard_filters = [] num_rows_per_page = 50 - preserve_state = False use_paging = False @@ -349,7 +348,6 @@ class RepositoryReviewsByUserGrid(grids.Grid): ] standard_filters = [] num_rows_per_page = 50 - preserve_state = False use_paging = False def build_initial_query(self, trans, **kwd): diff --git a/static/scripts/bundled/admin.bundled.js b/static/scripts/bundled/admin.bundled.js index 536164915bb..534d0aa6f40 100644 --- a/static/scripts/bundled/admin.bundled.js +++ b/static/scripts/bundled/admin.bundled.js @@ -1 +1 @@ -webpackJsonp([2],{23:function(e,t,o){"use strict";(function(e){function i(e){return e&&e.__esModule?e:{default:e}}function a(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t.default=e,t}function s(e,t){return this._init(e||{},t||{})}Object.defineProperty(t,"__esModule",{value:!0});var n=o(1),r=a(n),l=o(2),u=a(l),d=o(5),c=i(d),p=o(24),g=i(p),f=o(25),_=i(f),h=o(32),m=i(h),y=o(3),v=i(y);(0,m.default)(s,"GalaxyApp");var b="galaxy:debug:namespaces",w=!1;try{w="true"==localStorage.getItem("galaxy:debug")}catch(e){console.log((0,v.default)("localStorage not available for debug flag retrieval"))}s.prototype._init=function(e,t){var o=this;return r.extend(o,u.Events),w&&(o.logger=console,console.debug("debugging galaxy:","options:",e,"bootstrapped:",t)),o._processOptions(e),o.root=e.root||"/",o.params=e.params||{},o.session_csrf_token=e.session_csrf_token||null,o._initConfig(e.config||{}),o._patchGalaxy(window.Galaxy),o._initLogger(o.options.loggerOptions||{}),o.debug("GalaxyApp.options: ",o.options),o.debug("GalaxyApp.config: ",o.config),o.debug("GalaxyApp.logger: ",o.logger),o._initLocale(),o.debug("GalaxyApp.localize: ",o.localize),o.config=e.config||{},o.debug("GalaxyApp.config: ",o.config),o._initUser(e.user||{}),o.debug("GalaxyApp.user: ",o.user),o._setUpListeners(),o.trigger("ready",o),o},s.prototype.defaultOptions={patchExisting:!0,root:"/",session_csrf_token:null},s.prototype._processOptions=function(e){var t=this,o=t.defaultOptions;t.options={};for(var i in o)o.hasOwnProperty(i)&&(t.options[i]=e.hasOwnProperty(i)?e[i]:o[i]);return t},s.prototype._initConfig=function(e){var t=this;return t.config=e,t.config.debug=w||t.config.debug,t},s.prototype._patchGalaxy=function(e){var t=this;if(t.options.patchExisting&&e)for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])},s.prototype._initLogger=function(e){var t=this;if(t.config.debug){e.consoleLogger=e.consoleLogger||console,e.consoleLevel=e.consoleLevel||_.default.MetricsLogger.ALL;try{e.consoleNamespaceWhitelist=localStorage.getItem(b).split(",")}catch(e){}try{e.consoleFlattenMessages="true"==localStorage.getItem("galaxy:debug:flatten")}catch(e){}console.log(e.consoleFlattenMessages)}return t.logger=new _.default.MetricsLogger(e),t.emit={},["log","debug","info","warn","error","metric"].map(function(e){t.emit[e]=function(o){t.logger.emit(e,arguments[0],Array.prototype.slice.call(arguments,1))}}),t.config.debug&&(c.default.LoggableMixin.logger=t.logger),t},s.prototype._initLocale=function(e){var t=this;return t.debug("_initLocale:",e),t.localize=v.default,window._l=t.localize,t},s.prototype._initUser=function(e){var t=this;return t.debug("_initUser:",e),t.user=new g.default.User(e),t.user.logger=t.logger,t},s.prototype._setUpListeners=function(){var t=this;return t.lastAjax={},e(document).bind("ajaxSend",function(e,o,i){var a=i.data;try{a=JSON.parse(a)}catch(e){}t.lastAjax={url:location.href.slice(0,-1)+i.url,data:a}}),t},s.prototype.debugging=function(e){var t=this;try{if(void 0===e)return"true"===localStorage.getItem("galaxy:debug");if(e)return localStorage.setItem("galaxy:debug",!0),!0;localStorage.removeItem("galaxy:debug"),t.debuggingNamespaces(null)}catch(e){console.log((0,v.default)("localStorage not available for debug flag retrieval"))}return!1},s.prototype.debuggingNamespaces=function(e){var t=this;try{if(void 0===e){var o=localStorage.getItem(b);return"string"==typeof o?o.split(","):[]}null===e?localStorage.removeItem(b):localStorage.setItem(b,e);var i=t.debuggingNamespaces();return t.logger&&(t.logger.options.consoleNamespaceWhitelist=i),i}catch(e){console.log((0,v.default)("localStorage not available for debug namespace retrieval"))}},s.prototype.toString=function(){return"GalaxyApp("+(this.user?this.user.get("email")||"(anonymous)":"uninitialized")+")"},t.default={GalaxyApp:s}}).call(t,o(0))},25:function(e,t,o){"use strict";(function(e){function o(e){e=e||{};var t=this;return t.userId=window.bootstrapped&&window.bootstrapped.user?window.bootstrapped.user.id:null,t.userId=t.userId||e.userId||null,t.consoleLogger=e.consoleLogger||null,t._init(e),t}function i(e){var t=String(e);return"[object Object]"==t&&(t=JSON.stringify(e)),t}function a(e){return this._init(e||{})}Object.defineProperty(t,"__esModule",{value:!0});var s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};o.ALL=0,o.LOG=0,o.DEBUG=10,o.INFO=20,o.WARN=30,o.ERROR=40,o.METRIC=50,o.NONE=100,o.defaultOptions={logLevel:o.NONE,consoleLevel:o.NONE,defaultNamespace:"Galaxy",consoleNamespaceWhitelist:null,consoleFlattenMessages:!1,clientPrefix:"client.",maxCacheSize:3e3,postSize:1e3,addTime:!0,cacheKeyPrefix:"logs-",postUrl:"/api/metrics",delayPostInMs:6e5,getPingData:void 0,onServerResponse:void 0},o.prototype._init=function(e){var t=this;t.options={};for(var i in o.defaultOptions)o.defaultOptions.hasOwnProperty(i)&&(t.options[i]=e.hasOwnProperty(i)?e[i]:o.defaultOptions[i]);return t.options.logLevel=t._parseLevel(t.options.logLevel),t.options.consoleLevel=t._parseLevel(t.options.consoleLevel),t._sending=!1,t._waiting=null,t._postSize=t.options.postSize,t._initCache(),t},o.prototype._initCache=function(){try{this.cache=new a({maxSize:this.options.maxCacheSize,key:this.options.cacheKeyPrefix+this.userId})}catch(e){this._emitToConsole("warn","MetricsLogger",["Could not intitialize logging cache:",e]),this.options.logLevel=o.NONE}},o.prototype._parseLevel=function(e){var t=void 0===e?"undefined":s(e);if("number"===t)return e;if("string"===t){var i=e.toUpperCase();if(o.hasOwnProperty(i))return o[i]}throw new Error("Unknown log level: "+e)},o.prototype.emit=function(e,t,o){var i=this;return t=t||i.options.defaultNamespace,e&&o?(e=i._parseLevel(e),e>=i.options.logLevel&&i._addToCache(e,t,o),i.consoleLogger&&e>=i.options.consoleLevel&&i._emitToConsole(e,t,o),i):i},o.prototype._addToCache=function(e,t,o){this._emitToConsole("debug","MetricsLogger",["_addToCache:",arguments,this.options.addTime,this.cache.length()]);var i=this;try{i.cache.add(i._buildEntry(e,t,o))>=i._postSize&&i._postCache()}catch(e){i._emitToConsole("warn","MetricsLogger",["Metrics logger could not stringify logArguments:",t,o]),i._emitToConsole("error","MetricsLogger",[e])}return i},o.prototype._buildEntry=function(e,t,o){this._emitToConsole("debug","MetricsLogger",["_buildEntry:",arguments]);var i={level:e,namespace:this.options.clientPrefix+t,args:o};return this.options.addTime&&(i.time=(new Date).toISOString()),i},o.prototype._postCache=function(t){if(t=t||{},this._emitToConsole("info","MetricsLogger",["_postCache",t,this._postSize]),!this.options.postUrl||this._sending)return e.when({});var o=this,i=t.count||o._postSize,a=o.cache.get(i),s=a.length,n="function"==typeof o.options.getPingData?o.options.getPingData():{};return n.metrics=JSON.stringify(a),o._sending=!0,e.post(o.options.postUrl,n).always(function(){o._sending=!1}).fail(function(e,t,i){o._postSize=o.options.maxCacheSize,o.emit("error","MetricsLogger",["_postCache error:",e.readyState,e.status,e.responseJSON||e.responseText])}).done(function(e){"function"==typeof o.options.onServerResponse&&o.options.onServerResponse(e),o.cache.remove(s),o._postSize=o.options.postSize})},o.prototype._delayPost=function(){var e=this;e._waiting=setTimeout(function(){e._waiting=null},e.options.delayPostInMs)},o.prototype._emitToConsole=function(e,t,a){var s=this,n=s.options.consoleNamespaceWhitelist;if(!s.consoleLogger)return s;if(n&&-1===n.indexOf(t))return s;var r=Array.prototype.slice.call(a,0);return r.unshift(t),s.options.consoleFlattenMessages&&(r=[r.map(i).join(" ")]),e>=o.METRIC&&"function"==typeof s.consoleLogger.info?s.consoleLogger.info.apply(s.consoleLogger,r):e>=o.ERROR&&"function"==typeof s.consoleLogger.error?s.consoleLogger.error.apply(s.consoleLogger,r):(e>=o.WARN&&"function"==typeof s.consoleLogger.warn?s.consoleLogger.warn.apply(s.consoleLogger,r):e>=o.INFO&&"function"==typeof s.consoleLogger.info?s.consoleLogger.info.apply(s.consoleLogger,r):e>=o.DEBUG&&"function"==typeof s.consoleLogger.debug?s.consoleLogger.debug.apply(s.consoleLogger,r):"function"==typeof s.consoleLogger.log&&s.consoleLogger.log.apply(s.consoleLogger,r),s)},o.prototype.log=function(){this.emit(1,this.options.defaultNamespace,Array.prototype.slice.call(arguments,0))},o.prototype.debug=function(){this.emit(o.DEBUG,this.options.defaultNamespace,Array.prototype.slice.call(arguments,0))},o.prototype.info=function(){this.emit(o.INFO,this.options.defaultNamespace,Array.prototype.slice.call(arguments,0))},o.prototype.warn=function(){this.emit(o.WARN,this.options.defaultNamespace,Array.prototype.slice.call(arguments,0))},o.prototype.error=function(){this.emit(o.ERROR,this.options.defaultNamespace,Array.prototype.slice.call(arguments,0))},o.prototype.metric=function(){this.emit(o.METRIC,this.options.defaultNamespace,Array.prototype.slice.call(arguments,0))},a.defaultOptions={maxSize:5e3},a.prototype._init=function(e){if(!this._hasStorage())throw new Error("LoggingCache needs localStorage");if(!e.key)throw new Error("LoggingCache needs key for localStorage");return this.key=e.key,this._initStorage(),this.maxSize=e.maxSize||a.defaultOptions.maxSize,this},a.prototype._hasStorage=function(){try{return localStorage.setItem("test","test"),localStorage.removeItem("test"),!0}catch(e){return!1}},a.prototype._initStorage=function(){return null===localStorage.getItem(this.key)?this.empty():this},a.prototype.add=function(e){var t=this,o=t._fetchAndParse(),i=o.length+1-t.maxSize;return i>0&&o.splice(0,i),o.push(e),t._unparseAndStore(o),o.length},a.prototype._fetchAndParse=function(){var e=this;return JSON.parse(localStorage.getItem(e.key))},a.prototype._unparseAndStore=function(e){var t=this;return localStorage.setItem(t.key,JSON.stringify(e))},a.prototype.length=function(){return this._fetchAndParse().length},a.prototype.get=function(e){return this._fetchAndParse().slice(0,e)},a.prototype.remove=function(e){var t=this._fetchAndParse(),o=t.splice(0,e);return this._unparseAndStore(t),o},a.prototype.empty=function(){return localStorage.setItem(this.key,"[]"),this},a.prototype.stringify=function(e){return JSON.stringify(this.get(e))},a.prototype.print=function(){console.log(JSON.stringify(this._fetchAndParse(),null," "))},t.default={MetricsLogger:o,LoggingCache:a}}).call(t,o(0))},26:function(e,t,o){"use strict";(function(e,i,a){function s(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var n=o(33),r=s(n),l=o(22),u=s(l),d=o(8),c=s(d),p=o(4),g=s(p),f=e.View.extend({el:"body",className:"full-content",_panelids:["left","right"],initialize:function(t){var o=this;this.config=i.defaults(t.config||{},{message_box_visible:!1,message_box_content:"",message_box_class:"info",show_inactivity_warning:!1,inactivity_box_content:""}),Galaxy.modal=this.modal=new c.default.View,Galaxy.display=this.display=function(e){e.title?(g.default.setWindowTitle(e.title),e.allow_title_display=!1):(g.default.setWindowTitle(),e.allow_title_display=!0),o.center.display(e)},Galaxy.router=this.router=t.Router&&new t.Router(o,t),this.masthead=new r.default.View(this.config),this.center=new u.default.CenterPanel,this.$el.attr("scroll","no"),this.$el.html(this._template()),this.$("#masthead").replaceWith(this.masthead.$el),this.$("#center").append(this.center.$el),this.$el.append(this.masthead.frame.$el),this.$el.append(this.modal.$el),this.$messagebox=this.$("#messagebox"),this.$inactivebox=this.$("#inactivebox"),this.panels={},i.each(this._panelids,function(e){var i=e.charAt(0).toUpperCase()+e.slice(1),a=t[i];if(a){var s=new a(o,t);o[s.toString()]=s,o.panels[e]=new u.default.SidePanel({id:e,el:o.$("#"+e),view:s})}}),this.render(),this.router&&e.history.start({root:Galaxy.root,pushState:!0})},render:function(){return a(".select2-hidden-accessible").remove(),this.masthead.render(),this.renderMessageBox(),this.renderInactivityBox(),this.renderPanels(),this._checkCommunicationServerOnline(),this},renderMessageBox:function(){if(this.config.message_box_visible){var e=this.config.message_box_content||"",t=this.config.message_box_class||"info";this.$el.addClass("has-message-box"),this.$messagebox.attr("class","panel-"+t+"-message").html(e).toggle(!!e).show()}else this.$el.removeClass("has-message-box"),this.$messagebox.hide();return this},renderInactivityBox:function(){if(this.config.show_inactivity_warning){var e=this.config.inactivity_box_content||"",t=a("").attr("href",Galaxy.root+"user/resend_verification").text("Resend verification");this.$el.addClass("has-inactivity-box"),this.$inactivebox.html(e+" ").append(t).toggle(!!e).show()}else this.$el.removeClass("has-inactivity-box"),this.$inactivebox.hide();return this},renderPanels:function(){var e=this;return i.each(this._panelids,function(t){var o=e.panels[t];o?o.render():(e.$("#center").css(t,0),e.$("#"+t).hide())}),this},_template:function(){return['
    ','
    ','
    ','
    ','
    ','
    ','
    ','",'
    '].join("")},toString:function(){return"PageLayoutView"},_checkCommunicationServerOnline:function(){var e=window.Galaxy.config.communication_server_host,t=window.Galaxy.config.communication_server_port,o=window.Galaxy.user.attributes.preferences,i=a("#show-chat-online");o&&-1!=["1","true"].indexOf(o.communication_server)?a.ajax({url:e+":"+t}).success(function(e){null!==window.Galaxy.user.id&&"hidden"===i.css("visibility")&&i.css("visibility","visible")}).error(function(e){i.css("visibility","hidden")}):i.css("visibility","hidden")}});t.default={View:f}}).call(t,o(2),o(1),o(0))},277:function(e,t,o){"use strict";(function(e){function t(e){return e&&e.__esModule?e:{default:e}}var i=o(3),a=t(i),s=o(0),n=t(s),r=o(23),l=t(r),u=o(278),d=t(u),c=o(68),p=t(c),g=o(19),f=t(g),_=o(6),h=(t(_),o(14)),m=t(h),y=o(53),v=t(y),b=o(4),w=t(b),x=o(26),S=t(x),L=o(31),G=t(L),O=o(279),M=t(O),C=n.default;window.app=function(t,o){window.Galaxy=new l.default.GalaxyApp(t,o),Galaxy.debug("admin app");var i=v.default.extend({routes:{"(/)admin(/)users":"show_users","(/)admin(/)roles":"show_roles","(/)admin(/)groups":"show_groups","(/)admin(/)tool_versions":"show_tool_versions","(/)admin(/)quotas":"show_quotas","(/)admin(/)repositories":"show_repositories","(/)admin(/)forms":"show_forms","(/)admin(/)form(/)(:form_id)":"show_form","(/)admin/api_keys":"show_user_api_keys"},authenticate:function(e,t){return Galaxy.user&&Galaxy.user.id&&Galaxy.user.get("is_admin")},show_users:function(){this.page.display(new f.default({url_base:Galaxy.root+"admin/users_list",url_data:Galaxy.params,dict_format:!0}))},show_roles:function(){this.page.display(new f.default({url_base:Galaxy.root+"admin/roles_list",url_data:Galaxy.params,dict_format:!0}))},show_groups:function(){this.page.display(new f.default({url_base:Galaxy.root+"admin/groups_list",url_data:Galaxy.params,dict_format:!0}))},show_repositories:function(){this.page.display(new f.default({url_base:Galaxy.root+"admin_toolshed/browse_repositories",url_data:Galaxy.params,dict_format:!0}))},show_tool_versions:function(){this.page.display(new f.default({url_base:Galaxy.root+"admin/tool_versions_list",url_data:Galaxy.params,dict_format:!0}))},show_quotas:function(){this.page.display(new f.default({url_base:Galaxy.root+"admin/quotas_list",url_data:Galaxy.params,dict_format:!0}))},show_user_api_keys:function(){var e=document.createElement("div");this.page.display(e),new G.default(M.default).$mount(e)},show_forms:function(){this.page.display(new f.default({url_base:Galaxy.root+"forms/forms_list",url_data:Galaxy.params,dict_format:!0}))},show_form:function(e){var t="?id="+m.default.get("id"),o={reset_user_password:{title:(0,a.default)("Reset passwords"),url:"admin/reset_user_password"+t,icon:"fa-user",submit_title:"Save new password",redirect:"admin/users"},manage_roles_and_groups_for_user:{url:"admin/manage_roles_and_groups_for_user"+t,icon:"fa-users",redirect:"admin/users"},manage_users_and_groups_for_role:{url:"admin/manage_users_and_groups_for_role"+t,redirect:"admin/roles"},manage_users_and_roles_for_group:{url:"admin/manage_users_and_roles_for_group"+t,redirect:"admin/groups"},manage_users_and_groups_for_quota:{url:"admin/manage_users_and_groups_for_quota"+t,redirect:"admin/quotas"},create_role:{url:"admin/create_role",redirect:"admin/roles"},create_group:{url:"admin/create_group",redirect:"admin/groups"},create_quota:{url:"admin/create_quota",redirect:"admin/quotas"},rename_role:{url:"admin/rename_role"+t,redirect:"admin/roles"},rename_group:{url:"admin/rename_group"+t,redirect:"admin/groups"},rename_quota:{url:"admin/rename_quota"+t,redirect:"admin/quotas"},edit_quota:{url:"admin/edit_quota"+t,redirect:"admin/quotas"},set_quota_default:{url:"admin/set_quota_default"+t,redirect:"admin/quotas"},create_form:{url:"forms/create_form",redirect:"admin/forms"},edit_form:{url:"forms/edit_form"+t,redirect:"admin/forms"}};this.page.display(new p.default.View(o[e]))}});C(function(){e.extend(t.config,{active_view:"admin"}),w.default.setWindowTitle("Administration"),Galaxy.page=new S.default.View(e.extend(t,{Left:d.default,Router:i}))})}}).call(t,o(1))},278:function(e,t,o){"use strict";(function(e,i,a){Object.defineProperty(t,"__esModule",{value:!0});var s=o(3),n=function(e){return e&&e.__esModule?e:{default:e}}(s),r=e.View.extend({initialize:function(t,o){var i=this;this.page=t,this.root=o.root,this.config=o.config,this.settings=o.settings,this.message=o.message,this.status=o.status,this.model=new e.Model({title:(0,n.default)("Administration")}),this.categories=new e.Collection([{title:(0,n.default)("Server"),items:[{title:(0,n.default)("Data types"),url:"admin/view_datatypes_registry"},{title:(0,n.default)("Data tables"),url:"admin/view_tool_data_tables"},{title:(0,n.default)("Display applications"),url:"admin/display_applications"},{title:(0,n.default)("Manage jobs"),url:"admin/jobs"},{title:(0,n.default)("Local data"),url:"data_manager"}]},{title:(0,n.default)("User Management"),items:[{title:(0,n.default)("Users"),url:"admin/users",target:"__use_router__"},{title:(0,n.default)("Quotas"),url:"admin/quotas",target:"__use_router__",enabled:i.config.enable_quotas},{title:(0,n.default)("Groups"),url:"admin/groups",target:"__use_router__"},{title:(0,n.default)("Roles"),url:"admin/roles",target:"__use_router__"},{title:(0,n.default)("Forms"),url:"admin/forms",target:"__use_router__"},{title:(0,n.default)("API keys"),url:"admin/api_keys",target:"__use_router__"},{title:(0,n.default)("Impersonate a user"),url:"admin/impersonate",enabled:i.config.allow_user_impersonation}]},{title:(0,n.default)("Tool Management"),items:[{title:(0,n.default)("Install new tools"),url:"admin_toolshed/browse_tool_sheds",enabled:i.settings.is_tool_shed_installed},{title:"Install new tools (Beta)",url:"admin_toolshed/browse_toolsheds",enabled:i.settings.is_tool_shed_installed&&i.config.enable_beta_ts_api_install},{title:(0,n.default)("Monitor installation"),url:"admin_toolshed/monitor_repository_installation",enabled:i.settings.installing_repository_ids},{title:(0,n.default)("Manage tools"),url:"admin/repositories",enabled:i.settings.is_repo_installed,target:"__use_router__"},{title:(0,n.default)("Manage metadata"),url:"admin_toolshed/reset_metadata_on_selected_installed_repositories",enabled:i.settings.is_repo_installed},{title:(0,n.default)("Manage whitelist"),url:"admin/sanitize_whitelist"},{title:(0,n.default)("Manage dependencies"),url:"admin/manage_tool_dependencies"},{title:(0,n.default)("View lineage"),url:"admin/tool_versions",target:"__use_router__"},{title:(0,n.default)("View migration stages"),url:"admin/review_tool_migration_stages"},{title:(0,n.default)("View error logs"),url:"admin/tool_errors"}]}]),this.setElement(this._template())},render:function(){var e=this;this.$el.empty(),this.categories.each(function(t){var o=i(e._templateSection(t.attributes)),s=o.find(".ui-side-section-body");a.each(t.get("items"),function(t){if(void 0===t.enabled||t.enabled){var o=i("").attr({href:e.root+t.url}).text((0,n.default)(t.title));"__use_router__"==t.target?o.on("click",function(o){o.preventDefault(),e.page.router.push(t.url)}):o.attr("target","galaxy_main"),s.append(i("
    ").addClass("ui-side-section-body-title").append(o))}}),e.$el.append(o)}),this.page.$("#galaxy_main").prop("src",this.root+"admin/center?message="+this.message+"&status="+this.status)},_templateSection:function(e){return["
    ",'
    '+(0,n.default)(e.title)+"
    ",'
    ',"
    "].join("")},_template:function(){return'
    '},toString:function(){return"adminPanel"}});t.default=r}).call(t,o(2),o(0),o(1))},279:function(e,t,o){"use strict";function i(e){o(280)}Object.defineProperty(t,"__esModule",{value:!0});var a=o(282),s=o.n(a),n=o(283),r=o(48),l=i,u=r(s.a,n.a,!1,l,null,null);t.default=u.exports},280:function(e,t,o){var i=o(281);"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);o(47)("b1b74e4e",i,!0)},281:function(e,t,o){t=e.exports=o(46)(void 0),t.push([e.i,"",""])},282:function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=o(92),a=function(e){return e&&e.__esModule?e:{default:e}}(i);t.default={data:function(){return{users:[],errors:[]}},created:function(){var e=this;a.default.get(Galaxy.root+"userskeys/all_users").then(function(t){e.users=t.data}).catch(function(t){e.errors.push(t)})},methods:{generateKey:function(e){var t=this;a.default.get(Galaxy.root+"userskeys/admin_api_keys",{params:{uid:e}}).then(function(e){t.users=e.data}).catch(function(e){t.errors.push(e)})}}}},283:function(e,t,o){"use strict";var i=function(){var e=this,t=e.$createElement,o=e._self._c||t;return o("div",{staticClass:"toolForm",attrs:{id:"form-userkeys"}},[o("div",{staticClass:"toolFormTitle"},[e._v("User Information")]),e._v(" "),e.users&&e.users.length>0?o("div",[o("table",{staticClass:"grid"},[e._m(0,!1,!1),e._v(" "),o("tbody",e._l(e.users,function(t){return o("tr",[o("td",[e._v("\n "+e._s(t.uid)+"\n ")]),e._v(" "),o("td",[e._v("\n "+e._s(t.email)+"\n ")]),e._v(" "),o("td",[e._v("\n "+e._s(t.key)+"\n ")]),e._v(" "),o("td",[o("input",{attrs:{type:"button",value:"Generate a new key now"},on:{click:function(o){e.generateKey(t.uid)}}})])])}))])]):o("div",[o("div",[e._v("No user information available")])]),e._v(" "),o("div",{staticStyle:{clear:"both"}})])},a=[function(){var e=this,t=e.$createElement,o=e._self._c||t;return o("thead",[o("th",[e._v("Encoded UID")]),o("th",[e._v("Email")]),o("th",[e._v("API Key")]),o("th",[e._v("Actions")])])}],s={render:i,staticRenderFns:a};t.a=s},53:function(e,t,o){"use strict";(function(e){function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=o(0),s=i(a),n=o(14),r=i(n),l=o(6),u=i(l),d=s.default,c=e.Router.extend({initialize:function(e,t){this.page=e,this.options=t},push:function(e,t){t=t||{},t.__identifer=Math.random().toString(36).substr(2),d.isEmptyObject(t)||(e+=-1==e.indexOf("?")?"?":"&",e+=d.param(t,!0)),Galaxy.params=t,this.navigate(e,{trigger:!0})},execute:function(e,t,o){Galaxy.debug("router execute:",e,t,o);var i=r.default.parse(t.pop());t.push(i),e&&(this.authenticate(t,o)?e.apply(this,t):this.access_denied())},authenticate:function(e,t){return!0},access_denied:function(){this.page.display(new u.default.Message({status:"danger",message:"You must be logged in with proper credentials to make this request.",persistent:!0}))}});t.default=c}).call(t,o(2))},68:function(e,t,o){"use strict";(function(e,i){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var s=o(11),n=a(s),r=o(6),l=a(r),u=e.View.extend({initialize:function(t){this.model=new e.Model(t),this.url=this.model.get("url"),this.redirect=this.model.get("redirect"),this.setElement("
    "),this.render()},render:function(){var e=this;i.ajax({url:Galaxy.root+this.url,type:"GET"}).done(function(t){var o=i.extend({},e.model.attributes,t),a=new n.default({title:o.title,message:o.message,status:o.status||"warning",icon:o.icon,initial_errors:!0,errors:o.errors,inputs:o.inputs,buttons:{submit:new l.default.Button({tooltip:o.submit_tooltip,title:o.submit_title||"Save",icon:o.submit_icon||"fa-save",cls:"btn btn-primary ui-clear-float",onclick:function(){e._submit(a)}})}});e.$el.empty().append(a.$el)}).fail(function(t){e.$el.empty().append(new l.default.Message({message:"Failed to load resource "+e.url+".",status:"danger",persistent:!0}).$el)})},_submit:function(e){var t=this;i.ajax({url:Galaxy.root+t.url,data:JSON.stringify(e.data.create()),type:"PUT",contentType:"application/json"}).done(function(o){var a={};o.id?a.id=o.id:a={message:o.message,status:"success",persistent:!1},t.redirect?window.location=Galaxy.root+t.redirect+"?"+i.param(a):(e.data.matchModel(o,function(t,o){e.field_list[o].value(t.value)}),t._showMessage(e,success_message))}).fail(function(o){t._showMessage(e,{message:o.responseJSON.err_msg,status:"danger",persistent:!1})})},_showMessage:function(e,t){e.$el.parents().filter(function(){return-1!=["auto","scroll"].indexOf(i(this).css("overflow"))}).first().animate({scrollTop:0},500),e.message.update(t)}});t.default={View:u}}).call(t,o(2),o(0))}},[277]); \ No newline at end of file +webpackJsonp([2],{23:function(e,t,o){"use strict";(function(e){function i(e){return e&&e.__esModule?e:{default:e}}function a(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t.default=e,t}function s(e,t){return this._init(e||{},t||{})}Object.defineProperty(t,"__esModule",{value:!0});var n=o(1),r=a(n),l=o(2),u=a(l),d=o(5),c=i(d),p=o(24),g=i(p),f=o(25),_=i(f),h=o(32),m=i(h),y=o(3),v=i(y);(0,m.default)(s,"GalaxyApp");var b="galaxy:debug:namespaces",w=!1;try{w="true"==localStorage.getItem("galaxy:debug")}catch(e){console.log((0,v.default)("localStorage not available for debug flag retrieval"))}s.prototype._init=function(e,t){var o=this;return r.extend(o,u.Events),w&&(o.logger=console,console.debug("debugging galaxy:","options:",e,"bootstrapped:",t)),o._processOptions(e),o.root=e.root||"/",o.params=e.params||{},o.session_csrf_token=e.session_csrf_token||null,o._initConfig(e.config||{}),o._patchGalaxy(window.Galaxy),o._initLogger(o.options.loggerOptions||{}),o.debug("GalaxyApp.options: ",o.options),o.debug("GalaxyApp.config: ",o.config),o.debug("GalaxyApp.logger: ",o.logger),o._initLocale(),o.debug("GalaxyApp.localize: ",o.localize),o.config=e.config||{},o.debug("GalaxyApp.config: ",o.config),o._initUser(e.user||{}),o.debug("GalaxyApp.user: ",o.user),o._setUpListeners(),o.trigger("ready",o),o},s.prototype.defaultOptions={patchExisting:!0,root:"/",session_csrf_token:null},s.prototype._processOptions=function(e){var t=this,o=t.defaultOptions;t.options={};for(var i in o)o.hasOwnProperty(i)&&(t.options[i]=e.hasOwnProperty(i)?e[i]:o[i]);return t},s.prototype._initConfig=function(e){var t=this;return t.config=e,t.config.debug=w||t.config.debug,t},s.prototype._patchGalaxy=function(e){var t=this;if(t.options.patchExisting&&e)for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])},s.prototype._initLogger=function(e){var t=this;if(t.config.debug){e.consoleLogger=e.consoleLogger||console,e.consoleLevel=e.consoleLevel||_.default.MetricsLogger.ALL;try{e.consoleNamespaceWhitelist=localStorage.getItem(b).split(",")}catch(e){}try{e.consoleFlattenMessages="true"==localStorage.getItem("galaxy:debug:flatten")}catch(e){}console.log(e.consoleFlattenMessages)}return t.logger=new _.default.MetricsLogger(e),t.emit={},["log","debug","info","warn","error","metric"].map(function(e){t.emit[e]=function(o){t.logger.emit(e,arguments[0],Array.prototype.slice.call(arguments,1))}}),t.config.debug&&(c.default.LoggableMixin.logger=t.logger),t},s.prototype._initLocale=function(e){var t=this;return t.debug("_initLocale:",e),t.localize=v.default,window._l=t.localize,t},s.prototype._initUser=function(e){var t=this;return t.debug("_initUser:",e),t.user=new g.default.User(e),t.user.logger=t.logger,t},s.prototype._setUpListeners=function(){var t=this;return t.lastAjax={},e(document).bind("ajaxSend",function(e,o,i){var a=i.data;try{a=JSON.parse(a)}catch(e){}t.lastAjax={url:location.href.slice(0,-1)+i.url,data:a}}),t},s.prototype.debugging=function(e){var t=this;try{if(void 0===e)return"true"===localStorage.getItem("galaxy:debug");if(e)return localStorage.setItem("galaxy:debug",!0),!0;localStorage.removeItem("galaxy:debug"),t.debuggingNamespaces(null)}catch(e){console.log((0,v.default)("localStorage not available for debug flag retrieval"))}return!1},s.prototype.debuggingNamespaces=function(e){var t=this;try{if(void 0===e){var o=localStorage.getItem(b);return"string"==typeof o?o.split(","):[]}null===e?localStorage.removeItem(b):localStorage.setItem(b,e);var i=t.debuggingNamespaces();return t.logger&&(t.logger.options.consoleNamespaceWhitelist=i),i}catch(e){console.log((0,v.default)("localStorage not available for debug namespace retrieval"))}},s.prototype.toString=function(){return"GalaxyApp("+(this.user?this.user.get("email")||"(anonymous)":"uninitialized")+")"},t.default={GalaxyApp:s}}).call(t,o(0))},25:function(e,t,o){"use strict";(function(e){function o(e){e=e||{};var t=this;return t.userId=window.bootstrapped&&window.bootstrapped.user?window.bootstrapped.user.id:null,t.userId=t.userId||e.userId||null,t.consoleLogger=e.consoleLogger||null,t._init(e),t}function i(e){var t=String(e);return"[object Object]"==t&&(t=JSON.stringify(e)),t}function a(e){return this._init(e||{})}Object.defineProperty(t,"__esModule",{value:!0});var s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};o.ALL=0,o.LOG=0,o.DEBUG=10,o.INFO=20,o.WARN=30,o.ERROR=40,o.METRIC=50,o.NONE=100,o.defaultOptions={logLevel:o.NONE,consoleLevel:o.NONE,defaultNamespace:"Galaxy",consoleNamespaceWhitelist:null,consoleFlattenMessages:!1,clientPrefix:"client.",maxCacheSize:3e3,postSize:1e3,addTime:!0,cacheKeyPrefix:"logs-",postUrl:"/api/metrics",delayPostInMs:6e5,getPingData:void 0,onServerResponse:void 0},o.prototype._init=function(e){var t=this;t.options={};for(var i in o.defaultOptions)o.defaultOptions.hasOwnProperty(i)&&(t.options[i]=e.hasOwnProperty(i)?e[i]:o.defaultOptions[i]);return t.options.logLevel=t._parseLevel(t.options.logLevel),t.options.consoleLevel=t._parseLevel(t.options.consoleLevel),t._sending=!1,t._waiting=null,t._postSize=t.options.postSize,t._initCache(),t},o.prototype._initCache=function(){try{this.cache=new a({maxSize:this.options.maxCacheSize,key:this.options.cacheKeyPrefix+this.userId})}catch(e){this._emitToConsole("warn","MetricsLogger",["Could not intitialize logging cache:",e]),this.options.logLevel=o.NONE}},o.prototype._parseLevel=function(e){var t=void 0===e?"undefined":s(e);if("number"===t)return e;if("string"===t){var i=e.toUpperCase();if(o.hasOwnProperty(i))return o[i]}throw new Error("Unknown log level: "+e)},o.prototype.emit=function(e,t,o){var i=this;return t=t||i.options.defaultNamespace,e&&o?(e=i._parseLevel(e),e>=i.options.logLevel&&i._addToCache(e,t,o),i.consoleLogger&&e>=i.options.consoleLevel&&i._emitToConsole(e,t,o),i):i},o.prototype._addToCache=function(e,t,o){this._emitToConsole("debug","MetricsLogger",["_addToCache:",arguments,this.options.addTime,this.cache.length()]);var i=this;try{i.cache.add(i._buildEntry(e,t,o))>=i._postSize&&i._postCache()}catch(e){i._emitToConsole("warn","MetricsLogger",["Metrics logger could not stringify logArguments:",t,o]),i._emitToConsole("error","MetricsLogger",[e])}return i},o.prototype._buildEntry=function(e,t,o){this._emitToConsole("debug","MetricsLogger",["_buildEntry:",arguments]);var i={level:e,namespace:this.options.clientPrefix+t,args:o};return this.options.addTime&&(i.time=(new Date).toISOString()),i},o.prototype._postCache=function(t){if(t=t||{},this._emitToConsole("info","MetricsLogger",["_postCache",t,this._postSize]),!this.options.postUrl||this._sending)return e.when({});var o=this,i=t.count||o._postSize,a=o.cache.get(i),s=a.length,n="function"==typeof o.options.getPingData?o.options.getPingData():{};return n.metrics=JSON.stringify(a),o._sending=!0,e.post(o.options.postUrl,n).always(function(){o._sending=!1}).fail(function(e,t,i){o._postSize=o.options.maxCacheSize,o.emit("error","MetricsLogger",["_postCache error:",e.readyState,e.status,e.responseJSON||e.responseText])}).done(function(e){"function"==typeof o.options.onServerResponse&&o.options.onServerResponse(e),o.cache.remove(s),o._postSize=o.options.postSize})},o.prototype._delayPost=function(){var e=this;e._waiting=setTimeout(function(){e._waiting=null},e.options.delayPostInMs)},o.prototype._emitToConsole=function(e,t,a){var s=this,n=s.options.consoleNamespaceWhitelist;if(!s.consoleLogger)return s;if(n&&-1===n.indexOf(t))return s;var r=Array.prototype.slice.call(a,0);return r.unshift(t),s.options.consoleFlattenMessages&&(r=[r.map(i).join(" ")]),e>=o.METRIC&&"function"==typeof s.consoleLogger.info?s.consoleLogger.info.apply(s.consoleLogger,r):e>=o.ERROR&&"function"==typeof s.consoleLogger.error?s.consoleLogger.error.apply(s.consoleLogger,r):(e>=o.WARN&&"function"==typeof s.consoleLogger.warn?s.consoleLogger.warn.apply(s.consoleLogger,r):e>=o.INFO&&"function"==typeof s.consoleLogger.info?s.consoleLogger.info.apply(s.consoleLogger,r):e>=o.DEBUG&&"function"==typeof s.consoleLogger.debug?s.consoleLogger.debug.apply(s.consoleLogger,r):"function"==typeof s.consoleLogger.log&&s.consoleLogger.log.apply(s.consoleLogger,r),s)},o.prototype.log=function(){this.emit(1,this.options.defaultNamespace,Array.prototype.slice.call(arguments,0))},o.prototype.debug=function(){this.emit(o.DEBUG,this.options.defaultNamespace,Array.prototype.slice.call(arguments,0))},o.prototype.info=function(){this.emit(o.INFO,this.options.defaultNamespace,Array.prototype.slice.call(arguments,0))},o.prototype.warn=function(){this.emit(o.WARN,this.options.defaultNamespace,Array.prototype.slice.call(arguments,0))},o.prototype.error=function(){this.emit(o.ERROR,this.options.defaultNamespace,Array.prototype.slice.call(arguments,0))},o.prototype.metric=function(){this.emit(o.METRIC,this.options.defaultNamespace,Array.prototype.slice.call(arguments,0))},a.defaultOptions={maxSize:5e3},a.prototype._init=function(e){if(!this._hasStorage())throw new Error("LoggingCache needs localStorage");if(!e.key)throw new Error("LoggingCache needs key for localStorage");return this.key=e.key,this._initStorage(),this.maxSize=e.maxSize||a.defaultOptions.maxSize,this},a.prototype._hasStorage=function(){try{return localStorage.setItem("test","test"),localStorage.removeItem("test"),!0}catch(e){return!1}},a.prototype._initStorage=function(){return null===localStorage.getItem(this.key)?this.empty():this},a.prototype.add=function(e){var t=this,o=t._fetchAndParse(),i=o.length+1-t.maxSize;return i>0&&o.splice(0,i),o.push(e),t._unparseAndStore(o),o.length},a.prototype._fetchAndParse=function(){var e=this;return JSON.parse(localStorage.getItem(e.key))},a.prototype._unparseAndStore=function(e){var t=this;return localStorage.setItem(t.key,JSON.stringify(e))},a.prototype.length=function(){return this._fetchAndParse().length},a.prototype.get=function(e){return this._fetchAndParse().slice(0,e)},a.prototype.remove=function(e){var t=this._fetchAndParse(),o=t.splice(0,e);return this._unparseAndStore(t),o},a.prototype.empty=function(){return localStorage.setItem(this.key,"[]"),this},a.prototype.stringify=function(e){return JSON.stringify(this.get(e))},a.prototype.print=function(){console.log(JSON.stringify(this._fetchAndParse(),null," "))},t.default={MetricsLogger:o,LoggingCache:a}}).call(t,o(0))},26:function(e,t,o){"use strict";(function(e,i,a){function s(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var n=o(33),r=s(n),l=o(22),u=s(l),d=o(8),c=s(d),p=o(4),g=s(p),f=e.View.extend({el:"body",className:"full-content",_panelids:["left","right"],initialize:function(t){var o=this;this.config=i.defaults(t.config||{},{message_box_visible:!1,message_box_content:"",message_box_class:"info",show_inactivity_warning:!1,inactivity_box_content:""}),Galaxy.modal=this.modal=new c.default.View,Galaxy.display=this.display=function(e){e.title?(g.default.setWindowTitle(e.title),e.allow_title_display=!1):(g.default.setWindowTitle(),e.allow_title_display=!0),o.center.display(e)},Galaxy.router=this.router=t.Router&&new t.Router(o,t),this.masthead=new r.default.View(this.config),this.center=new u.default.CenterPanel,this.$el.attr("scroll","no"),this.$el.html(this._template()),this.$("#masthead").replaceWith(this.masthead.$el),this.$("#center").append(this.center.$el),this.$el.append(this.masthead.frame.$el),this.$el.append(this.modal.$el),this.$messagebox=this.$("#messagebox"),this.$inactivebox=this.$("#inactivebox"),this.panels={},i.each(this._panelids,function(e){var i=e.charAt(0).toUpperCase()+e.slice(1),a=t[i];if(a){var s=new a(o,t);o[s.toString()]=s,o.panels[e]=new u.default.SidePanel({id:e,el:o.$("#"+e),view:s})}}),this.render(),this.router&&e.history.start({root:Galaxy.root,pushState:!0})},render:function(){return a(".select2-hidden-accessible").remove(),this.masthead.render(),this.renderMessageBox(),this.renderInactivityBox(),this.renderPanels(),this._checkCommunicationServerOnline(),this},renderMessageBox:function(){if(this.config.message_box_visible){var e=this.config.message_box_content||"",t=this.config.message_box_class||"info";this.$el.addClass("has-message-box"),this.$messagebox.attr("class","panel-"+t+"-message").html(e).toggle(!!e).show()}else this.$el.removeClass("has-message-box"),this.$messagebox.hide();return this},renderInactivityBox:function(){if(this.config.show_inactivity_warning){var e=this.config.inactivity_box_content||"",t=a("").attr("href",Galaxy.root+"user/resend_verification").text("Resend verification");this.$el.addClass("has-inactivity-box"),this.$inactivebox.html(e+" ").append(t).toggle(!!e).show()}else this.$el.removeClass("has-inactivity-box"),this.$inactivebox.hide();return this},renderPanels:function(){var e=this;return i.each(this._panelids,function(t){var o=e.panels[t];o?o.render():(e.$("#center").css(t,0),e.$("#"+t).hide())}),this},_template:function(){return['
    ','
    ','
    ','
    ','
    ','
    ','
    ','",'
    '].join("")},toString:function(){return"PageLayoutView"},_checkCommunicationServerOnline:function(){var e=window.Galaxy.config.communication_server_host,t=window.Galaxy.config.communication_server_port,o=window.Galaxy.user.attributes.preferences,i=a("#show-chat-online");o&&-1!=["1","true"].indexOf(o.communication_server)?a.ajax({url:e+":"+t}).success(function(e){null!==window.Galaxy.user.id&&"hidden"===i.css("visibility")&&i.css("visibility","visible")}).error(function(e){i.css("visibility","hidden")}):i.css("visibility","hidden")}});t.default={View:f}}).call(t,o(2),o(1),o(0))},277:function(e,t,o){"use strict";(function(e){function t(e){return e&&e.__esModule?e:{default:e}}var i=o(3),a=t(i),s=o(0),n=t(s),r=o(23),l=t(r),u=o(278),d=t(u),c=o(68),p=t(c),g=o(19),f=t(g),_=o(6),h=(t(_),o(14)),m=t(h),y=o(53),v=t(y),b=o(4),w=t(b),x=o(26),S=t(x),L=o(31),G=t(L),O=o(279),M=t(O),C=n.default;window.app=function(t,o){window.Galaxy=new l.default.GalaxyApp(t,o),Galaxy.debug("admin app");var i=v.default.extend({routes:{"(/)admin(/)users":"show_users","(/)admin(/)roles":"show_roles","(/)admin(/)groups":"show_groups","(/)admin(/)tool_versions":"show_tool_versions","(/)admin(/)quotas":"show_quotas","(/)admin(/)repositories":"show_repositories","(/)admin(/)forms":"show_forms","(/)admin(/)form(/)(:form_id)":"show_form","(/)admin/api_keys":"show_user_api_keys"},authenticate:function(e,t){return Galaxy.user&&Galaxy.user.id&&Galaxy.user.get("is_admin")},show_users:function(){this.page.display(new f.default({url_base:Galaxy.root+"admin/users_list",url_data:Galaxy.params}))},show_roles:function(){this.page.display(new f.default({url_base:Galaxy.root+"admin/roles_list",url_data:Galaxy.params}))},show_groups:function(){this.page.display(new f.default({url_base:Galaxy.root+"admin/groups_list",url_data:Galaxy.params}))},show_repositories:function(){this.page.display(new f.default({url_base:Galaxy.root+"admin_toolshed/browse_repositories",url_data:Galaxy.params}))},show_tool_versions:function(){this.page.display(new f.default({url_base:Galaxy.root+"admin/tool_versions_list",url_data:Galaxy.params}))},show_quotas:function(){this.page.display(new f.default({url_base:Galaxy.root+"admin/quotas_list",url_data:Galaxy.params}))},show_user_api_keys:function(){var e=document.createElement("div");this.page.display(e),new G.default(M.default).$mount(e)},show_forms:function(){this.page.display(new f.default({url_base:Galaxy.root+"forms/forms_list",url_data:Galaxy.params}))},show_form:function(e){var t="?id="+m.default.get("id"),o={reset_user_password:{title:(0,a.default)("Reset passwords"),url:"admin/reset_user_password"+t,icon:"fa-user",submit_title:"Save new password",redirect:"admin/users"},manage_roles_and_groups_for_user:{url:"admin/manage_roles_and_groups_for_user"+t,icon:"fa-users",redirect:"admin/users"},manage_users_and_groups_for_role:{url:"admin/manage_users_and_groups_for_role"+t,redirect:"admin/roles"},manage_users_and_roles_for_group:{url:"admin/manage_users_and_roles_for_group"+t,redirect:"admin/groups"},manage_users_and_groups_for_quota:{url:"admin/manage_users_and_groups_for_quota"+t,redirect:"admin/quotas"},create_role:{url:"admin/create_role",redirect:"admin/roles"},create_group:{url:"admin/create_group",redirect:"admin/groups"},create_quota:{url:"admin/create_quota",redirect:"admin/quotas"},rename_role:{url:"admin/rename_role"+t,redirect:"admin/roles"},rename_group:{url:"admin/rename_group"+t,redirect:"admin/groups"},rename_quota:{url:"admin/rename_quota"+t,redirect:"admin/quotas"},edit_quota:{url:"admin/edit_quota"+t,redirect:"admin/quotas"},set_quota_default:{url:"admin/set_quota_default"+t,redirect:"admin/quotas"},create_form:{url:"forms/create_form",redirect:"admin/forms"},edit_form:{url:"forms/edit_form"+t,redirect:"admin/forms"}};this.page.display(new p.default.View(o[e]))}});C(function(){e.extend(t.config,{active_view:"admin"}),w.default.setWindowTitle("Administration"),Galaxy.page=new S.default.View(e.extend(t,{Left:d.default,Router:i}))})}}).call(t,o(1))},278:function(e,t,o){"use strict";(function(e,i,a){Object.defineProperty(t,"__esModule",{value:!0});var s=o(3),n=function(e){return e&&e.__esModule?e:{default:e}}(s),r=e.View.extend({initialize:function(t,o){var i=this;this.page=t,this.root=o.root,this.config=o.config,this.settings=o.settings,this.message=o.message,this.status=o.status,this.model=new e.Model({title:(0,n.default)("Administration")}),this.categories=new e.Collection([{title:(0,n.default)("Server"),items:[{title:(0,n.default)("Data types"),url:"admin/view_datatypes_registry"},{title:(0,n.default)("Data tables"),url:"admin/view_tool_data_tables"},{title:(0,n.default)("Display applications"),url:"admin/display_applications"},{title:(0,n.default)("Manage jobs"),url:"admin/jobs"},{title:(0,n.default)("Local data"),url:"data_manager"}]},{title:(0,n.default)("User Management"),items:[{title:(0,n.default)("Users"),url:"admin/users",target:"__use_router__"},{title:(0,n.default)("Quotas"),url:"admin/quotas",target:"__use_router__",enabled:i.config.enable_quotas},{title:(0,n.default)("Groups"),url:"admin/groups",target:"__use_router__"},{title:(0,n.default)("Roles"),url:"admin/roles",target:"__use_router__"},{title:(0,n.default)("Forms"),url:"admin/forms",target:"__use_router__"},{title:(0,n.default)("API keys"),url:"admin/api_keys",target:"__use_router__"},{title:(0,n.default)("Impersonate a user"),url:"admin/impersonate",enabled:i.config.allow_user_impersonation}]},{title:(0,n.default)("Tool Management"),items:[{title:(0,n.default)("Install new tools"),url:"admin_toolshed/browse_tool_sheds",enabled:i.settings.is_tool_shed_installed},{title:"Install new tools (Beta)",url:"admin_toolshed/browse_toolsheds",enabled:i.settings.is_tool_shed_installed&&i.config.enable_beta_ts_api_install},{title:(0,n.default)("Monitor installation"),url:"admin_toolshed/monitor_repository_installation",enabled:i.settings.installing_repository_ids},{title:(0,n.default)("Manage tools"),url:"admin/repositories",enabled:i.settings.is_repo_installed,target:"__use_router__"},{title:(0,n.default)("Manage metadata"),url:"admin_toolshed/reset_metadata_on_selected_installed_repositories",enabled:i.settings.is_repo_installed},{title:(0,n.default)("Manage whitelist"),url:"admin/sanitize_whitelist"},{title:(0,n.default)("Manage dependencies"),url:"admin/manage_tool_dependencies"},{title:(0,n.default)("View lineage"),url:"admin/tool_versions",target:"__use_router__"},{title:(0,n.default)("View migration stages"),url:"admin/review_tool_migration_stages"},{title:(0,n.default)("View error logs"),url:"admin/tool_errors"}]}]),this.setElement(this._template())},render:function(){var e=this;this.$el.empty(),this.categories.each(function(t){var o=i(e._templateSection(t.attributes)),s=o.find(".ui-side-section-body");a.each(t.get("items"),function(t){if(void 0===t.enabled||t.enabled){var o=i("").attr({href:e.root+t.url}).text((0,n.default)(t.title));"__use_router__"==t.target?o.on("click",function(o){o.preventDefault(),e.page.router.push(t.url)}):o.attr("target","galaxy_main"),s.append(i("
    ").addClass("ui-side-section-body-title").append(o))}}),e.$el.append(o)}),this.page.$("#galaxy_main").prop("src",this.root+"admin/center?message="+this.message+"&status="+this.status)},_templateSection:function(e){return["
    ",'
    '+(0,n.default)(e.title)+"
    ",'
    ',"
    "].join("")},_template:function(){return'
    '},toString:function(){return"adminPanel"}});t.default=r}).call(t,o(2),o(0),o(1))},279:function(e,t,o){"use strict";function i(e){o(280)}Object.defineProperty(t,"__esModule",{value:!0});var a=o(282),s=o.n(a),n=o(283),r=o(48),l=i,u=r(s.a,n.a,!1,l,null,null);t.default=u.exports},280:function(e,t,o){var i=o(281);"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);o(47)("b1b74e4e",i,!0)},281:function(e,t,o){t=e.exports=o(46)(void 0),t.push([e.i,"",""])},282:function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=o(92),a=function(e){return e&&e.__esModule?e:{default:e}}(i);t.default={data:function(){return{users:[],errors:[]}},created:function(){var e=this;a.default.get(Galaxy.root+"userskeys/all_users").then(function(t){e.users=t.data}).catch(function(t){e.errors.push(t)})},methods:{generateKey:function(e){var t=this;a.default.get(Galaxy.root+"userskeys/admin_api_keys",{params:{uid:e}}).then(function(e){t.users=e.data}).catch(function(e){t.errors.push(e)})}}}},283:function(e,t,o){"use strict";var i=function(){var e=this,t=e.$createElement,o=e._self._c||t;return o("div",{staticClass:"toolForm",attrs:{id:"form-userkeys"}},[o("div",{staticClass:"toolFormTitle"},[e._v("User Information")]),e._v(" "),e.users&&e.users.length>0?o("div",[o("table",{staticClass:"grid"},[e._m(0,!1,!1),e._v(" "),o("tbody",e._l(e.users,function(t){return o("tr",[o("td",[e._v("\n "+e._s(t.uid)+"\n ")]),e._v(" "),o("td",[e._v("\n "+e._s(t.email)+"\n ")]),e._v(" "),o("td",[e._v("\n "+e._s(t.key)+"\n ")]),e._v(" "),o("td",[o("input",{attrs:{type:"button",value:"Generate a new key now"},on:{click:function(o){e.generateKey(t.uid)}}})])])}))])]):o("div",[o("div",[e._v("No user information available")])]),e._v(" "),o("div",{staticStyle:{clear:"both"}})])},a=[function(){var e=this,t=e.$createElement,o=e._self._c||t;return o("thead",[o("th",[e._v("Encoded UID")]),o("th",[e._v("Email")]),o("th",[e._v("API Key")]),o("th",[e._v("Actions")])])}],s={render:i,staticRenderFns:a};t.a=s},53:function(e,t,o){"use strict";(function(e){function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=o(0),s=i(a),n=o(14),r=i(n),l=o(6),u=i(l),d=s.default,c=e.Router.extend({initialize:function(e,t){this.page=e,this.options=t},push:function(e,t){t=t||{},t.__identifer=Math.random().toString(36).substr(2),d.isEmptyObject(t)||(e+=-1==e.indexOf("?")?"?":"&",e+=d.param(t,!0)),Galaxy.params=t,this.navigate(e,{trigger:!0})},execute:function(e,t,o){Galaxy.debug("router execute:",e,t,o);var i=r.default.parse(t.pop());t.push(i),e&&(this.authenticate(t,o)?e.apply(this,t):this.access_denied())},authenticate:function(e,t){return!0},access_denied:function(){this.page.display(new u.default.Message({status:"danger",message:"You must be logged in with proper credentials to make this request.",persistent:!0}))}});t.default=c}).call(t,o(2))},68:function(e,t,o){"use strict";(function(e,i){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var s=o(11),n=a(s),r=o(6),l=a(r),u=e.View.extend({initialize:function(t){this.model=new e.Model(t),this.url=this.model.get("url"),this.redirect=this.model.get("redirect"),this.setElement("
    "),this.render()},render:function(){var e=this;i.ajax({url:Galaxy.root+this.url,type:"GET"}).done(function(t){var o=i.extend({},e.model.attributes,t),a=new n.default({title:o.title,message:o.message,status:o.status||"warning",icon:o.icon,initial_errors:!0,errors:o.errors,inputs:o.inputs,buttons:{submit:new l.default.Button({tooltip:o.submit_tooltip,title:o.submit_title||"Save",icon:o.submit_icon||"fa-save",cls:"btn btn-primary ui-clear-float",onclick:function(){e._submit(a)}})}});e.$el.empty().append(a.$el)}).fail(function(t){e.$el.empty().append(new l.default.Message({message:"Failed to load resource "+e.url+".",status:"danger",persistent:!0}).$el)})},_submit:function(e){var t=this;i.ajax({url:Galaxy.root+t.url,data:JSON.stringify(e.data.create()),type:"PUT",contentType:"application/json"}).done(function(o){var a={};o.id?a.id=o.id:a={message:o.message,status:"success",persistent:!1},t.redirect?window.location=Galaxy.root+t.redirect+"?"+i.param(a):(e.data.matchModel(o,function(t,o){e.field_list[o].value(t.value)}),t._showMessage(e,success_message))}).fail(function(o){t._showMessage(e,{message:o.responseJSON.err_msg,status:"danger",persistent:!1})})},_showMessage:function(e,t){e.$el.parents().filter(function(){return-1!=["auto","scroll"].indexOf(i(this).css("overflow"))}).first().animate({scrollTop:0},500),e.message.update(t)}});t.default={View:u}}).call(t,o(2),o(0))}},[277]); \ No newline at end of file diff --git a/static/scripts/bundled/analysis.bundled.js b/static/scripts/bundled/analysis.bundled.js index 1a4ef4b03c9..c11f7efed05 100644 --- a/static/scripts/bundled/analysis.bundled.js +++ b/static/scripts/bundled/analysis.bundled.js @@ -1,3 +1,3 @@ webpackJsonp([0],[,,,,,,,,,,function(e,t,i){"use strict";(function(e,n){Object.defineProperty(t,"__esModule",{value:!0});var s=i(4),a=function(e){return e&&e.__esModule?e:{default:e}}(s),o=e.View.extend({optionsDefault:{css:"",placeholder:"No data available",data:[],value:null,multiple:!1,minimumInputLength:0,initialData:""},initialize:function(e){if(this.options=a.default.merge(e,this.optionsDefault),this.setElement(this._template(this.options)),!this.options.container)return void console.log("ui-select::initialize() : container not specified.");if(this.options.container.append(this.$el),this.select_data=this.options.data,this._refresh(),!this.options.multiple){this.options.value&&this._setValue(this.options.value);var t=this;this.options.onchange&&this.$el.on("change",function(){t.options.onchange(t.value())})}},value:function(e){var t=this._getValue();void 0!==e&&this._setValue(e);var i=this._getValue();return i!=t&&this.options.onchange&&this.options.onchange(i),i},text:function(){return this.$el.select2("data").text},disabled:function(){return!this.$el.select2("enable")},enable:function(){this.$el.select2("enable",!0)},disable:function(){this.$el.select2("enable",!1)},add:function(e){this.select_data.push({id:e.id,text:e.text}),this._refresh()},del:function(e){var t=this._getIndex(e);-1!=t&&(this.select_data.splice(t,1),this._refresh())},remove:function(){this.$el.select2("destroy")},update:function(e){this.select_data=[];for(var t in e.data)this.select_data.push(e.data[t]);this._refresh()},_refresh:function(){if(this.options.multiple){var e={multiple:this.options.multiple,containerCssClass:this.options.css,placeholder:this.options.placeholder,minimumInputLength:this.options.minimumInputLength,ajax:this.options.ajax,dropdownCssClass:this.options.dropdownCssClass,escapeMarkup:this.options.escapeMarkup,formatResult:this.options.formatResult,formatSelection:this.options.formatSelection,initSelection:this.options.initSelection,initialData:this.options.initialData};this.$el.select2(e)}else{var t=this._getValue(),e={data:this.select_data,containerCssClass:this.options.css,placeholder:this.options.placeholder,dropdownAutoWidth:!0};this.$el.select2(e),this._setValue(t)}},_getIndex:function(e){n.findIndex(this.select_data,{id:e})},_getValue:function(){return this.$el.select2("val")},_setValue:function(e){-1==this._getIndex(e)&&this.select_data.length>0&&(e=this.select_data[0].id),this.$el.select2("val",e)},_template:function(e){return''}});t.default={View:o}}).call(t,i(2),i(1))},,,,,function(e,t,i){"use strict";(function(e,n,s){Object.defineProperty(t,"__esModule",{value:!0});var a=i(4),o=function(e){return e&&e.__esModule?e:{default:e}}(a),l=e.View.extend({optionsDefault:{with_close:!0,title:null,placement:"top",container:"body",body:null},initialize:function(e){this.setElement(this._template()),this.uid=o.default.uid(),this.options=n.defaults(e||{},this.optionsDefault),this.options.container.parent().append(this.el),this.$title=this.$(".popover-title-label"),this.$close=this.$(".popover-close"),this.$body=this.$(".popover-content"),this.options.body&&this.append(this.options.body);var t=this;s("body").on("mousedown."+this.uid,function(e){t.visible&&!s(t.options.container).is(e.target)&&!s(t.el).is(e.target)&&0===s(t.el).has(e.target).length&&t.hide()})},render:function(){this.$title.html(this.options.title),this.$el.removeClass().addClass("ui-popover popover fade in").addClass(this.options.placement),this.$el.css(this._get_placement(this.options.placement));var e=this;this.options.with_close?this.$close.on("click",function(){e.hide()}).show():this.$close.off().hide()},title:function(e){void 0!==e&&(this.options.title=e,this.$title.html(e))},show:function(){this.render(),this.$el.show(),this.visible=!0},hide:function(){this.$el.hide(),this.visible=!1},append:function(e){this.$body.append(e)},empty:function(){this.$body.empty()},remove:function(){s("body").off("mousedown."+this.uid),this.$el.remove()},_get_placement:function(e){var t,i,n=this._get_width(this.$el),s=this.$el.height(),a=this.options.container,o=this._get_width(a),l=this._get_height(a),r=a.position();if(t=i=0,-1!=["top","bottom"].indexOf(e))switch(i=r.left-n+(o+n)/2,e){case"top":t=r.top-s-5;break;case"bottom":t=r.top+l+5}else switch(t=r.top-s+(l+s)/2,e){case"right":i=r.left+o}return{top:t,left:i}},_get_width:function(e){return e.width()+parseInt(e.css("padding-left"))+parseInt(e.css("margin-left"))+parseInt(e.css("padding-right"))+parseInt(e.css("margin-right"))},_get_height:function(e){return e.height()+parseInt(e.css("padding-top"))+parseInt(e.css("padding-bottom"))},_template:function(e){return'
    '}});t.default={View:l}}).call(t,i(2),i(1),i(0))},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={UPLOAD:"upload",QUEUED:"queued",RUNNING:"running",SETTING_METADATA:"setting_metadata",NEW:"new",EMPTY:"empty",OK:"ok",PAUSED:"paused",FAILED_METADATA:"failed_metadata",NOT_VIEWABLE:"noPermission",DISCARDED:"discarded",ERROR:"error"};n.READY_STATES=[n.OK,n.EMPTY,n.PAUSED,n.FAILED_METADATA,n.NOT_VIEWABLE,n.DISCARDED,n.ERROR],n.NOT_READY_STATES=[n.UPLOAD,n.QUEUED,n.RUNNING,n.SETTING_METADATA,n.NEW],t.default=n},,,,,function(e,t,i){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var n=i(0),s=function(e){return e&&e.__esModule?e:{default:e}}(n),a=s.default,o=function(t){t=t||{},t.tooltipConfig=t.tooltipConfig||{placement:"bottom"},t.classes=["icon-btn"].concat(t.classes||[]),t.disabled&&t.classes.push("disabled");var i=['','',""].join(""),n=a(i).tooltip(t.tooltipConfig);return e.isFunction(t.onclick)&&n.click(t.onclick),n};t.default=o}).call(t,i(1))},,function(e,t,i){"use strict";(function(e){function n(e){return e&&e.__esModule?e:{default:e}}function s(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}function a(e,t){return this._init(e||{},t||{})}Object.defineProperty(t,"__esModule",{value:!0});var o=i(1),l=s(o),r=i(2),d=s(r),c=i(5),u=n(c),h=i(24),f=n(h),p=i(25),m=n(p),g=i(32),_=n(g),v=i(3),y=n(v);(0,_.default)(a,"GalaxyApp");var w="galaxy:debug:namespaces",b=!1;try{b="true"==localStorage.getItem("galaxy:debug")}catch(e){console.log((0,y.default)("localStorage not available for debug flag retrieval"))}a.prototype._init=function(e,t){var i=this;return l.extend(i,d.Events),b&&(i.logger=console,console.debug("debugging galaxy:","options:",e,"bootstrapped:",t)),i._processOptions(e),i.root=e.root||"/",i.params=e.params||{},i.session_csrf_token=e.session_csrf_token||null,i._initConfig(e.config||{}),i._patchGalaxy(window.Galaxy),i._initLogger(i.options.loggerOptions||{}),i.debug("GalaxyApp.options: ",i.options),i.debug("GalaxyApp.config: ",i.config),i.debug("GalaxyApp.logger: ",i.logger),i._initLocale(),i.debug("GalaxyApp.localize: ",i.localize),i.config=e.config||{},i.debug("GalaxyApp.config: ",i.config),i._initUser(e.user||{}),i.debug("GalaxyApp.user: ",i.user),i._setUpListeners(),i.trigger("ready",i),i},a.prototype.defaultOptions={patchExisting:!0,root:"/",session_csrf_token:null},a.prototype._processOptions=function(e){var t=this,i=t.defaultOptions;t.options={};for(var n in i)i.hasOwnProperty(n)&&(t.options[n]=e.hasOwnProperty(n)?e[n]:i[n]);return t},a.prototype._initConfig=function(e){var t=this;return t.config=e,t.config.debug=b||t.config.debug,t},a.prototype._patchGalaxy=function(e){var t=this;if(t.options.patchExisting&&e)for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},a.prototype._initLogger=function(e){var t=this;if(t.config.debug){e.consoleLogger=e.consoleLogger||console,e.consoleLevel=e.consoleLevel||m.default.MetricsLogger.ALL;try{e.consoleNamespaceWhitelist=localStorage.getItem(w).split(",")}catch(e){}try{e.consoleFlattenMessages="true"==localStorage.getItem("galaxy:debug:flatten")}catch(e){}console.log(e.consoleFlattenMessages)}return t.logger=new m.default.MetricsLogger(e),t.emit={},["log","debug","info","warn","error","metric"].map(function(e){t.emit[e]=function(i){t.logger.emit(e,arguments[0],Array.prototype.slice.call(arguments,1))}}),t.config.debug&&(u.default.LoggableMixin.logger=t.logger),t},a.prototype._initLocale=function(e){var t=this;return t.debug("_initLocale:",e),t.localize=y.default,window._l=t.localize,t},a.prototype._initUser=function(e){var t=this;return t.debug("_initUser:",e),t.user=new f.default.User(e),t.user.logger=t.logger,t},a.prototype._setUpListeners=function(){var t=this;return t.lastAjax={},e(document).bind("ajaxSend",function(e,i,n){var s=n.data;try{s=JSON.parse(s)}catch(e){}t.lastAjax={url:location.href.slice(0,-1)+n.url,data:s}}),t},a.prototype.debugging=function(e){var t=this;try{if(void 0===e)return"true"===localStorage.getItem("galaxy:debug");if(e)return localStorage.setItem("galaxy:debug",!0),!0;localStorage.removeItem("galaxy:debug"),t.debuggingNamespaces(null)}catch(e){console.log((0,y.default)("localStorage not available for debug flag retrieval"))}return!1},a.prototype.debuggingNamespaces=function(e){var t=this;try{if(void 0===e){var i=localStorage.getItem(w);return"string"==typeof i?i.split(","):[]}null===e?localStorage.removeItem(w):localStorage.setItem(w,e);var n=t.debuggingNamespaces();return t.logger&&(t.logger.options.consoleNamespaceWhitelist=n),n}catch(e){console.log((0,y.default)("localStorage not available for debug namespace retrieval"))}},a.prototype.toString=function(){return"GalaxyApp("+(this.user?this.user.get("email")||"(anonymous)":"uninitialized")+")"},t.default={GalaxyApp:a}}).call(t,i(0))},,function(e,t,i){"use strict";(function(e){function i(e){e=e||{};var t=this;return t.userId=window.bootstrapped&&window.bootstrapped.user?window.bootstrapped.user.id:null,t.userId=t.userId||e.userId||null,t.consoleLogger=e.consoleLogger||null,t._init(e),t}function n(e){var t=String(e);return"[object Object]"==t&&(t=JSON.stringify(e)),t}function s(e){return this._init(e||{})}Object.defineProperty(t,"__esModule",{value:!0});var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};i.ALL=0,i.LOG=0,i.DEBUG=10,i.INFO=20,i.WARN=30,i.ERROR=40,i.METRIC=50,i.NONE=100,i.defaultOptions={logLevel:i.NONE,consoleLevel:i.NONE,defaultNamespace:"Galaxy",consoleNamespaceWhitelist:null,consoleFlattenMessages:!1,clientPrefix:"client.",maxCacheSize:3e3,postSize:1e3,addTime:!0,cacheKeyPrefix:"logs-",postUrl:"/api/metrics",delayPostInMs:6e5,getPingData:void 0,onServerResponse:void 0},i.prototype._init=function(e){var t=this;t.options={};for(var n in i.defaultOptions)i.defaultOptions.hasOwnProperty(n)&&(t.options[n]=e.hasOwnProperty(n)?e[n]:i.defaultOptions[n]);return t.options.logLevel=t._parseLevel(t.options.logLevel),t.options.consoleLevel=t._parseLevel(t.options.consoleLevel),t._sending=!1,t._waiting=null,t._postSize=t.options.postSize,t._initCache(),t},i.prototype._initCache=function(){try{this.cache=new s({maxSize:this.options.maxCacheSize,key:this.options.cacheKeyPrefix+this.userId})}catch(e){this._emitToConsole("warn","MetricsLogger",["Could not intitialize logging cache:",e]),this.options.logLevel=i.NONE}},i.prototype._parseLevel=function(e){var t=void 0===e?"undefined":a(e);if("number"===t)return e;if("string"===t){var n=e.toUpperCase();if(i.hasOwnProperty(n))return i[n]}throw new Error("Unknown log level: "+e)},i.prototype.emit=function(e,t,i){var n=this;return t=t||n.options.defaultNamespace,e&&i?(e=n._parseLevel(e),e>=n.options.logLevel&&n._addToCache(e,t,i),n.consoleLogger&&e>=n.options.consoleLevel&&n._emitToConsole(e,t,i),n):n},i.prototype._addToCache=function(e,t,i){this._emitToConsole("debug","MetricsLogger",["_addToCache:",arguments,this.options.addTime,this.cache.length()]);var n=this;try{n.cache.add(n._buildEntry(e,t,i))>=n._postSize&&n._postCache()}catch(e){n._emitToConsole("warn","MetricsLogger",["Metrics logger could not stringify logArguments:",t,i]),n._emitToConsole("error","MetricsLogger",[e])}return n},i.prototype._buildEntry=function(e,t,i){this._emitToConsole("debug","MetricsLogger",["_buildEntry:",arguments]);var n={level:e,namespace:this.options.clientPrefix+t,args:i};return this.options.addTime&&(n.time=(new Date).toISOString()),n},i.prototype._postCache=function(t){if(t=t||{},this._emitToConsole("info","MetricsLogger",["_postCache",t,this._postSize]),!this.options.postUrl||this._sending)return e.when({});var i=this,n=t.count||i._postSize,s=i.cache.get(n),a=s.length,o="function"==typeof i.options.getPingData?i.options.getPingData():{};return o.metrics=JSON.stringify(s),i._sending=!0,e.post(i.options.postUrl,o).always(function(){i._sending=!1}).fail(function(e,t,n){i._postSize=i.options.maxCacheSize,i.emit("error","MetricsLogger",["_postCache error:",e.readyState,e.status,e.responseJSON||e.responseText])}).done(function(e){"function"==typeof i.options.onServerResponse&&i.options.onServerResponse(e),i.cache.remove(a),i._postSize=i.options.postSize})},i.prototype._delayPost=function(){var e=this;e._waiting=setTimeout(function(){e._waiting=null},e.options.delayPostInMs)},i.prototype._emitToConsole=function(e,t,s){var a=this,o=a.options.consoleNamespaceWhitelist;if(!a.consoleLogger)return a;if(o&&-1===o.indexOf(t))return a;var l=Array.prototype.slice.call(s,0);return l.unshift(t),a.options.consoleFlattenMessages&&(l=[l.map(n).join(" ")]),e>=i.METRIC&&"function"==typeof a.consoleLogger.info?a.consoleLogger.info.apply(a.consoleLogger,l):e>=i.ERROR&&"function"==typeof a.consoleLogger.error?a.consoleLogger.error.apply(a.consoleLogger,l):(e>=i.WARN&&"function"==typeof a.consoleLogger.warn?a.consoleLogger.warn.apply(a.consoleLogger,l):e>=i.INFO&&"function"==typeof a.consoleLogger.info?a.consoleLogger.info.apply(a.consoleLogger,l):e>=i.DEBUG&&"function"==typeof a.consoleLogger.debug?a.consoleLogger.debug.apply(a.consoleLogger,l):"function"==typeof a.consoleLogger.log&&a.consoleLogger.log.apply(a.consoleLogger,l),a)},i.prototype.log=function(){this.emit(1,this.options.defaultNamespace,Array.prototype.slice.call(arguments,0))},i.prototype.debug=function(){this.emit(i.DEBUG,this.options.defaultNamespace,Array.prototype.slice.call(arguments,0))},i.prototype.info=function(){this.emit(i.INFO,this.options.defaultNamespace,Array.prototype.slice.call(arguments,0))},i.prototype.warn=function(){this.emit(i.WARN,this.options.defaultNamespace,Array.prototype.slice.call(arguments,0))},i.prototype.error=function(){this.emit(i.ERROR,this.options.defaultNamespace,Array.prototype.slice.call(arguments,0))},i.prototype.metric=function(){this.emit(i.METRIC,this.options.defaultNamespace,Array.prototype.slice.call(arguments,0))},s.defaultOptions={maxSize:5e3},s.prototype._init=function(e){if(!this._hasStorage())throw new Error("LoggingCache needs localStorage");if(!e.key)throw new Error("LoggingCache needs key for localStorage");return this.key=e.key,this._initStorage(),this.maxSize=e.maxSize||s.defaultOptions.maxSize,this},s.prototype._hasStorage=function(){try{return localStorage.setItem("test","test"),localStorage.removeItem("test"),!0}catch(e){return!1}},s.prototype._initStorage=function(){return null===localStorage.getItem(this.key)?this.empty():this},s.prototype.add=function(e){var t=this,i=t._fetchAndParse(),n=i.length+1-t.maxSize;return n>0&&i.splice(0,n),i.push(e),t._unparseAndStore(i),i.length},s.prototype._fetchAndParse=function(){var e=this;return JSON.parse(localStorage.getItem(e.key))},s.prototype._unparseAndStore=function(e){var t=this;return localStorage.setItem(t.key,JSON.stringify(e))},s.prototype.length=function(){return this._fetchAndParse().length},s.prototype.get=function(e){return this._fetchAndParse().slice(0,e)},s.prototype.remove=function(e){var t=this._fetchAndParse(),i=t.splice(0,e);return this._unparseAndStore(t),i},s.prototype.empty=function(){return localStorage.setItem(this.key,"[]"),this},s.prototype.stringify=function(e){return JSON.stringify(this.get(e))},s.prototype.print=function(){console.log(JSON.stringify(this._fetchAndParse(),null," "))},t.default={MetricsLogger:i,LoggingCache:s}}).call(t,i(0))},function(e,t,i){"use strict";(function(e,n,s){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(33),l=a(o),r=i(22),d=a(r),c=i(8),u=a(c),h=i(4),f=a(h),p=e.View.extend({el:"body",className:"full-content",_panelids:["left","right"],initialize:function(t){var i=this;this.config=n.defaults(t.config||{},{message_box_visible:!1,message_box_content:"",message_box_class:"info",show_inactivity_warning:!1,inactivity_box_content:""}),Galaxy.modal=this.modal=new u.default.View,Galaxy.display=this.display=function(e){e.title?(f.default.setWindowTitle(e.title),e.allow_title_display=!1):(f.default.setWindowTitle(),e.allow_title_display=!0),i.center.display(e)},Galaxy.router=this.router=t.Router&&new t.Router(i,t),this.masthead=new l.default.View(this.config),this.center=new d.default.CenterPanel,this.$el.attr("scroll","no"),this.$el.html(this._template()),this.$("#masthead").replaceWith(this.masthead.$el),this.$("#center").append(this.center.$el),this.$el.append(this.masthead.frame.$el),this.$el.append(this.modal.$el),this.$messagebox=this.$("#messagebox"),this.$inactivebox=this.$("#inactivebox"),this.panels={},n.each(this._panelids,function(e){var n=e.charAt(0).toUpperCase()+e.slice(1),s=t[n];if(s){var a=new s(i,t);i[a.toString()]=a,i.panels[e]=new d.default.SidePanel({id:e,el:i.$("#"+e),view:a})}}),this.render(),this.router&&e.history.start({root:Galaxy.root,pushState:!0})},render:function(){return s(".select2-hidden-accessible").remove(),this.masthead.render(),this.renderMessageBox(),this.renderInactivityBox(),this.renderPanels(),this._checkCommunicationServerOnline(),this},renderMessageBox:function(){if(this.config.message_box_visible){var e=this.config.message_box_content||"",t=this.config.message_box_class||"info";this.$el.addClass("has-message-box"),this.$messagebox.attr("class","panel-"+t+"-message").html(e).toggle(!!e).show()}else this.$el.removeClass("has-message-box"),this.$messagebox.hide();return this},renderInactivityBox:function(){if(this.config.show_inactivity_warning){var e=this.config.inactivity_box_content||"",t=s("
    ").attr("href",Galaxy.root+"user/resend_verification").text("Resend verification");this.$el.addClass("has-inactivity-box"),this.$inactivebox.html(e+" ").append(t).toggle(!!e).show()}else this.$el.removeClass("has-inactivity-box"),this.$inactivebox.hide();return this},renderPanels:function(){var e=this;return n.each(this._panelids,function(t){var i=e.panels[t];i?i.render():(e.$("#center").css(t,0),e.$("#"+t).hide())}),this},_template:function(){return['
    ','
    ','
    ','
    ','
    ','
    ','
    ','",'
    '].join("")},toString:function(){return"PageLayoutView"},_checkCommunicationServerOnline:function(){var e=window.Galaxy.config.communication_server_host,t=window.Galaxy.config.communication_server_port,i=window.Galaxy.user.attributes.preferences,n=s("#show-chat-online");i&&-1!=["1","true"].indexOf(i.communication_server)?s.ajax({url:e+":"+t}).success(function(e){null!==window.Galaxy.user.id&&"hidden"===n.css("visibility")&&n.css("visibility","visible")}).error(function(e){n.css("visibility","hidden")}):n.css("visibility","hidden")}});t.default={View:p}}).call(t,i(2),i(1),i(0))},,,function(e,t,i){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var i=e.Model.extend({defaults:{extension:"auto",genome:"?",url_paste:"",status:"init",info:null,file_name:"",file_mode:"",file_size:0,file_type:null,file_path:"",file_data:null,percentage:0,space_to_tab:!1,to_posix_lines:!0,enabled:!0},reset:function(e){this.clear().set(this.defaults).set(e)}}),n=e.Collection.extend({model:i});t.default={Model:i,Collection:n}}).call(t,i(2))},,,,,,,,,,function(e,t,i){"use strict";(function(e,n){function s(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=i(5),o=s(a),l=i(3),r=s(l),d=e.View.extend(o.default.LoggableMixin).extend(o.default.HiddenUntilActivatedViewMixin).extend({tagName:"div",className:"tags-display",select_width:"100%",events:{},initialize:function(e){this.show_editor=!1,!1===e.usePrompt?this.label="":this.label='",this.workflow_mode=e.workflow_mode||!1,this.workflow_mode&&(this.events.click="showEditor",this.events.keydown="keydownHandler"),this.hiddenUntilActivated(e.$activator,e)},render:function(){var e=this;return this.workflow_mode?this.$el.html(this._workflowTemplate()):this.$el.html(this._defaultTemplate()),this.$input().select2({placeholder:"Add tags",width:this.workflow_mode?this.width:this.select_width,tags:function(){return e._getTagsUsed()}}),this._setUpBehaviors(),this},_hashToName:function(e){return e.startsWith("#")?"name:"+e.slice(1):e},_nameToHash:function(e){return e.startsWith("name:")&&(e="#"+e.slice(5)),e},_defaultTemplate:function(){return[this.label,this._renderEditor()].join("")},_workflowTemplate:function(){return[this.show_editor?this._renderEditor():this._renderTags()].join(" ")},keydownHandler:function(e){switch(e.which){case 27:this.hideEditor()}},showEditor:function(){this.show_editor=!0,this.render()},hideEditor:function(){this.show_editor=!1,this.render()},_renderEditor:function(){return''},_renderTags:function(){var e=this.model.get("tags"),t=Galaxy.root+"static/images/fugue/tag--plus.png",i=[];return n.each(e,function(e){e=0==e.indexOf("name:")?e.slice(5):e;var t=''+e+"";i.push(t)}),0===i.length&&i.push("'),i.join(" ")},tagsToCSV:function(){var e=this,t=this.model.get("tags");return!n.isArray(t)||n.isEmpty(t)?"":t.map(function(t){return n.escape(e._nameToHash(t))}).sort().join(",")},$input:function(){return this.$el.find("input.tags-input")},_getTagsUsed:function(){var e=this;return n.map(Galaxy.user.get("tags_used"),e._nameToHash)},_setUpBehaviors:function(){var e=this;this.$input().on("change",function(t){t.val=n.map(t.val,e._hashToName),e.model.save({tags:t.val}),t.added&&e._addNewTagToTagsUsed(""+t.added.text)})},_addNewTagToTagsUsed:function(e){var t=Galaxy.user.get("tags_used");n.contains(t,e)||(t.push(e),t.sort(),Galaxy.user.set("tags_used",t))},remove:function(){this.$input.off(),this.stopListening(this.model),e.View.prototype.remove.call(this)},toString:function(){return["TagsEditor(",""+this.model,")"].join("")}});t.default={TagsEditor:d}}).call(t,i(2),i(1))},,,,,,,,,,,,,,function(e,t,i){"use strict";(function(e){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var s=i(0),a=n(s),o=i(14),l=n(o),r=i(6),d=n(r),c=a.default,u=e.Router.extend({initialize:function(e,t){this.page=e,this.options=t},push:function(e,t){t=t||{},t.__identifer=Math.random().toString(36).substr(2),c.isEmptyObject(t)||(e+=-1==e.indexOf("?")?"?":"&",e+=c.param(t,!0)),Galaxy.params=t,this.navigate(e,{trigger:!0})},execute:function(e,t,i){Galaxy.debug("router execute:",e,t,i);var n=l.default.parse(t.pop());t.push(n),e&&(this.authenticate(t,i)?e.apply(this,t):this.access_denied())},authenticate:function(e,t){return!0},access_denied:function(){this.page.display(new d.default.Message({status:"danger",message:"You must be logged in with proper credentials to make this request.",persistent:!0}))}});t.default=u}).call(t,i(2))},function(e,t,i){"use strict";(function(e,n,s){Object.defineProperty(t,"__esModule",{value:!0});var a=i(4);!function(e){e&&e.__esModule}(a);t.default=e.View.extend({options:{class_check:"fa-check-square-o",class_uncheck:"fa-square-o",parameters:[{id:"space_to_tab",title:"Convert spaces to tabs"},{id:"to_posix_lines",title:"Use POSIX standard"}]},initialize:function(e){this.model=e.model,this.setElement(n("
    ").addClass("upload-settings")),this.$el.append(n("
    ").addClass("upload-settings-cover")),this.$el.append(n("").addClass("upload-settings-table ui-table-striped").append("")),this.$cover=this.$(".upload-settings-cover"),this.$table=this.$(".upload-settings-table > tbody"),this.listenTo(this.model,"change",this.render,this),this.model.trigger("change")},render:function(){var e=this;this.$table.empty(),s.each(this.options.parameters,function(t){var i=n("
    ").addClass("upload-"+t.id+" upload-icon-button fa").addClass(e.model.get(t.id)&&e.options.class_check||e.options.class_uncheck).on("click",function(){e.model.get("enabled")&&e.model.set(t.id,!e.model.get(t.id))});e.$table.append(n("
    ").append(n(""},_template:function(){return'
    '+this.model.get("help_text")+'
    Available files:   
    ").append(i)).append(n("").append(t.title)))}),this.$cover[this.model.get("enabled")&&"hide"||"show"]()}})}).call(t,i(2),i(0),i(1))},function(e,t,i){"use strict";(function(e,n,s){Object.defineProperty(t,"__esModule",{value:!0});var a=i(4),o=function(e){return e&&e.__esModule?e:{default:e}}(a);t.default=e.View.extend({initialize:function(t){this.model=new e.Model({cls:"upload-ftp",class_add:"upload-icon-button fa fa-square-o",class_remove:"upload-icon-button fa fa-check-square-o",class_partial:"upload-icon-button fa fa-minus-square-o",help_enabled:!0,help_text:"This Galaxy server allows you to upload files via FTP. To upload some files, log in to the FTP server at "+t.ftp_upload_site+" using your Galaxy credentials.",collection:null,onchange:function(){},onadd:function(){},onremove:function(){}}).set(t),this.collection=this.model.get("collection"),this.setElement(this._template()),this.$content=this.$(".upload-ftp-content"),this.$wait=this.$(".upload-ftp-wait"),this.$help=this.$(".upload-ftp-help"),this.$number=this.$(".upload-ftp-number"),this.$disk=this.$(".upload-ftp-disk"),this.$body=this.$(".upload-ftp-body"),this.$warning=this.$(".upload-ftp-warning"),this.$select=this.$(".upload-ftp-select-all"),this.render()},render:function(){var e=this;this.$wait.show(),this.$content.hide(),this.$warning.hide(),this.$help.hide(),n.ajax({url:Galaxy.root+"api/remote_files",method:"GET",success:function(t){e.model.set("ftp_files",t),e._index(),e._renderTable()},error:function(){e._renderTable()}})},_renderTable:function(){var e=this,t=this.model.get("ftp_files");if(this.rows=[],t&&t.length>0){this.$body.empty();var i=0;s.each(t,function(t){e.rows.push(e._renderRow(t)),i+=t.size}),this.$number.html(t.length+" files"),this.$disk.html(o.default.bytesToString(i,!0)),this.collection&&(this.$("._has_collection").show(),this.$select.addClass(this.model.get("class_add")).off().on("click",function(){e._all()}),this._refresh()),this.$content.show()}else this.$warning.show();this.model.get("help_enabled")&&this.$help.show(),this.$wait.hide()},_renderRow:function(e){var t=this,i=this.model.attributes,s=n(this._templateRow(e)),a=s.find(".icon");if(this.$body.append(s),this.collection){var o=this.ftp_index[e.path];a.addClass(void 0===o?i.class_add:i.class_remove),s.on("click",function(){t._switch(a,e),t._refresh()})}else s.on("click",function(){i.onchange(e)});return a},_index:function(){var e=this;this.ftp_index={},this.collection&&this.collection.each(function(t){"ftp"==t.get("file_mode")&&(e.ftp_index[t.get("file_path")]=t.id)})},_all:function(){var e=this.model.attributes,t=this.model.get("ftp_files"),i=this.$select.hasClass(e.class_add);for(var n in t){var s=t[n],a=this.ftp_index[s.path];(void 0===a&&i||void 0!==a&&!i)&&this._switch(this.rows[n],s)}this._refresh()},_switch:function(e,t){e.removeClass();var i=this.model.attributes,n=this.ftp_index[t.path];if(void 0===n){var s=i.onadd(t);e.addClass(i.class_remove),this.ftp_index[t.path]=s}else i.onremove(n),e.addClass(i.class_add),this.ftp_index[t.path]=void 0},_refresh:function(){var e=s.reduce(this.ftp_index,function(e,t){return void 0!==t&&e++,e},0);this.$select.removeClass(),0==e?this.$select.addClass(this.model.get("class_add")):this.$select.addClass(e==this.rows.length?this.model.get("class_remove"):this.model.get("class_partial"))},_templateRow:function(e){return'
    '+s.escape(e.path)+''+o.default.bytesToString(e.size)+''+e.ctime+"
    NameSizeCreated
    Your FTP directory does not contain any files.
    '}})}).call(t,i(2),i(0),i(1))},function(e,t,i){"use strict";(function(e,n){function s(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=i(4),o=(s(a),i(15)),l=s(o);t.default=e.View.extend({initialize:function(t){this.model=new e.Model(t),this.setElement("
    "),this.render()},render:function(){var e=this.model.attributes,t=n.findWhere(e.list,{id:e.extension});this.extension_popup&&this.extension_popup.remove(),this.extension_popup=new l.default.View({placement:e.placement||"bottom",container:e.$el}),this.extension_popup.title(e.title),this.extension_popup.empty(),this.extension_popup.append(this._templateDescription(t)),this.extension_popup.show()},_templateDescription:function(e){if(e.description){var t=e.description;return e.description_url&&(t+=' (read more)'),t}return"There is no description available for this file extension."}})}).call(t,i(2),i(1))},function(e,t,i){"use strict";(function(e,t){!function(i){e.event.props.push("dataTransfer"),i.uploadpost=function(t){var n=i.extend({},{data:{},success:function(){},error:function(){},progress:function(){},url:null,maxfilesize:2048,error_filesize:"File exceeds 2GB. Please use a FTP client.",error_default:"Please make sure the file is available.",error_server:"Upload request failed.",error_login:"Uploads require you to log in."},t),s=n.data;if(s.error_message)return void n.error(s.error_message);var a=new FormData;for(var o in s.payload)a.append(o,s.payload[o]);var l=0;for(var o in s.files){var r=s.files[o];a.append(r.name,r.file,r.file.name),l+=r.file.size}if(l>1048576*n.maxfilesize)return void n.error(n.error_filesize);var d=new XMLHttpRequest;d.open("POST",n.url,!0),d.setRequestHeader("Accept","application/json"),d.setRequestHeader("Cache-Control","no-cache"),d.setRequestHeader("X-Requested-With","XMLHttpRequest"),d.onreadystatechange=function(){if(d.readyState==d.DONE){var t=null,i="";if(d.responseText)try{t=e.parseJSON(d.responseText),i=t.err_msg}catch(e){t=d.responseText,i=t}if(d.status<200||d.status>299){var s=d.statusText;403==d.status?s=n.error_login:0==d.status?s=n.error_server:s||(s=n.error_default),n.error(s+" ("+d.status+"). "+i)}else n.success(t)}},d.upload.addEventListener("progress",function(e){e.lengthComputable&&n.progress(Math.round(100*e.loaded/e.total))},!1),Galaxy.emit.debug("uploadbox::uploadpost()","Posting following data.",n),d.send(a)},i.fn.uploadinput=function(e){var t=this,n=i.extend({},{ondragover:function(){},ondragleave:function(){},onchange:function(){},multiple:!1},e),s=i('");return t.append(s.change(function(e){n.onchange(e.target.files),i(this).val("")})),t.on("drop",function(e){n.ondragleave(e),e.dataTransfer&&(n.onchange(e.dataTransfer.files),e.preventDefault())}),t.on("dragover",function(e){e.preventDefault(),n.ondragover(e)}),t.on("dragleave",function(e){e.stopPropagation(),n.ondragleave(e)}),{dialog:function(){s.trigger("click")}}},i.fn.uploadbox=function(e){function n(e){if(e&&e.length&&!g){var i=void 0;return t.each(e,function(e,i){"new"!==e.mode&&t.filter(f,function(t){return t.name===e.name&&t.size===e.size}).length&&(e.duplicate=!0)}),t.each(e,function(e){e.duplicate||(i=String(p++),f[i]=e,h.announce(i,f[i]),m++)}),i}}function s(e){f[e]&&(delete f[e],m--)}function a(){if(0==m||_)return _=!1,g=!1,void h.complete();g=!0;var e=-1;for(var t in f){e=t;break}f[e];s(e),i.uploadpost({url:h.url,data:h.initialize(e),success:function(t){h.success(e,t),a()},error:function(t){h.error(e,t),a()},progress:function(t){h.progress(e,t)}})}function o(){v.dialog()}function l(e){for(e in f)s(e)}function r(){g||(g=!0,a())}function d(){_=!0}function c(e){return h=i.extend({},h,e)}function u(){return window.File&&window.FormData&&window.XMLHttpRequest&&window.FileList}var h=i.extend({},{dragover:function(){},dragleave:function(){},announce:function(e){},initialize:function(e){},progress:function(e,t){},success:function(e,t){},error:function(e,t){alert(t)},complete:function(){}},e),f={},p=0,m=0,g=!1,_=!1,v=i(this).uploadinput({multiple:!0,onchange:function(e){n(e)},ondragover:e.ondragover,ondragleave:e.ondragleave});return{select:o,add:n,remove:s,start:r,stop:d,reset:l,configure:c,compatible:u}}}(e)}).call(t,i(0),i(1))},function(e,t,i){"use strict";(function(e,n,s,a){function o(e){return e&&e.__esModule?e:{default:e}}function l(e,t){var i=e.toJSON();return $(i,{defaultHideSourceItems:t,creationFn:function(t,i,n){return t=t.map(function(e){return{id:e.id,name:e.name,src:"dataset"===e.history_content_type?"hda":"hdca"}}),e.createHDCA(t,"list",i,n)}})}Object.defineProperty(t,"__esModule",{value:!0});var r=i(59),d=o(r),c=i(16),u=o(c),h=i(5),f=o(h),p=i(108),m=o(p),g=i(8),_=o(g),v=i(109),y=(o(v),i(3)),w=o(y);i(110);var b=e.View.extend(f.default.LoggableMixin).extend({_logNamespace:"collections",tagName:"li",className:"collection-element",initialize:function(e){this.element=e.element||{},this.selected=e.selected||!1},render:function(){this.dragStartHandler=n.bind(this._dragstart,this),this.dragEndHandler=n.bind(this._dragend,this);var e=this.$el.attr("data-element-id",this.element.id).attr("draggable",!0).html(this.template({element:this.element})).get(0);return e.addEventListener("dragstart",this.dragStartHandler,!1),e.addEventListener("dragend",this.dragEndHandler,!1),this.selected&&this.$el.addClass("selected"),this},template:n.template(['',"<%- element.name %>","",'"].join("")),select:function(e){this.$el.toggleClass("selected",e),this.trigger("select",{source:this,selected:this.$el.hasClass("selected")})},discard:function(){var e=this,t=this.$el.parent().width();this.$el.animate({"margin-right":t},"fast",function(){e.trigger("discard",{source:e}),e.destroy()})},destroy:function(){this.off(),this.$el.remove()},events:{click:"_click","click .name":"_clickName","click .discard":"_clickDiscard",dragover:"_sendToParent",drop:"_sendToParent"},_click:function(e){e.stopPropagation(),this.select(e)},_clickName:function(e){e.stopPropagation(),e.preventDefault();var t=([(0,w.default)("Enter a new name for the element"),":\n(",(0,w.default)("Note that changing the name here will not rename the dataset"),")"].join(""),prompt((0,w.default)("Enter a new name for the element")+":",this.element.name));t&&(this.element.name=t,this.render())},_clickDiscard:function(e){e.stopPropagation(),this.discard()},_dragstart:function(e){e.originalEvent&&(e=e.originalEvent),e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",JSON.stringify(this.element)),this.$el.addClass("dragging"),this.$el.parent().trigger("collection-element.dragstart",[this])},_dragend:function(e){this.$el.removeClass("dragging"),this.$el.parent().trigger("collection-element.dragend",[this])},_sendToParent:function(e){this.$el.parent().trigger(e)},toString:function(){return"DatasetCollectionElementView()"}}),x=e.View.extend(f.default.LoggableMixin).extend(m.default.CollectionCreatorMixin).extend({_logNamespace:"collections",elementViewClass:b,collectionClass:d.default.HistoryDatasetCollection,className:"list-collection-creator collection-creator flex-row-container",minElements:1,defaultAttributes:{creationFn:function(){throw new TypeError("no creation fn for creator")},oncreate:function(){},oncancel:function(){},autoscrollDist:24,highlightClr:"rgba( 64, 255, 255, 1.0 )"},footerSettings:{".hide-originals":"hideOriginals"},initialize:function(e){this.metric("ListCollectionCreator.initialize",e);var t=this;n.each(this.defaultAttributes,function(i,n){i=e[n]||i,t[n]=i}),t.initialElements=e.elements||[],this._setUpCommonSettings(e),this._instanceSetUp(),this._elementsSetUp(),this._setUpBehaviors()},_instanceSetUp:function(){this.selectedIds={},this.$dragging=null,this.blocking=!1},_elementsSetUp:function(){this.invalidElements=[],this.workingElements=[],this.elementViews=[],this.workingElements=this.initialElements.slice(0),this._ensureElementIds(),this._validateElements(),this._mangleDuplicateNames(),this._sortElements()},_ensureElementIds:function(){return this.workingElements.forEach(function(e){e.hasOwnProperty("id")||(e.id=n.uniqueId())}),this.workingElements},_validateElements:function(){var e=this;return e.invalidElements=[],this.workingElements=this.workingElements.filter(function(t){var i=e._isElementInvalid(t);return i&&e.invalidElements.push({element:t,text:i}),!i}),this.workingElements},_isElementInvalid:function(e){return"dataset"!==e.history_content_type?(0,w.default)("is not a dataset"):e.state===u.default.OK||n.contains(u.default.NOT_READY_STATES,e.state)?e.deleted||e.purged?(0,w.default)("has been deleted or purged"):null:(0,w.default)("has errored, is paused, or is not accessible")},_mangleDuplicateNames:function(){var e=1,t={};this.workingElements.forEach(function(i){for(var n=i.name;t.hasOwnProperty(n);)if(n=i.name+" ("+e+")",(e+=1)>=900)throw new Error("Safety hit in while loop - thats impressive");i.name=n,t[i.name]=!0})},_sortElements:function(e){},render:function(e,t){return this.workingElements.length .clear-selected").show():this.$(".collection-elements-controls > .clear-selected").hide()},_renderList:function(e,t){var i=this,s=a("
    "),o=i.$list();n.each(this.elementViews,function(e){e.destroy(),i.removeElementView(e)}),i.workingElements.forEach(function(e){var t=i._createElementView(e);s.append(t.$el)}),i._renderClearSelected(),o.empty().append(s.children()),n.invoke(i.elementViews,"render"),o.height()>o.css("max-height")?o.css("border-width","1px 0px 1px 0px"):o.css("border-width","0px")},_createElementView:function(e){var t=new this.elementViewClass({element:e,selected:n.has(this.selectedIds,e.id)});return this.elementViews.push(t),this._listenToElementView(t),t},_listenToElementView:function(e){var t=this;t.listenTo(e,{select:function(e){var i=e.source.element;e.selected?t.selectedIds[i.id]=!0:delete t.selectedIds[i.id],t.trigger("elements:select",e)},discard:function(e){t.trigger("elements:discard",e)}})},addElementView:function(e){},removeElementView:function(e){delete this.selectedIds[e.element.id],this._renderClearSelected(),this.elementViews=n.without(this.elementViews,e),this.stopListening(e)},_renderNoElementsLeft:function(){this._disableNameAndCreate(!0),this.$(".collection-elements").append(this.templates.noElementsLeft())},_elementToJSON:function(e){return e},createList:function(e){if(!this.workingElements.length){var t=(0,w.default)("No valid elements for final list")+". ";return t+=''+(0,w.default)("Cancel")+" ",t+=(0,w.default)("or"),t+=' '+(0,w.default)("start over")+".",void this._showAlert(t)}var i=this,n=this.workingElements.map(function(e){return i._elementToJSON(e)});return i.blocking=!0,i.creationFn(n,e,i.hideOriginals).always(function(){i.blocking=!1}).fail(function(e,t,n){i.trigger("error",{xhr:e,status:t,message:(0,w.default)("An error occurred while creating this collection")})}).done(function(e,t,n){i.trigger("collection:created",e,t,n),i.metric("collection:created",e),"function"==typeof i.oncreate&&i.oncreate.call(this,e,t,n)})},_setUpBehaviors:function(){return this.on("error",this._errorHandler),this.once("rendered",function(){this.trigger("rendered:initial",this)}),this.on("elements:select",function(e){this._renderClearSelected()}),this.on("elements:discard",function(e){var t=e.source.element;this.removeElementView(e.source),this.workingElements=n.without(this.workingElements,t),this.workingElements.length||this._renderNoElementsLeft()}),this},_errorHandler:function(e){this.error(e);var t=this,i=e.message||(0,w.default)("An error occurred");if(e.xhr){var n=e.xhr,s=e.message;0===n.readyState&&0===n.status?i+=": "+(0,w.default)("Galaxy could not be reached and may be updating.")+(0,w.default)(" Try again in a few minutes."):n.responseJSON?i+=":
    "+JSON.stringify(n.responseJSON)+"
    ":i+=": "+s}t._showAlert(i,"alert-danger")},events:{"click .more-help":"_clickMoreHelp","click .less-help":"_clickLessHelp","click .main-help":"_toggleHelp","click .header .alert button":"_hideAlert","click .reset":"reset","click .clear-selected":"clearSelectedElements","click .collection-elements":"clearSelectedElements","dragover .collection-elements":"_dragoverElements","drop .collection-elements":"_dropElements","collection-element.dragstart .collection-elements":"_elementDragstart","collection-element.dragend .collection-elements":"_elementDragend","change .collection-name":"_changeName","keydown .collection-name":"_nameCheckForEnter","change .hide-originals":"_changeHideOriginals","click .cancel-create":"_cancelCreate","click .create-collection":"_clickCreate"},reset:function(){this._instanceSetUp(),this._elementsSetUp(),this.render()},clearSelectedElements:function(e){this.$(".collection-elements .collection-element").removeClass("selected"),this.$(".collection-elements-controls > .clear-selected").hide()},_dragoverElements:function(e){e.preventDefault();var t=this.$list();this._checkForAutoscroll(t,e.originalEvent.clientY);var i=this._getNearestElement(e.originalEvent.clientY);this.$(".element-drop-placeholder").remove();var n=s('
    ');i.length?i.before(n):t.append(n)},_checkForAutoscroll:function(e,t){var i=e.offset(),n=e.scrollTop(),s=t-i.top,a=i.top+e.outerHeight()-t;s>=0&&s=0&&ae&&a-o','
    ',(0,w.default)("More help"),"",'","
    ",'
    ','','',"
    "].join("")),middle:n.template(['",'
    ',"
    "].join("")),footer:n.template(['
    ','
    ','","
    ",'
    ','','
    ',(0,w.default)("Name"),":
    ","
    ","
    ",'
    "].join("")),helpContent:n.template(["

    ",(0,w.default)(["Collections of datasets are permanent, ordered lists of datasets that can be passed to tools and ","workflows in order to have analyses done on each member of the entire group. This interface allows ","you to create a collection and re-order the final collection."].join("")),"

    ","
      ","
    • ",(0,w.default)(["Rename elements in the list by clicking on ",'the existing name.'].join("")),"
    • ","
    • ",(0,w.default)(["Discard elements from the final created list by clicking on the ",'"Discard" button.'].join("")),"
    • ","
    • ",(0,w.default)(["Reorder the list by clicking and dragging elements. Select multiple elements by clicking on ",'them and you can then move those selected by dragging the ',"entire group. Deselect them by clicking them again or by clicking the ",'the "Clear selected" link.'].join("")),"
    • ","
    • ",(0,w.default)(['Click the "Start over" link to begin again as if you had just opened ',"the interface."].join("")),"
    • ","
    • ",(0,w.default)(['Click the "Cancel" button to exit the interface.'].join("")),"
    • ","

    ","

    ",(0,w.default)(['Once your collection is complete, enter a name and ','click "Create list".'].join("")),"

    "].join("")),invalidElements:n.template([(0,w.default)("The following selections could not be included due to problems:"),"
      <% _.each( problems, function( problem ){ %>","
    • <%- problem.element.name %>: <%- problem.text %>
    • ","<% }); %>
    "].join("")),noElementsLeft:n.template(['
  • ',(0,w.default)("No elements left! "),(0,w.default)("Would you like to "),'',(0,w.default)("start over"),"?","
  • "].join("")),invalidInitial:n.template(['
    ','
    ','',"<% if( _.size( problems ) ){ %>",(0,w.default)("The following selections could not be included due to problems"),":","
      <% _.each( problems, function( problem ){ %>","
    • <%- problem.element.name %>: <%- problem.text %>
    • ","<% }); %>
    ","<% } else if( _.size( elements ) < 1 ){ %>",(0,w.default)("No datasets were selected"),".","<% } %>","
    ",(0,w.default)("At least one element is needed for the collection"),". ",(0,w.default)("You may need to "),'',(0,w.default)("cancel")," ",(0,w.default)("and reselect new elements"),".","
    ","
    ","
    ",'"].join(""))}),toString:function(){return"ListCollectionCreator"}}),C=function(e,t,i){var s,o=a.Deferred(),l=Galaxy.modal||new _.default.View;return t=n.defaults(t||{},{elements:e,oncancel:function(){l.hide(),o.reject("cancelled")},oncreate:function(e,t){l.hide(),o.resolve(t)}}),s=new i(t),l.show({title:t.title||(0,w.default)("Create a collection"),body:s.$el,width:"80%",height:"100%",closing_events:!0}),s.render(),window._collectionCreator=s,o},$=function(e,t){return t=t||{},t.title=(0,w.default)("Create a collection from a list of datasets"),C(e,t,x)};t.default={DatasetCollectionElementView:b,ListCollectionCreator:x,collectionCreatorModal:C,listCollectionCreatorModal:$,createListCollection:l}}).call(t,i(2),i(1),i(0),i(0))},function(e,t,i){"use strict";(function(e){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var s=i(60),a=n(s),o=i(107),l=n(o),r=i(3),d=(n(r),l.default.HistoryContentMixin),c=a.default.DatasetCollection,u=c.extend(d).extend({defaults:e.extend(e.clone(c.prototype.defaults),{history_content_type:"dataset_collection",model_class:"HistoryDatasetCollectionAssociation"}),save:function(e,t){return this.isNew()&&(t=t||{},t.url=this.urlRoot+this.get("history_id")+"/contents",e=e||{},e.type="dataset_collection"),c.prototype.save.call(this,e,t)},toString:function(){return"History"+c.prototype.toString.call(this)}});t.default={HistoryDatasetCollection:u}}).call(t,i(1))},function(e,t,i){"use strict";(function(e,n,s){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(106),l=a(o),r=i(5),d=a(r),c=i(3),u=(a(c),{defaults:{model_class:"DatasetCollectionElement",element_identifier:null,element_index:null,element_type:null},_mergeObject:function(t){return e.extend(t,t.object,{element_id:t.id}),delete t.object,t},constructor:function(e,t){e=this._mergeObject(e),this.idAttribute="element_id",n.Model.apply(this,arguments)},parse:function(e,t){var i=e;return i=this._mergeObject(i)}}),h=n.Model.extend(d.default.LoggableMixin).extend(u).extend({_logNamespace:"collections"}),f=n.Collection.extend(d.default.LoggableMixin).extend({_logNamespace:"collections",model:h,toString:function(){return["DatasetCollectionElementCollection(",this.length,")"].join("")}}),p=l.default.DatasetAssociation.extend(d.default.mixin(u,{url:function(){return this.has("history_id")?Galaxy.root+"api/histories/"+this.get("history_id")+"/contents/"+this.get("id"):(console.warn("no endpoint for non-hdas within a collection yet"),Galaxy.root+"api/datasets")},defaults:e.extend({},l.default.DatasetAssociation.prototype.defaults,u.defaults),_downloadQueryParameters:function(){var e=this.get("file_ext"),t=this.get("element_identifier");return"?to_ext="+e+"&hdca_id="+this.get("parent_hdca_id")+"&element_identifier="+t},constructor:function(e,t){this.debug("\t DatasetDCE.constructor:",e,t),u.constructor.call(this,e,t)},hasDetails:function(){return this.elements&&this.elements.length},toString:function(){this.get("element_identifier");return"DatasetDCE({objStr})"}})),m=f.extend({model:p,toString:function(){return["DatasetDCECollection(",this.length,")"].join("")}}),g=n.Model.extend(d.default.LoggableMixin).extend(d.default.SearchableModelMixin).extend({_logNamespace:"collections",defaults:{collection_type:null,deleted:!1},collectionClass:function(){return this.attributes.collection_type.indexOf(":")>0?v:m},initialize:function(e,t){this.debug(this+"(DatasetCollection).initialize:",e,t,this),this.elements=this._createElementsModel(),this.on("change:elements",function(){this.log("change:elements"),this.elements=this._createElementsModel()})},_createElementsModel:function(){var t=this.collectionClass();this.debug(this+"._createElementsModel",t,this.get("elements"),this.elements);var i=this.get("elements")||[];this.unset("elements",{silent:!0});var n=this;return e.each(i,function(t,i){e.extend(t,{parent_hdca_id:n.get("id")})}),this.elements=new t(i),this.elements},toJSON:function(){var e=n.Model.prototype.toJSON.call(this);return this.elements&&(e.elements=this.elements.toJSON()),e},inReadyState:function(){var e=this.get("populated");return this.isDeletedOrPurged()||e},hasDetails:function(){return 0!==this.elements.length},getVisibleContents:function(e){return this.elements},parse:function(e,t){var i=n.Model.prototype.parse.call(this,e,t);return i.create_time&&(i.create_time=new Date(i.create_time)),i.update_time&&(i.update_time=new Date(i.update_time)),i},delete:function(e){return this.get("deleted")?s.when():this.save({deleted:!0},e)},undelete:function(e){return!this.get("deleted")||this.get("purged")?s.when():this.save({deleted:!1},e)},isDeletedOrPurged:function(){return this.get("deleted")||this.get("purged")},searchAttributes:["name","tags"],toString:function(){return"DatasetCollection("+[this.get("id"),this.get("name")||this.get("element_identifier")].join(",")+")"}}),_=g.extend(d.default.mixin(u,{constructor:function(e,t){this.debug("\t NestedDCDCE.constructor:",e,t),u.constructor.call(this,e,t)},toString:function(){return["NestedDCDCE(",this.object?""+this.object:this.get("element_identifier"),")"].join("")}})),v=f.extend({model:_,toString:function(){return["NestedDCDCECollection(",this.length,")"].join("")}});t.default={DatasetCollection:g}}).call(t,i(1),i(2),i(0))},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={tool:"fa-wrench",data_input:"fa-file-o",data_collection_input:"fa-folder-o",subworkflow:"fa-sitemap fa-rotate-270",pause:"fa-pause"}},function(e,t,i){"use strict";(function(e,n,s,a){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var l=i(63),r=o(l),d=i(64),c=(o(d),i(114)),u=o(c),h=i(4),f=o(h),p=i(5),m=o(p),g=i(3),_=o(g),v=e.Model.extend(m.default.LoggableMixin).extend(m.default.mixin(m.default.SearchableModelMixin,{_logNamespace:"history",UPDATE_DELAY:4e3,defaults:{model_class:"History",id:null,name:"Unnamed History",state:"new",deleted:!1,contents_active:{},contents_states:{}},urlRoot:Galaxy.root+"api/histories",contentsClass:r.default.HistoryContents,searchAttributes:["name","annotation","tags"],searchAliases:{title:"name",tag:"tags"},initialize:function(e,t){t=t||{},this.logger=t.logger||null,this.log(this+".initialize:",e,t),this.contents=new this.contentsClass([],{history:this,historyId:this.get("id"),order:t.order}),this._setUpListeners(),this._setUpCollectionListeners(),this.updateTimeoutId=null},_setUpListeners:function(){return this.on({error:function(e,t,i,n,s){this.clearUpdateTimeout()},"change:id":function(e,t){this.contents&&(this.contents.historyId=t)}})},_setUpCollectionListeners:function(){return this.contents?this.listenTo(this.contents,{error:function(){this.trigger.apply(this,n.makeArray(arguments))}}):this},contentsShown:function(){var e=this.get("contents_active"),t=e.active||0;return t+=this.contents.includeDeleted?e.deleted:0,t+=this.contents.includeHidden?e.hidden:0},nice_size:function(){var e=this.get("size");return e?f.default.bytesToString(e,!0,2):(0,_.default)("(empty)")},toJSON:function(){return s.extend(e.Model.prototype.toJSON.call(this),{nice_size:this.nice_size()})},get:function(t){return"nice_size"===t?this.nice_size():e.Model.prototype.get.apply(this,arguments)},ownedByCurrUser:function(){return!(!Galaxy||!Galaxy.user)&&(!Galaxy.user.isAnonymous()&&Galaxy.user.id===this.get("user_id"))},numOfUnfinishedJobs:function(){var e=this.get("non_ready_jobs");return e?e.length:0},numOfUnfinishedShownContents:function(){return this.contents.runningAndActive().length||0},_fetchContentRelatedAttributes:function(){var e=["size","non_ready_jobs","contents_active","hid_counter"];return this.fetch({data:a.param({keys:e.join(",")})})},refresh:function(e){var t=this;e=e||{};var i=this.lastUpdateTime;return this.contents.allFetched=!1,(0!==this.contents.currentPage?function(){return t.contents.fetchPage(t.contents.currentPage)}:function(){return t.contents.fetchUpdated(i)})().done(function(i,n,s){var a;try{a=new Date(s.getResponseHeader("Date"))}catch(e){}t.lastUpdateTime=a||new Date,t.checkForUpdates(e)})},checkForUpdates:function(e){var t=this;e=e||{};var i=this.UPDATE_DELAY;if(this.id){var n=function(){t.clearUpdateTimeout(),t.updateTimeoutId=setTimeout(function(){t.refresh(e)},i)};this.numOfUnfinishedShownContents()>0?n():this._fetchContentRelatedAttributes().done(function(e){t.numOfUnfinishedJobs()>0?n():t.trigger("ready")})}},clearUpdateTimeout:function(){this.updateTimeoutId&&(clearTimeout(this.updateTimeoutId),this.updateTimeoutId=null)},stopPolling:function(){this.clearUpdateTimeout(),this.contents&&this.contents.stopPolling()},parse:function(t,i){var n=e.Model.prototype.parse.call(this,t,i);return n.create_time&&(n.create_time=new Date(n.create_time)),n.update_time&&(n.update_time=new Date(n.update_time)),n},fetchWithContents:function(e,t){e=e||{};var i=this;return e.view="dev-detailed",this.fetch(e).then(function(e){return i.contents.history=i,i.contents.setHistoryId(e.id),i.fetchContents(t)})},fetchContents:function(e){e=e||{};var t=this;return t.lastUpdateTime=new Date,t.contents.fetchCurrentPage(e)},_delete:function(e){return this.get("deleted")?n.when():this.save({deleted:!0},e)},purge:function(e){return this.get("purged")?n.when():this.save({deleted:!0,purged:!0},e)},undelete:function(e){return this.get("deleted")?this.save({deleted:!1},e):n.when()},copy:function(e,t,i){if(e=void 0===e||e,!this.id)throw new Error("You must set the history ID before copying it.");var s={history_id:this.id};e&&(s.current=!0),t&&(s.name=t),i||(s.all_datasets=!1),s.view="dev-detailed";var a=this,o=n.post(this.urlRoot,s);return e?o.then(function(e){return new v(e).setAsCurrent().done(function(){a.trigger("copied",a,e)})}):o.done(function(e){a.trigger("copied",a,e)})},setAsCurrent:function(){var e=this,t=n.getJSON(Galaxy.root+"history/set_as_current?id="+this.id);return t.done(function(){e.trigger("set-as-current",e)}),t},toString:function(){return"History("+this.get("id")+","+this.get("name")+")"}})),y=u.default.InfinitelyScrollingCollection,w=y.extend(m.default.LoggableMixin).extend({_logNamespace:"history",model:v,order:"update_time",limitOnFirstFetch:10,limitPerFetch:10,initialize:function(e,t){t=t||{},this.log("HistoryCollection.initialize",e,t),y.prototype.initialize.call(this,e,t),this.includeDeleted=t.includeDeleted||!1,this.currentHistoryId=t.currentHistoryId,this.setUpListeners()},urlRoot:Galaxy.root+"api/histories",url:function(){return this.urlRoot},setUpListeners:function(){return this.on({"change:deleted":function(e){this.debug("change:deleted",this.includeDeleted,e.get("deleted")),!this.includeDeleted&&e.get("deleted")&&this.remove(e)},copied:function(e,t){this.setCurrent(new v(t,[]))},"set-as-current":function(e){var t=this.currentHistoryId;this.trigger("no-longer-current",t),this.currentHistoryId=e.id}})},_buildFetchData:function(e){return s.extend(y.prototype._buildFetchData.call(this,e),{view:"dev-detailed"})},_buildFetchFilters:function(e){var t=y.prototype._buildFetchFilters.call(this,e)||{},i={};return this.includeDeleted?i.deleted=null:(i.deleted=!1,i.purged=!1),s.defaults(t,i)},fetchFirst:function(e){var t=this,i=a.when();return this.currentHistoryId&&(i=y.prototype.fetchFirst.call(t,{silent:!0,limit:1,filters:{purged:"",deleted:"","encoded_id-in":this.currentHistoryId}})),i.then(function(){return e=e||{},e.offset=0,t.fetchMore(e)})},comparators:s.extend(s.clone(y.prototype.comparators),{name:m.default.buildComparator("name",{ascending:!0}),"name-dsc":m.default.buildComparator("name",{ascending:!1}),size:m.default.buildComparator("size",{ascending:!1}),"size-asc":m.default.buildComparator("size",{ascending:!0})}),sort:function(e){e=e||{};var t=e.silent,i=this.remove(this.get(this.currentHistoryId));return y.prototype.sort.call(this,s.defaults({silent:!0},e)),this.unshift(i,{silent:!0}),t||this.trigger("sort",this,e),this},create:function(e,t,i,s){var a=this;return n.getJSON(Galaxy.root+"history/create_new_current").done(function(e){a.setCurrent(new v(e,[],i||{}))})},setCurrent:function(e,t){return t=t||{},this.unshift(e,t),this.currentHistoryId=e.get("id"),t.silent||this.trigger("new-current",e,this),this},toString:function(){return"HistoryCollection("+this.length+",current:"+this.currentHistoryId+")"}});t.default={History:v,HistoryCollection:w}}).call(t,i(2),i(0),i(1),i(0))},function(e,t,i){"use strict";(function(e,n,s){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(114),l=a(o),r=i(115),d=a(r),c=i(59),u=a(c),h=i(64),f=a(h),p=i(253),m=a(p),g=i(5),_=a(g),v=i(116),y=a(v),w=500;try{w=localStorage.getItem("historyContentsLimitPerPageDefault")||w}catch(e){}var b=l.default.PaginatedCollection,x=b.extend(_.default.LoggableMixin).extend({_logNamespace:"history",limitPerPage:w,limitPerProgressiveFetch:w,order:"hid",urlRoot:Galaxy.root+"api/histories",url:function(){return this.urlRoot+"/"+this.historyId+"/contents"},initialize:function(e,t){this.on({"sync add":this.trackJobStates}),t=t||{},b.prototype.initialize.call(this,e,t),this.history=t.history||null,this.setHistoryId(t.historyId||null),this.includeDeleted=t.includeDeleted||this.includeDeleted,this.includeHidden=t.includeHidden||this.includeHidden,this.model.prototype.idAttribute="type_id"},trackJobStates:function(){var e=this;this.each(function(t){if(!t.has("job_states_summary")&&"dataset_collection"===t.attributes.history_content_type){var i=t.attributes.job_source_type,n=t.attributes.job_source_id;if(i){e.jobStateSummariesCollection.add({id:n,model:i,history_id:e.history_id,collection_id:t.attributes.id});var s=e.jobStateSummariesCollection.get(n);t.jobStatesSummary=s}}})},model:function(e,t){return"dataset"===e.history_content_type?new d.default.HistoryDatasetAssociation(e,t):"dataset_collection"===e.history_content_type?new u.default.HistoryDatasetCollection(e,t):{validationError:"Unknown history_content_type: "+e.history_content_type}},stopPolling:function(){this.jobStateSummariesCollection&&(this.jobStateSummariesCollection.active=!1,this.jobStateSummariesCollection.clearUpdateTimeout())},setHistoryId:function(e){this.stopPolling(),this.historyId=e,e&&(this._setUpWebStorage(),this.jobStateSummariesCollection=new m.default.JobStatesSummaryCollection,this.jobStateSummariesCollection.historyId=e,this.jobStateSummariesCollection.monitor())},_setUpWebStorage:function(e){return this.storage=new f.default.HistoryPrefs({id:f.default.HistoryPrefs.historyStorageKey(this.historyId)}),this.trigger("new-storage",this.storage,this),this.on({"include-deleted":function(e){this.storage.includeDeleted(e)},"include-hidden":function(e){this.storage.includeHidden(e)}}),this.includeDeleted=this.storage.includeDeleted()||!1,this.includeHidden=this.storage.includeHidden()||!1,this},comparators:e.extend(e.clone(b.prototype.comparators),{name:_.default.buildComparator("name",{ascending:!0}),"name-dsc":_.default.buildComparator("name",{ascending:!1}),hid:_.default.buildComparator("hid",{ascending:!1}),"hid-asc":_.default.buildComparator("hid",{ascending:!0})}),running:function(){return this.filter(function(e){return!e.inReadyState()})},runningAndActive:function(){return this.filter(function(e){return!e.inReadyState()&&e.get("visible")&&!e.get("deleted")})},getByHid:function(e){return this.findWhere({hid:e})},haveDetails:function(){return this.all(function(e){return e.hasDetails()})},hidden:function(){return this.filter(function(e){return e.hidden()})},deleted:function(){return this.filter(function(e){return e.get("deleted")})},visibleAndUndeleted:function(){return this.filter(function(e){return e.get("visible")&&!e.get("deleted")})},setIncludeDeleted:function(t,i){if(e.isBoolean(t)&&t!==this.includeDeleted){if(this.includeDeleted=t,e.result(i,"silent"))return;this.trigger("include-deleted",t,this)}},setIncludeHidden:function(t,i){if(e.isBoolean(t)&&t!==this.includeHidden){if(this.includeHidden=t,i=i||{},e.result(i,"silent"))return;this.trigger("include-hidden",t,this)}},fetch:function(t){if(t=t||{},this.historyId&&!t.details){var i=f.default.HistoryPrefs.get(this.historyId).toJSON();e.isEmpty(i.expandedIds)||(t.details=e.values(i.expandedIds).join(","))}return b.prototype.fetch.call(this,t)},_buildFetchData:function(t){return e.extend(b.prototype._buildFetchData.call(this,t),{v:"dev"})},_fetchParams:b.prototype._fetchParams.concat(["v","details"]),_buildFetchFilters:function(t){var i=b.prototype._buildFetchFilters.call(this,t)||{},n={};return this.includeDeleted||(n.deleted=!1,n.purged=!1),this.includeHidden||(n.visible=!0),e.defaults(i,n)},getTotalItemCount:function(){return this.history.contentsShown()},fetchUpdated:function(e,t){return e&&(t=t||{filters:{}},t.remove=!1,t.filters={"update_time-ge":e.toISOString(),visible:""}),this.fetch(t)},fetchDeleted:function(t){var i=this;return t=t||{},t.filters=e.extend(t.filters,{deleted:!0,purged:void 0}),t.remove=!1,this.trigger("fetching-deleted",this),this.fetch(t).always(function(){i.trigger("fetching-deleted-done",i)})},fetchHidden:function(t){t=t||{};var i=this;return t.filters=e.extend(t.filters,{visible:!1}),t.remove=!1,i.trigger("fetching-hidden",i),i.fetch(t).always(function(){i.trigger("fetching-hidden-done",i)})},fetchAllDetails:function(t){t=t||{};var i={details:"all"};return t.data=e.extend(t.data||{},i),this.fetch(t)},_filterAndUpdate:function(e,t){var i=this,n=i.model.prototype.idAttribute,s=[t];return i.fetch({filters:e,remove:!1}).then(function(e){return e=e.reduce(function(e,t,s){var a=i.get(t[n]);return a?e.concat(a):e},[]),i.ajaxQueue("save",s,e)})},ajaxQueue:function(t,i,n){return n=n||this.models,new y.default.AjaxQueue(n.slice().reverse().map(function(n,s){var a=e.isString(t)?n[t]:t;return function(){return a.apply(n,i)}})).deferred},progressivelyFetchDetails:function(t){function i(n){n=n||0;var l=e.extend(e.clone(t),{view:"summary",keys:r,limit:o,offset:n,reset:0===n,remove:!1});e.defer(function(){a.fetch.call(a,l).fail(s.reject).done(function(e){s.notify(e,o,n),e.length!==o?(a.allFetched=!0,s.resolve(e,o,n)):i(n+o)})})}t=t||{};var s=n.Deferred(),a=this,o=t.limitPerCall||a.limitPerProgressiveFetch,l=d.default.HistoryDatasetAssociation.prototype.searchAttributes,r=l.join(",");return i(),s},isCopyable:function(t){var i=["HistoryDatasetAssociation","HistoryDatasetCollectionAssociation"];return e.isObject(t)&&t.id&&e.contains(i,t.model_class)},copy:function(t){var i,s,a;e.isString(t)?(i=t,a="hda",s="dataset"):(i=t.id,a={HistoryDatasetAssociation:"hda",LibraryDatasetDatasetAssociation:"ldda",HistoryDatasetCollectionAssociation:"hdca"}[t.model_class]||"hda",s="hdca"===a?"dataset_collection":"dataset");var o=this,l=n.ajax(this.url(),{method:"POST",contentType:"application/json",data:JSON.stringify({content:i,source:a,type:s})}).done(function(e){o.add([e],{parse:!0})}).fail(function(e,t,n){o.trigger("error",o,l,{},"Error copying contents",{type:s,id:i,source:a})});return l},createHDCA:function(e,t,i,n,s){return this.model({history_content_type:"dataset_collection",collection_type:t,history_id:this.historyId,name:i,hide_source_items:n||!1,element_identifiers:e}).save(s)},haveSearchDetails:function(){return this.allFetched&&this.all(function(t){return e.has(t.attributes,"annotation")})},matches:function(e){return this.filter(function(t){return t.matches(e)})},clone:function(){var e=s.Collection.prototype.clone.call(this);return e.historyId=this.historyId,e},toString:function(){return["HistoryContents(",[this.historyId,this.length].join(),")"].join("")}});t.default={HistoryContents:x}}).call(t,i(1),i(0),i(2))},function(e,t,i){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var n=i(5),s=function(e){return e&&e.__esModule?e:{default:e}}(n),a=s.default.SessionStorageModel.extend({defaults:{expandedIds:{},show_deleted:!1,show_hidden:!1},addExpanded:function(e){var t=this.get("expandedIds");t[e.id]=e.get("id"),this.save("expandedIds",t)},removeExpanded:function(e){var t=this.get("expandedIds");delete t[e.id],this.save("expandedIds",t)},isExpanded:function(t){return e.result(this.get("expandedIds"),t,!1)},allExpanded:function(){return e.values(this.get("expandedIds"))},clearExpanded:function(){this.set("expandedIds",{})},includeDeleted:function(t){return e.isUndefined(t)||this.set("show_deleted",t),this.get("show_deleted")},includeHidden:function(t){return e.isUndefined(t)||this.set("show_hidden",t),this.get("show_hidden")},toString:function(){return"HistoryPrefs("+this.id+")"}},{storageKeyPrefix:"history:",historyStorageKey:function(e){if(!e)throw new Error("HistoryPrefs.historyStorageKey needs valid id: "+e);return a.storageKeyPrefix+e},get:function(e){return new a({id:a.historyStorageKey(e)})},clearAll:function(e){for(var t in sessionStorage)0===t.indexOf(a.storageKeyPrefix)&&sessionStorage.removeItem(t)}});t.default={HistoryPrefs:a}}).call(t,i(1))},function(e,t,i){"use strict";(function(e,n,s,a){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var l=i(5),r=o(l),d=i(3),c=(o(d),e.View.extend(r.default.LoggableMixin).extend({_logNamespace:"list",initialize:function(e){this.expanded=e.expanded||!1,this.log("\t expanded:",this.expanded),this.fxSpeed=void 0!==e.fxSpeed?e.fxSpeed:this.fxSpeed},fxSpeed:"fast",render:function(e){var t=this._buildNewRender();return this._setUpBehaviors(t),this._queueNewRender(t,e),this},_buildNewRender:function(){var e=n(this.templates.el(this.model.toJSON(),this));return this.expanded&&this.$details(e).replaceWith(this._renderDetails().show()),e},_queueNewRender:function(e,t){t=void 0===t?this.fxSpeed:t;var i=this;0===t?(i._swapNewRender(e),i.trigger("rendered",i)):n(i).queue("fx",[function(e){i.$el.fadeOut(t,e)},function(t){i._swapNewRender(e),t()},function(e){i.$el.fadeIn(t,e)},function(e){i.trigger("rendered",i),e()}])},_swapNewRender:function(e){return this.$el.empty().attr("class",s.isFunction(this.className)?this.className():this.className).append(e.children())},_setUpBehaviors:function(e){e=e||this.$el,e.find("[title]").tooltip({placement:"bottom"})},$details:function(e){return e=e||this.$el,e.find("> .details")},_renderDetails:function(){var e=n(this.templates.details(this.model.toJSON(),this));return this._setUpBehaviors(e),e},toggleExpanded:function(e){return e=void 0===e?!this.expanded:e,e?this.expand():this.collapse(),this},expand:function(){var e=this;return e._fetchModelDetails().always(function(){e._expand()})},_fetchModelDetails:function(){return this.model.hasDetails()?a.when():this.model.fetch()},_expand:function(){var e=this,t=e._renderDetails();e.$details().replaceWith(t),e.expanded=!0,e.$details().slideDown(e.fxSpeed,function(){e.trigger("expanded",e)})},collapse:function(){this.debug(this+"(ExpandableView).collapse");var e=this;e.expanded=!1,this.$details().slideUp(e.fxSpeed,function(){e.trigger("collapsed",e)})}})),u=c.extend(r.default.mixin(r.default.SelectableViewMixin,r.default.DraggableViewMixin,{tagName:"div",className:"list-item",initialize:function(e){c.prototype.initialize.call(this,e),r.default.SelectableViewMixin.initialize.call(this,e),r.default.DraggableViewMixin.initialize.call(this,e),this._setUpListeners()},_setUpListeners:function(){return this.on("selectable",function(e){e?this.$(".primary-actions").hide():this.$(".primary-actions").show()},this),this},_buildNewRender:function(){var e=c.prototype._buildNewRender.call(this);return e.children(".warnings").replaceWith(this._renderWarnings()),e.children(".title-bar").replaceWith(this._renderTitleBar()),e.children(".primary-actions").append(this._renderPrimaryActions()),e.find("> .title-bar .subtitle").replaceWith(this._renderSubtitle()),e},_swapNewRender:function(e){return c.prototype._swapNewRender.call(this,e),this.selectable&&this.showSelector(0),this.draggable&&this.draggableOn(),this.$el},_renderWarnings:function(){var e=this,t=n('
    '),i=e.model.toJSON();return s.each(e.templates.warnings,function(s){t.append(n(s(i,e)))}),t},_renderTitleBar:function(){return n(this.templates.titleBar(this.model.toJSON(),this))},_renderPrimaryActions:function(){return[]},_renderSubtitle:function(){return n(this.templates.subtitle(this.model.toJSON(),this))},events:{"click .title-bar":"_clickTitleBar","keydown .title-bar":"_keyDownTitleBar","click .selector":"toggleSelect"},_clickTitleBar:function(e){e.stopPropagation(),e.altKey?(this.toggleSelect(e),this.selectable||this.showSelector()):this.toggleExpanded()},_keyDownTitleBar:function(e){return!e||"keydown"!==e.type||32!==e.keyCode&&13!==e.keyCode||(this.toggleExpanded(),e.stopPropagation(),!1)},toString:function(){return"ListItemView("+(this.model?""+this.model:"(no model)")+")"}}));u.prototype.templates=function(){return{el:r.default.wrapTemplate(['
    ','
    ','
    ','',"
    ",'
    ','
    ','
    ',"
    "]),warnings:{},titleBar:r.default.wrapTemplate(['
    ','','
    ','<%- element.name %>',"
    ",'
    ',"
    "],"element"),subtitle:r.default.wrapTemplate(['
    ']),details:r.default.wrapTemplate(['
    '])}}();var h=u.extend({foldoutStyle:"foldout",foldoutPanelClass:null,initialize:function(e){"drilldown"===this.foldoutStyle&&(this.expanded=!1),this.foldoutStyle=e.foldoutStyle||this.foldoutStyle,this.foldoutPanelClass=e.foldoutPanelClass||this.foldoutPanelClass,u.prototype.initialize.call(this,e),this.foldout=this._createFoldoutPanel()},_renderDetails:function(){if("drilldown"===this.foldoutStyle)return n();var e=u.prototype._renderDetails.call(this);return this._attachFoldout(this.foldout,e)},_createFoldoutPanel:function(){var e=this.model,t=this._getFoldoutPanelClass(e),i=this._getFoldoutPanelOptions(e);return new t(s.extend(i,{model:e}))},_getFoldoutPanelClass:function(){return this.foldoutPanelClass},_getFoldoutPanelOptions:function(){return{foldoutStyle:this.foldoutStyle,fxSpeed:this.fxSpeed}},_attachFoldout:function(e,t){return t=t||this.$("> .details"),this.foldout=e.render(0),e.$("> .controls").hide(),t.append(e.$el)},expand:function(){var e=this;return e._fetchModelDetails().always(function(){"foldout"===e.foldoutStyle?e._expand():"drilldown"===e.foldoutStyle&&e._expandByDrilldown()})},_expandByDrilldown:function(){var e=this;e.listenTo(e.foldout,"close",function(){e.trigger("collapsed:drilldown",e,e.foldout)}),e.trigger("expanded:drilldown",e,e.foldout)}});h.prototype.templates=function(){var e=r.default.wrapTemplate(['
    ',"
    "],"collection");return s.extend({},u.prototype.templates,{details:e})}(),t.default={ExpandableView:c,ListItemView:u,FoldoutListItemView:h}}).call(t,i(2),i(0),i(1),i(0))},function(e,t,i){"use strict";(function(e,n,s,a){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var l=i(65),r=o(l),d=i(16),c=o(d),u=i(21),h=o(u),f=i(5),p=o(f),m=i(3),g=o(m),_=r.default.ListItemView,v=_.extend({_logNamespace:"dataset",className:_.prototype.className+" dataset",id:function(){return["dataset",this.model.get("id")].join("-")},initialize:function(e){e.logger&&(this.logger=this.model.logger=e.logger),this.log(this+".initialize:",e),_.prototype.initialize.call(this,e),this.linkTarget=e.linkTarget||"_blank"},_setUpListeners:function(){_.prototype._setUpListeners.call(this);var t=this;return t.listenTo(t.model,{change:function(i){t.model.changedAttributes().state&&t.model.inReadyState()&&t.expanded&&!t.model.hasDetails()?t.model.fetch({silent:!0}).done(function(){t.render()}):e.has(i.changed,"tags")&&1===e.keys(i.changed).length?t.$(".nametags").html(t._renderNametags()):t.render()}})},_fetchModelDetails:function(){var e=this;return e.model.inReadyState()&&!e.model.hasDetails()?e.model.fetch({silent:!0}):n.when()},remove:function(e,t){var i=this;e=e||this.fxSpeed,this.$el.fadeOut(e,function(){s.View.prototype.remove.call(i),t&&t.call(i)})},_swapNewRender:function(e){return _.prototype._swapNewRender.call(this,e),this.model.has("state")&&this.$el.addClass("state-"+this.model.get("state")),this.$el},_renderPrimaryActions:function(){return[this._renderDisplayButton()]},_renderDisplayButton:function(){var e=this.model.get("state");if(e===c.default.NOT_VIEWABLE||e===c.default.DISCARDED||!this.model.get("accessible"))return null;var t={target:this.linkTarget,classes:"display-btn"};if(this.model.get("purged"))t.disabled=!0,t.title=(0,g.default)("Cannot display datasets removed from disk");else if(e===c.default.UPLOAD)t.disabled=!0,t.title=(0,g.default)("This dataset must finish uploading before it can be viewed");else if(e===c.default.NEW)t.disabled=!0,t.title=(0,g.default)("This dataset is not yet viewable");else{t.title=(0,g.default)("View data"),t.href=this.model.urls.display;var i=this;t.onclick=function(e){Galaxy.frame&&Galaxy.frame.active&&(Galaxy.frame.addDataset(i.model.get("id")),e.preventDefault())}}return t.faIcon="fa-eye",(0,h.default)(t)},_renderDetails:function(){if(this.model.get("state")===c.default.NOT_VIEWABLE)return a(this.templates.noAccess(this.model.toJSON(),this));var e=_.prototype._renderDetails.call(this);return e.find(".actions .left").empty().append(this._renderSecondaryActions()),e.find(".summary").html(this._renderSummary()).prepend(this._renderDetailMessages()),e.find(".display-applications").html(this._renderDisplayApplications()),this._setUpBehaviors(e),e},_renderSummary:function(){var e=this.model.toJSON(),t=this.templates.summaries[e.state];return(t=t||this.templates.summaries.unknown)(e,this)},_renderDetailMessages:function(){var t=this,i=a('
    '),n=t.model.toJSON();return e.each(t.templates.detailMessages,function(e){i.append(a(e(n,t)))}),i},_renderDisplayApplications:function(){return this.model.isDeletedOrPurged()?"":[this.templates.displayApplications(this.model.get("display_apps"),this),this.templates.displayApplications(this.model.get("display_types"),this)].join("")},_renderSecondaryActions:function(){switch(this.debug("_renderSecondaryActions"),this.model.get("state")){case c.default.NOT_VIEWABLE:return[];case c.default.OK:case c.default.FAILED_METADATA:case c.default.ERROR:return[this._renderDownloadButton(),this._renderShowParamsButton()]}return[this._renderShowParamsButton()]},_renderShowParamsButton:function(){return(0,h.default)({title:(0,g.default)("View details"),classes:"params-btn",href:this.model.urls.show_params,target:this.linkTarget,faIcon:"fa-info-circle",onclick:function(e){Galaxy.frame&&Galaxy.frame.active&&(Galaxy.frame.add({title:(0,g.default)("Dataset details"),url:this.href}),e.preventDefault(),e.stopPropagation())}})},_renderDownloadButton:function(){return this.model.get("purged")||!this.model.hasData()?null:e.isEmpty(this.model.get("meta_files"))?a(['','',""].join("")):this._renderMetaFileDownloadButton()},_renderMetaFileDownloadButton:function(){var t=this.model.urls;return a(['"].join("\n"))},_renderNametags:function(){return e.template(["<% _.each(_.sortBy(_.uniq(tags), function(x) { return x }), function(tag){ %>",'<% if (tag.indexOf("name:") == 0){ %>','<%- tag.slice(5) %>',"<% } %>","<% }); %>"].join(""))({tags:this.model.get("tags")})},events:e.extend(e.clone(_.prototype.events),{"click .display-btn":function(e){this.trigger("display",this,e)},"click .params-btn":function(e){this.trigger("params",this,e)},"click .download-btn":function(e){this.trigger("download",this,e)}}),toString:function(){return"DatasetListItemView("+(this.model?""+this.model:"(no model)")+")"}});v.prototype.templates=function(){var t=e.extend({},_.prototype.templates.warnings,{failed_metadata:p.default.wrapTemplate(['<% if( model.state === "failed_metadata" ){ %>','
    ',(0,g.default)("An error occurred setting the metadata for this dataset"),"
    ","<% } %>"]),error:p.default.wrapTemplate(["<% if( model.error ){ %>",'
    ',(0,g.default)("There was an error getting the data for this dataset"),": <%- model.error %>","
    ","<% } %>"]),purged:p.default.wrapTemplate(["<% if( model.purged ){ %>",'
    ',(0,g.default)("This dataset has been deleted and removed from disk"),"
    ","<% } %>"]),deleted:p.default.wrapTemplate(["<% if( model.deleted && !model.purged ){ %>",'
    ',(0,g.default)("This dataset has been deleted"),"
    ","<% } %>"])}),i=p.default.wrapTemplate(['
    ','
    ','
    ','
    ','
    ',"
    ","<% if( !dataset.deleted && !dataset.purged ){ %>",'
    ','
    ','
    ',"<% if( dataset.peek ){ %>",'
    <%= dataset.peek %>
    ',"<% } %>","<% } %>","
    "],"dataset"),n=p.default.wrapTemplate(['
    ','
    ',(0,g.default)("You do not have permission to view this dataset"),"
    ","
    "],"dataset"),s={};s[c.default.OK]=s[c.default.FAILED_METADATA]=p.default.wrapTemplate(["<% if( dataset.misc_blurb ){ %>",'
    ','<%- dataset.misc_blurb %>',"
    ","<% } %>","<% if( dataset.file_ext ){ %>",'
    ','",'<%- dataset.file_ext %>',"
    ","<% } %>","<% if( dataset.metadata_dbkey ){ %>",'
    ','",'',"<%- dataset.metadata_dbkey %>","","
    ","<% } %>","<% if( dataset.misc_info ){ %>",'
    ','<%- dataset.misc_info %>',"
    ","<% } %>"],"dataset"),s[c.default.NEW]=p.default.wrapTemplate(["
    ",(0,g.default)("This is a new dataset and not all of its data are available yet"),"
    "],"dataset"),s[c.default.NOT_VIEWABLE]=p.default.wrapTemplate(["
    ",(0,g.default)("You do not have permission to view this dataset"),"
    "],"dataset"),s[c.default.DISCARDED]=p.default.wrapTemplate(["
    ",(0,g.default)("The job creating this dataset was cancelled before completion"),"
    "],"dataset"),s[c.default.QUEUED]=p.default.wrapTemplate(["
    ",(0,g.default)("This job is waiting to run"),"
    "],"dataset"),s[c.default.RUNNING]=p.default.wrapTemplate(["
    ",(0,g.default)("This job is currently running"),"
    "],"dataset"),s[c.default.UPLOAD]=p.default.wrapTemplate(["
    ",(0,g.default)("This dataset is currently uploading"),"
    "],"dataset"),s[c.default.SETTING_METADATA]=p.default.wrapTemplate(["
    ",(0,g.default)("Metadata is being auto-detected"),"
    "],"dataset"),s[c.default.PAUSED]=p.default.wrapTemplate(["
    ",(0,g.default)('This job is paused. Use the "Resume Paused Jobs" in the history menu to resume'),"
    "],"dataset"),s[c.default.ERROR]=p.default.wrapTemplate(["<% if( !dataset.purged ){ %>","
    <%- dataset.misc_blurb %>
    ","<% } %>",'',(0,g.default)("An error occurred with this dataset"),":",'
    <%- dataset.misc_info %>
    '],"dataset"),s[c.default.EMPTY]=p.default.wrapTemplate(["
    ",(0,g.default)("No data"),": <%- dataset.misc_blurb %>
    "],"dataset"),s.unknown=p.default.wrapTemplate(['
    Error: unknown dataset state: "<%- dataset.state %>"
    '],"dataset");var a={resubmitted:p.default.wrapTemplate(["<% if( model.resubmitted ){ %>",'
    ',(0,g.default)("The job creating this dataset has been resubmitted"),"
    ","<% } %>"])},o=p.default.wrapTemplate(["<% _.each( apps, function( app ){ %>",'
    ','<%- app.label %> ','',"<% _.each( app.links, function( link ){ %>",'',"<% print( _l( link.text ) ); %>"," ","<% }); %>","","
    ","<% }); %>"],"apps");return e.extend({},_.prototype.templates,{warnings:t,details:i,noAccess:n,summaries:s,detailMessages:a,displayApplications:o})}(),t.default={DatasetListItemView:v}}).call(t,i(1),i(0),i(2),i(0))},function(e,t,i){"use strict";(function(e,n,s){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(65),l=a(o),r=i(66),d=a(r),c=i(5),u=a(c),h=i(3),f=a(h),p=l.default.FoldoutListItemView,m=l.default.ListItemView,g=p.extend({className:p.prototype.className+" dataset-collection",id:function(){return["dataset_collection",this.model.get("id")].join("-")},initialize:function(e){this.linkTarget=e.linkTarget||"_blank",this.hasUser=e.hasUser,p.prototype.initialize.call(this,e)},_setUpListeners:function(){p.prototype._setUpListeners.call(this),this.listenTo(this.model,"change",function(t,i){e.has(t.changed,"deleted")?this.render():e.has(t.changed,"element_count")&&this.$("> .title-bar .subtitle").replaceWith(this._renderSubtitle())})},_renderSubtitle:function(){return n(this.templates.subtitle(this.model.toJSON(),this))},_getFoldoutPanelOptions:function(){var t=p.prototype._getFoldoutPanelOptions.call(this);return e.extend(t,{linkTarget:this.linkTarget,hasUser:this.hasUser})},$selector:function(){return this.$("> .selector")},toString:function(){return"DCListItemView("+(this.model?""+this.model:"(no model)")+")"}});g.prototype.templates=function(){var t=e.extend({},p.prototype.templates.warnings,{error:u.default.wrapTemplate(["<% if( model.error ){ %>",'
    ',(0,f.default)("There was an error getting the data for this collection"),": <%- model.error %>","
    ","<% } %>"]),purged:u.default.wrapTemplate(["<% if( model.purged ){ %>",'
    ',(0,f.default)("This collection has been deleted and removed from disk"),"
    ","<% } %>"]),deleted:u.default.wrapTemplate(["<% if( model.deleted && !model.purged ){ %>",'
    ',(0,f.default)("This collection has been deleted"),"
    ","<% } %>"])}),i=u.default.wrapTemplate(['
    ','
    ','<%- collection.element_identifier || collection.name %>',"
    ",'
    ',"
    "],"collection"),n=u.default.wrapTemplate(['
    ','<% var countText = collection.element_count? ( collection.element_count + " " ) : ""; %>','<% if( collection.collection_type === "list" ){ %>',(0,f.default)("a list of <%- countText %>datasets"),'<% } else if( collection.collection_type === "paired" ){ %>',(0,f.default)("a pair of datasets"),'<% } else if( collection.collection_type === "list:paired" ){ %>',(0,f.default)("a list of <%- countText %>dataset pairs"),'<% } else if( collection.collection_type === "list:list" ){ %>',(0,f.default)("a list of <%- countText %>dataset lists"),"<% } %>","
    "],"collection");return e.extend({},p.prototype.templates,{warnings:t,titleBar:i,subtitle:n})}();var _=m.extend({className:m.prototype.className+" dataset-collection-element",initialize:function(e){e.logger&&(this.logger=this.model.logger=e.logger),this.log("DCEListItemView.initialize:",e),m.prototype.initialize.call(this,e)},toString:function(){return"DCEListItemView("+(this.model?""+this.model:"(no model)")+")"}});_.prototype.templates=function(){var t=u.default.wrapTemplate(['
    ','
    ','<%- element.element_identifier %>',"
    ",'
    ',"
    "],"element");return e.extend({},m.prototype.templates,{titleBar:t})}();var v=d.default.DatasetListItemView.extend({className:d.default.DatasetListItemView.prototype.className+" dataset-collection-element",initialize:function(e){e.logger&&(this.logger=this.model.logger=e.logger),this.log("DatasetDCEListItemView.initialize:",e),d.default.DatasetListItemView.prototype.initialize.call(this,e)},_fetchModelDetails:function(){var e=this;return e.model.inReadyState()&&!e.model.hasDetails()?e.model.fetch({silent:!0}):s.when()},toString:function(){return"DatasetDCEListItemView("+(this.model?""+this.model:"(no model)")+")"}});v.prototype.templates=function(){var t=u.default.wrapTemplate(['
    ','','
    ','<%- element.element_identifier %>',"
    ","
    "],"element");return e.extend({},d.default.DatasetListItemView.prototype.templates,{titleBar:t})}();var y=g.extend({className:g.prototype.className+" dataset-collection-element",_swapNewRender:function(e){g.prototype._swapNewRender.call(this,e);var t=this.model.get("state")||"ok";return this.$el.addClass("state-"+t),this.$el},toString:function(){return"NestedDCDCEListItemView("+(this.model?""+this.model:"(no model)")+")"}});t.default={DCListItemView:g,DCEListItemView:_,DatasetDCEListItemView:v,NestedDCDCEListItemView:y}}).call(t,i(1),i(0),i(0))},function(e,t,i){"use strict";(function(e,n){function s(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=i(11),o=s(a),l=i(6),r=s(l),d=e.View.extend({initialize:function(t){this.model=new e.Model(t),this.url=this.model.get("url"),this.redirect=this.model.get("redirect"),this.setElement("
    "),this.render()},render:function(){var e=this;n.ajax({url:Galaxy.root+this.url,type:"GET"}).done(function(t){var i=n.extend({},e.model.attributes,t),s=new o.default({title:i.title,message:i.message,status:i.status||"warning",icon:i.icon,initial_errors:!0,errors:i.errors,inputs:i.inputs,buttons:{submit:new r.default.Button({tooltip:i.submit_tooltip,title:i.submit_title||"Save",icon:i.submit_icon||"fa-save",cls:"btn btn-primary ui-clear-float",onclick:function(){e._submit(s)}})}});e.$el.empty().append(s.$el)}).fail(function(t){e.$el.empty().append(new r.default.Message({message:"Failed to load resource "+e.url+".",status:"danger",persistent:!0}).$el)})},_submit:function(e){var t=this;n.ajax({url:Galaxy.root+t.url,data:JSON.stringify(e.data.create()),type:"PUT",contentType:"application/json"}).done(function(i){var s={};i.id?s.id=i.id:s={message:i.message,status:"success",persistent:!1},t.redirect?window.location=Galaxy.root+t.redirect+"?"+n.param(s):(e.data.matchModel(i,function(t,i){e.field_list[i].value(t.value)}),t._showMessage(e,success_message))}).fail(function(i){t._showMessage(e,{message:i.responseJSON.err_msg,status:"danger",persistent:!1})})},_showMessage:function(e,t){e.$el.parents().filter(function(){return-1!=["auto","scroll"].indexOf(n(this).css("overflow"))}).first().animate({scrollTop:0},500),e.message.update(t)}});t.default={View:d}}).call(t,i(2),i(0))},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,i){"use strict";(function(e,n,s){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(16),l=a(o),r=i(5),d=a(r),c=i(3),u=a(c),h=d.default.SearchableModelMixin,f=e.Model.extend(d.default.LoggableMixin).extend(d.default.mixin(h,{_logNamespace:"dataset",defaults:{state:l.default.NEW,deleted:!1,purged:!1,name:"(unnamed dataset)",accessible:!0,data_type:"",file_ext:"",file_size:0,meta_files:[],misc_blurb:"",misc_info:"",tags:[]},initialize:function(e,t){this.debug(this+"(Dataset).initialize",e,t), //!! this state is not in trans.app.model.Dataset.states - set it here - -this.get("accessible")||this.set("state",l.default.NOT_VIEWABLE),this.urls=this._generateUrls(),this._setUpListeners()},_generateUrls:function(){var e=this.get("id");if(!e)return{};var t={purge:"datasets/"+e+"/purge_async",display:"datasets/"+e+"/display/?preview=True",edit:"datasets/edit?dataset_id="+e,download:"datasets/"+e+"/display"+this._downloadQueryParameters(),report_error:"dataset/errors?id="+e,rerun:"tool_runner/rerun?id="+e,show_params:"datasets/"+e+"/show_params",visualization:"visualization",meta_download:"dataset/get_metadata_file?hda_id="+e+"&metadata_name="};return n.each(t,function(e,i){t[i]=Galaxy.root+e}),this.urls=t,t},_downloadQueryParameters:function(){return"?to_ext="+this.get("file_ext")},_setUpListeners:function(){this.on("change:state",function(e,t){this.log(this+" has changed state:",e,t),this.inReadyState()&&this.trigger("state:ready",e,t,this.previous("state"))}),this.on("change:id change:file_ext",function(e){this._generateUrls()})},toJSON:function(){var t=e.Model.prototype.toJSON.call(this);return n.extend(t,{urls:this.urls})},isDeletedOrPurged:function(){return this.get("deleted")||this.get("purged")},inReadyState:function(){var e=n.contains(l.default.READY_STATES,this.get("state"));return this.isDeletedOrPurged()||e},hasDetails:function(){return!this.get("accessible")||this.has("annotation")},hasData:function(){return this.get("file_size")>0},fetch:function(t){var i=this;return e.Model.prototype.fetch.call(this,t).always(function(){i._generateUrls()})},parse:function(t,i){var n=e.Model.prototype.parse.call(this,t,i);return n.create_time&&(n.create_time=new Date(n.create_time)),n.update_time&&(n.update_time=new Date(n.update_time)),n},save:function(t,i){return i=i||{},i.wait=!!n.isUndefined(i.wait)||i.wait,e.Model.prototype.save.call(this,t,i)},delete:function(e){return this.get("deleted")?s.when():this.save({deleted:!0},e)},undelete:function(e){return!this.get("deleted")||this.get("purged")?s.when():this.save({deleted:!1},e)},purge:function(e){if(this.get("purged"))return s.when();e=e||{},e.url=this.urls.purge;var t=this,i=s.ajax(e);return i.done(function(e,i,n){t.set({deleted:!0,purged:!0})}),i.fail(function(i,n,s){var a=(0,u.default)("Unable to purge dataset");i.responseJSON&&i.responseJSON.error?a=i.responseJSON.error:-1!==i.responseText.indexOf("Removal of datasets by users is not allowed in this Galaxy instance")&&(a="Removal of datasets by users is not allowed in this Galaxy instance"),i.responseText=a,t.trigger("error",t,i,e,(0,u.default)(a),{error:a})}),i},searchAttributes:["name","file_ext","genome_build","misc_blurb","misc_info","annotation","tags"],searchAliases:{title:"name",format:"file_ext",database:"genome_build",blurb:"misc_blurb",description:"misc_blurb",info:"misc_info",tag:"tags"},toString:function(){var e=this.get("id")||"";return this.get("name")&&(e='"'+this.get("name")+'",'+e),"Dataset("+e+")"}})),p=e.Collection.extend(d.default.LoggableMixin).extend({_logNamespace:"dataset",model:f,urlRoot:Galaxy.root+"api/datasets",url:function(){return this.urlRoot},ids:function(){return this.map(function(e){return e.get("id")})},notReady:function(){return this.filter(function(e){return!e.inReadyState()})},haveDetails:function(){return this.all(function(e){return e.hasDetails()})},ajaxQueue:function(e,t){var i=s.Deferred(),n=this.length,a=[];if(!n)return i.resolve([]),i;var o=this.chain().reverse().map(function(s,l){return function(){var r=e.call(s,t);r.done(function(e){i.notify({curr:l,total:n,response:e,model:s})}),r.always(function(e){a.push(e),o.length?o.shift()():i.resolve(a)})}}).value();return o.shift()(),i},matches:function(e){return this.filter(function(t){return t.matches(e)})},toString:function(){return["DatasetAssociationCollection(",this.length,")"].join("")}});t.default={DatasetAssociation:f,DatasetAssociationCollection:p}}).call(t,i(2),i(1),i(0))},function(e,t,i){"use strict";(function(e){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var s=i(16),a=(n(s),i(5)),o=(n(a),i(3)),l=(n(o),1e3);try{l=localStorage.getItem("collectionFuzzyCountDefault")||l}catch(e){}var r={defaults:{history_id:null,history_content_type:null,hid:null,visible:!0},idAttribute:"type_id",hidden:function(){return!this.get("visible")},isVisible:function(e,t){var i=!0;return e||!this.get("deleted")&&!this.get("purged")||(i=!1),t||this.get("visible")||(i=!1),i},urlRoot:Galaxy.root+"api/histories/",url:function(){var e=this.get("history_content_type"),t=this.get("history_id"),i=this.get("id"),n=""+this.urlRoot+t+"/contents/"+e+"s/"+i;return"dataset_collection"==e&&(n=n+"?view=element-reference&fuzzy_count="+l),n},hide:function(t){return this.get("visible")?this.save({visible:!1},t):e.when()},unhide:function(t){return this.get("visible")?e.when():this.save({visible:!0},t)},toString:function(){return[this.get("type_id"),this.get("hid"),this.get("name")].join(":")}};t.default={HistoryContentMixin:r}}).call(t,i(0))},function(e,t,i){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var i={_validationWarning:function(e,t){"name"===e&&(e=this.$(".collection-name").add(this.$(".collection-name-prompt")),this.$(".collection-name").focus().select()),t?(e=e||this.$(".validation-warning"),e.removeClass("validation-warning")):e.addClass("validation-warning")},_changeHideOriginals:function(e){this.hideOriginals=this.$(".hide-originals").prop("checked")},_changeName:function(e){this._validationWarning("name",!!this._getName())},_nameCheckForEnter:function(e){13!==e.keyCode||this.blocking||this._clickCreate()},_getName:function(){return e.escape(this.$(".collection-name").val())},_clickMoreHelp:function(e){e.stopPropagation(),this.$(".main-help").addClass("expanded"),this.$(".more-help").hide()},_clickLessHelp:function(e){e.stopPropagation(),this.$(".main-help").removeClass("expanded"),this.$(".more-help").show()},_toggleHelp:function(e){e.stopPropagation(),this.$(".main-help").toggleClass("expanded"),this.$(".more-help").toggle()},_showAlert:function(e,t){t=t||"alert-danger",this.$(".main-help").hide(),this.$(".header .alert").attr("class","alert alert-dismissable").addClass(t).show().find(".alert-message").html(e)},_hideAlert:function(e){this.$(".main-help").show(),this.$(".header .alert").hide()},_cancelCreate:function(e){"function"==typeof this.oncancel&&this.oncancel.call(this)},_clickCreate:function(e){var t=this._getName();t?this.blocking||this.createList(t):this._validationWarning("name")},_setUpCommonSettings:function(e){this.hideOriginals=e.defaultHideSourceItems||!1},_renderFooter:function(t,i){var n=this,s=this.$(".footer").empty().html(this.templates.footer());return e.each(this.footerSettings,function(e,t){n.$(t).prop("checked",n[e])}),"function"==typeof this.oncancel&&this.$(".cancel-create.btn").show(),s},_creatorTemplates:{main:e.template(['
    ','
    ',''].join(""))}};t.default={CollectionCreatorMixin:i}}).call(t,i(1))},function(e,t,i){"use strict";function n(e,t){var i=/(-?[0-9\.]+)/g,n=e.toString().toLowerCase()||"",s=t.toString().toLowerCase()||"",a=String.fromCharCode(0),o=n.replace(i,a+"$1"+a).split(a),l=s.replace(i,a+"$1"+a).split(a),r=new Date(n).getTime(),d=r?new Date(s).getTime():null;if(d){if(rd)return 1}for(var c,u,h=0,f=Math.max(o.length,l.length);hu)return 1}return 0}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n},function(e,t,i){"use strict";var n=i(0),s=function(e){return e&&e.__esModule?e:{default:e}}(n),a=s.default;s.default.fn.extend({hoverhighlight:function(e,t){return e=e||"body",this.length?(a(this).each(function(){var i=a(this),n=i.data("target");n&&i.mouseover(function(i){a(n,e).css({background:t})}).mouseout(function(e){a(n).css({background:""})})}),this):this}})},function(e,t,i){"use strict";(function(e,n,s){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(3),l=a(o),r=i(4),d=a(r),c=i(87),u=a(c),h=i(6),f=a(h),p=i(11),m=a(p),g=i(90),_=a(g),v=i(45),y=a(v),w=i(8),b=a(w),x=i(34),C=a(x),$=i(61),k=a($),S=e.View.extend({initialize:function(t){var i=this;this.modal=parent.Galaxy.modal||new b.default.View,this.model=t&&t.model||new e.Model(t),this.deferred=new u.default,this.setElement(n("
    ").addClass("ui-form-composite").append(this.$message=n("
    ")).append(this.$header=n("
    ")).append(this.$steps=n("
    "))),n("body").append(this.$el),this._configure(),this.render(),n(window).resize(function(){i._refresh()})},_refresh:function(e){var t=s.reduce(this.$el.children(),function(e,t){return e+n(t).outerHeight()},0)-this.$steps.height()+90;this.$steps.css("height",n(window).height()-t)},_configure:function(){function e(e,n){for(var s,a=/\$\{(.+?)\}/g;s=a.exec(String(e));){var o=s[1];n(t.wp_inputs[o]=t.wp_inputs[o]||{label:o,name:o,type:"text",color:"hsl( "+100*++i+", 70%, 30% )",style:"ui-form-wp-source",links:[]})}}var t=this;this.forms=[],this.steps=[],this.links=[],this.parms=[],s.each(this.model.get("steps"),function(e,i){Galaxy.emit.debug("tool-form-composite::initialize()",i+" : Preparing workflow step.");var n=k.default[e.step_type],a=parseInt(i+1)+": "+(e.step_label||e.step_name);e.annotation&&(a+=" - "+e.annotation),e.step_version&&(a+=" (Galaxy Version "+e.step_version+")"),e=d.default.merge({index:i,fixed_title:s.escape(a),icon:n||"",help:null,citations:null,collapsible:!0,collapsed:i>0&&!t._isDataStep(e),sustain_version:!0,sustain_repeats:!0,sustain_conditionals:!0,narrow:!0,text_enable:"Edit",text_disable:"Undo",cls_enable:"fa fa-edit",cls_disable:"fa fa-undo",errors:e.messages,initial_errors:!0,cls:"ui-portlet-narrow",hide_operations:!0,needs_refresh:!1,always_refresh:"tool"!=e.step_type},e),t.steps[i]=e,t.links[i]=[],t.parms[i]={}}),s.each(this.steps,function(e,i){_.default.visitInputs(e.inputs,function(e,n){t.parms[i][n]=e})}),s.each(this.steps,function(e,i){s.each(e.output_connections,function(e){s.each(t.steps,function(n,s){n.step_index===e.input_step_index&&t.links[i].push(n)})})}),s.each(this.steps,function(e,i){s.each(t.steps,function(n,a){var o={};s.each(e.output_connections,function(e){n.step_index===e.input_step_index&&(o[e.input_name]=e)}),s.each(t.parms[a],function(t,n){var s=o[n];s&&(t.type="hidden",t.help=t.step_linked?t.help+", ":"",t.help+="Output dataset '"+s.output_name+"' from step "+(parseInt(i)+1),t.step_linked=t.step_linked||[],t.step_linked.push(e))})})});var i=0;this.wp_inputs={},s.each(this.steps,function(i,n){s.each(t.parms[n],function(t,n){e(t.value,function(e){e.links.push(i),t.wp_linked=!0,t.type="text",t.backdrop=!0,t.style="ui-form-wp-target"})}),s.each(i.post_job_actions,function(t){s.each(t.action_arguments,function(t){e(t,function(){})})})}),s.each(this.steps,function(e,i){if("tool"==e.step_type){var n=!0;_.default.visitInputs(e.inputs,function(i,s,a){var o=i.value&&"RuntimeValue"==i.value.__class__,l=-1!=["data","data_collection"].indexOf(i.type),r=a[i.data_ref];i.step_linked&&!t._isDataStep(i.step_linked)&&(n=!1),i.options&&(0==i.options.length&&!n||i.wp_linked)&&(i.is_workflow=!0),r&&(i.is_workflow=r.step_linked&&!t._isDataStep(r.step_linked)||i.wp_linked),(l||i.value&&"RuntimeValue"==i.value.__class__&&!i.step_linked)&&(e.collapsed=!1),o&&(i.value=i.default_value),i.flavor="workflow",o||l||"hidden"===i.type||i.wp_linked||(i.optional||!d.default.isEmpty(i.value)&&""!==i.value)&&(i.collapsible_value=i.value,i.collapsible_preview=!0)})}})},render:function(){var e=this;this.deferred.reset(),this._renderHeader(),this._renderMessage(),this._renderParameters(),this._renderHistory(),s.each(this.steps,function(t){e._renderStep(t)})},_renderHeader:function(){var e=this;this.execute_btn=new f.default.Button({icon:"fa-check",title:(0,l.default)("Run workflow"),cls:"btn btn-primary",onclick:function(){e._execute()}}),this.$header.addClass("ui-form-header").empty().append(new f.default.Label({title:"Workflow: "+this.model.get("name")}).$el).append(this.execute_btn.$el)},_renderMessage:function(){this.$message.empty(),this.model.get("has_upgrade_messages")&&this.$message.append(new f.default.Message({message:"Some tools in this workflow may have changed since it was last saved or some errors were found. The workflow may still run, but any new options will have default values. Please review the messages below to make a decision about whether the changes will affect your analysis.",status:"warning",persistent:!0,fade:!1}).$el);var e=this.model.get("step_version_changes");e&&e.length>0&&this.$message.append(new f.default.Message({message:"Some tools are being executed with different versions compared to those available when this workflow was last saved because the other versions are not or no longer available on this Galaxy instance. To upgrade your workflow and dismiss this message simply edit the workflow and re-save it.",status:"warning",persistent:!0,fade:!1}).$el)},_renderParameters:function(){var e=this;this.wp_form=null,s.isEmpty(this.wp_inputs)||(this.wp_form=new m.default({title:"Workflow Parameters",inputs:this.wp_inputs,cls:"ui-portlet-narrow",onchange:function(){s.each(e.wp_form.input_list,function(t,i){s.each(t.links,function(t){e._refreshStep(t)})})}}),this._append(this.$steps.empty(),this.wp_form.$el))},_renderHistory:function(){this.history_form=new m.default({cls:"ui-portlet-narrow",title:"History Options",inputs:[{type:"conditional",name:"new_history",test_param:{name:"check",label:"Send results to a new history",type:"boolean",value:"false",help:""},cases:[{value:"true",inputs:[{name:"name",label:"History name",type:"text",value:this.model.get("name")}]}]}]}),this._append(this.$steps,this.history_form.$el)},_renderStep:function(e){var t=this,i=null;this.deferred.execute(function(a){if(t.$steps.addClass("ui-steps"),"tool"==e.step_type)e.postchange=function(t,i){var s={tool_id:e.id,tool_version:e.version,inputs:n.extend(!0,{},i.data.create())};i.wait(!0),Galaxy.emit.debug("tool-form-composite::postchange()","Sending current state.",s),d.default.request({type:"POST",url:Galaxy.root+"api/tools/"+e.id+"/build",data:s,success:function(e){i.update(e),i.wait(!1),Galaxy.emit.debug("tool-form-composite::postchange()","Received new model.",e),t.resolve()},error:function(e){Galaxy.emit.debug("tool-form-composite::postchange()","Refresh request failed.",e),t.reject()}})},i=new y.default(e),e.post_job_actions&&e.post_job_actions.length&&i.portlet.append(n("
    ").addClass("ui-form-element-disabled").append(n("
    ").addClass("ui-form-title").html("Job Post Actions")).append(n("
    ").addClass("ui-form-preview").html(s.reduce(e.post_job_actions,function(e,t){return e+" "+t.short_str},""))));else{var o=-1!=["data_input","data_collection_input"].indexOf(e.step_type);s.each(e.inputs,function(e){e.flavor="module",e.hide_label=o}),i=new m.default(d.default.merge({title:e.fixed_title,onchange:function(){s.each(t.links[e.index],function(e){t._refreshStep(e)})},inputs:e.inputs&&e.inputs.length>0?e.inputs:[{type:"hidden",name:"No options available.",ignore:null}]},e))}t.forms[e.index]=i,t._append(t.$steps,i.$el),t._refresh(),e.needs_refresh&&t._refreshStep(e),i.portlet[t.show_progress?"disable":"enable"](),t.show_progress&&t.execute_btn.model.set({wait:!0,wait_text:"Preparing...",percentage:100*(e.index+1)/t.steps.length}),Galaxy.emit.debug("tool-form-composite::initialize()",e.index+" : Workflow step state ready.",e),setTimeout(function(){a.resolve()},0)})},_refreshStep:function(e){var t=this,i=this.forms[e.index];i?(s.each(t.parms[e.index],function(e,n){if(e.step_linked||e.wp_linked){var a=i.field_list[i.data.match(n)];if(a){var o=void 0;if(e.step_linked)o={values:[]},s.each(e.step_linked,function(e){if(t._isDataStep(e)){var i=t.forms[e.index].data.create().input;i&&s.each(i.values,function(e){o.values.push(e)})}}),!e.multiple&&o.values.length>0&&(o={values:[o.values[0]]});else if(e.wp_linked){o=e.value;for(var l,r=/\$\{(.+?)\}/g;l=r.exec(e.value);){var d=t.wp_form.field_list[t.wp_form.data.match(l[1])],c=d&&d.value();c&&(o=o.split(l[0]).join(c))}}void 0!==o&&a.value(o)}}}),i.trigger("change")):e.needs_refresh=!0},_refreshHistory:function(){var e=this,t=parent.Galaxy&&parent.Galaxy.currHistoryPanel&&parent.Galaxy.currHistoryPanel.model;this._refresh_history&&clearTimeout(this._refresh_history),t&&t.refresh().success(function(){0===t.numOfUnfinishedShownContents()&&(e._refresh_history=setTimeout(function(){e._refreshHistory()},t.UPDATE_DELAY))})},_execute:function(){var e=this;this.show_progress=!0,this._enabled(!1),this.deferred.execute(function(t){setTimeout(function(){t.resolve(),e._submit()},0)})},_submit:function(){var e=this,t=this.history_form.data.create(),i={new_history_name:t["new_history|name"]?t["new_history|name"]:null,history_id:t["new_history|name"]?null:this.model.get("history_id"),replacement_params:this.wp_form?this.wp_form.data.create():{},parameters:{},parameters_normalized:!0,batch:!0},s=!0;for(var a in this.forms){var o=this.forms[a],r=o.data.create(),c=e.steps[a],u=c.step_index;o.trigger("reset");for(var h in r){var f=r[h],p=o.data.match(h),m=(o.field_list[p],o.input_list[p]);if(!m.step_linked){if(!(s=this._isDataStep(c)?f&&f.values&&f.values.length>0:m.optional||m.is_workflow&&""!==f||!m.is_workflow&&null!==f)){o.highlight(p);break}i.parameters[u]=i.parameters[u]||{},i.parameters[u][h]=r[h]}}if(!s)break}s?(Galaxy.emit.debug("tool-form-composite::submit()","Validation complete.",i),d.default.request({type:"POST",url:Galaxy.root+"api/workflows/"+this.model.id+"/invocations",data:i,success:function(t){if(Galaxy.emit.debug("tool-form-composite::submit","Submission successful.",t),e.$el.children().hide(),e.$el.append(e._templateSuccess(t)),n.isArray(t)&&t.length>0){e.$el.append(n("
    ",{id:"webhook-view"}));new C.default.WebhookView({urlRoot:Galaxy.root+"api/webhooks/workflow",toolId:i.tool_id,toolVersion:i.tool_version})}e._refreshHistory()},error:function(t){Galaxy.emit.debug("tool-form-composite::submit","Submission failed.",t);var n=!1;if(t&&t.err_data)for(var s in e.forms){var a=e.forms[s],o=t.err_data[a.model.get("step_index")];if(o){var r=a.data.matchResponse(o);for(var d in r){a.highlight(d,r[d]),n=!0;break}}}n||e.modal.show({title:(0,l.default)("Workflow submission failed"),body:e._templateError(i,t&&t.err_msg),buttons:{Close:function(){e.modal.hide()}}})},complete:function(){e._enabled(!0)}})):(e._enabled(!0),Galaxy.emit.debug("tool-form-composite::submit()","Validation failed.",i))},_append:function(e,t){e.append("

    ").append(t)},_enabled:function(e){this.execute_btn.model.set({wait:!e,wait_text:"Sending...",percentage:-1}),this.wp_form&&this.wp_form.portlet[e?"enable":"disable"](),this.history_form&&this.history_form.portlet[e?"enable":"disable"](),s.each(this.forms,function(t){t&&t.portlet[e?"enable":"disable"]()})},_isDataStep:function(e){for(var t=n.isArray(e)?e:[e],i=0;i0?n("

    ").addClass("donemessagelarge").append(n("

    ").html("Successfully invoked workflow "+d.default.sanitize(this.model.get("name"))+""+(e.length>1?" "+e.length+" times":"")+".")).append(n("

    ").append("").text("You can check the status of queued jobs and view the resulting data by refreshing the History pane. When the job has been run the status will change from 'running' to 'finished' if completed successfully or 'error' if problems were encountered.")):this._templateError(e,"Invalid success response. No invocations found.")},_templateError:function(e,t){return n("

    ").addClass("errormessagelarge").append(n("

    ").text("The server could not complete the request. Please contact the Galaxy Team if this error persists. "+(JSON.stringify(t)||""))).append(n("

    ").text(JSON.stringify(e,null,4)))}});t.default={View:S}}).call(t,i(2),i(0),i(1))},function(e,t,i){"use strict";(function(e,n,s){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(8),l=a(o),r=i(113),d=a(r),c=i(3),u=a(c),h={defaultName:e.template("Copy of '<%- name %>'"),title:e.template((0,u.default)("Copying history")+' "<%- name %>"'),submitLabel:(0,u.default)("Copy"),errorMessage:(0,u.default)("History could not be copied."),progressive:(0,u.default)("Copying history"),activeLabel:(0,u.default)("Copy only the active, non-deleted datasets"),allLabel:(0,u.default)("Copy all datasets including deleted ones"),anonWarning:(0,u.default)("As an anonymous user, unless you login or register, you will lose your current history ")+(0,u.default)("after copying this history. "),_template:e.template(["<% if( isAnon ){ %>",'
    ',"<%- anonWarning %>",(0,u.default)("You can"),' ',(0,u.default)("login here")," ",(0,u.default)("or")," ",' ',(0,u.default)("register here"),".","
    ","<% } %>","
    ",'
    ",'','","<% if( allowAll ){ %>","
    ","

    ",(0,u.default)("Choose which datasets from the original history to include:"),"

    ",'/>','',"
    ",'/>','',"<% } %>","
    "].join("")),_showAjaxIndicator:function(){var e='

    '+this.progressive+"...

    ";this.modal.$(".modal-body").empty().append(e).css({"margin-top":"8px"})},dialog:function(t,i,a){function o(){var e=t.$("#copy-modal-title").val();if(!e)return void t.$(".invalid-title").show();var n="copy-all"===t.$('input[name="copy-what"]:checked').val();t.$("button").prop("disabled",!0),l._showAjaxIndicator(),i.copy(!0,e,n).done(function(e){r.resolve(e)}).fail(function(t,s,a){var o={name:e,copyAllDatasets:n};d.default.ajaxErrorModal(i,t,o,l.errorMessage),r.rejectWith(r,arguments)}).done(function(){m&&t.hide()})}a=a||{};var l=this,r=n.Deferred(),c=a.nameFn||this.defaultName,h=c({name:i.get("name")}),f=a.allDatasets?"copy-all":"copy-non-deleted",p=!!e.isUndefined(a.allowAll)||a.allowAll,m=!!e.isUndefined(a.autoClose)||a.autoClose;this.modal=t;var g=a.closing_callback;return t.show(e.extend(a,{title:this.title({name:i.get("name")}),body:s(l._template({name:h,isAnon:Galaxy.user.isAnonymous(),allowAll:p,copyWhat:f,activeLabel:this.activeLabel,allLabel:this.allLabel,anonWarning:this.anonWarning})),buttons:e.object([[(0,u.default)("Cancel"),function(){t.hide()}],[this.submitLabel,o]]),height:"auto",closing_events:!0,closing_callback:function(e){e&&r.reject({cancelled:!0}),g&&g(e)}})),t.$("#copy-modal-title").focus().select(),t.$("#copy-modal-title").on("keydown",function(e){13===e.keyCode&&(e.preventDefault(),o())}),r}},f=e.extend({},h,{defaultName:e.template("imported: <%- name %>"),title:e.template((0,u.default)("Importing history")+' "<%- name %>"'),submitLabel:(0,u.default)("Import"),errorMessage:(0,u.default)("History could not be imported."),progressive:(0,u.default)("Importing history"),activeLabel:(0,u.default)("Import only the active, non-deleted datasets"),allLabel:(0,u.default)("Import all datasets including deleted ones"),anonWarning:(0,u.default)("As an anonymous user, unless you login or register, you will lose your current history ")+(0,u.default)("after importing this history. ")}),p=function(e,t){t=t||{};var i=window.parent.Galaxy.modal||new l.default.View({});return t.useImport?f.dialog(i,e,t):h.dialog(i,e,t)};t.default=p}).call(t,i(1),i(0),i(0))},function(e,t,i){"use strict";(function(e,n){function s(t,i,n){return Galaxy.modal.show({title:i,body:t,closing_events:!0,buttons:{Ok:function(){Galaxy.modal.hide()}}}),Galaxy.modal.$el.addClass("error-modal"),n&&(Galaxy.modal.$(".error-details").add(Galaxy.modal.$('button:contains("Details")')).remove(),e("
    ").addClass("error-details").hide().appendTo(Galaxy.modal.$(".modal-content")).append([e("

    ").text(p),e("

    ").text(JSON.stringify(n,null,"  "))]),e('").appendTo(Galaxy.modal.$(".buttons")).click(function(){Galaxy.modal.$(".error-details").toggle()})),Galaxy.modal}function a(e,t,i){if(e){if(e=(0,u.default)(e),t=(0,u.default)(t)||(0,u.default)("Error:"),window.Galaxy&&Galaxy.modal)return s(e,t,i);alert(t+"\n\n"+e),console.log("error details:",JSON.stringify(i))}}function o(){return a((0,u.default)("You appear to be offline. Please check your connection and try again."),(0,u.default)("Offline?"))}function l(){return a((0,u.default)("Galaxy is currently unreachable. Please try again in a few minutes.")+" "+h,(0,u.default)("Cannot connect to Galaxy"))}function r(e,t,i,n,s){return n=n||f,n+=" "+h,s=s||(0,u.default)("An error occurred"),a(n,s,d(e,t,i))}function d(e,t,i){return{raven:n.result(window.Raven,"lastEventId"),userAgent:navigator.userAgent,onLine:navigator.onLine,version:n.result(Galaxy.config,"version_major"),xhr:n.omit(t,n.functions(t)),options:n.omit(i,"xhr"),url:n.result(Galaxy.lastAjax,"url"),data:n.result(Galaxy.lastAjax,"data"),model:n.result(e,"toJSON",""+e),user:n.omit(n.result(Galaxy.user,"toJSON"),"email")}}Object.defineProperty(t,"__esModule",{value:!0});var c=i(3),u=function(e){return e&&e.__esModule?e:{default:e}}(c),h=(0,u.default)("Please contact a Galaxy administrator if the problem persists."),f=(0,u.default)("An error occurred while updating information with the server."),p=(0,u.default)("The following information can assist the developers in finding the source of the error:");t.default={errorModal:a,offlineErrorModal:o,badGatewayErrorModal:l,ajaxErrorModal:r}}).call(t,i(0),i(1))},function(e,t,i){"use strict";(function(e){function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}Object.defineProperty(t,"__esModule",{value:!0});var s=i(1),a=n(s),o=i(2),l=n(o),r=i(5),d=function(e){return e&&e.__esModule?e:{default:e}}(r),c=l.Collection.extend({initialize:function(e,t){l.Collection.prototype.initialize.call(this,e,t),this.setOrder(t.order||this.order,{silent:!0})},_setUpListeners:function(){return this.on({"changed-order":this.sort})},fetch:function(e){return e=this._buildFetchOptions(e),Galaxy.debug("fetch options:",e),l.Collection.prototype.fetch.call(this,e)},_buildFetchOptions:function(e){e=a.clone(e)||{};var t=this;e.traditional=!0,e.data=e.data||t._buildFetchData(e),Galaxy.debug("data:",e.data);var i=this._buildFetchFilters(e);return Galaxy.debug("filters:",i),a.isEmpty(i)||a.extend(e.data,this._fetchFiltersToAjaxData(i)),Galaxy.debug("data:",e.data),e},_buildFetchData:function(e){var t={};return this.order&&(t.order=this.order),a.defaults(a.pick(e,this._fetchParams),t)},_fetchParams:["order","limit","offset","view","keys"],_buildFetchFilters:function(e){return a.clone(e.filters||{})},_fetchFiltersToAjaxData:function(e){var t={q:[],qv:[]};return a.each(e,function(e,i){void 0!==e&&""!==e&&(!0===e&&(e="True"),!1===e&&(e="False"),null===e&&(e="None"),t.q.push(i),t.qv.push(e))}),t},reset:function(e,t){return this.allFetched=!1,l.Collection.prototype.reset.call(this,e,t)},order:null,comparators:{update_time:d.default.buildComparator("update_time",{ascending:!1}),"update_time-asc":d.default.buildComparator("update_time",{ascending:!0}),create_time:d.default.buildComparator("create_time",{ascending:!1}),"create_time-asc":d.default.buildComparator("create_time",{ascending:!0})},setOrder:function(e,t){t=t||{};var i=this,n=i.comparators[e];if(a.isUndefined(n))throw new Error("unknown order: "+e);if(n!==i.comparator)return i.order=e,i.comparator=n,t.silent||i.trigger("changed-order",t),i}}),u=c.extend({limitPerPage:500,initialize:function(e,t){c.prototype.initialize.call(this,e,t),this.currentPage=t.currentPage||0},getTotalItemCount:function(){return this.length},shouldPaginate:function(){return this.getTotalItemCount()>=this.limitPerPage},getLastPage:function(){return Math.floor(this.getTotalItemCount()/this.limitPerPage)},getPageCount:function(){return this.getLastPage()+1},getPageLimitOffset:function(e){return e=this.constrainPageNum(e),{limit:this.limitPerPage,offset:e*this.limitPerPage}},constrainPageNum:function(e){return Math.max(0,Math.min(e,this.getLastPage()))},fetchPage:function(e,t){var i=this;return e=i.constrainPageNum(e),i.currentPage=e,t=a.defaults(t||{},i.getPageLimitOffset(e)),i.trigger("fetching-more"),i.fetch(t).always(function(){i.trigger("fetching-more-done")})},fetchCurrentPage:function(e){return this.fetchPage(this.currentPage,e)},fetchPrevPage:function(e){return this.fetchPage(this.currentPage-1,e)},fetchNextPage:function(e){return this.fetchPage(this.currentPage+1,e)}}),h=c.extend({limitOnFirstFetch:null,limitPerFetch:100,initialize:function(e,t){c.prototype.initialize.call(this,e,t),this.limitOnFirstFetch=t.limitOnFirstFetch||this.limitOnFirstFetch,this.limitPerFetch=t.limitPerFetch||this.limitPerFetch,this.allFetched=!1,this.lastFetched=t.lastFetched||0},_buildFetchOptions:function(e){return e.remove=e.remove||!1,c.prototype._buildFetchOptions.call(this,e)},fetchFirst:function(e){return Galaxy.debug("ControlledFetchCollection.fetchFirst:",e),e=e?a.clone(e):{},this.allFetched=!1,this.lastFetched=0,this.fetchMore(a.defaults(e,{reset:!0,limit:this.limitOnFirstFetch}))},fetchMore:function(t){Galaxy.debug("ControlledFetchCollection.fetchMore:",t),t=a.clone(t||{});var i=this;if(Galaxy.debug("fetchMore, options.reset:",t.reset),!t.reset&&i.allFetched)return e.when();t.reset?t.offset=0:void 0===t.offset&&(t.offset=i.lastFetched);var n=t.limit=t.limit||i.limitPerFetch||null;return Galaxy.debug("fetchMore, limit:",n,"offset:",t.offset),i.trigger("fetching-more"),i.fetch(t).always(function(){i.trigger("fetching-more-done")}).done(function(e){var t=a.isArray(e)?e.length:0;i.lastFetched+=t,Galaxy.debug("fetchMore, lastFetched:",i.lastFetched),(!n||t1?this.renderItems():1===i.added.length?this.addItemView(n.first(i.added),e,t):1===i.removed.length?this.removeItemView(n.first(i.removed),e,t):void 0}}),this},_setUpViewListeners:function(){this.log(this+"._setUpViewListeners"),this.on({"view:selected":function(e,t){if(t&&t.shiftKey&&this.lastSelected){var i=this.viewFromModelId(this.lastSelected);i&&this.selectRange(e,i)}else t&&t.altKey&&!this.selecting&&this.showSelectors();this.selected.push(e.model.id),this.lastSelected=e.model.id},"view:de-selected":function(e,t){this.selected=n.without(this.selected,e.model.id)}})},render:function(e){this.log(this+".render",e);var t=this._buildNewRender();return this._setUpBehaviors(t),this._queueNewRender(t,e),this},_buildNewRender:function(){this.debug(this+"(ListPanel)._buildNewRender");var e=s(this.templates.el({},this));return this._renderControls(e),this._renderTitle(e),this._renderSubtitle(e),this._renderSearch(e),this.renderItems(e),e},_renderControls:function(e){this.debug(this+"(ListPanel)._renderControls");var t=s(this.templates.controls({},this));return e.find(".controls").replaceWith(t),t},_renderTitle:function(e){},_renderSubtitle:function(e){},_queueNewRender:function(e,t){t=void 0===t?this.fxSpeed:t;var i=this;i.log("_queueNewRender:",e,t),s(i).queue("fx",[function(e){i.$el.fadeOut(t,e)},function(t){i._swapNewRender(e),t()},function(e){i.$el.fadeIn(t,e)},function(e){i.trigger("rendered",i),e()}])},_swapNewRender:function(e){return this.$el.empty().attr("class",this.className).append(e.children()),this.selecting&&this.showSelectors(0),this},_setUpBehaviors:function(e){return e=e||this.$el,this.$controls(e).find("[title]").tooltip(),this._renderMultiselectActionMenu(e),this},_renderMultiselectActionMenu:function(e){e=e||this.$el;var t=e.find(".list-action-menu"),i=this.multiselectActions();if(!i.length)return t.empty();var n=s(['
    ','",'","
    "].join("")),a=i.map(function(e){var t=['
  • ',e.html,"
  • "].join("");return s(t).click(function(t){return t.preventDefault(),e.func(t)})});return n.find("ul").append(a),t.replaceWith(n),n},multiselectActions:function(){return[]},$scrollContainer:function(e){return(e||this.$el).parent().parent()},$controls:function(e){return(e||this.$el).find("> .controls")},$list:function(e){return(e||this.$el).find("> .list-items")},$messages:function(e){return(e||this.$el).find("> .controls .messages")},$emptyMessage:function(e){return(e||this.$el).find("> .empty-message")},renderItems:function(e){e=e||this.$el;var t=this;t.log(this+".renderItems",e);var i=t.$list(e);t.freeViews();var n=t._filterCollection();return t.views=n.map(function(e){return t._createItemView(e)}),i.empty(),t.views.length&&t._attachItems(e),t._renderEmptyMessage(e).toggle(!t.views.length),t.trigger("views:ready",t.views),t.views},_filterCollection:function(){var e=this;return e.collection.filter(n.bind(e._filterItem,e))},_filterItem:function(e){var t=this;return n.every(t.filters.map(function(t){return t.call(e)}))&&(!t.searchFor||e.matchesAll(t.searchFor))},_createItemView:function(e){var t=this._getItemViewClass(e),i=n.extend(this._getItemViewOptions(e),{model:e}),s=new t(i);return this._setUpItemViewListeners(s),s},_destroyItemView:function(e){this.stopListening(e),this.views=n.without(this.views,e)},_destroyItemViews:function(e){var t=this;return t.views.forEach(function(e){t.stopListening(e)}),t.views=[],t},freeViews:function(){return this._destroyItemViews()},_getItemViewClass:function(e){return this.viewClass},_getItemViewOptions:function(e){return{fxSpeed:this.fxSpeed,expanded:!1,selectable:this.selecting,selected:n.contains(this.selected,e.id),draggable:this.dragItems}},_setUpItemViewListeners:function(e){var t=this;return this.listenTo(e,"all",function(){var e=Array.prototype.slice.call(arguments,0);e[0]="view:"+e[0],t.trigger.apply(t,e)}),this.listenTo(e,"draggable:dragstart",function(e,t){var i={},n=this.getSelectedModels();i=n.length?n.toJSON():[t.model.toJSON()],e.dataTransfer.setData("text",JSON.stringify(i))},this),t},_attachItems:function(e){var t=this;return this.$list(e).append(this.views.map(function(e){return t._renderItemView$el(e)})),this},_renderItemView$el:function(e){return e.render(0).$el},_renderEmptyMessage:function(e){this.debug("_renderEmptyMessage",e,this.searchFor);var t=this.searchFor?this.noneFoundMsg:this.emptyMsg;return this.$emptyMessage(e).text(t)},expandAll:function(){n.each(this.views,function(e){e.expand()})},collapseAll:function(){n.each(this.views,function(e){e.collapse()})},addItemView:function(e,t,i){var n=this,a=n._filterCollection().indexOf(e);if(-1!==a){var o=n._createItemView(e);return s(o).queue("fx",[function(e){n.$emptyMessage().is(":visible")?n.$emptyMessage().fadeOut(n.fxSpeed,e):e()},function(e){n._attachView(o,a),e()}]),o}},_attachView:function(e,t,i){i=!!n.isUndefined(i)||i,t=t||0;var s=this;return s.views.splice(t,0,e),s._insertIntoListAt(t,s._renderItemView$el(e).hide()),s.trigger("view:attached",e),i?e.$el.slideDown(s.fxSpeed,function(){s.trigger("view:attached:rendered")}):(e.$el.show(),s.trigger("view:attached:rendered")),e},_insertIntoListAt:function(e,t){var i=this.$list();return 0===e?i.prepend(t):i.children().eq(e-1).after(t),t},removeItemView:function(e,t,i){var a=this,o=n.find(a.views,function(t){return t.model===e});if(o)return a.views=n.without(a.views,o),a.trigger("view:removed",o),s({}).queue("fx",[function(e){o.$el.fadeOut(a.fxSpeed,e)},function(e){o.remove(),a.trigger("view:removed:rendered"),a.views.length?e():a._renderEmptyMessage().fadeIn(a.fxSpeed,e)}]),o},viewFromModelId:function(e){return n.find(this.views,function(t){return t.model.id===e})},viewFromModel:function(e){return e?this.viewFromModelId(e.id):void 0},viewsWhereModel:function(e){return this.views.filter(function(t){return n.isMatch(t.model.attributes,e)})},viewRange:function(e,t){if(e===t)return e?[e]:[];var i=this.views.indexOf(e),n=this.views.indexOf(t);return-1===i||-1===n?i===n?[]:-1===i?[t]:[e]:i .controls .search-query");return i.val()!==e&&i.val(e),this},clearSearch:function(e){return this.searchFor="",this.trigger("search:clear",this),this.$("> .controls .search-query").val(""),this.renderItems(),this},THROTTLE_SELECTOR_FX_AT:20,showSelectors:function(e){e=void 0!==e?e:this.fxSpeed,this.selecting=!0,this.$(".list-actions").slideDown(e),e=this.views.length>=this.THROTTLE_SELECTOR_FX_AT?0:e,n.each(this.views,function(t){t.showSelector(e)})},hideSelectors:function(e){e=void 0!==e?e:this.fxSpeed,this.selecting=!1,this.$(".list-actions").slideUp(e),e=this.views.length>=this.THROTTLE_SELECTOR_FX_AT?0:e,n.each(this.views,function(t){t.hideSelector(e)}),this.selected=[],this.lastSelected=null},toggleSelectors:function(){this.selecting?this.hideSelectors():this.showSelectors()},selectAll:function(e){n.each(this.views,function(t){t.select(e)})},deselectAll:function(e){this.lastSelected=null,n.each(this.views,function(t){t.deselect(e)})},selectRange:function(e,t){var i=this.viewRange(e,t);return n.each(i,function(e){e.select()}),i},getSelectedViews:function(){return n.filter(this.views,function(e){return e.selected})},getSelectedModels:function(){return new this.collection.constructor(n.map(this.getSelectedViews(),function(e){return e.model}))},_showLoadingIndicator:function(e,t,i){this.debug("_showLoadingIndicator",this.indicator,e,t,i),t=void 0!==t?t:this.fxSpeed,this.indicator||(this.indicator=new d.default(this.$el),this.debug("\t created",this.indicator)),this.$el.is(":visible")?(this.$el.fadeOut(t),this.indicator.show(e,t,i)):this.indicator.show(0,i)},_hideLoadingIndicator:function(e,t){this.debug("_hideLoadingIndicator",this.indicator,e,t),e=void 0!==e?e:this.fxSpeed,this.indicator&&this.indicator.hide(e,t)},scrollPosition:function(){return this.$scrollContainer().scrollTop()},scrollTo:function(e,t){return t=t||0,this.$scrollContainer().animate({scrollTop:e},t),this},scrollToTop:function(e){return this.scrollTo(0,e)},scrollToItem:function(e,t){return this},scrollToId:function(e,t){return this.scrollToItem(this.viewFromModelId(e),t)},events:{"click .select-all":"selectAll","click .deselect-all":"deselectAll"},toString:function(){return"ListPanel("+this.collection+")"}});p.prototype.templates=function(){return{el:u.default.wrapTemplate(["
    ",'
    ','
    ','
    ',"
    "]),controls:u.default.wrapTemplate(['
    ','
    ','
    <%- view.title %>
    ',"
    ",'
    <%- view.subtitle %>
    ','
    ','
    ','",'
    ','
    ','",'","
    ",'
    ',"
    ","
    ","
    "])}}();var m=p.extend({modelCollectionKey:"contents",initialize:function(e){p.prototype.initialize.call(this,e),this.selecting=void 0!==e.selecting&&e.selecting,this.setModel(this.model,e)},setModel:function(e,t){if(t=t||{},this.debug(this+".setModel:",e,t),this.freeModel(),this.freeViews(),e){var i=this.model?this.model.get("id"):null;this.model=e,this.logger&&(this.model.logger=this.logger),this._setUpModelListeners(),this.stopListening(this.collection),this.collection=this.model[this.modelCollectionKey]||t.collection||this._createDefaultCollection(),this._setUpCollectionListeners(),i&&e.get("id")!==i&&this.trigger("new-model",this)}return this},freeModel:function(){return this.model&&this.stopListening(this.model),this},_setUpModelListeners:function(){return this.log(this+"._setUpModelListeners",this.model),this.listenTo(this.model,"error",function(){var e=Array.prototype.slice.call(arguments,0);e.unshift("error"),this.trigger.apply(this,e)},this),this.logger&&this.listenTo(this.model,"all",function(e){this.info(this+"(model)",e,arguments)}),this},_renderControls:function(e){this.debug(this+"(ModelListPanel)._renderControls");var t=this.model?this.model.toJSON():{},i=s(this.templates.controls(t,this));return e.find(".controls").replaceWith(i),i},toString:function(){return"ModelListPanel("+this.model+")"}});m.prototype.templates=function(){var e=u.default.wrapTemplate(['
    ','
    ','
    <%- model.name %>
    ',"
    ",'
    <%- view.subtitle %>
    ','
    ','
    ','",'
    ','
    ','",'","
    ",'
    ',"
    ","
    ","
    "]);return n.extend(n.clone(p.prototype.templates),{controls:e})}(),t.default={ListPanel:p,ModelListPanel:m}}).call(t,i(2),i(1),i(0))},function(e,t,i){"use strict";function n(e,t){function i(e){o(this).parent().children("input").val("").trigger("searchInput.clear").blur(),t.onclear()}function n(e,n){if(!n)return i();o(this).trigger("search.search",n),"function"==typeof t.onfirstsearch&&u?(u=!1,t.onfirstsearch(n)):t.onsearch(n)}function s(){return['"].join("")}var r=27,d=13,c=o(e),u=!0,h={initialVal:"",name:"search",placeholder:"search",classes:"",onclear:function(){},onfirstsearch:null,onsearch:function(e){},minSearchLen:0,escWillClear:!0,oninit:function(){}};return"string"===a.default.type(t)?("toggle-loading"===t&&function(){c.find(".search-loading").toggle(),c.find(".search-clear").toggle()}(),c):("object"===a.default.type(t)&&(t=a.default.extend(!0,{},h,t)),c.addClass("search-input").prepend([function(){return o(s()).focus(function(e){o(this).select()}).keyup(function(e){if(e.preventDefault(),e.stopPropagation(),e.which===r&&t.escWillClear)i.call(this,e);else{var s=o(this).val();(e.which===d||t.minSearchLen&&s.length>=t.minSearchLen)&&n.call(this,e,s)}}).val(t.initialVal)}(),function(){return o([''].join("")).tooltip({placement:"bottom"}).click(function(e){i.call(this,e)})}(),function(){return o([''].join("")).hide().tooltip({placement:"bottom"})}()]))}var s=i(0),a=function(e){return e&&e.__esModule?e:{default:e}}(s),o=a.default,l=window._l||function(e){return e};a.default.fn.extend({searchInput:function(e){return this.each(function(){return n(this,e)})}})},function(e,t,i){"use strict";(function(e){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var s=i(66),a=n(s),o=i(5),l=n(o),r=i(120),d=n(r),c=i(3),u=n(c),h=a.default.DatasetListItemView,f=h.extend({className:h.prototype.className+" history-content",initialize:function(e,t){h.prototype.initialize.call(this,e,t)},toString:function(){return"HDAListItemView("+(this.model?""+this.model:"(no model)")+")"}});f.prototype.templates=function(){var t=function(t){return'\n
    \n \n
    \n '+t.hid+'\n '+e.escape(t.name)+"\n
    \n
    \n "+d.default.nametagTemplate(t)+"\n
    \n "},i=e.extend({},h.prototype.templates.warnings,{hidden:l.default.wrapTemplate(["<% if( !dataset.visible ){ %>",'
    ',(0,u.default)("This dataset has been hidden"),"
    ","<% } %>"],"dataset")});return e.extend({},h.prototype.templates,{titleBar:t,warnings:i})}(),t.default={HDAListItemView:f}}).call(t,i(1))},function(e,t,i){"use strict";(function(e){function i(t){return 0==t.indexOf("name:")?''+e.escape(t.slice(5))+"":""}function n(t){return''+e.sortBy(e.uniq(t.tags)).map(i).join("")+""}Object.defineProperty(t,"__esModule",{value:!0}),t.default={nametagTemplate:n}}).call(t,i(1))},function(e,t,i){"use strict";(function(e){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var s=i(16),a=n(s),o=i(67),l=n(o),r=i(122),d=n(r),c=i(5),u=(n(c),i(120)),h=n(u),f=i(3),p=n(f),m=l.default.DCListItemView,g=m.extend({className:m.prototype.className+" history-content",_setUpListeners:function(){var e=this;m.prototype._setUpListeners.call(this);var t=function(t,i){e.render()};this.model.jobStatesSummary&&this.listenTo(this.model.jobStatesSummary,"change",t),this.listenTo(this.model,{"change:tags change:visible change:state":t})},_getFoldoutPanelClass:function(){return d.default.CollectionView},_swapNewRender:function(e){m.prototype._swapNewRender.call(this,e);var t,i=this.model.jobStatesSummary;t=i?i.new()?"loading":i.errored()?"error":i.terminal()?"ok":i.running()?"running":"queued":this.model.get("job_source_id")?"loading":this.model.get("populated_state")?a.default.OK:a.default.RUNNING,this.$el.addClass("state-"+t);var n=this.stateDescription();return this.$(".state-description").html(n),this.$el},stateDescription:function(){var e=this.model,t=(e.get("element_count"),e.get("job_source_type")),i=(this.model.get("collection_type"),d.default.collectionTypeDescription(e)),n=d.default.collectionDescription(e),s=e.jobStatesSummary;if(t&&"Job"!=t){if(s&&s.hasDetails()){var a=s.new(),o=a?null:s.jobCount();if(a)return'\n
    \n Creating jobs...\n
    \n
    ';if(s.errored()){return"a "+i+" with "+s.numInError()+" / "+o+" jobs in error"}if(s.terminal())return n;var l=s.states().running||0,r=s.states().ok||0,c=r/(1*o),u=l/(1*o),h=1-c-u;return'\n
    \n '+(o&&o>1?o+" jobs":"a job")+" generating a "+i+'\n
    \n
    \n
    \n
    '}return'\n
    \n Loading job data for '+i+'...\n
    \n
    '}return n},toString:function(){return"HDCAListItemView("+(this.model?""+this.model:"(no model)")+")"}});g.prototype.templates=function(){var t=e.extend({},m.prototype.templates.warnings,{hidden:function(e){e.visible||(0,p.default)("This collection has been hidden")}}),i=function(t){return'\n
    \n \n
    \n '+t.hid+'\n '+e.escape(t.name)+'\n
    \n
    \n
    \n '+h.default.nametagTemplate(t)+"\n
    \n "};return e.extend({},m.prototype.templates,{warnings:t,titleBar:i})}(),t.default={HDCAListItemView:g}}).call(t,i(1))},function(e,t,i){"use strict";(function(e){function n(e){return e&&e.__esModule?e:{default:e}}function s(e){var t=e.get("collection_type");return"list"==t?(0,f.default)("list"):"paired"==t?(0,f.default)("dataset pair"):"list:paired"==t?(0,f.default)("list of pairs"):(0,f.default)("nested list")}function a(e){var t=e.get("element_count"),i="a "+s(e);if(t){var n;1==t?n="with 1 item":t&&(n="with "+t+" items"),i=i+" "+(0,f.default)(n)}return i}Object.defineProperty(t,"__esModule",{value:!0});var o=i(117),l=n(o),r=i(60),d=(n(r),i(67)),c=n(d),u=i(5),h=(n(u),i(3)),f=n(h),p=l.default.ModelListPanel,m=p.extend({_logNamespace:"collections",className:p.prototype.className+" dataset-collection-panel",DatasetDCEViewClass:c.default.DatasetDCEListItemView,modelCollectionKey:"elements",initialize:function(e){p.prototype.initialize.call(this,e),this.linkTarget=e.linkTarget||"_blank",this.hasUser=e.hasUser,this.panelStack=[],this.parentName=e.parentName,this.foldoutStyle=e.foldoutStyle||"foldout",this.downloadUrl=Galaxy.root+"api/dataset_collections/"+this.model.attributes.id+"/download"},getNestedDCDCEViewClass:function(){return c.default.NestedDCDCEListItemView.extend({foldoutPanelClass:m})},_queueNewRender:function(e,t){t=void 0===t?this.fxSpeed:t;var i=this;this.handleWarning(e),i.log("_queueNewRender:",e,t),i._swapNewRender(e),i.trigger("rendered",i)},handleWarning:function(e){var t=this.views.length,i=this.model.get("element_count");if(i&&i!==t){var n=(0,f.default)("displaying only "+t+" of "+i+" items");e.find(".elements-warning").html('
    '+n+"
    ")}},_filterCollection:function(){return this.model.getVisibleContents()},_getItemViewClass:function(e){switch(e.get("element_type")){case"hda":return this.DatasetDCEViewClass;case"dataset_collection":return this.getNestedDCDCEViewClass()}throw new TypeError("Unknown element type:",e.get("element_type"))},_getItemViewOptions:function(t){var i=p.prototype._getItemViewOptions.call(this,t);return e.extend(i,{linkTarget:this.linkTarget,hasUser:this.hasUser,foldoutStyle:this.foldoutStyle})},_setUpItemViewListeners:function(e){var t=this;return p.prototype._setUpItemViewListeners.call(t,e),t.listenTo(e,{"expanded:drilldown":function(e,t){this._expandDrilldownPanel(t)},"collapsed:drilldown":function(e,t){this._collapseDrilldownPanel(t)}}),this},_expandDrilldownPanel:function(e){this.panelStack.push(e),this.$("> .controls").add(this.$list()).hide(),e.parentName=this.model.get("name"),this.$el.append(e.render().$el)},_collapseDrilldownPanel:function(e){this.panelStack.pop(),this.render()},events:{"click .navigation .back":"close"},close:function(e){this.remove(),this.trigger("close")},toString:function(){return"CollectionView("+(this.model?this.model.get("name"):"")+")"}});m.prototype.templates=function(){var t=function(t,i){var n=a(i.model);return'\n
    \n \n
    \n
    '+(e.escape(t.name)||e.escape(t.element_identifier))+'
    \n
    \n '+n+'\n
    \n
    \n
    \n
    \n
    \n
    \n \n \n \n
    \n
    '};return e.extend(e.clone(p.prototype.templates),{controls:t})}(),t.default={collectionTypeDescription:s,collectionDescription:a,CollectionView:m}}).call(t,i(1))},function(e,t,i){"use strict";(function(e,n){function s(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=i(16),o=s(a),l=i(66),r=s(l),d=i(39),c=s(d),u=i(124),h=s(u),f=i(21),p=s(f),m=i(5),g=s(m),_=i(3),v=s(_),y=r.default.DatasetListItemView,w=y.extend({initialize:function(e){y.prototype.initialize.call(this,e),this.hasUser=e.hasUser,this.purgeAllowed=e.purgeAllowed||!1,this.tagsEditorShown=e.tagsEditorShown||!1,this.annotationEditorShown=e.annotationEditorShown||!1},_renderPrimaryActions:function(){var e=y.prototype._renderPrimaryActions.call(this);return this.model.get("state")===o.default.NOT_VIEWABLE?e:y.prototype._renderPrimaryActions.call(this).concat([this._renderEditButton(),this._renderDeleteButton()])},_renderEditButton:function(){var t=this;if(this.model.get("state")===o.default.DISCARDED||!this.model.get("accessible"))return null;var i=this.model.get("purged"),n=this.model.get("deleted"),s={title:(0,v.default)("Edit attributes"),href:Galaxy.root+"datasets/edit?dataset_id="+this.model.attributes.id,faIcon:"fa-pencil",classes:"edit-btn",onclick:function(e){Galaxy.router&&(e.preventDefault(),Galaxy.router.push("datasets/edit",{dataset_id:t.model.attributes.id}))}};return n||i?(s.disabled=!0,i?s.title=(0,v.default)("Cannot edit attributes of datasets removed from disk"):n&&(s.title=(0,v.default)("Undelete dataset to edit attributes"))):e.contains([o.default.UPLOAD,o.default.NEW],this.model.get("state"))&&(s.disabled=!0,s.title=(0,v.default)("This dataset is not yet editable")),(0,p.default)(s)},_renderDeleteButton:function(){if(!this.model.get("accessible"))return null;var e=this,t=this.model.isDeletedOrPurged();return(0,p.default)({title:t?(0,v.default)("Dataset is already deleted"):(0,v.default)("Delete"),disabled:t,faIcon:"fa-times",classes:"delete-btn",onclick:function(){e.$el.find(".icon-btn.delete-btn").trigger("mouseout"),e.model.delete()}})},_renderDetails:function(){var t=y.prototype._renderDetails.call(this),i=this.model.get("state");return!this.model.isDeletedOrPurged()&&e.contains([o.default.OK,o.default.FAILED_METADATA],i)&&(this._renderTags(t),this._renderAnnotation(t),this._makeDbkeyEditLink(t)),this._setUpBehaviors(t),t},_renderToolHelpButton:function(){var e=this.model.attributes.dataset_id,t=this.model.attributes.creating_job,i=this,s=function(t){var s='
    ';t.name&&t.help?(s+="Tool help for "+t.name+"
    ",s+=t.help):s+="Tool help is unavailable for this dataset.
    ",s+="
    ",i.$el.find(".details").append(n.parseHTML(s))},a=function(e){n.ajax({url:Galaxy.root+"api/tools/"+e.tool_id+"/build"}).done(function(e){s(e)}).fail(function(){s({})})};return null===Galaxy.user.id?null:(0,p.default)({title:(0,v.default)("Tool Help"),classes:"icon-btn",href:"#",faIcon:"fa-question",onclick:function(){i.$el.find(".toolhelp").length>0?i.$el.find(".toolhelp").toggle():n.ajax({url:Galaxy.root+"api/jobs/"+t}).done(function(e){a(e)}).fail(function(){console.log('Failed at recovering job information from the Galaxy API for job id "'+t+'".')})}})},_renderSecondaryActions:function(){var e=y.prototype._renderSecondaryActions.call(this);switch(this.model.get("state")){case o.default.UPLOAD:case o.default.NOT_VIEWABLE:return e;case o.default.ERROR:return e.unshift(this._renderErrButton()),e.concat([this._renderRerunButton(),this._renderToolHelpButton()]);case o.default.OK:case o.default.FAILED_METADATA:return e.concat([this._renderRerunButton(),this._renderVisualizationsButton(),this._renderToolHelpButton()])}return e.concat([this._renderRerunButton(),this._renderToolHelpButton()])},_renderErrButton:function(){var e=this;return(0,p.default)({title:(0,v.default)("View or report this error"),href:Galaxy.root+"datasets/error?dataset_id="+this.model.attributes.id,classes:"report-error-btn",faIcon:"fa-bug",onclick:function(t){Galaxy.router&&(t.preventDefault(),Galaxy.router.push("datasets/error",{dataset_id:e.model.attributes.id}))}})},_renderRerunButton:function(){var e=this.model.get("creating_job");if(this.model.get("rerunnable"))return(0,p.default)({title:(0,v.default)("Run this job again"),href:this.model.urls.rerun,classes:"rerun-btn",target:this.linkTarget,faIcon:"fa-refresh",onclick:function(t){Galaxy.router&&(t.preventDefault(),Galaxy.router.push("/",{job_id:e}))}})},_renderVisualizationsButton:function(){var t=this.model.get("visualizations");if(this.model.isDeletedOrPurged()||!this.hasUser||!this.model.hasData()||e.isEmpty(t))return null;if(!e.isObject(t[0]))return this.warn("Visualizations have been switched off"),null;var i=n(this.templates.visualizations(t,this));return i.find('[target="galaxy_main"]').attr("target",this.linkTarget),this._addScratchBookFn(i.find(".visualization-link").addBack(".visualization-link")),i},_addScratchBookFn:function(e){e.click(function(e){Galaxy.frame&&Galaxy.frame.active&&(Galaxy.frame.add({title:(0,v.default)("Visualization"),url:n(this).attr("href")}),e.preventDefault(),e.stopPropagation())})},_renderTags:function(e){if(this.hasUser){var t=this;this.tagsEditor=new c.default.TagsEditor({model:this.model,el:e.find(".tags-display"),onshowFirstTime:function(){this.render()},onshow:function(){t.tagsEditorShown=!0},onhide:function(){t.tagsEditorShown=!1},$activator:(0,p.default)({title:(0,v.default)("Edit dataset tags"),classes:"tag-btn",faIcon:"fa-tags"}).appendTo(e.find(".actions .right"))}),this.tagsEditorShown&&this.tagsEditor.toggle(!0)}},_renderAnnotation:function(e){if(this.hasUser){var t=this;this.annotationEditor=new h.default.AnnotationEditor({model:this.model,el:e.find(".annotation-display"),onshowFirstTime:function(){this.render()},onshow:function(){t.annotationEditorShown=!0},onhide:function(){t.annotationEditorShown=!1},$activator:(0,p.default)({title:(0,v.default)("Edit dataset annotation"),classes:"annotate-btn",faIcon:"fa-comment"}).appendTo(e.find(".actions .right"))}),this.annotationEditorShown&&this.annotationEditor.toggle(!0)}},_makeDbkeyEditLink:function(e){if("?"===this.model.get("metadata_dbkey")&&!this.model.isDeletedOrPurged()){var t=n('?').attr("href",this.model.urls.edit).attr("target","_top");e.find(".dbkey .value").replaceWith(t)}},events:e.extend(e.clone(y.prototype.events),{"click .undelete-link":"_clickUndeleteLink","click .purge-link":"_clickPurgeLink","click .edit-btn":function(e){this.trigger("edit",this,e)},"click .delete-btn":function(e){this.trigger("delete",this,e)},"click .rerun-btn":function(e){this.trigger("rerun",this,e)},"click .report-err-btn":function(e){this.trigger("report-err",this,e)},"click .visualization-btn":function(e){this.trigger("visualize",this,e)},"click .dbkey a":function(e){this.trigger("edit",this,e)}}),_clickUndeleteLink:function(e){return this.model.undelete(),!1},_clickPurgeLink:function(e){return confirm((0,v.default)("This will permanently remove the data in your dataset. Are you sure?"))&&this.model.purge(),!1},toString:function(){return"HDAEditView("+(this.model?""+this.model:"(no model)")+")"}});w.prototype.templates=function(){var t=e.extend({},y.prototype.templates.warnings,{failed_metadata:g.default.wrapTemplate(['<% if( dataset.state === "failed_metadata" ){ %>','","<% } %>"],"dataset"),deleted:g.default.wrapTemplate(["<% if( dataset.deleted && !dataset.purged ){ %>",'
    ',(0,v.default)("This dataset has been deleted"),'
    ',(0,v.default)("Undelete it"),"","<% if( view.purgeAllowed ){ %>",'
    ',(0,v.default)("Permanently remove it from disk"),"","<% } %>","
    ","<% } %>"],"dataset")}),i=g.default.wrapTemplate(["<% if( visualizations.length === 1 ){ %>",'">','',"","<% } else { %>",'","<% } %>"],"visualizations");return e.extend({},y.prototype.templates,{warnings:t,visualizations:i})}(),t.default={DatasetListItemEdit:w}}).call(t,i(1),i(0))},function(e,t,i){"use strict";(function(e,n){function s(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=i(5),o=s(a),l=i(3),r=s(l);i(20);var d=e.View.extend(o.default.LoggableMixin).extend(o.default.HiddenUntilActivatedViewMixin).extend({tagName:"div",className:"annotation-display",initialize:function(e){e=e||{},this.tooltipConfig=e.tooltipConfig||{placement:"bottom"},this.listenTo(this.model,"change:annotation",function(){this.render()}),this.hiddenUntilActivated(e.$activator,e)},render:function(){var e=this;return this.$el.html(this._template()),this.$annotation().make_text_editable({use_textarea:!0,on_finish:function(t){e.$annotation().text(t),e.model.save({annotation:t},{silent:!0}).fail(function(){e.$annotation().text(e.model.previous("annotation"))})}}),this},_template:function(){var e=this.model.get("annotation");return['",'
    ',n.escape(e),"
    "].join("")},$annotation:function(){return this.$el.find(".annotation")},remove:function(){this.$annotation.off(),this.stopListening(this.model),e.View.prototype.remove.call(this)},toString:function(){return["AnnotationEditor(",""+this.model,")"].join("")}});t.default={AnnotationEditor:d}}).call(t,i(2),i(1))},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,i){"use strict";(function(e){function t(e){return e&&e.__esModule?e:{default:e}}var n=i(0),s=t(n),a=i(23),o=t(a),l=i(53),r=t(l),d=i(240),c=t(d),u=i(250),h=t(u),f=i(26),p=t(f),m=i(86),g=t(m),_=i(68),v=t(_),y=i(264),w=t(y),b=i(265),x=t(b),C=i(80),$=t(C),k=i(19),S=t(k),T=i(266),P=t(T),E=i(267),D=t(E),A=i(269),M=t(A),I=i(274),L=t(I),O=i(111),N=t(O),j=i(14),G=t(j),V=i(4),H=t(V),z=i(6),U=t(z),F=i(275),R=t(F),B=i(276),W=t(B),J=i(91),q=t(J),Y=i(31),Q=t(Y),K=s.default;window.app=function(t,i){window.Galaxy=new o.default.GalaxyApp(t,i),Galaxy.debug("analysis app");var n=r.default.extend({routes:{"(/)":"home","(/)root*":"home","(/)tours(/)(:tour_id)":"show_tours","(/)user(/)":"show_user","(/)user(/)(:form_id)":"show_user_form","(/)pages(/)create(/)":"show_pages_create","(/)pages(/)edit(/)":"show_pages_edit","(/)pages(/)(:action_id)":"show_pages","(/)visualizations(/)edit(/)":"show_visualizations_edit","(/)visualizations/(:action_id)":"show_visualizations","(/)workflows/import_workflow":"show_import_workflow","(/)workflows/run(/)":"show_run","(/)workflows(/)list":"show_workflows","(/)workflows/list_published(/)":"show_workflows_published","(/)workflows/create(/)":"show_workflows_create","(/)histories(/)citations(/)":"show_history_citations","(/)histories(/)rename(/)":"show_histories_rename","(/)histories(/)import(/)":"show_histories_import","(/)histories(/)permissions(/)":"show_histories_permissions","(/)histories(/)(:action_id)":"show_histories","(/)datasets(/)list(/)":"show_datasets","(/)custom_builds":"show_custom_builds","(/)datasets/edit":"show_dataset_edit_attributes","(/)datasets/error":"show_dataset_error"},require_login:["show_user","show_user_form","show_workflows"],authenticate:function(e,t){return Galaxy.user&&Galaxy.user.id||-1==this.require_login.indexOf(t)},show_tours:function(e){e?$.default.giveTourById(e):this.page.display(new $.default.ToursView)},show_user:function(){this.page.display(new w.default.View)},show_user_form:function(e){var t=new w.default.Model({user_id:Galaxy.params.id});this.page.display(new v.default.View(t.get(e)))},show_visualizations:function(e){this.page.display(new P.default.View({action_id:e,plural:"Visualizations",item:"visualization"}))},show_visualizations_edit:function(){this.page.display(new v.default.View({url:"visualization/edit?id="+G.default.get("id"),redirect:"visualizations/list"}))},show_workflows_published:function(){this.page.display(new S.default({url_base:Galaxy.root+"workflow/list_published",dict_format:!0}))},show_histories:function(e){this.page.display(new L.default.View({action_id:e}))},show_history_citations:function(){var e=Q.default.extend(q.default),t=document.createElement("div");this.page.display(t),new e({propsData:{id:G.default.get("id"),source:"histories"}}).$mount(t)},show_histories_rename:function(){this.page.display(new v.default.View({url:"history/rename?id="+G.default.get("id"),redirect:"histories/list"}))},show_histories_import:function(){var e=Q.default.extend(M.default),t=document.createElement("div");this.page.display(t),(new e).$mount(t)},show_histories_permissions:function(){this.page.display(new v.default.View({url:"history/permissions?id="+G.default.get("id"),redirect:"histories/list"}))},show_datasets:function(){this.page.display(new S.default({url_base:Galaxy.root+"dataset/list",dict_format:!0}))},show_pages:function(e){this.page.display(new P.default.View({action_id:e,plural:"Pages",item:"page"}))},show_pages_create:function(){this.page.display(new v.default.View({url:"page/create",redirect:"pages/list"}))},show_pages_edit:function(){this.page.display(new v.default.View({url:"page/edit?id="+G.default.get("id"),redirect:"pages/list"}))},show_workflows:function(){this.page.display(new D.default.View)},show_workflows_create:function(){this.page.display(new v.default.View({url:"workflow/create",redirect:"workflow/editor"}))},show_run:function(){this._loadWorkflow()},show_import_workflow:function(){this.page.display(new D.default.ImportWorkflowView)},show_custom_builds:function(){var e=this,t=this.page.historyPanel.historyView;if(!t||!t.model||!t.model.id)return void window.setTimeout(function(){e.show_custom_builds()},500);this.page.display(new x.default.View)},show_dataset_edit_attributes:function(){this.page.display(new W.default.View)},show_dataset_error:function(){this.page.display(new R.default.View)},home:function(e){e.tool_id||e.job_id?"upload1"===e.tool_id?(this.page.toolPanel.upload.show(),this._loadCenterIframe("welcome")):this._loadToolForm(e):e.workflow_id?this._loadWorkflow():e.m_c?this._loadCenterIframe(e.m_c+"/"+e.m_a):this._loadCenterIframe("welcome")},_loadToolForm:function(e){e.id=decodeURIComponent(e.tool_id),this.page.display(new g.default.View(e))},_loadCenterIframe:function(e,t){t=t||Galaxy.root,e=t+e,this.page.$("#galaxy_main").prop("src",e)},_loadWorkflow:function(){var e=this;H.default.get({url:Galaxy.root+"api/workflows/"+H.default.getQueryString("id")+"/download?style=run",success:function(t){e.page.display(new N.default.View(t))},error:function(t){var i=t.err_msg||"Error occurred while loading the resource.",n={message:i,status:"danger",persistent:!0};e.page.display(new U.default.Message(n))}})}});K(function(){Galaxy.page=new p.default.View(e.extend(t,{Left:c.default,Right:h.default,Router:n}))})}}).call(t,i(1))},function(e,t,i){"use strict";(function(e,n){function s(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=i(85),o=s(a),l=i(241),r=s(l),d=i(3),c=s(d),u=i(111),h=(s(u),e.View.extend({initialize:function(t,i){var n=i.config;this.root=i.root,this.stored_workflow_menu_entries=n.stored_workflow_menu_entries||[];var s=new o.default.ToolSearch({hidden:!1}),a=new o.default.ToolCollection(n.toolbox);this.tool_panel=new o.default.ToolPanel({tool_search:s,tools:a,layout:n.toolbox_in_panel}),this.tool_panel_view=new o.default.ToolPanelView({model:this.tool_panel}),this.upload_button=new r.default({nginx_upload_path:n.nginx_upload_path,ftp_upload_site:n.ftp_upload_site,default_genome:n.default_genome,default_extension:n.default_extension}),Galaxy.upload=this.upload_button,this.model=new e.Model({title:(0,c.default)("Tools"),buttons:[this.upload_button]}),this.setElement(this._template())},render:function(){var e=this;this.tool_panel.get("layout").size()>0&&(this.$el.prepend(this.tool_panel_view.$el),this.tool_panel_view.render()),e.$("#internal-workflows").append(e._templateAllWorkflow({title:(0,c.default)("All workflows"),href:"workflows/list"})),n.each(this.stored_workflow_menu_entries,function(t){e.$("#internal-workflows").append(e._templateWorkflowLink({title:t.stored_workflow.name,href:"workflows/run?id="+t.encoded_stored_workflow_id}))})},_templateTool:function(e){return['"].join("")},_templateAllWorkflow:function(e){return['"].join("")},_templateWorkflowLink:function(e){return['"].join("")},_template:function(){return['
    ','",'
    ','
    ','
    ',"",(0,c.default)("Workflows"),"","
    ",'
    ','
    ',"
    ","
    "].join("")},toString:function(){return"toolPanel"}}));t.default=h}).call(t,i(2),i(1))},function(e,t,i){"use strict";(function(e){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var s=i(3),a=n(s),o=i(4),l=n(o),r=i(8),d=n(r),c=i(43),u=n(c),h=i(242),f=n(h),p=i(243),m=n(p),g=i(246),_=n(g),v=i(248),y=n(v);t.default=e.View.extend({options:{nginx_upload_path:"",ftp_upload_site:"n/a",default_genome:"?",default_extension:"auto",height:500,width:900,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_extensions:[],list_genomes:[],initialize:function(e){var t=this;this.options=l.default.merge(e,this.options),this.ui_button=new f.default.View({onclick:function(e){e.preventDefault(),t.show()},onunload:function(){var e=t.ui_button.model.get("percentage",0);if(e>0&&e<100)return"Several uploads are queued."}}),this.setElement(this.ui_button.$el);var t=this;l.default.get({url:Galaxy.root+"api/datatypes?extension_only=False",success:function(e){for(var i in e)t.list_extensions.push({id:e[i].extension,text:e[i].extension,description:e[i].description,description_url:e[i].description_url,composite_files:e[i].composite_files});t.list_extensions.sort(function(e,t){var i=e.text&&e.text.toLowerCase(),n=t.text&&t.text.toLowerCase();return i>n?1:ii.text?1:e.text0){var n={file_count:e.length,dbkey:e[0].get("genome","?"),file_type:e[0].get("extension","auto")};for(var s in e){var a=e[s];if(a.set("status","running"),!(a.get("file_size")>0)){i.error_message="Upload content incomplete.",a.set("status","error"),a.set("info",i.error_message);break}var o="files_"+s+"|";switch(n[o+"type"]="upload_dataset",n[o+"space_to_tab"]=a.get("space_to_tab")&&"Yes"||null,n[o+"to_posix_lines"]=a.get("to_posix_lines")&&"Yes"||null,n[o+"dbkey"]=a.get("genome",null),n[o+"file_type"]=a.get("extension",null),a.get("file_mode")){case"new":n[o+"url_paste"]=a.get("url_paste");break;case"ftp":n[o+"ftp_files"]=a.get("file_path");break;case"local":i.files.push({name:o+"file_data",file:a.get("file_data")})}}i.payload.inputs=JSON.stringify(n)}return i}})}).call(t,i(2))},function(e,t,i){"use strict";(function(e,n){Object.defineProperty(t,"__esModule",{value:!0});var s=i(3),a=function(e){return e&&e.__esModule?e:{default:e}}(s),o=e.View.extend({initialize:function(t){var i=this;this.model=t&&t.model||new e.Model({icon:"fa-upload",tooltip:(0,a.default)("Download from URL or upload files from disk"),label:"Load Data",percentage:0,status:"",onunload:function(){},onclick:function(){}}).set(t),this.setElement(this._template()),this.$progress=this.$(".progress-bar"),this.listenTo(this.model,"change",this.render,this),this.render(),n(window).on("beforeunload",function(){return i.model.get("onunload")()})},render:function(){var e=this.model.attributes;this.$el.off("click").on("click",function(t){e.onclick(t)}).tooltip({title:this.model.get("tooltip"),placement:"bottom"}),this.$progress.removeClass().addClass("progress-bar").addClass("progress-bar-notransition").addClass(""!=e.status&&"progress-bar-"+e.status).css({width:e.percentage+"%"})},_template:function(){return'
    '}});t.default={View:o}}).call(t,i(2),i(0))},function(e,t,i){"use strict";(function(e,n,s){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(3),l=a(o),r=i(4),d=(a(r),i(29)),c=a(d),u=i(244),h=a(u),f=i(55),p=a(f),m=i(56),g=a(m),_=i(15),v=a(_),y=i(10),w=a(y),b=i(6),x=a(b),C=i(245),$=a(C);i(57),t.default=e.View.extend({upload_size:0,collection:new c.default.Collection,counter:{announce:0,success:0,error:0,running:0,reset:function(){this.announce=this.success=this.error=this.running=0}},initialize:function(e){var t=this;this.app=e,this.options=e.options,this.list_extensions=e.list_extensions,this.list_genomes=e.list_genomes,this.ui_button=e.ui_button,this.ftp_upload_site=e.currentFtp(),this.setElement(this._template()),this.$uploadbox=this.$(".upload-box"),this.$uploadtable=this.$(".upload-table"),this.btnLocal=new x.default.Button({id:"btn-local",title:(0,l.default)("Choose local file"),onclick:function(){t.uploadbox.select()},icon:"fa fa-laptop"}),this.btnFtp=new x.default.Button({id:"btn-ftp",title:(0,l.default)("Choose FTP file"),onclick:function(){t._eventFtp()},icon:"fa fa-folder-open-o"}),this.btnCreate=new x.default.Button({id:"btn-new",title:"Paste/Fetch data",onclick:function(){t._eventCreate()},icon:"fa fa-edit"}),this.btnStart=new x.default.Button({id:"btn-start",title:(0,l.default)("Start"),onclick:function(){t._eventStart()}}),this.btnStop=new x.default.Button({id:"btn-stop",title:(0,l.default)("Pause"),onclick:function(){t._eventStop()}}),this.btnReset=new x.default.Button({id:"btn-reset",title:(0,l.default)("Reset"),onclick:function(){t._eventReset()}}),this.btnClose=new x.default.Button({id:"btn-close",title:(0,l.default)("Close"),onclick:function(){t.app.modal.hide()}}),n.each([this.btnLocal,this.btnFtp,this.btnCreate,this.btnStop,this.btnReset,this.btnStart,this.btnClose],function(e){t.$(".upload-buttons").prepend(e.$el)}),this.uploadbox=this.$uploadbox.uploadbox({url:this.app.options.nginx_upload_path,announce:function(e,i){t._eventAnnounce(e,i)},initialize:function(e){return t.app.toData([t.collection.get(e)],t.history_id)},progress:function(e,i){t._eventProgress(e,i)},success:function(e,i){t._eventSuccess(e,i)},error:function(e,i){t._eventError(e,i)},complete:function(){t._eventComplete()},ondragover:function(){t.$uploadbox.addClass("highlight")},ondragleave:function(){t.$uploadbox.removeClass("highlight")}}),this.ftp=new v.default.View({title:(0,l.default)("FTP files"),container:this.btnFtp.$el}),this.select_extension=new w.default.View({css:"upload-footer-selection",container:this.$(".upload-footer-extension"),data:n.filter(this.list_extensions,function(e){return!e.composite_files}),value:this.options.default_extension,onchange:function(e){t._changeExtension(e)}}),this.$(".upload-footer-extension-info").on("click",function(e){new g.default({$el:s(e.target),title:t.select_extension.text(),extension:t.select_extension.value(),list:t.list_extensions,placement:"top"})}).on("mousedown",function(e){e.preventDefault()}),this.select_genome=new w.default.View({css:"upload-footer-selection",container:this.$(".upload-footer-genome"),data:this.list_genomes,value:this.options.default_genome,onchange:function(e){t._changeGenome(e)}}),this.loader=new $.default({$container:this.$uploadbox,collection:this.collection,new_content:function(e){var i=new h.default(t,{model:e});return t.$uploadtable.find("> tbody:first").append(i.$el),i.render(),i}}),this.collection.on("remove",function(e){t._eventRemove(e)}),this.render()},render:function(){var e="";e=0==this.counter.announce?this.uploadbox.compatible()?" ":"Browser does not support Drag & Drop. Try Firefox 4+, Chrome 7+, IE 10+, Opera 12+ or Safari 6+.":0==this.counter.running?"You added "+this.counter.announce+" file(s) to the queue. Add more files or click 'Start' to proceed.":"Please wait..."+this.counter.announce+" out of "+this.counter.running+" remaining.",this.$(".upload-top-info").html(e);var t=0==this.counter.running&&this.counter.announce+this.counter.success+this.counter.error>0,i=0==this.counter.running&&this.counter.announce>0,n=0==this.counter.running,s=this.counter.announce+this.counter.success+this.counter.error>0;this.btnReset[t?"enable":"disable"](),this.btnStart[i?"enable":"disable"](),this.btnStart.$el[i?"addClass":"removeClass"]("btn-primary"),this.btnStop[this.counter.running>0?"enable":"disable"](),this.btnLocal[n?"enable":"disable"](),this.btnFtp[n?"enable":"disable"](),this.btnCreate[n?"enable":"disable"](),this.btnFtp.$el[this.ftp_upload_site?"show":"hide"](),this.$(".upload-table")[s?"show":"hide"](),this.$(".upload-helper")[s?"hide":"show"]()},_eventAnnounce:function(e,t){this.counter.announce++;var i=new c.default.Model({id:e,file_name:t.name,file_size:t.size,file_mode:t.mode||"local",file_path:t.path,file_data:t});this.render(),this.collection.add(i)},_eventProgress:function(e,t){var i=this.collection.get(e);i.set("percentage",t),this.ui_button.model.set("percentage",this._uploadPercentage(t,i.get("file_size")))},_eventSuccess:function(e,t){var i=this.collection.get(e);i.set({percentage:100,status:"success"}),this.ui_button.model.set("percentage",this._uploadPercentage(100,i.get("file_size"))),this.upload_completed+=100*i.get("file_size"),this.counter.announce--,this.counter.success++,this.render(),Galaxy.currHistoryPanel.refreshContents()},_eventError:function(e,t){var i=this.collection.get(e);i.set({percentage:100,status:"error",info:t}),this.ui_button.model.set({percentage:this._uploadPercentage(100,i.get("file_size")),status:"danger"}),this.upload_completed+=100*i.get("file_size"),this.counter.announce--,this.counter.error++,this.render()},_eventComplete:function(){this.collection.each(function(e){"queued"==e.get("status")&&e.set("status","init")}),this.counter.running=0,this.render()},_eventRemove:function(e){var t=e.get("status");"success"==t?this.counter.success--:"error"==t?this.counter.error--:this.counter.announce--,this.uploadbox.remove(e.id),this.render()},_eventFtp:function(){if(this.ftp.visible)this.ftp.hide();else{this.ftp.empty();var e=this;this.ftp.append(new p.default({collection:this.collection,ftp_upload_site:this.ftp_upload_site,onadd:function(t){return e.uploadbox.add([{mode:"ftp",name:t.path,size:t.size,path:t.path}])},onremove:function(t){e.collection.remove(t)}}).$el),this.ftp.show()}},_eventCreate:function(){this.uploadbox.add([{name:"New File",size:0,mode:"new"}])},_eventStart:function(){if(0!=this.counter.announce&&0==this.counter.running){var e=this;this.upload_size=0,this.upload_completed=0,this.collection.each(function(t){"init"==t.get("status")&&(t.set("status","queued"),e.upload_size+=t.get("file_size"))}),this.ui_button.model.set({percentage:0,status:"success"}),this.counter.running=this.counter.announce,this.history_id=this.app.currentHistory(),this._uploadFtp(),this.uploadbox.start(),this.render()}},_eventStop:function(){this.counter.running>0&&(this.ui_button.model.set("status","info"),s(".upload-top-info").html("Queue will pause after completing the current file..."),this.uploadbox.stop())},_eventReset:function(){if(0==this.counter.running){this.collection.reset(),this.counter.reset(),this.uploadbox.reset(),this.select_extension.value(this.options.default_extension),this.select_genome.value(this.options.default_genome),this.ui_button.model.set("percentage",0),this.render()}},_changeExtension:function(e,t){var i=this;this.collection.each(function(n){"init"!=n.get("status")||n.get("extension")!=i.options.default_extension&&t||n.set("extension",e)})},_changeGenome:function(e,t){var i=this;this.collection.each(function(n){"init"!=n.get("status")||n.get("genome")!=i.options.default_genome&&t||n.set("genome",e)})},_uploadFtp:function(){var e=this,t=[];this.collection.each(function(i){"queued"==i.get("status")&&"ftp"==i.get("file_mode")&&(e.uploadbox.remove(i.id),t.push(i))}),t.length>0&&s.uploadpost({data:this.app.toData(t),url:this.app.options.nginx_upload_path,success:function(i){n.each(t,function(t){e._eventSuccess(t.id)})},error:function(i){n.each(t,function(t){e._eventError(t.id,i)})}})},_uploadPercentage:function(e,t){return(this.upload_completed+e*t)/this.upload_size},_template:function(){return'
    Drop files here
    '}})}).call(t,i(2),i(1),i(0))},function(e,t,i){"use strict";(function(e,n,s){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(3),l=a(o),r=i(4),d=a(r),c=i(29),u=(a(c),i(54)),h=a(u),f=i(15),p=a(f),m=i(10),g=a(m);t.default=e.View.extend({status_classes:{init:"upload-icon-button fa fa-trash-o",queued:"upload-icon fa fa-spinner fa-spin",running:"upload-icon fa fa-spinner fa-spin",success:"upload-icon-button fa fa-check",error:"upload-icon-button fa fa-exclamation-triangle"},initialize:function(e,t){var i=this;this.app=e,this.model=t.model,this.setElement(this._template(t.model)),this.$mode=this.$(".upload-mode"),this.$title=this.$(".upload-title"),this.$text=this.$(".upload-text"),this.$size=this.$(".upload-size"),this.$info_text=this.$(".upload-info-text"),this.$info_progress=this.$(".upload-info-progress"),this.$text_content=this.$(".upload-text-content"),this.$settings=this.$(".upload-settings"),this.$symbol=this.$(".upload-symbol"),this.$progress_bar=this.$(".upload-progress-bar"),this.$percentage=this.$(".upload-percentage"),this.settings=new p.default.View({title:(0,l.default)("Upload configuration"),container:this.$(".upload-settings"),placement:"bottom"});var s=this.app.select_genome.value(),a=this.app.select_extension.value();this.select_genome=new g.default.View({css:"upload-genome",data:i.app.list_genomes,container:this.$(".upload-genome"),value:s,onchange:function(e){i.model.set("genome",e)}}),this.select_extension=new g.default.View({css:"upload-extension",data:i.app.list_extensions,container:this.$(".upload-extension"),value:a,onchange:function(e){i.model.set("extension",e)}}),this.model.set({genome:s,extension:a}),this.$symbol.on("click",function(){i._removeRow()}),this.$(".upload-extension-info").on("click",function(e){i.app.showExtensionInfo({$el:n(e.target),title:i.select_extension.text(),extension:i.select_extension.value()})}).on("mousedown",function(e){e.preventDefault()}),this.$settings.on("click",function(e){i._showSettings()}).on("mousedown",function(e){e.preventDefault()}),this.$text_content.on("change input",function(e){i.model.set({url_paste:n(e.target).val(),file_size:n(e.target).val().length})}),this.listenTo(this.model,"change:percentage",function(){i._refreshPercentage()}),this.listenTo(this.model,"change:status",function(){i._refreshStatus()}),this.listenTo(this.model,"change:info",function(){i._refreshInfo()}),this.listenTo(this.model,"change:genome",function(){i._refreshGenome()}),this.listenTo(this.model,"change:extension",function(){i._refreshExtension()}),this.listenTo(this.model,"change:file_size",function(){i._refreshFileSize()})},render:function(){this._refreshType(),this._refreshPercentage(),this._refreshStatus(),this._refreshInfo(),this._refreshGenome(),this._refreshExtension(),this._refreshFileSize()},remove:function(){this.select_genome.remove(),this.select_extension.remove(),e.View.prototype.remove.apply(this)},_refreshType:function(){var e=this.model.attributes;this.$title.html(s.escape(e.file_name)),this.$size.html(d.default.bytesToString(e.file_size)),this.$mode.removeClass().addClass("upload-mode").addClass("text-primary"),"new"==e.file_mode?(this.$text.css({width:this.$el.width()-16+"px",top:this.$el.height()-8+"px"}).show(),this.$el.height(this.$el.height()-8+this.$text.height()+16),this.$mode.addClass("fa fa-edit")):"local"==e.file_mode?this.$mode.addClass("fa fa-laptop"):"ftp"==e.file_mode&&this.$mode.addClass("fa fa-folder-open-o")},_refreshExtension:function(){this.select_extension.value(this.model.get("extension"))},_refreshGenome:function(){this.select_genome.value(this.model.get("genome"))},_refreshInfo:function(){var e=this.model.get("info");e?this.$info_text.html("Failed: "+e).show():this.$info_text.hide()},_refreshPercentage:function(){var e=parseInt(this.model.get("percentage"));this.$progress_bar.css({width:e+"%"}),this.$percentage.html(100!=e?e+"%":"Adding to history...")},_refreshStatus:function(){var e=this.model.get("status");this.$symbol.removeClass().addClass("upload-symbol").addClass(this.status_classes[e]),this.model.set("enabled","init"==e);var t=this.model.get("enabled");this.$text_content.attr("disabled",!t),t?(this.select_genome.enable(),this.select_extension.enable()):(this.select_genome.disable(),this.select_extension.disable()),"success"==e&&(this.$el.addClass("success"),this.$percentage.html("100%")),"error"==e&&(this.$el.addClass("danger"),this.$info_progress.hide())},_refreshFileSize:function(){this.$size.html(d.default.bytesToString(this.model.get("file_size")))},_removeRow:function(){-1!==["init","success","error"].indexOf(this.model.get("status"))&&this.app.collection.remove(this.model)},_showSettings:function(){this.settings.visible?this.settings.hide():(this.settings.empty(),this.settings.append(new h.default(this).$el),this.settings.show())},_template:function(e){return'
    You can tell Galaxy to download data from web by entering URL in this box (one per line). You can also directly paste the contents of a file.
    ",st.noCloneChecked=!!e.cloneNode(!0).lastChild.defaultValue}();var Ht=/^key/,qt=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Ft=/^([^.]*)(?:\.(.+)|)/;lt.event={global:{},add:function(t,e,i,n,r){var a,o,s,l,u,c,h,d,f,p,m,g=At.get(t);if(g)for(i.handler&&(a=i,i=a.handler,r=a.selector),i.guid||(i.guid=lt.guid++),(l=g.events)||(l=g.events={}),(o=g.handle)||(o=g.handle=function(e){return void 0!==lt&<.event.triggered!==e.type?lt.event.dispatch.apply(t,arguments):void 0}),e=(e||"").match(Ct)||[""],u=e.length;u--;)s=Ft.exec(e[u])||[],f=m=s[1],p=(s[2]||"").split(".").sort(),f&&(h=lt.event.special[f]||{},f=(r?h.delegateType:h.bindType)||f,h=lt.event.special[f]||{},c=lt.extend({type:f,origType:m,data:n,handler:i,guid:i.guid,selector:r,needsContext:r&<.expr.match.needsContext.test(r),namespace:p.join(".")},a),(d=l[f])||(d=l[f]=[],d.delegateCount=0,h.setup&&!1!==h.setup.call(t,n,p,o)||t.addEventListener&&t.addEventListener(f,o)),h.add&&(h.add.call(t,c),c.handler.guid||(c.handler.guid=i.guid)),r?d.splice(d.delegateCount++,0,c):d.push(c),lt.event.global[f]=!0)},remove:function(t,e,i,n,r){var a,o,s,l,u,c,h,d,f,p,m,g=At.hasData(t)&&At.get(t);if(g&&(l=g.events)){for(e=(e||"").match(Ct)||[""],u=e.length;u--;)if(s=Ft.exec(e[u])||[],f=m=s[1],p=(s[2]||"").split(".").sort(),f){for(h=lt.event.special[f]||{},f=(n?h.delegateType:h.bindType)||f,d=l[f]||[],s=s[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),o=a=d.length;a--;)c=d[a],!r&&m!==c.origType||i&&i.guid!==c.guid||s&&!s.test(c.namespace)||n&&n!==c.selector&&("**"!==n||!c.selector)||(d.splice(a,1),c.selector&&d.delegateCount--,h.remove&&h.remove.call(t,c));o&&!d.length&&(h.teardown&&!1!==h.teardown.call(t,p,g.handle)||lt.removeEvent(t,f,g.handle),delete l[f])}else for(f in l)lt.event.remove(t,f+e[u],i,n,!0);lt.isEmptyObject(l)&&At.remove(t,"handle events")}},dispatch:function(t){t=lt.event.fix(t);var e,i,n,r,a,o=[],s=tt.call(arguments),l=(At.get(this,"events")||{})[t.type]||[],u=lt.event.special[t.type]||{};if(s[0]=t,t.delegateTarget=this,!u.preDispatch||!1!==u.preDispatch.call(this,t)){for(o=lt.event.handlers.call(this,t,l),e=0;(r=o[e++])&&!t.isPropagationStopped();)for(t.currentTarget=r.elem,i=0;(a=r.handlers[i++])&&!t.isImmediatePropagationStopped();)t.rnamespace&&!t.rnamespace.test(a.namespace)||(t.handleObj=a,t.data=a.data,void 0!==(n=((lt.event.special[a.origType]||{}).handle||a.handler).apply(r.elem,s))&&!1===(t.result=n)&&(t.preventDefault(),t.stopPropagation()));return u.postDispatch&&u.postDispatch.call(this,t),t.result}},handlers:function(t,e){var i,n,r,a,o=[],s=e.delegateCount,l=t.target;if(s&&l.nodeType&&("click"!==t.type||isNaN(t.button)||t.button<1))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&(!0!==l.disabled||"click"!==t.type)){for(n=[],i=0;i-1:lt.find(r,this,null,[l]).length),n[r]&&n.push(a);n.length&&o.push({elem:l,handlers:n})}return s]*)\/>/gi,Vt=/\s*$/g;lt.extend({htmlPrefilter:function(t){return t.replace(Bt,"<$1>")},clone:function(t,e,i){var n,r,a,o,s=t.cloneNode(!0),l=lt.contains(t.ownerDocument,t);if(!(st.noCloneChecked||1!==t.nodeType&&11!==t.nodeType||lt.isXMLDoc(t)))for(o=p(s),a=p(t),n=0,r=a.length;n0&&m(o,!l&&p(t,"script")),s},cleanData:function(t){for(var e,i,n,r=lt.event.special,a=0;void 0!==(i=t[a]);a++)if(Tt(i)){if(e=i[At.expando]){if(e.events)for(n in e.events)r[n]?lt.event.remove(i,n):lt.removeEvent(i,n,e.handle);i[At.expando]=void 0}i[Mt.expando]&&(i[Mt.expando]=void 0)}}}),lt.fn.extend({domManip:T,detach:function(t){return A(this,t,!0)},remove:function(t){return A(this,t)},text:function(t){return St(this,function(t){return void 0===t?lt.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=t)})},null,t,arguments.length)},append:function(){return T(this,arguments,function(t){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){w(this,t).appendChild(t)}})},prepend:function(){return T(this,arguments,function(t){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var e=w(this,t);e.insertBefore(t,e.firstChild)}})},before:function(){return T(this,arguments,function(t){this.parentNode&&this.parentNode.insertBefore(t,this)})},after:function(){return T(this,arguments,function(t){this.parentNode&&this.parentNode.insertBefore(t,this.nextSibling)})},empty:function(){for(var t,e=0;null!=(t=this[e]);e++)1===t.nodeType&&(lt.cleanData(p(t,!1)),t.textContent="");return this},clone:function(t,e){return t=null!=t&&t,e=null==e?t:e,this.map(function(){return lt.clone(this,t,e)})},html:function(t){return St(this,function(t){var e=this[0]||{},i=0,n=this.length;if(void 0===t&&1===e.nodeType)return e.innerHTML;if("string"==typeof t&&!Vt.test(t)&&!Lt[(It.exec(t)||["",""])[1].toLowerCase()]){t=lt.htmlPrefilter(t);try{for(;i1)},show:function(){return I(this,!0)},hide:function(){return I(this)},toggle:function(t){return"boolean"==typeof t?t?this.show():this.hide():this.each(function(){Pt(this)?lt(this).show():lt(this).hide()})}}),lt.Tween=N,N.prototype={constructor:N,init:function(t,e,i,n,r,a){this.elem=t,this.prop=i,this.easing=r||lt.easing._default,this.options=e,this.start=this.now=this.cur(),this.end=n,this.unit=a||(lt.cssNumber[i]?"":"px")},cur:function(){var t=N.propHooks[this.prop];return t&&t.get?t.get(this):N.propHooks._default.get(this)},run:function(t){var e,i=N.propHooks[this.prop];return this.options.duration?this.pos=e=lt.easing[this.easing](t,this.options.duration*t,0,1,this.options.duration):this.pos=e=t,this.now=(this.end-this.start)*e+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),i&&i.set?i.set(this):N.propHooks._default.set(this),this}},N.prototype.init.prototype=N.prototype,N.propHooks={_default:{get:function(t){var e;return 1!==t.elem.nodeType||null!=t.elem[t.prop]&&null==t.elem.style[t.prop]?t.elem[t.prop]:(e=lt.css(t.elem,t.prop,""),e&&"auto"!==e?e:0)},set:function(t){lt.fx.step[t.prop]?lt.fx.step[t.prop](t):1!==t.elem.nodeType||null==t.elem.style[lt.cssProps[t.prop]]&&!lt.cssHooks[t.prop]?t.elem[t.prop]=t.now:lt.style(t.elem,t.prop,t.now+t.unit)}}},N.propHooks.scrollTop=N.propHooks.scrollLeft={set:function(t){t.elem.nodeType&&t.elem.parentNode&&(t.elem[t.prop]=t.now)}},lt.easing={linear:function(t){return t},swing:function(t){return.5-Math.cos(t*Math.PI)/2},_default:"swing"},lt.fx=N.prototype.init,lt.fx.step={};var oe,se,le=/^(?:toggle|show|hide)$/,ue=/queueHooks$/;lt.Animation=lt.extend(B,{tweeners:{"*":[function(t,e){var i=this.createTween(t,e);return f(i.elem,t,Dt.exec(e),i),i}]},tweener:function(t,e){lt.isFunction(t)?(e=t,t=["*"]):t=t.match(Ct);for(var i,n=0,r=t.length;n1)},removeAttr:function(t){return this.each(function(){lt.removeAttr(this,t)})}}),lt.extend({attr:function(t,e,i){var n,r,a=t.nodeType;if(3!==a&&8!==a&&2!==a)return void 0===t.getAttribute?lt.prop(t,e,i):(1===a&<.isXMLDoc(t)||(e=e.toLowerCase(),r=lt.attrHooks[e]||(lt.expr.match.bool.test(e)?ce:void 0)),void 0!==i?null===i?void lt.removeAttr(t,e):r&&"set"in r&&void 0!==(n=r.set(t,i,e))?n:(t.setAttribute(e,i+""),i):r&&"get"in r&&null!==(n=r.get(t,e))?n:(n=lt.find.attr(t,e),null==n?void 0:n))},attrHooks:{type:{set:function(t,e){if(!st.radioValue&&"radio"===e&<.nodeName(t,"input")){var i=t.value;return t.setAttribute("type",e),i&&(t.value=i),e}}}},removeAttr:function(t,e){var i,n,r=0,a=e&&e.match(Ct);if(a&&1===t.nodeType)for(;i=a[r++];)n=lt.propFix[i]||i,lt.expr.match.bool.test(i)&&(t[n]=!1),t.removeAttribute(i)}}),ce={set:function(t,e,i){return!1===e?lt.removeAttr(t,i):t.setAttribute(i,i),i}},lt.each(lt.expr.match.bool.source.match(/\w+/g),function(t,e){var i=he[e]||lt.find.attr;he[e]=function(t,e,n){var r,a;return n||(a=he[e],he[e]=r,r=null!=i(t,e,n)?e.toLowerCase():null,he[e]=a),r}});var de=/^(?:input|select|textarea|button)$/i,fe=/^(?:a|area)$/i;lt.fn.extend({prop:function(t,e){return St(this,lt.prop,t,e,arguments.length>1)},removeProp:function(t){return this.each(function(){delete this[lt.propFix[t]||t]})}}),lt.extend({prop:function(t,e,i){var n,r,a=t.nodeType;if(3!==a&&8!==a&&2!==a)return 1===a&<.isXMLDoc(t)||(e=lt.propFix[e]||e,r=lt.propHooks[e]),void 0!==i?r&&"set"in r&&void 0!==(n=r.set(t,i,e))?n:t[e]=i:r&&"get"in r&&null!==(n=r.get(t,e))?n:t[e]},propHooks:{tabIndex:{get:function(t){var e=lt.find.attr(t,"tabindex");return e?parseInt(e,10):de.test(t.nodeName)||fe.test(t.nodeName)&&t.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),st.optSelected||(lt.propHooks.selected={get:function(t){var e=t.parentNode;return e&&e.parentNode&&e.parentNode.selectedIndex,null},set:function(t){var e=t.parentNode;e&&(e.selectedIndex,e.parentNode&&e.parentNode.selectedIndex)}}),lt.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){lt.propFix[this.toLowerCase()]=this});var pe=/[\t\r\n\f]/g;lt.fn.extend({addClass:function(t){var e,i,n,r,a,o,s,l=0;if(lt.isFunction(t))return this.each(function(e){lt(this).addClass(t.call(this,e,V(this)))});if("string"==typeof t&&t)for(e=t.match(Ct)||[];i=this[l++];)if(r=V(i),n=1===i.nodeType&&(" "+r+" ").replace(pe," ")){for(o=0;a=e[o++];)n.indexOf(" "+a+" ")<0&&(n+=a+" ");s=lt.trim(n),r!==s&&i.setAttribute("class",s)}return this},removeClass:function(t){var e,i,n,r,a,o,s,l=0;if(lt.isFunction(t))return this.each(function(e){lt(this).removeClass(t.call(this,e,V(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof t&&t)for(e=t.match(Ct)||[];i=this[l++];)if(r=V(i),n=1===i.nodeType&&(" "+r+" ").replace(pe," ")){for(o=0;a=e[o++];)for(;n.indexOf(" "+a+" ")>-1;)n=n.replace(" "+a+" "," ");s=lt.trim(n),r!==s&&i.setAttribute("class",s)}return this},toggleClass:function(t,e){var i=typeof t;return"boolean"==typeof e&&"string"===i?e?this.addClass(t):this.removeClass(t):lt.isFunction(t)?this.each(function(i){lt(this).toggleClass(t.call(this,i,V(this),e),e)}):this.each(function(){var e,n,r,a;if("string"===i)for(n=0,r=lt(this),a=t.match(Ct)||[];e=a[n++];)r.hasClass(e)?r.removeClass(e):r.addClass(e);else void 0!==t&&"boolean"!==i||(e=V(this),e&&At.set(this,"__className__",e),this.setAttribute&&this.setAttribute("class",e||!1===t?"":At.get(this,"__className__")||""))})},hasClass:function(t){var e,i,n=0;for(e=" "+t+" ";i=this[n++];)if(1===i.nodeType&&(" "+V(i)+" ").replace(pe," ").indexOf(e)>-1)return!0;return!1}});var me=/\r/g,ge=/[\x20\t\r\n\f]+/g;lt.fn.extend({val:function(t){var e,i,n,r=this[0];{if(arguments.length)return n=lt.isFunction(t),this.each(function(i){var r;1===this.nodeType&&(r=n?t.call(this,i,lt(this).val()):t,null==r?r="":"number"==typeof r?r+="":lt.isArray(r)&&(r=lt.map(r,function(t){return null==t?"":t+""})),(e=lt.valHooks[this.type]||lt.valHooks[this.nodeName.toLowerCase()])&&"set"in e&&void 0!==e.set(this,r,"value")||(this.value=r))});if(r)return(e=lt.valHooks[r.type]||lt.valHooks[r.nodeName.toLowerCase()])&&"get"in e&&void 0!==(i=e.get(r,"value"))?i:(i=r.value,"string"==typeof i?i.replace(me,""):null==i?"":i)}}}),lt.extend({valHooks:{option:{get:function(t){var e=lt.find.attr(t,"value");return null!=e?e:lt.trim(lt.text(t)).replace(ge," ")}},select:{get:function(t){for(var e,i,n=t.options,r=t.selectedIndex,a="select-one"===t.type||r<0,o=a?null:[],s=a?r+1:n.length,l=r<0?s:a?r:0;l-1)&&(i=!0);return i||(t.selectedIndex=-1),a}}}}),lt.each(["radio","checkbox"],function(){lt.valHooks[this]={set:function(t,e){if(lt.isArray(e))return t.checked=lt.inArray(lt(t).val(),e)>-1}},st.checkOn||(lt.valHooks[this].get=function(t){return null===t.getAttribute("value")?"on":t.value})});var ve=/^(?:focusinfocus|focusoutblur)$/;lt.extend(lt.event,{trigger:function(t,e,n,r){var a,o,s,l,u,c,h,d=[n||Z],f=ot.call(t,"type")?t.type:t,p=ot.call(t,"namespace")?t.namespace.split("."):[];if(o=s=n=n||Z,3!==n.nodeType&&8!==n.nodeType&&!ve.test(f+lt.event.triggered)&&(f.indexOf(".")>-1&&(p=f.split("."),f=p.shift(),p.sort()),u=f.indexOf(":")<0&&"on"+f,t=t[lt.expando]?t:new lt.Event(f,"object"==typeof t&&t),t.isTrigger=r?2:3,t.namespace=p.join("."),t.rnamespace=t.namespace?new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=n),e=null==e?[t]:lt.makeArray(e,[t]),h=lt.event.special[f]||{},r||!h.trigger||!1!==h.trigger.apply(n,e))){if(!r&&!h.noBubble&&!lt.isWindow(n)){for(l=h.delegateType||f,ve.test(l+f)||(o=o.parentNode);o;o=o.parentNode)d.push(o),s=o;s===(n.ownerDocument||Z)&&d.push(s.defaultView||s.parentWindow||i)}for(a=0;(o=d[a++])&&!t.isPropagationStopped();)t.type=a>1?l:h.bindType||f,c=(At.get(o,"events")||{})[t.type]&&At.get(o,"handle"),c&&c.apply(o,e),(c=u&&o[u])&&c.apply&&Tt(o)&&(t.result=c.apply(o,e),!1===t.result&&t.preventDefault());return t.type=f,r||t.isDefaultPrevented()||h._default&&!1!==h._default.apply(d.pop(),e)||!Tt(n)||u&<.isFunction(n[f])&&!lt.isWindow(n)&&(s=n[u],s&&(n[u]=null),lt.event.triggered=f,n[f](),lt.event.triggered=void 0,s&&(n[u]=s)),t.result}},simulate:function(t,e,i){var n=lt.extend(new lt.Event,i,{type:t,isSimulated:!0});lt.event.trigger(n,null,e)}}),lt.fn.extend({trigger:function(t,e){return this.each(function(){lt.event.trigger(t,e,this)})},triggerHandler:function(t,e){var i=this[0];if(i)return lt.event.trigger(t,e,i,!0)}}),lt.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(t,e){lt.fn[e]=function(t,i){return arguments.length>0?this.on(e,null,t,i):this.trigger(e)}}),lt.fn.extend({hover:function(t,e){return this.mouseenter(t).mouseleave(e||t)}}),st.focusin="onfocusin"in i,st.focusin||lt.each({focus:"focusin",blur:"focusout"},function(t,e){var i=function(t){lt.event.simulate(e,t.target,lt.event.fix(t))};lt.event.special[e]={setup:function(){var n=this.ownerDocument||this,r=At.access(n,e);r||n.addEventListener(t,i,!0),At.access(n,e,(r||0)+1)},teardown:function(){var n=this.ownerDocument||this,r=At.access(n,e)-1;r?At.access(n,e,r):(n.removeEventListener(t,i,!0),At.remove(n,e))}}});var _e=i.location,ye=lt.now(),be=/\?/;lt.parseJSON=function(t){return JSON.parse(t+"")},lt.parseXML=function(t){var e;if(!t||"string"!=typeof t)return null;try{e=(new i.DOMParser).parseFromString(t,"text/xml")}catch(t){e=void 0}return e&&!e.getElementsByTagName("parsererror").length||lt.error("Invalid XML: "+t),e};var we=/#.*$/,xe=/([?&])_=[^&]*/,Ce=/^(.*?):[ \t]*([^\r\n]*)$/gm,ke=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Se=/^(?:GET|HEAD)$/,Te=/^\/\//,Ae={},Me={},Ee="*/".concat("*"),Oe=Z.createElement("a");Oe.href=_e.href,lt.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:_e.href,type:"GET",isLocal:ke.test(_e.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Ee,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":lt.parseJSON,"text xml":lt.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(t,e){return e?G(G(t,lt.ajaxSettings),e):G(lt.ajaxSettings,t)},ajaxPrefilter:U(Ae),ajaxTransport:U(Me),ajax:function(t,e){function n(t,e,n,s){var u,h,_,y,w,C=e;2!==b&&(b=2,l&&i.clearTimeout(l),r=void 0,o=s||"",x.readyState=t>0?4:0,u=t>=200&&t<300||304===t,n&&(y=X(d,x,n)),y=Y(d,y,x,u),u?(d.ifModified&&(w=x.getResponseHeader("Last-Modified"),w&&(lt.lastModified[a]=w),(w=x.getResponseHeader("etag"))&&(lt.etag[a]=w)),204===t||"HEAD"===d.type?C="nocontent":304===t?C="notmodified":(C=y.state,h=y.data,_=y.error,u=!_)):(_=C,!t&&C||(C="error",t<0&&(t=0))),x.status=t,x.statusText=(e||C)+"",u?m.resolveWith(f,[h,C,x]):m.rejectWith(f,[x,C,_]),x.statusCode(v),v=void 0,c&&p.trigger(u?"ajaxSuccess":"ajaxError",[x,d,u?h:_]),g.fireWith(f,[x,C]),c&&(p.trigger("ajaxComplete",[x,d]),--lt.active||lt.event.trigger("ajaxStop")))}"object"==typeof t&&(e=t,t=void 0),e=e||{};var r,a,o,s,l,u,c,h,d=lt.ajaxSetup({},e),f=d.context||d,p=d.context&&(f.nodeType||f.jquery)?lt(f):lt.event,m=lt.Deferred(),g=lt.Callbacks("once memory"),v=d.statusCode||{},_={},y={},b=0,w="canceled",x={readyState:0,getResponseHeader:function(t){var e;if(2===b){if(!s)for(s={};e=Ce.exec(o);)s[e[1].toLowerCase()]=e[2];e=s[t.toLowerCase()]}return null==e?null:e},getAllResponseHeaders:function(){return 2===b?o:null},setRequestHeader:function(t,e){var i=t.toLowerCase();return b||(t=y[i]=y[i]||t,_[t]=e),this},overrideMimeType:function(t){return b||(d.mimeType=t),this},statusCode:function(t){var e;if(t)if(b<2)for(e in t)v[e]=[v[e],t[e]];else x.always(t[x.status]);return this},abort:function(t){var e=t||w;return r&&r.abort(e),n(0,e),this}};if(m.promise(x).complete=g.add,x.success=x.done,x.error=x.fail,d.url=((t||d.url||_e.href)+"").replace(we,"").replace(Te,_e.protocol+"//"),d.type=e.method||e.type||d.method||d.type,d.dataTypes=lt.trim(d.dataType||"*").toLowerCase().match(Ct)||[""],null==d.crossDomain){u=Z.createElement("a");try{u.href=d.url,u.href=u.href,d.crossDomain=Oe.protocol+"//"+Oe.host!=u.protocol+"//"+u.host}catch(t){d.crossDomain=!0}}if(d.data&&d.processData&&"string"!=typeof d.data&&(d.data=lt.param(d.data,d.traditional)),W(Ae,d,e,x),2===b)return x;c=lt.event&&d.global,c&&0==lt.active++&<.event.trigger("ajaxStart"),d.type=d.type.toUpperCase(),d.hasContent=!Se.test(d.type),a=d.url,d.hasContent||(d.data&&(a=d.url+=(be.test(a)?"&":"?")+d.data,delete d.data),!1===d.cache&&(d.url=xe.test(a)?a.replace(xe,"$1_="+ye++):a+(be.test(a)?"&":"?")+"_="+ye++)),d.ifModified&&(lt.lastModified[a]&&x.setRequestHeader("If-Modified-Since",lt.lastModified[a]),lt.etag[a]&&x.setRequestHeader("If-None-Match",lt.etag[a])),(d.data&&d.hasContent&&!1!==d.contentType||e.contentType)&&x.setRequestHeader("Content-Type",d.contentType),x.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+("*"!==d.dataTypes[0]?", "+Ee+"; q=0.01":""):d.accepts["*"]);for(h in d.headers)x.setRequestHeader(h,d.headers[h]);if(d.beforeSend&&(!1===d.beforeSend.call(f,x,d)||2===b))return x.abort();w="abort";for(h in{success:1,error:1,complete:1})x[h](d[h]);if(r=W(Me,d,e,x)){if(x.readyState=1,c&&p.trigger("ajaxSend",[x,d]),2===b)return x;d.async&&d.timeout>0&&(l=i.setTimeout(function(){x.abort("timeout")},d.timeout));try{b=1,r.send(_,n)}catch(t){if(!(b<2))throw t;n(-1,t)}}else n(-1,"No Transport");return x},getJSON:function(t,e,i){return lt.get(t,e,i,"json")},getScript:function(t,e){return lt.get(t,void 0,e,"script")}}),lt.each(["get","post"],function(t,e){lt[e]=function(t,i,n,r){return lt.isFunction(i)&&(r=r||n,n=i,i=void 0),lt.ajax(lt.extend({url:t,type:e,dataType:r,data:i,success:n},lt.isPlainObject(t)&&t))}}),lt._evalUrl=function(t){return lt.ajax({url:t,type:"GET",dataType:"script",async:!1,global:!1,throws:!0})},lt.fn.extend({wrapAll:function(t){var e;return lt.isFunction(t)?this.each(function(e){lt(this).wrapAll(t.call(this,e))}):(this[0]&&(e=lt(t,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&e.insertBefore(this[0]),e.map(function(){for(var t=this;t.firstElementChild;)t=t.firstElementChild;return t}).append(this)),this)},wrapInner:function(t){return lt.isFunction(t)?this.each(function(e){lt(this).wrapInner(t.call(this,e))}):this.each(function(){var e=lt(this),i=e.contents();i.length?i.wrapAll(t):e.append(t)})},wrap:function(t){var e=lt.isFunction(t);return this.each(function(i){lt(this).wrapAll(e?t.call(this,i):t)})},unwrap:function(){return this.parent().each(function(){lt.nodeName(this,"body")||lt(this).replaceWith(this.childNodes)}).end()}}),lt.expr.filters.hidden=function(t){return!lt.expr.filters.visible(t)},lt.expr.filters.visible=function(t){return t.offsetWidth>0||t.offsetHeight>0||t.getClientRects().length>0};var $e=/%20/g,De=/\[\]$/,je=/\r?\n/g,Pe=/^(?:submit|button|image|reset|file)$/i,Re=/^(?:input|select|textarea|keygen)/i;lt.param=function(t,e){var i,n=[],r=function(t,e){e=lt.isFunction(e)?e():null==e?"":e,n[n.length]=encodeURIComponent(t)+"="+encodeURIComponent(e)};if(void 0===e&&(e=lt.ajaxSettings&<.ajaxSettings.traditional),lt.isArray(t)||t.jquery&&!lt.isPlainObject(t))lt.each(t,function(){r(this.name,this.value)});else for(i in t)J(i,t[i],e,r);return n.join("&").replace($e,"+")},lt.fn.extend({serialize:function(){return lt.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var t=lt.prop(this,"elements");return t?lt.makeArray(t):this}).filter(function(){var t=this.type;return this.name&&!lt(this).is(":disabled")&&Re.test(this.nodeName)&&!Pe.test(t)&&(this.checked||!Rt.test(t))}).map(function(t,e){var i=lt(this).val();return null==i?null:lt.isArray(i)?lt.map(i,function(t){return{name:e.name,value:t.replace(je,"\r\n")}}):{name:e.name,value:i.replace(je,"\r\n")}}).get()}}),lt.ajaxSettings.xhr=function(){try{return new i.XMLHttpRequest}catch(t){}};var Ie={0:200,1223:204},Ne=lt.ajaxSettings.xhr();st.cors=!!Ne&&"withCredentials"in Ne,st.ajax=Ne=!!Ne,lt.ajaxTransport(function(t){var e,n;if(st.cors||Ne&&!t.crossDomain)return{send:function(r,a){var o,s=t.xhr();if(s.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(o in t.xhrFields)s[o]=t.xhrFields[o];t.mimeType&&s.overrideMimeType&&s.overrideMimeType(t.mimeType),t.crossDomain||r["X-Requested-With"]||(r["X-Requested-With"]="XMLHttpRequest");for(o in r)s.setRequestHeader(o,r[o]);e=function(t){return function(){e&&(e=n=s.onload=s.onerror=s.onabort=s.onreadystatechange=null,"abort"===t?s.abort():"error"===t?"number"!=typeof s.status?a(0,"error"):a(s.status,s.statusText):a(Ie[s.status]||s.status,s.statusText,"text"!==(s.responseType||"text")||"string"!=typeof s.responseText?{binary:s.response}:{text:s.responseText},s.getAllResponseHeaders()))}},s.onload=e(),n=s.onerror=e("error"),void 0!==s.onabort?s.onabort=n:s.onreadystatechange=function(){4===s.readyState&&i.setTimeout(function(){e&&n()})},e=e("abort");try{s.send(t.hasContent&&t.data||null)}catch(t){if(e)throw t}},abort:function(){e&&e()}}}),lt.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(t){return lt.globalEval(t),t}}}),lt.ajaxPrefilter("script",function(t){void 0===t.cache&&(t.cache=!1),t.crossDomain&&(t.type="GET")}),lt.ajaxTransport("script",function(t){if(t.crossDomain){var e,i;return{send:function(n,r){e=lt("