Elimination of included toastr; use node_module.

This commit is contained in:
Dannon Baker
2019-04-01 11:25:26 -04:00
parent d538dc05b8
commit d8f2c6e2ff
19 changed files with 26 additions and 323 deletions
-1
View File
@@ -9,7 +9,6 @@
"homepage": "usegalaxy.org",
"dependencies": {
"farbtastic": "~2.0.0-alpha.1",
"toastr": "~2.1.0",
"jquery-form": "~3.46.0",
"jquery-autocomplete": "git://github.com/dyve/jquery-autocomplete",
"select2": "~3.5.2",
+1 -1
View File
@@ -8,7 +8,7 @@ import Backbone from "backbone";
import { getAppRoot } from "onload/loadConfig";
import { getGalaxyInstance } from "app";
// import mod_utils from "utils/utils";
import mod_toastr from "libs/toastr";
import mod_toastr from "toastr";
import mod_baseMVC from "mvc/base-mvc";
// import mod_library_model from "mvc/library/library-model";
import mod_folderlist_view from "mvc/library/library-folderlist-view";
-307
View File
@@ -1,307 +0,0 @@
/*
* Toastr
* Version 2.0.1
* Copyright 2012 John Papa and Hans Fjällemark.
* All Rights Reserved.
* Use, reproduction, distribution, and modification of this code is subject to the terms and
* conditions of the MIT license, available at http://www.opensource.org/licenses/mit-license.php
*
* Author: John Papa and Hans Fjällemark
* Project: https://github.com/CodeSeven/toastr
*/
; (function (define) {
define([], function () {
var $ = jQuery;
return (function () {
var version = '2.0.1';
var $container;
var listener;
var toastId = 0;
var toastType = {
error: 'error',
info: 'info',
success: 'success',
warning: 'warning'
};
var toastr = {
clear: clear,
error: error,
getContainer: getContainer,
info: info,
options: {},
subscribe: subscribe,
success: success,
version: version,
warning: warning
};
return toastr;
//#region Accessible Methods
function error(message, title, optionsOverride) {
return notify({
type: toastType.error,
iconClass: getOptions().iconClasses.error,
message: message,
optionsOverride: optionsOverride,
title: title
});
}
function info(message, title, optionsOverride) {
return notify({
type: toastType.info,
iconClass: getOptions().iconClasses.info,
message: message,
optionsOverride: optionsOverride,
title: title
});
}
function subscribe(callback) {
listener = callback;
}
function success(message, title, optionsOverride) {
return notify({
type: toastType.success,
iconClass: getOptions().iconClasses.success,
message: message,
optionsOverride: optionsOverride,
title: title
});
}
function warning(message, title, optionsOverride) {
return notify({
type: toastType.warning,
iconClass: getOptions().iconClasses.warning,
message: message,
optionsOverride: optionsOverride,
title: title
});
}
function clear($toastElement) {
var options = getOptions();
if (!$container) { getContainer(options); }
if ($toastElement && $(':focus', $toastElement).length === 0) {
$toastElement[options.hideMethod]({
duration: options.hideDuration,
easing: options.hideEasing,
complete: function () { removeToast($toastElement); }
});
return;
}
if ($container.children().length) {
$container[options.hideMethod]({
duration: options.hideDuration,
easing: options.hideEasing,
complete: function () { $container.remove(); }
});
}
}
//#endregion
//#region Internal Methods
function getDefaults() {
return {
tapToDismiss: true,
toastClass: 'toast',
containerId: 'toast-container',
debug: false,
showMethod: 'fadeIn', //fadeIn, slideDown, and show are built into jQuery
showDuration: 300,
showEasing: 'swing', //swing and linear are built into jQuery
onShown: undefined,
hideMethod: 'fadeOut',
hideDuration: 1000,
hideEasing: 'swing',
onHidden: undefined,
extendedTimeOut: 1000,
iconClasses: {
error: 'toast-error',
info: 'toast-info',
success: 'toast-success',
warning: 'toast-warning'
},
iconClass: 'toast-info',
positionClass: 'toast-top-right',
timeOut: 5000, // Set timeOut and extendedTimeout to 0 to make it sticky
titleClass: 'toast-title',
messageClass: 'toast-message',
target: 'body',
closeHtml: '<button>&times;</button>',
newestOnTop: true
};
}
function publish(args) {
if (!listener) {
return;
}
listener(args);
}
function notify(map) {
var
options = getOptions(),
iconClass = map.iconClass || options.iconClass;
if (typeof (map.optionsOverride) !== 'undefined') {
options = $.extend(options, map.optionsOverride);
iconClass = map.optionsOverride.iconClass || iconClass;
}
toastId++;
$container = getContainer(options);
var
intervalId = null,
$toastElement = $('<div/>'),
$titleElement = $('<div/>'),
$messageElement = $('<div/>'),
$closeElement = $(options.closeHtml),
response = {
toastId: toastId,
state: 'visible',
startTime: new Date(),
options: options,
map: map
};
if (map.iconClass) {
$toastElement.addClass(options.toastClass).addClass(iconClass);
}
if (map.title) {
$titleElement.append(map.title).addClass(options.titleClass);
$toastElement.append($titleElement);
}
if (map.message) {
$messageElement.append(map.message).addClass(options.messageClass);
$toastElement.append($messageElement);
}
if (options.closeButton) {
$closeElement.addClass('toast-close-button');
$toastElement.prepend($closeElement);
}
$toastElement.hide();
if (options.newestOnTop) {
$container.prepend($toastElement);
} else {
$container.append($toastElement);
}
$toastElement[options.showMethod](
{ duration: options.showDuration, easing: options.showEasing, complete: options.onShown }
);
if (options.timeOut > 0) {
intervalId = setTimeout(hideToast, options.timeOut);
}
$toastElement.hover(stickAround, delayedhideToast);
if (!options.onclick && options.tapToDismiss) {
$toastElement.click(hideToast);
}
if (options.closeButton && $closeElement) {
$closeElement.click(function (event) {
event.stopPropagation();
hideToast(true);
});
}
if (options.onclick) {
$toastElement.click(function () {
options.onclick();
hideToast();
});
}
publish(response);
if (options.debug && console) {
console.log(response);
}
return $toastElement;
function hideToast(override) {
if ($(':focus', $toastElement).length && !override) {
return;
}
return $toastElement[options.hideMethod]({
duration: options.hideDuration,
easing: options.hideEasing,
complete: function () {
removeToast($toastElement);
if (options.onHidden) {
options.onHidden();
}
response.state = 'hidden';
response.endTime = new Date(),
publish(response);
}
});
}
function delayedhideToast() {
if (options.timeOut > 0 || options.extendedTimeOut > 0) {
intervalId = setTimeout(hideToast, options.extendedTimeOut);
}
}
function stickAround() {
clearTimeout(intervalId);
$toastElement.stop(true, true)[options.showMethod](
{ duration: options.showDuration, easing: options.showEasing }
);
}
}
function getContainer(options) {
if (!options) { options = getOptions(); }
$container = $('#' + options.containerId);
if ($container.length) {
return $container;
}
$container = $('<div/>')
.attr('id', options.containerId)
.addClass(options.positionClass);
$container.appendTo($(options.target));
return $container;
}
function getOptions() {
return $.extend({}, getDefaults(), toastr.options);
}
function removeToast($toastElement) {
if (!$container) { $container = getContainer(); }
if ($toastElement.is(':visible')) {
return;
}
$toastElement.remove();
$toastElement = null;
if ($container.children().length === 0) {
$container.remove();
}
}
//#endregion
})();
});
}(typeof define === 'function' && define.amd ? define : function (deps, factory) {
if (typeof module !== 'undefined' && module.exports) { //Node
module.exports = factory(require(deps[0]));
} else {
window['toastr'] = factory(window['jQuery']);
}
}));
@@ -4,7 +4,7 @@ import Backbone from "backbone";
import { getAppRoot } from "onload/loadConfig";
import { getGalaxyInstance } from "app";
import _l from "utils/localization";
import mod_toastr from "libs/toastr";
import mod_toastr from "toastr";
import mod_library_model from "mvc/library/library-model";
import mod_utils from "utils/utils";
import mod_select from "mvc/ui/ui-select";
@@ -3,7 +3,7 @@ import $ from "jquery";
import Backbone from "backbone";
import { getGalaxyInstance } from "app";
import { getAppRoot } from "onload/loadConfig";
import mod_toastr from "libs/toastr";
import mod_toastr from "toastr";
import mod_library_model from "mvc/library/library-model";
import mod_select from "mvc/ui/ui-select";
@@ -1,7 +1,7 @@
import $ from "jquery";
import _ from "underscore";
import Backbone from "backbone";
import mod_toastr from "libs/toastr";
import mod_toastr from "toastr";
import mod_library_model from "mvc/library/library-model";
import mod_library_folderrow_view from "mvc/library/library-folderrow-view";
import { getGalaxyInstance } from "app";
@@ -3,7 +3,7 @@ import $ from "jquery";
import Backbone from "backbone";
import { getAppRoot } from "onload/loadConfig";
import { getGalaxyInstance } from "app";
import mod_toastr from "libs/toastr";
import mod_toastr from "toastr";
import mod_library_model from "mvc/library/library-model";
import mod_library_dataset_view from "mvc/library/library-dataset-view";
@@ -5,7 +5,7 @@ import { getAppRoot } from "onload/loadConfig";
import { getGalaxyInstance } from "app";
import _l from "utils/localization";
import mod_utils from "utils/utils";
import mod_toastr from "libs/toastr";
import mod_toastr from "toastr";
import mod_library_model from "mvc/library/library-model";
import mod_select from "mvc/ui/ui-select";
import LIST_CREATOR from "mvc/collection/list-collection-creator";
@@ -3,7 +3,7 @@ import $ from "jquery";
import Backbone from "backbone";
import { getAppRoot } from "onload/loadConfig";
import { getGalaxyInstance } from "app";
import mod_toastr from "libs/toastr";
import mod_toastr from "toastr";
import mod_library_model from "mvc/library/library-model";
import mod_select from "mvc/ui/ui-select";
@@ -2,7 +2,7 @@ import $ from "jquery";
import _ from "libs/underscore";
import Backbone from "backbone";
import { getGalaxyInstance } from "app";
import mod_toastr from "libs/toastr";
import mod_toastr from "toastr";
import mod_library_model from "mvc/library/library-model";
import mod_library_libraryrow_view from "mvc/library/library-libraryrow-view";
@@ -1,7 +1,7 @@
import _ from "underscore";
import $ from "jquery";
import Backbone from "backbone";
import mod_toastr from "libs/toastr";
import mod_toastr from "toastr";
import { getGalaxyInstance } from "app";
// galaxy library row view
@@ -2,7 +2,7 @@ import _ from "underscore";
import $ from "jquery";
import Backbone from "backbone";
import _l from "utils/localization";
import mod_toastr from "libs/toastr";
import mod_toastr from "toastr";
import mod_library_model from "mvc/library/library-model";
import { getGalaxyInstance } from "app";
@@ -1,6 +1,6 @@
import $ from "jquery";
import * as Toastr from "libs/toastr";
import * as Toastr from "toastr";
function Connector(handle1, handle2) {
this.canvas = null;
@@ -1,6 +1,6 @@
import $ from "jquery";
import Connector from "mvc/workflow/workflow-connector";
import * as Toastr from "libs/toastr";
import * as Toastr from "toastr";
class Workflow {
constructor(app, canvas_container) {
@@ -4,7 +4,7 @@ import $ from "jquery";
import Backbone from "backbone";
import { getAppRoot } from "onload/loadConfig";
import { getGalaxyInstance } from "app";
import * as mod_toastr from "libs/toastr";
import * as mod_toastr from "toastr";
import WORKFLOWS from "mvc/workflow/workflow-model";
import QueryStringParsing from "utils/query-string-parsing";
import _l from "utils/localization";
@@ -1,7 +1,7 @@
import $ from "jquery";
import _ from "underscore";
import Backbone from "backbone";
import * as mod_toastr from "libs/toastr";
import * as mod_toastr from "toastr";
import mod_group_model from "toolshed/groups/group-model";
// toolshed group detail view
@@ -1,7 +1,7 @@
import $ from "jquery";
import _ from "underscore";
import Backbone from "backbone";
import * as mod_toastr from "libs/toastr";
import * as mod_toastr from "toastr";
import mod_group_model from "toolshed/groups/group-model";
import mod_group_row from "toolshed/groups/group-listrow-view";
const GroupListView = Backbone.View.extend({
+1
View File
@@ -40,6 +40,7 @@
"requirejs": "2.3.6",
"rxjs": "^6.4.0",
"slugify": "^1.3.4",
"toastr": "^2.1.4",
"underscore": "^1.9.1",
"vue": "^2.6.10",
"vue-router": "^3.0.2",
+10
View File
@@ -7435,6 +7435,10 @@ jquery@2:
resolved "https://registry.yarnpkg.com/jquery/-/jquery-2.2.4.tgz#2c89d6889b5eac522a7eea32c14521559c6cbf02"
integrity sha1-LInWiJterFIqfuoywUUhVZxsvwI=
jquery@>=1.12.0:
version "3.2.1"
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.2.1.tgz#5c4d9de652af6cd0a770154a631bba12b015c787"
jquery@^3.0.0:
version "3.3.1"
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.3.1.tgz#958ce29e81c9790f31be7792df5d4d95fc57fbca"
@@ -12899,6 +12903,12 @@ to-through@^2.0.0:
dependencies:
through2 "^2.0.3"
toastr@^2.1.4:
version "2.1.4"
resolved "https://registry.yarnpkg.com/toastr/-/toastr-2.1.4.tgz#8b43be64fb9d0c414871446f2db8e8ca4e95f181"
dependencies:
jquery ">=1.12.0"
token-stream@0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/token-stream/-/token-stream-0.0.1.tgz#ceeefc717a76c4316f126d0b9dbaa55d7e7df01a"