JS libraries cleanup

- remove obsolete libraries
- update some libraries
- use bower versions of some libraries

Change-Id: If434f18d3133966bf56a89008e392e1cca13aa14
This commit is contained in:
Vitaly Kramskikh 2014-12-25 21:12:47 +03:00
parent 8a64a9df35
commit b564dd3903
10 changed files with 15 additions and 1723 deletions

View File

@ -27,9 +27,9 @@ module.exports = function(grunt) {
baseUrl: '.',
appDir: staticBuildPreparationDir + '/static',
dir: staticBuildDir,
waitSeconds: 60,
optimize: 'uglify2',
optimizeCss: 'standard',
wrapShim: true,
pragmas: {
compressed: true
},
@ -41,6 +41,7 @@ module.exports = function(grunt) {
paths: {
react: 'js/libs/bower/react/js/react-with-addons.min'
},
stubModules: ['jsx'],
modules: [
{
name: 'js/main',

View File

@ -6,12 +6,14 @@
"react": "0.12.1",
"react.backbone": "0.4.0",
"requirejs": "2.1.15",
"requirejs-plugins": "1.0.2",
"requirejs-text": "2.0.10",
"requirejs-plugins": "1.0.3",
"requirejs-text": "2.0.12",
"require-css": "0.1.0",
"jsx-requirejs-plugin": "0.5.1",
"routefilter": "0.2.1",
"lodash": "2.4.1",
"autoNumeric": "1.9.12",
"backbone": "1.1.2",
"backbone.stickit": "0.7.0",
"cocktail": "0.5.7",
"i18next": "1.7.1",

View File

@ -25,7 +25,7 @@
"jshint-stylish": "~0.4.0",
"less": "~1.5.1",
"lodash-node": "~2.4.1",
"requirejs": "~2.1.9",
"requirejs": "~2.1.15",
"uglifyjs": "~2.3.6"
}
}

View File

@ -22,7 +22,6 @@ define(function() {
paths: {
jquery: 'js/libs/bower/jquery/js/jquery',
'jquery-cookie': 'js/libs/bower/jquery-cookie/jquery.cookie',
'jquery-checkbox': 'js/libs/custom/jquery.checkbox',
'jquery-timeout': 'js/libs/custom/jquery.timeout',
'jquery-ui': 'js/libs/custom/jquery-ui-1.10.2.custom',
'jquery-autoNumeric': 'js/libs/bower/autoNumeric/js/autoNumeric',
@ -31,11 +30,11 @@ define(function() {
keystone_client: 'js/keystone_client',
lodash: 'js/libs/bower/lodash/js/lodash.compat',
underscore: 'js/libs/bower/lodash/js/lodash.compat',
backbone: 'js/libs/custom/backbone',
backbone: 'js/libs/bower/backbone/backbone',
'backbone-lodash-monkeypatch': 'js/libs/custom/backbone-lodash-monkeypatch',
react: 'js/libs/bower/react/js/react-with-addons',
JSXTransformer: 'js/libs/bower/react/js/JSXTransformer',
jsx: 'js/libs/custom/jsx',
jsx: 'js/libs/bower/jsx-requirejs-plugin/jsx',
'react.backbone': 'js/libs/bower/react.backbone/react.backbone',
stickit: 'js/libs/bower/backbone.stickit/js/backbone.stickit',
coccyx: 'js/libs/custom/coccyx',
@ -57,16 +56,6 @@ define(function() {
controls: 'js/views/controls'
},
shim: {
underscore: {
exports: '_'
},
backbone: {
deps: ['underscore', 'jquery', 'cocktail'],
exports: 'Backbone',
init: function(_, $, Cocktail) {
Cocktail.patch(Backbone);
}
},
'expression/parser': {
exports: 'parser'
},
@ -77,7 +66,7 @@ define(function() {
deps: ['backbone']
},
coccyx: {
deps: ['backbone'],
deps: ['backbone', 'underscore'],
exports: 'Coccyx'
},
bootstrap: {
@ -92,9 +81,6 @@ define(function() {
'jquery-cookie': {
deps: ['jquery']
},
'jquery-checkbox': {
deps: ['jquery']
},
'jquery-timeout': {
deps: ['jquery']
},

File diff suppressed because it is too large Load Diff

View File

@ -1,55 +0,0 @@
/**
* jQuery custom checkboxes
*
* Copyright (c) 2008 Khavilo Dmitry (http://widowmaker.kiev.ua/checkbox/)
* Licensed under the MIT License:
* http://www.opensource.org/licenses/mit-license.php
*
* @version 1.3.0 Beta 1
* @author Khavilo Dmitry
* @mailto wm.morgun@gmail.com
**/
(function($){
var CB = function(e)
{
if (!e) var e = window.event;
e.cancelBubble = true;
if (e.stopPropagation) e.stopPropagation();
};
$.fn.checkbox = function(options) {
var addEvents = function(object)
{
var checked = object.checked;
var disabled = object.disabled;
var $object = $(object);
if ( object.stateInterval )
clearInterval(object.stateInterval);
object.stateInterval = setInterval(
function()
{
if ( object.disabled != disabled )
$object.trigger( (disabled = !!object.disabled) ? 'disable' : 'enable');
if ( object.checked != checked )
$object.trigger( (checked = !!object.checked) ? 'check' : 'uncheck');
},
10
);
return $object;
};
return this.each(function()
{
var ch = this;
var $ch = addEvents(ch);
if (ch.wrapper) ch.wrapper.remove();
ch.wrapper = $('<span>&nbsp;</span>');
$ch.after(ch.wrapper);
ch.wrapper.click(function(e) { $ch.trigger('click',[e]); CB(e); return false;});
$ch.click(function(e){CB(e);});
$ch.bind('check', function() { ch.wrapper.addClass('checked' );}).bind('uncheck', function() { ch.wrapper.removeClass('checked');});
if ( ch.checked ) ch.wrapper.addClass('checked');
});
}
})(jQuery);

View File

@ -1,65 +0,0 @@
/**
* @license The MIT License (MIT)
*
* Copyright (c) 2014 Felipe O. Carvalho
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
define(['JSXTransformer', 'text'], function (JSXTransformer, text) {
'use strict';
var buildMap = {};
var jsx = {
version: '0.2.1',
load: function (name, req, onLoadNative, config) {
var fileExtension = config.jsx && config.jsx.fileExtension || '.js';
var onLoad = function(content) {
try {
content = JSXTransformer.transform(content).code;
} catch (err) {
onLoadNative.error(err);
}
if (config.isBuild) {
buildMap[name] = content;
} else {
content += "\n//# sourceURL=" + location.protocol + "//" + location.hostname +
config.baseUrl + name + fileExtension;
}
onLoadNative.fromText(content);
};
text.load(name + fileExtension, req, onLoad, config);
},
write: function (pluginName, moduleName, write) {
if (buildMap.hasOwnProperty(moduleName)) {
var content = buildMap[moduleName];
write.asModule(moduleName, content);
}
}
};
return jsx;
});

View File

@ -31,22 +31,16 @@ require(['./config'], function(config) {
'backbone',
'backbone-lodash-monkeypatch',
'stickit',
'coccyx',
'react',
'react.backbone',
'cocktail',
'routefilter',
'i18next',
'bootstrap',
'jquery-cookie',
'jquery-checkbox',
'jquery-timeout',
'jquery-ui',
'jquery-autoNumeric',
'text',
//>>excludeStart("compressed", pragmas.compressed);
'jsx',
//>>excludeEnd("compressed");
'less!/static/css/styles',
'app'
], function() {

View File

@ -115,7 +115,8 @@ function(utils, models, EditNodeScreen, editNodeDisksScreenTemplate, nodeDisksTe
this.constructor.__super__.initialize.apply(this, arguments);
if (this.nodes.length) {
this.model.on('change:status', this.revertChanges, this);
this.volumes = new models.Volumes([], {url: _.result(this.nodes.at(0), 'url') + '/volumes'});
this.volumes = new models.Volumes();
this.volumes.url = _.result(this.nodes.at(0), 'url') + '/volumes';
this.loading = $.when.apply($, this.nodes.map(function(node) {
node.disks = new models.Disks();
return node.disks.fetch({url: _.result(node, 'url') + '/disks'});

View File

@ -18,6 +18,7 @@ define(
'require',
'utils',
'models',
'cocktail',
'view_mixins',
'text!templates/wizard/create_cluster_wizard.html',
'text!templates/wizard/name_and_release.html',
@ -30,7 +31,7 @@ define(
'text!templates/wizard/warning.html',
'text!templates/wizard/text_input.html'
],
function(require, utils, models, viewMixins, createClusterWizardTemplate, clusterNameAndReleasePaneTemplate, commonWizardTemplate, modePaneTemplate, networkPaneTemplate, storagePaneTemplate, clusterReadyPaneTemplate, controlTemplate, warningTemplate, textInputTemplate) {
function(require, utils, models, Cocktail, viewMixins, createClusterWizardTemplate, clusterNameAndReleasePaneTemplate, commonWizardTemplate, modePaneTemplate, networkPaneTemplate, storagePaneTemplate, clusterReadyPaneTemplate, controlTemplate, warningTemplate, textInputTemplate) {
'use strict';
var views = {},
@ -339,7 +340,6 @@ function(require, utils, models, viewMixins, createClusterWizardTemplate, cluste
views.WizardPane = Backbone.View.extend({
template: _.template(commonWizardTemplate),
constructorName: 'WizardPane',
mixins: [viewMixins.toggleablePassword],
initialize: function(options) {
_.defaults(this, options);
this.attachWarningListeners();
@ -562,6 +562,7 @@ function(require, utils, models, viewMixins, createClusterWizardTemplate, cluste
return this;
}
});
Cocktail.mixin(views.WizardPane, viewMixins.toggleablePassword);
clusterWizardPanes.NameAndRelease = views.WizardPane.extend({
constructorName: 'NameAndRelease',