Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/dev' into admin_data_tables_vue
Browse files Browse the repository at this point in the history
  • Loading branch information
dannon committed Dec 11, 2017
2 parents fe8c009 + 3d98924 commit 0e13c14
Show file tree
Hide file tree
Showing 47 changed files with 640 additions and 455 deletions.
2 changes: 1 addition & 1 deletion client/galaxy/scripts/apps/analysis.js
Expand Up @@ -76,7 +76,7 @@ window.app = function app(options, bootstrapped) {

show_tours: function(tour_id) {
if (tour_id) {
Tours.giveTour(tour_id);
Tours.giveTourById(tour_id);
} else {
this.page.display(new Tours.ToursView());
}
Expand Down
2 changes: 1 addition & 1 deletion client/galaxy/scripts/apps/panels/tool-panel.js
Expand Up @@ -59,7 +59,7 @@ var ToolPanel = Backbone.View.extend({
self.$("#internal-workflows").append(
self._templateAllWorkflow({
title: _l("All workflows"),
href: "workflow"
href: "workflows/list"
})
);
_.each(this.stored_workflow_menu_entries, menu_entry => {
Expand Down
82 changes: 53 additions & 29 deletions client/galaxy/scripts/mvc/tours.js
Expand Up @@ -4,7 +4,10 @@ import _l from "utils/localization";
* rendering a tour menu.
*/

import * as BootstrapTour from "libs/bootstrap-tour";
// bootstrap-tour configures a window.Tour object; keep a local ref.
import "libs/bootstrap-tour";
let Tour = window.Tour;

var gxy_root = typeof Galaxy === "undefined" ? "/" : Galaxy.root;

var tourpage_template = `<h2>Galaxy Tours</h2>
Expand Down Expand Up @@ -93,31 +96,8 @@ var Tours = Backbone.Collection.extend({
model: TourItem
});

var giveTour = tour_id => {
var url = `${gxy_root}api/tours/${tour_id}`;
$.getJSON(url, data => {
// Set hooks for additional click and data entry actions.
var tourdata = hooked_tour_from_data(data);
sessionStorage.setItem("activeGalaxyTour", JSON.stringify(data));
// Store tour steps in sessionStorage to easily persist w/o hackery.
var tour = new Tour(
_.extend(
{
steps: tourdata.steps
},
tour_opts
)
);
// Always clean restart, since this is a new, explicit giveTour execution.
tour.init();
tour.goTo(0);
tour.restart();
});
};

var ToursView = Backbone.View.extend({
export var ToursView = Backbone.View.extend({
title: _l("Tours"),
// initialize
initialize: function() {
var self = this;
this.setElement("<div/>");
Expand Down Expand Up @@ -165,7 +145,7 @@ var ToursView = Backbone.View.extend({
)
.on("click", ".tourItem", function(e) {
e.preventDefault();
giveTour($(this).data("tour.id"));
giveTourById($(this).data("tour.id"));
})
.on("click", ".tag-selector-button", e => {
var elem = $(e.target);
Expand All @@ -183,9 +163,53 @@ var ToursView = Backbone.View.extend({
}
});

export function giveTourWithData(data) {
let hookedTourData = hooked_tour_from_data(data);
sessionStorage.setItem("activeGalaxyTour", JSON.stringify(data));
// Store tour steps in sessionStorage to easily persist w/o hackery.
let tour = new Tour(_.extend({ steps: hookedTourData.steps }, tour_opts));
// Always clean restart, since this is a new, explicit execution.
tour.init();
tour.goTo(0);
tour.restart();
return tour;
}

export function giveTourById(tour_id) {
var url = `${gxy_root}api/tours/${tour_id}`;
$.getJSON(url, data => {
giveTourWithData(data);
});
}

export function activeGalaxyTourRunner() {
var et = JSON.parse(sessionStorage.getItem("activeGalaxyTour"));
if (et) {
et = hooked_tour_from_data(et);
if (et && et.steps) {
if (window && window.self === window.top) {
// Only kick off a new tour if this is the toplevel window (non-iframe). This
// functionality actually *could* be useful, but we'd need to handle it better and
// come up with some design guidelines for tours jumping between windows.
// Disabling for now.
var tour = new Tour(
_.extend(
{
steps: et.steps
},
tour_opts
)
);
tour.init();
tour.restart();
}
}
}
}

export default {
ToursView: ToursView,
hooked_tour_from_data: hooked_tour_from_data,
tour_opts: tour_opts,
giveTour: giveTour
giveTourWithData: giveTourWithData,
giveTourById: giveTourById,
activeGalaxyTourRunner: activeGalaxyTourRunner
};
5 changes: 4 additions & 1 deletion client/galaxy/scripts/mvc/workflow/workflow-canvas.js
Expand Up @@ -106,7 +106,10 @@ $.extend(CanvasManager.prototype, {
// If it appears that the user is trying to copy/paste text, we
// pass that through.
if (window.getSelection().toString() === "") {
if (this.app.workflow.active_node) {
if (
this.app.workflow.active_node &&
this.app.workflow.active_node.type !== "subworkflow"
) {
e.clipboardData.setData(
"application/json",
JSON.stringify({
Expand Down
22 changes: 12 additions & 10 deletions client/galaxy/scripts/mvc/workflow/workflow-terminals.js
Expand Up @@ -8,10 +8,10 @@ function CollectionTypeDescription(collectionType) {

var NULL_COLLECTION_TYPE_DESCRIPTION = {
isCollection: false,
canMatch: function(other) {
canMatch: function() {
return false;
},
canMapOver: function(other) {
canMapOver: function() {
return false;
},
toString: function() {
Expand All @@ -30,13 +30,13 @@ var ANY_COLLECTION_TYPE_DESCRIPTION = {
canMatch: function(other) {
return NULL_COLLECTION_TYPE_DESCRIPTION !== other;
},
canMapOver: function(other) {
canMapOver: function() {
return false;
},
toString: function() {
return "AnyCollectionType[]";
},
append: function(otherCollectionType) {
append: function() {
throw "Cannot append to ANY_COLLECTION_TYPE_DESCRIPTION";
},
equal: function(other) {
Expand All @@ -50,7 +50,7 @@ $.extend(CollectionTypeDescription.prototype, {
return this;
}
if (otherCollectionTypeDescription === ANY_COLLECTION_TYPE_DESCRIPTION) {
return otherCollectionType;
return otherCollectionTypeDescription;
}
return new CollectionTypeDescription(`${this.collectionType}:${otherCollectionTypeDescription.collectionType}`);
},
Expand Down Expand Up @@ -143,7 +143,9 @@ var Terminal = Backbone.Model.extend({
},
destroyInvalidConnections: function() {
_.each(this.connectors, connector => {
connector && connector.destroyIfInvalid();
if (connector) {
connector.destroyIfInvalid();
}
});
},
setMapOver: function(val) {
Expand Down Expand Up @@ -258,7 +260,7 @@ var BaseInputTerminal = Terminal.extend({
if (this._collectionAttached()) {
// Can only attach one collection to multiple input
// data parameter.
inputsFilled = true;
inputFilled = true;
} else {
inputFilled = false;
}
Expand Down Expand Up @@ -317,17 +319,17 @@ var BaseInputTerminal = Terminal.extend({
if (thisDatatype == "input") {
return true;
}
var cat_outputs = new Array();
var cat_outputs = [];
cat_outputs = cat_outputs.concat(other.datatypes);
if (other.node.post_job_actions) {
for (var pja_i in other.node.post_job_actions) {
var pja = other.node.post_job_actions[pja_i];
if (
pja.action_type == "ChangeDatatypeAction" &&
(pja.output_name == "" || pja.output_name == other.name) &&
(pja.output_name === "" || pja.output_name == other.name) &&
pja.action_arguments
) {
cat_outputs.push(pja.action_arguments["newtype"]);
cat_outputs.push(pja.action_arguments.newtype);
}
}
}
Expand Down
16 changes: 9 additions & 7 deletions client/galaxy/scripts/mvc/workflow/workflow-view.js
Expand Up @@ -764,13 +764,15 @@ export default Backbone.View.extend({
// Fix width to computed width
// Now add floats
var buttons = $("<div class='buttons' style='float: right;'></div>");
buttons.append(
$("<div/>")
.addClass("fa-icon-button fa fa-files-o")
.click(e => {
node.clone();
})
);
if (type !== "subworkflow") {
buttons.append(
$("<div/>")
.addClass("fa-icon-button fa fa-files-o")
.click(e => {
node.clone();
})
);
}
buttons.append(
$("<div/>")
.addClass("fa-icon-button fa fa-times")
Expand Down
71 changes: 23 additions & 48 deletions client/galaxy/scripts/onload.js
Expand Up @@ -19,13 +19,12 @@ import layout_modal from "layout/modal";
_.extend(window, layout_modal);
import async_save_text from "utils/async-save-text";
window.async_save_text = async_save_text;
import POPUPMENU from "ui/popupmenu";
window.make_popupmenu = POPUPMENU.make_popupmenu;
window.make_popup_menus = POPUPMENU.make_popup_menus;
import Popupmenu from "ui/popupmenu";
window.make_popupmenu = Popupmenu.make_popupmenu;
window.make_popup_menus = Popupmenu.make_popup_menus;
import init_tag_click_function from "ui/autocom_tagging";
window.init_tag_click_function = init_tag_click_function;
import TOURS from "mvc/tours";
import QUERY_STRING from "utils/query-string-parsing";
import Tours from "mvc/tours";
// console.debug( 'galaxy globals loaded' );

// ============================================================================
Expand Down Expand Up @@ -89,10 +88,7 @@ function init_refresh_on_change() {
.change(function() {
var select_field = $(this);
var select_val = select_field.val();
var refresh = false;

var ref_on_change_vals = select_field.attr("refresh_on_change_values");

if (ref_on_change_vals) {
ref_on_change_vals = ref_on_change_vals.split(",");
var last_selected_value = select_field.attr("last_selected_value");
Expand All @@ -114,10 +110,7 @@ function init_refresh_on_change() {
.click(function() {
var select_field = $(this);
var select_val = select_field.val();
var refresh = false;

var ref_on_change_vals = select_field.attr("refresh_on_change_values");

if (ref_on_change_vals) {
ref_on_change_vals = ref_on_change_vals.split(",");
var last_selected_value = select_field.attr("last_selected_value");
Expand Down Expand Up @@ -156,7 +149,7 @@ $(document).ready(() => {
$("[title]").tooltip();
}
// Make popup menus.
make_popup_menus();
Popupmenu.make_popup_menus();

// Replace big selects.
replace_big_select_inputs(20, 1500);
Expand All @@ -165,7 +158,7 @@ $(document).ready(() => {
// add use_panels=True and set target to self.
$("a").click(function() {
var anchor = $(this);
var galaxy_main_exists = parent.frames && parent.frames.galaxy_main;
var galaxy_main_exists = window.parent.frames && window.parent.frames.galaxy_main;
if (anchor.attr("target") == "galaxy_main" && !galaxy_main_exists) {
var href = anchor.attr("href");
if (href.indexOf("?") == -1) {
Expand All @@ -180,44 +173,26 @@ $(document).ready(() => {
return anchor;
});

var et = JSON.parse(sessionStorage.getItem("activeGalaxyTour"));
if (et) {
et = TOURS.hooked_tour_from_data(et);
if (et && et.steps) {
if (window && window.self === window.top) {
// Only kick off a new tour if this is the toplevel window (non-iframe). This
// functionality actually *could* be useful, but we'd need to handle it better and
// come up with some design guidelines for tours jumping between windows.
// Disabling for now.
var tour = new Tour(
_.extend(
{
steps: et.steps
},
TOURS.tour_opts
)
);
tour.init();
tour.restart();
}
}
}
Tours.activeGalaxyTourRunner();

function onloadWebhooks() {
if (Galaxy.root !== undefined) {
// Load all webhooks with the type 'onload'
$.getJSON(`${Galaxy.root}api/webhooks/onload/all`, webhooks => {
_.each(webhooks, webhook => {
if (webhook.activate && webhook.script) {
$("<script/>", { type: "text/javascript" })
.text(webhook.script)
.appendTo("head");
$("<style/>", { type: "text/css" })
.text(webhook.styles)
.appendTo("head");
}
// Wait until Galaxy.config is loaded.
if (Galaxy.config) {
if (Galaxy.config.enable_webhooks) {
// Load all webhooks with the type 'onload'
$.getJSON(`${Galaxy.root}api/webhooks/onload/all`, webhooks => {
_.each(webhooks, webhook => {
if (webhook.activate && webhook.script) {
$("<script/>", { type: "text/javascript" })
.text(webhook.script)
.appendTo("head");
$("<style/>", { type: "text/css" })
.text(webhook.styles)
.appendTo("head");
}
});
});
});
}
} else {
setTimeout(onloadWebhooks, 100);
}
Expand Down
Expand Up @@ -6,6 +6,6 @@
# appropriate files.
---
-
image: bgruening/docker-hicbrowser
image: quay.io/bgruening/hicbrowser
description: |
A simple web browser to visualize Hi-C and other genomic tracks
12 changes: 1 addition & 11 deletions config/plugins/webhooks/demo/tour_generator/static/script.js
Expand Up @@ -58,17 +58,7 @@ $(document).ready(function() {
},

_generateTour: function(data) {
var tourData = Tours.default.hooked_tour_from_data(data);
sessionStorage.setItem('activeGalaxyTour', JSON.stringify(data));

// Generate and run the tour
var tour = new Tour(_.extend({
steps: tourData.steps
}));
tour.init();
tour.goTo(0);
tour.restart();

var tour = Tours.giveTourWithData(data);
// Force ending the tour when pressing the Execute button
$('#execute').on('mousedown', function() {
if (tour) {
Expand Down

0 comments on commit 0e13c14

Please sign in to comment.