mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-28 02:58:18 +08:00
Simplified loading jquery, referenced npm modules when present
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
import * as Backbone from "backbone";
|
||||
import * as _ from "underscore";
|
||||
/* global Galaxy */
|
||||
|
||||
import _l from "utils/localization";
|
||||
import jQuery from "jquery";
|
||||
var $ = jQuery;
|
||||
import GalaxyApp from "galaxy";
|
||||
import AdminPanel from "./panels/admin-panel";
|
||||
import FormWrapper from "mvc/form/form-wrapper";
|
||||
@@ -15,8 +13,6 @@ import DataTables from "components/admin/DataTables.vue";
|
||||
import DataTypes from "components/admin/DataTypes.vue";
|
||||
import Vue from "vue";
|
||||
|
||||
/* global Galaxy */
|
||||
|
||||
window.app = function app(options, bootstrapped) {
|
||||
window.Galaxy = new GalaxyApp.GalaxyApp(options, bootstrapped);
|
||||
Galaxy.debug("admin app");
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import $ from "jquery";
|
||||
import "bootstrap";
|
||||
import * as _ from "underscore";
|
||||
/* global Galaxy, $, _ */
|
||||
import GalaxyApp from "galaxy";
|
||||
import Router from "layout/router";
|
||||
import ToolPanel from "./panels/tool-panel";
|
||||
@@ -30,8 +28,6 @@ import Citations from "components/Citations.vue";
|
||||
import DisplayStructure from "components/DisplayStructured.vue";
|
||||
import Vue from "vue";
|
||||
|
||||
/* global Galaxy */
|
||||
|
||||
/** define the 'Analyze Data'/analysis/main/home page for Galaxy
|
||||
* * has a masthead
|
||||
* * a left tool menu to allow the user to load tools in the center panel
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import $ from "jquery";
|
||||
/* global Galaxy, $ */
|
||||
import "bootstrap";
|
||||
import GalaxyApp from "galaxy";
|
||||
import WorkflowView from "mvc/workflow/workflow-view";
|
||||
@@ -26,8 +26,6 @@ import LegacyGridView from "legacy/grid/grid-view";
|
||||
import * as run_stats from "reports/run_stats";
|
||||
import ToolshedGroups from "toolshed/toolshed.groups";
|
||||
|
||||
/* global Galaxy */
|
||||
|
||||
if (window.Galaxy && window.Galaxy.debug === undefined) {
|
||||
//TODO: (kind of a temporary hack?) Must have Galaxy.logging for some of the imports
|
||||
//here; remove when imports are all fixed.
|
||||
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
/* eslint-env commonjs */
|
||||
|
||||
// Having a hard time making this work with standard es6 import/exports
|
||||
var $ = require("jqueryVendor");
|
||||
|
||||
// Eww....
|
||||
require("libs/jquery/jquery.migrate");
|
||||
require("libs/jquery/jquery.autocomplete");
|
||||
require("libs/jquery/jquery.event.hover");
|
||||
require("libs/jquery/jquery.event.drag");
|
||||
require("libs/jquery/jquery.mousewheel");
|
||||
require("libs/jquery/jquery.form");
|
||||
require("libs/jquery/jquery.rating");
|
||||
require("libs/jquery/select2");
|
||||
require("libs/jquery/jquery-ui");
|
||||
|
||||
// THIS ONE IS REALLY BAD, probably replace it, see if there's a more grown-up
|
||||
// version or just refactor it out since there's really no sensible reason for
|
||||
// an unholy marriage between localstorage and jquery
|
||||
require("libs/jquery/jstorage");
|
||||
|
||||
require("libs/farbtastic");
|
||||
require("libs/jquery/jquery.dynatree");
|
||||
|
||||
module.exports = $;
|
||||
@@ -1,11 +1,8 @@
|
||||
import * as Backbone from "backbone";
|
||||
/* global Backbone, $, Galaxy */
|
||||
import Menu from "layout/menu";
|
||||
import Scratchbook from "layout/scratchbook";
|
||||
import QuotaMeter from "mvc/user/user-quotameter";
|
||||
|
||||
/* global Galaxy */
|
||||
/* global $ */
|
||||
|
||||
/** Masthead **/
|
||||
var View = Backbone.View.extend({
|
||||
initialize: function(options) {
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
/* global Backbone, $, _, Galaxy */
|
||||
|
||||
/** Masthead Collection **/
|
||||
import * as Backbone from "backbone";
|
||||
import * as _ from "underscore";
|
||||
import _l from "utils/localization";
|
||||
import { CommunicationServerView } from "layout/communication-server-view";
|
||||
import Webhooks from "mvc/webhooks";
|
||||
import _l from "utils/localization";
|
||||
import Utils from "utils/utils";
|
||||
|
||||
/* global Galaxy */
|
||||
/* global $ */
|
||||
|
||||
var Collection = Backbone.Collection.extend({
|
||||
model: Backbone.Model.extend({
|
||||
defaults: {
|
||||
|
||||
@@ -1,14 +1,24 @@
|
||||
// ============================================================================
|
||||
// Globals (temporary)
|
||||
// ============================================================================
|
||||
// HACK: add these to global scope until we stop asking for them there...
|
||||
// Via webpack: these are required here automatically by the provider plugin
|
||||
// Via script tag: these are redundant (identities) since they're already global
|
||||
// window["jQuery"] = jQuery; // a weird form to prevent webpack from sub'ing 'window.jQuery' in the provider plugin
|
||||
// window.$ = jQuery;
|
||||
// window._ = _;
|
||||
// window.Backbone = Backbone;
|
||||
// console.debug('globals loaded:', window.jQuery, window.Backbone, '...');
|
||||
/* global $, _, Galaxy */
|
||||
|
||||
// Jquery and all its horrible plugins
|
||||
import "jquery-migrate";
|
||||
import "libs/jquery/jquery.autocomplete";
|
||||
import "libs/jquery/jquery.event.hover";
|
||||
import "libs/jquery/jquery.event.drag";
|
||||
import "jquery-mousewheel";
|
||||
import "libs/jquery/jquery.form";
|
||||
import "libs/jquery/jquery.rating";
|
||||
import "libs/jquery/select2";
|
||||
import "jquery-ui";
|
||||
import "libs/jquery/jstorage";
|
||||
import "libs/farbtastic";
|
||||
import "jquery.cookie";
|
||||
import "libs/jquery/jquery.dynatree";
|
||||
import "jquery.complexify";
|
||||
|
||||
// Bootstrap overwrites .tooltip() method, so load it after jquery-ui
|
||||
import "bootstrap";
|
||||
import "bootstrap-tour";
|
||||
|
||||
// these are galaxy globals not defined in the provider (although they could be - but why encourage that?)
|
||||
import Panel from "layout/panel";
|
||||
@@ -46,7 +56,8 @@ function replace_big_select_inputs(min_length, max_length, select_elts) {
|
||||
}
|
||||
|
||||
// To do replace, the select2 plugin must be loaded.
|
||||
if (!jQuery.fn.select2) {
|
||||
if (!$.fn.select2) {
|
||||
console.warn("No select 2");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -60,7 +71,7 @@ function replace_big_select_inputs(min_length, max_length, select_elts) {
|
||||
|
||||
select_elts = select_elts || $("select");
|
||||
|
||||
select_elts.each(function () {
|
||||
select_elts.each(function() {
|
||||
var select_elt = $(this).not("[multiple]");
|
||||
// Make sure that options is within range.
|
||||
var num_options = select_elt.find("option").length;
|
||||
@@ -87,7 +98,7 @@ function replace_big_select_inputs(min_length, max_length, select_elts) {
|
||||
function init_refresh_on_change() {
|
||||
$("select[refresh_on_change='true']")
|
||||
.off("change")
|
||||
.change(function () {
|
||||
.change(function() {
|
||||
var select_field = $(this);
|
||||
var select_val = select_field.val();
|
||||
var ref_on_change_vals = select_field.attr("refresh_on_change_values");
|
||||
@@ -109,7 +120,7 @@ function init_refresh_on_change() {
|
||||
// checkboxes refresh on change
|
||||
$(":checkbox[refresh_on_change='true']")
|
||||
.off("click")
|
||||
.click(function () {
|
||||
.click(function() {
|
||||
var select_field = $(this);
|
||||
var select_val = select_field.val();
|
||||
var ref_on_change_vals = select_field.attr("refresh_on_change_values");
|
||||
@@ -130,7 +141,7 @@ function init_refresh_on_change() {
|
||||
// Links with confirmation
|
||||
$("a[confirm]")
|
||||
.off("click")
|
||||
.click(function () {
|
||||
.click(function() {
|
||||
return confirm($(this).attr("confirm"));
|
||||
});
|
||||
}
|
||||
@@ -158,7 +169,7 @@ $(document).ready(() => {
|
||||
|
||||
// If galaxy_main frame does not exist and link targets galaxy_main,
|
||||
// add use_panels=True and set target to self.
|
||||
$("a").click(function () {
|
||||
$("a").click(function() {
|
||||
var anchor = $(this);
|
||||
var galaxy_main_exists = window.parent.frames && window.parent.frames.galaxy_main;
|
||||
if (anchor.attr("target") == "galaxy_main" && !galaxy_main_exists) {
|
||||
@@ -183,7 +194,7 @@ $(document).ready(() => {
|
||||
// Load all webhooks with the type 'onload'
|
||||
Webhooks.load({
|
||||
type: "onload",
|
||||
callback: function (webhooks) {
|
||||
callback: function(webhooks) {
|
||||
webhooks.each(model => {
|
||||
var webhook = model.toJSON();
|
||||
if (webhook.activate && webhook.script) {
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@
|
||||
"jquery": "2",
|
||||
"jquery-migrate": "~1.4",
|
||||
"jquery-mousewheel": "^3.1.13",
|
||||
"jquery-ui-bundle": "^1.12.1",
|
||||
"jquery-ui": "^1.12.1",
|
||||
"jquery.complexify": "^0.5.2",
|
||||
"jquery.cookie": "^1.4.1",
|
||||
"latex-parser": "^0.6.2",
|
||||
|
||||
@@ -55,9 +55,7 @@ let buildconfig = {
|
||||
resolve: {
|
||||
modules: [scriptsBase, "node_modules"],
|
||||
alias: {
|
||||
vue: "vue/dist/vue.js",
|
||||
jquery$: path.resolve(__dirname, "galaxy/scripts/jquery-custom.js"),
|
||||
jqueryVendor$: path.resolve(__dirname, "node_modules/jquery/dist/jquery.js")
|
||||
vue: "vue/dist/vue.js"
|
||||
}
|
||||
},
|
||||
optimization: {
|
||||
@@ -73,24 +71,6 @@ let buildconfig = {
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
// Manual shimming for standard, horrible, jquery plugins
|
||||
{
|
||||
test: /jquery\.(migrate|autocomplete|event\.hover|event\.drag|form|rating|dynatree)/,
|
||||
use: "imports-loader?jQuery=jqueryVendor"
|
||||
},
|
||||
{
|
||||
test: /(select2|jstorage|farbtastic)/,
|
||||
use: "imports-loader?jQuery=jqueryVendor"
|
||||
},
|
||||
{
|
||||
test: /jquery-ui\.js/,
|
||||
use: "imports-loader?jQuery=jqueryVendor"
|
||||
},
|
||||
// Even MORE special handling!
|
||||
{
|
||||
test: /jquery\.mousewheel/,
|
||||
use: "imports-loader?define=>false,jQuery=jqueryVendor"
|
||||
},
|
||||
{
|
||||
test: /\.vue$/,
|
||||
loader: "vue-loader",
|
||||
|
||||
+3
-3
@@ -6885,10 +6885,10 @@ jquery-mousewheel@^3.1.13:
|
||||
resolved "https://registry.yarnpkg.com/jquery-mousewheel/-/jquery-mousewheel-3.1.13.tgz#06f0335f16e353a695e7206bf50503cb523a6ee5"
|
||||
integrity sha1-BvAzXxbjU6aV5yBr9QUDy1I6buU=
|
||||
|
||||
jquery-ui-bundle@^1.12.1:
|
||||
jquery-ui@^1.12.1:
|
||||
version "1.12.1"
|
||||
resolved "https://registry.yarnpkg.com/jquery-ui-bundle/-/jquery-ui-bundle-1.12.1.tgz#d6be2e4c377494e2378b1cae2920a91d1182d8c4"
|
||||
integrity sha1-1r4uTDd0lOI3ixyuKSCpHRGC2MQ=
|
||||
resolved "https://registry.yarnpkg.com/jquery-ui/-/jquery-ui-1.12.1.tgz#bcb4045c8dd0539c134bc1488cdd3e768a7a9e51"
|
||||
integrity sha1-vLQEXI3QU5wTS8FIjN0+dop6nlE=
|
||||
|
||||
jquery.complexify@^0.5.2:
|
||||
version "0.5.2"
|
||||
|
||||
Reference in New Issue
Block a user