Upgrade Babel, Webpack and Lodash to latest versions

Change-Id: I0999cc9550260f3e94101eb586fe2a5d3202de45
This commit is contained in:
Jiri Tomasek 2016-03-07 09:47:50 +01:00
parent ae11d49f12
commit eb2c692845
22 changed files with 51 additions and 486 deletions

View File

@ -8,7 +8,7 @@ var less = require('gulp-less');
// var rename = require('gulp-rename');
var shell = require('gulp-shell');
// var uglify = require('gulp-uglify');
var webpack = require('gulp-webpack');
var webpack = require('webpack-stream');
var webpackConfig = require('./webpack.config.js');
var tempStorageWorkerConfig = require('./tempstorageworker.webpack.config.js');

View File

@ -4,7 +4,12 @@
"description": "TripleO UI - TripleO-based OpenStack deployment UI",
"main": "index.js",
"dependencies": {
"babel": "~5.5.8",
"babel-core": "^6.0.0",
"babel-loader": "^6.0.0",
"babel-polyfill": "^6.0.0",
"babel-preset-es2015": "^6.0.0",
"babel-preset-react": "^6.0.0",
"babel-preset-stage-0": "^6.5.0",
"bootstrap": "~3.3.5",
"classnames": "~2.1.2",
"connect-history-api-fallback": "~1.1.0",
@ -15,7 +20,7 @@
"immutable": "~3.7.6",
"invariant": "~2.1.1",
"keymirror": "~0.1.1",
"lodash": "~3.10.1",
"lodash": "^4.0.0",
"normalizr": "^2.0.0",
"patternfly": "~2.5.0",
"react": "~0.14.1",
@ -34,9 +39,7 @@
"xhr2": "~0.1.2"
},
"devDependencies": {
"babel-core": "~5.5.8",
"babel-eslint": "~4.1.6",
"babel-loader": "~5.1.4",
"babel-eslint": "^4.1.6",
"browser-sync": "~2.7.12",
"eslint": "~1.1.0",
"eslint-plugin-react": "~3.2.2",
@ -45,10 +48,9 @@
"gulp-rename": "~1.2.2",
"gulp-shell": "~0.4.2",
"gulp-uglify": "~1.2.0",
"gulp-webpack": "~1.5.0",
"webpack-stream": "^3.1.0",
"ini": "^1.3.4",
"jasmine": "~2.3.2",
"jasmine-core": "~2.3.4",
"jasmine-immutable-matchers": "^1.0.1",
"karma": "~0.13.9",
"karma-cli": "~0.1.0",

View File

@ -1,8 +1,8 @@
const AppDispatcher = require('../../js/dispatchers/AppDispatcher');
const KeystoneApiService = require('../../js/services/KeystoneApiService');
const LoginActions = require('../../js/actions/LoginActions');
const LoginConstants = require('../../js/constants/LoginConstants');
const TempStorage = require('../../js/services/TempStorage.js');
import AppDispatcher from '../../js/dispatchers/AppDispatcher';
import KeystoneApiService from '../../js/services/KeystoneApiService';
import LoginActions from '../../js/actions/LoginActions';
import LoginConstants from '../../js/constants/LoginConstants';
import TempStorage from '../../js/services/TempStorage.js';
let mockKeystoneAccess = {
token: {

View File

@ -7,8 +7,8 @@ import { Plan } from '../../js/immutableRecords/plans';
import { planSchema } from '../../js/normalizrSchemas/plans';
import TripleOApiService from '../../js/services/TripleOApiService';
const PlansActions = require('../../js/actions/PlansActions');
const plansReducer = require('../../js/reducers/plansReducer');
import PlansActions from '../../js/actions/PlansActions';
import plansReducer from '../../js/reducers/plansReducer';
describe('plansReducer default state', () => {
describe('default state', () => {

View File

@ -1,9 +1,9 @@
import React from 'react';
import TestUtils from 'react-addons-test-utils';
const Login = require('../../js/components/Login');
const LoginActions = require('../../js/actions/LoginActions');
const LoginStore = require('../../js/stores/LoginStore');
import Login from '../../js/components/Login';
import LoginActions from '../../js/actions/LoginActions';
import LoginStore from '../../js/stores/LoginStore';
let loginInstance;

View File

@ -2,20 +2,9 @@ import React from 'react';
import TestUtils from 'react-addons-test-utils';
const IronicApiService = require('../../../js/services/IronicApiService');
// const NodesStore = require('../../../js/stores/NodesStore');
import Nodes from '../../../js/components/nodes/Nodes';
// let nodesStoreState = {
// nodes: {
// all: [],
// registered: [],
// introspected: [],
// provisioned: [],
// maintenance: []
// }
// };
describe('Nodes Component', () => {
let NodesVdom, NodesInstance;
beforeEach(() => {

View File

@ -2,7 +2,7 @@ import React from 'react';
import TestUtils from 'react-addons-test-utils';
import { List } from 'immutable';
const NodesTable = require('../../../js/components/nodes/NodesTable');
import NodesTable from '../../../js/components/nodes/NodesTable';
const initialState = {
filterString: '',

View File

@ -1,10 +1,6 @@
// jest.autoMockOff();
// jest.mock('../../js/actions/LoginActions');
const KeystoneApiService = require('../../js/services/KeystoneApiService');
const LoginActions = require('../../js/actions/LoginActions');
const when = require('when');
import KeystoneApiService from '../../js/services/KeystoneApiService';
import LoginActions from '../../js/actions/LoginActions';
import when from 'when';
describe('KeystoneApiService', () => {
xit('logs user in when response is received', () => {

View File

@ -1,4 +1,4 @@
const TempStorage = require('../../js/services/TempStorage.js');
import TempStorage from '../../js/services/TempStorage.js';
const WORKER_URL = '/js/tripleo_ui_tempstorage_worker.js';
describe('TempStorage', () => {

View File

@ -1,5 +1,6 @@
import when from 'when';
const TripleOApiService = require('../../js/services/TripleOApiService.js');
import TripleOApiService from '../../js/services/TripleOApiService.js';
describe('TripleOApiService', () => {

View File

@ -1,94 +0,0 @@
// jest.autoMockOff();
// jest.mock('../../js/dispatchers/AppDispatcher');
const AppDispatcher = require('../../js/dispatchers/AppDispatcher');
const LoginStore = require('../../js/stores/LoginStore');
const LoginConstants = require('../../js/constants/LoginConstants');
let callback;
let loggedInState = {
token: 'token',
user: 'admin',
serviceCatalog: 'service catalog',
metadata: 'some metadata'
};
// mock actions
let loginUserAction = {
actionType: LoginConstants.LOGIN_USER,
keystoneAccess: loggedInState
};
let logoutUserAction = {
actionType: LoginConstants.LOGOUT_USER
};
describe('LoginStore', () => {
describe('An API endpoint URL', () => {
beforeEach(() => {
LoginStore.onLoginUser({
serviceCatalog: [
{
name: 'keystone',
endpoints: [
{publicURL: 'http://192.0.2.1:5000/v2.0'}
]
},
{
name: 'swift',
endpoints: [
{publicURL: 'http://192.0.2.1:8080/v1/AUTH_fb6ecfdf792241718144254ed3ccf34a'}
]
}
]
});
});
it('is accessible through the ``getServiceUrl(<name>)`` method', () => {
expect(LoginStore.getServiceUrl('keystone'))
.toBe('http://192.0.2.1:5000/v2.0');
expect(LoginStore.getServiceUrl('swift'))
.toBe('http://192.0.2.1:8080/v1/AUTH_fb6ecfdf792241718144254ed3ccf34a');
});
});
// beforeEach(() => {
// callback = AppDispatcher.register.mock.calls[0][0];
// });
xit('registers a callback with the dispatcher', function() {
expect(AppDispatcher.register.mock.calls.length).toBe(1);
});
xit('sets state to keystoneAccess data when user logs in', () => {
// LoginStore.emitChange = jest.genMockFunction();
callback(loginUserAction);
expect(LoginStore.state).toEqual({
token: 'token',
user: 'admin',
serviceCatalog: 'service catalog',
metadata: 'some metadata'
});
expect(LoginStore.emitChange).toBeCalled();
});
xit('cleans the state when user logs out', () => {
// LoginStore.emitChange = jest.genMockFunction();
callback(logoutUserAction);
expect(LoginStore.state).toEqual({});
expect(LoginStore.emitChange).toBeCalled();
});
xit('returns state with getState', () => {
LoginStore.state = loggedInState;
expect(LoginStore.getState()).toEqual(loggedInState);
});
xit('provides function to determine if user is logged in', () => {
LoginStore.state = loggedInState;
expect(LoginStore.isLoggedIn()).toEqual(true);
});
});

View File

@ -1,13 +0,0 @@
import ValidationsConstants from '../../js/constants/ValidationsConstants';
import ValidationsStore from '../../js/stores/ValidationsStore';
describe('Validations Store', () => {
it('should call onListStages on LIST_STAGES action', () => {
spyOn(ValidationsStore, 'onListStages').and.callThrough();
let payload = { actionType: ValidationsConstants.LIST_STAGES,
stages: [ 's1', 's2'] };
ValidationsStore._registerToActions(payload);
expect(ValidationsStore.onListStages).toHaveBeenCalledWith(payload.stages);
expect(ValidationsStore.state.stages).toEqual(payload.stages);
});
});

View File

@ -39,7 +39,7 @@ class PlanFileInput extends React.Component {
}
});
};
}(file));
})(file);
reader.readAsText(file);
}
}

View File

@ -6,8 +6,6 @@ let keystoneUrl = appConfig.keystone_url || host + ':5000/v2.0';
let tripleoApiUrl = appConfig.tripleo_api_url || host + ':8585/v1';
let validationsUrl = appConfig.validations_url || host + ':5001/v1';
export default {
KEYSTONE_URL: keystoneUrl,
TRIPLEOAPI_URL: tripleoApiUrl,
VALIDATIONS_URL: validationsUrl
};
export const KEYSTONE_URL = keystoneUrl;
export const TRIPLEOAPI_URL = tripleoApiUrl;
export const VALIDATIONS_URL = validationsUrl;

View File

@ -1,3 +0,0 @@
export default {
GET_IMAGES_PATH: 'images'
};

View File

@ -1,5 +1,3 @@
import { KEYSTONE_URL } from './APIEndpointUrls';
export default {
AUTH_URL: KEYSTONE_URL + '/tokens'
};
export const AUTH_URL = KEYSTONE_URL + '/tokens';

View File

@ -1,257 +0,0 @@
/*eslint-disable quotes, quote-props, max-len */
export default {
"root_template": "overcloud-without-mergepy.yaml",
"topics": [
{
"title": "Basic Configuration",
"description": null,
"environment_groups": [
{
"title": null,
"description": "Enable basic configuration required for OpenStack Deployment",
"environments": [
{
"file": "overcloud-resource-registry-puppet.yaml",
"title": "Default Configuration",
"description": null
}
]
}
]
},
{
"title": "Deployment options",
"description": null,
"environment_groups": [
{
"title": "High Availability",
"description": "Enables configuration of an Overcloud controller with Pacemaker",
"environments": [
{
"file": "environments/puppet-pacemaker.yaml",
"title": "Pacemaker",
"description": "Enable configuration of an Overcloud controller with Pacemaker",
"requires": [
"overcloud-resource-registry-puppet.yaml"
]
}
]
},
{
"title": "Docker RDO",
"description": "Docker container with heat agents for containerized compute node\n",
"environments": [
{
"file": "environments/docker-rdo.yaml",
"title": "Docker RDO",
"description": null,
"requires": [
"overcloud-resource-registry-puppet.yaml"
]
}
]
}
]
},
{
"title": "Overlay network Configuration",
"description": null,
"environment_groups": [
{
"title": "Network Isolation",
"description": "Enable Network Isolation Enable the creation of Neutron networks for isolated Overcloud traffic and configure each role to assign ports (related to that role) on these networks.\n",
"environments": [
{
"file": "environments/network-isolation.yaml",
"title": "Network Isolation",
"description": "Enable Network Isolation",
"requires": [
"overcloud-resource-registry-puppet.yaml"
]
}
]
},
{
"title": "Single nic or Bonding",
"description": "Configure roles to use pair of bonded nics or to use Vlans on a single nic. This option assumes use of Network Isolation.\n",
"environments": [
{
"file": "environments/net-bond-with-vlans.yaml",
"title": "Bond with Vlans",
"description": "Configure each role to use a pair of bonded nics (nic2 and nic3) and configures an IP address on each relevant isolated network for each role. This option assumes use of Network Isolation.\n",
"requires": [
"environments/network-isolation.yaml",
"overcloud-resource-registry-puppet.yaml"
]
},
{
"file": "environments/net-single-nic-with-vlans.yaml",
"title": "Single nic with Vlans",
"description": "Configure each role to use Vlans on a single nic for each isolated network. This option assumes use of Network Isolation.\n",
"requires": [
"environments/network-isolation.yaml",
"overcloud-resource-registry-puppet.yaml"
]
}
]
}
]
},
{
"title": "Neutron Plugin Configuration",
"description": null,
"environment_groups": [
{
"title": "BigSwitch extensions or Cisco N1KV backend",
"description": null,
"environments": [
{
"file": "environments/neutron-ml2-bigswitch.yaml",
"title": "BigSwitch extensions",
"description": "Enable Big Switch extensions, configured via puppet\n"
},
{
"file": "environments/neutron-ml2-cisco-n1kv.yaml",
"title": "Cisco N1KV backend",
"description": "Enable a Cisco N1KV backend, configured via puppet\n",
"requires": [
"overcloud-resource-registry-puppet.yaml"
]
}
]
},
{
"title": "Cisco Neutron plugin",
"description": "Enable a Cisco Neutron plugin\n",
"environments": [
{
"file": "environments/neutron-ml2-cisco-nexus-ucsm.yaml",
"title": "Cisco Neutron plugin",
"description": null,
"requires": [
"overcloud-resource-registry-puppet.yaml"
]
}
]
}
]
},
{
"title": "Storage",
"description": null,
"environment_groups": [
{
"title": "Cinder NetApp backend",
"description": "Enable a Cinder NetApp backend, configured via puppet\n",
"environments": [
{
"file": "environments/cinder-netapp-config.yaml",
"title": "Cinder NetApp backend",
"description": null,
"requires": [
"overcloud-resource-registry-puppet.yaml"
]
}
]
},
{
"title": "Externally managed Ceph",
"description": "Enable the use of an externally managed Ceph cluster\n",
"environments": [
{
"file": "environments/puppet-ceph-external.yaml",
"title": "Externally managed Ceph",
"description": null,
"requires": [
"overcloud-resource-registry-puppet.yaml"
]
}
]
},
{
"title": "Ceph Devel",
"description": "Enable a Ceph storage cluster using the controller and 2 ceph nodes. Rbd backends are enabled for Cinder, Glance, and Nova.\n",
"environments": [
{
"file": "environments/puppet-ceph-devel.yaml",
"title": "Ceph Devel",
"description": null,
"requires": [
"overcloud-resource-registry-puppet.yaml"
]
}
]
},
{
"title": "Storage Environment",
"description": "Can be used to set up storage backends. Defaults to Ceph used as a backend for Cinder, Glance and Nova ephemeral storage. It configures for example which services will use Ceph, or if any of the services will use NFS. And more. Usually requires to be edited by user first.\n",
"tags": [
"no-gui"
],
"environments": [
{
"file": "environments/storage-environment.yaml",
"title": "Storage Environment",
"description": null,
"requires": [
"overcloud-resource-registry-puppet.yaml"
]
}
]
}
]
},
{
"title": "Utilities",
"description": null,
"environment_groups": [
{
"title": "Config Debug",
"description": "Enable config management (e.g. Puppet) debugging",
"environments": [
{
"file": "environments/config-debug.yaml",
"title": "Config Debug",
"description": null,
"requires": [
"overcloud-resource-registry-puppet.yaml"
]
}
]
},
{
"title": "Disable journal in MongoDb",
"description": "Since, when journaling is enabled, MongoDb will create big journal file it can take time. In a CI environment for example journaling is not necessary.\n",
"environments": [
{
"file": "environments/mongodb-nojournal.yaml",
"title": "Disable journal in MongoDb",
"description": null,
"requires": [
"overcloud-resource-registry-puppet.yaml"
]
}
]
},
{
"title": "Overcloud Steps",
"description": "Specifies hooks/breakpoints where overcloud deployment should stop Allows operator validation between steps, and/or more granular control. Note: the wildcards relate to naming convention for some resource suffixes, e.g see puppet/*-post.yaml, enabling this will mean we wait for a user signal on every *Deployment_StepN resource defined in those files.\n",
"tags": [
"no-gui"
],
"environments": [
{
"file": "environments/overcloud-steps.yaml",
"title": "Overcloud Steps",
"description": null,
"requires": [
"overcloud-resource-registry-puppet.yaml"
]
}
]
}
]
}
]
};

View File

@ -1,65 +0,0 @@
/*eslint-disable quotes, quote-props, max-len */
export default {
"NestedParameters": {
"level-1-groups": {
"NestedParameters": {
"0": {
"NestedParameters": {
"level-2-resource": {
"Type": "jdob::Level2",
"Description": "level 2 nested template",
"Parameters": {
"level-2-p2-optional": {
"Default": "",
"Type": "String",
"NoEcho": "false",
"Description": "not set by parent, should be considered a param_default parameter",
"Label": "level-2-p2-optional"
},
"level-2-p1": {
"Type": "String",
"NoEcho": "false",
"Description": "must be set by parent; should have a value in the nested params list",
"Value": "level-1-set-value",
"Label": "level-2-p1"
}
}
}
},
"Type": "jdob::Level1",
"Description": "level 1 nested template",
"Parameters": {
"level-1-p1": {
"Type": "String",
"NoEcho": "false",
"Description": "must be set by parent; should have a value in the nested params list",
"Value": "parent-set-value-1",
"Label": "level-1-p1"
},
"level-1-p2-optional": {
"Default": "",
"Type": "String",
"NoEcho": "false",
"Description": "not set by parent, should be considered a param_default parameter",
"Label": "level-1-p2-optional"
}
}
}
},
"Type": "OS::Heat::ResourceGroup",
"Description": "No description",
"Parameters": {}
}
},
"Description": "parent template",
"Parameters": {
"parent-p1": {
"Default": "foo",
"Type": "String",
"NoEcho": "false",
"Description": "parent first parameter",
"Label": "parent-p1"
}
}
};

View File

@ -1,4 +1,4 @@
import 'babel/polyfill';
import 'babel-polyfill';
import { Provider } from 'react-redux';
import React from 'react';

View File

@ -1,5 +1,5 @@
// *Some* environments (phantomjs) don't have es5 (Function.prototype.bind)
require('babel-core/polyfill');
require('babel-polyfill');
// this regex should match any files in __tests__ directories
var context = require.context('./__tests__/', true, /.+\.js$/);

View File

@ -6,7 +6,14 @@ module.exports = {
},
module: {
loaders: [
{ test: /\.js$/, include: /src\/js\/workers/, loader: 'babel-loader' }//,
{
test: /\.js$/,
include: /src\/js\/workers/,
loader: 'babel-loader',
query: {
presets: ['es2015', 'stage-0', 'react']
}
}
]
},
node: {

View File

@ -6,9 +6,15 @@ module.exports = {
},
module: {
loaders: [
{ test: /\.js$/, include: /src/,
exclude: /src\/js\/workers/, loader: 'babel-loader' }
// { test: /\.json$/, loader: 'json-loader' }
{
test: /\.js$/,
include: /src/,
exclude: /src\/js\/workers/,
loader: 'babel-loader',
query: {
presets: ['es2015', 'stage-0', 'react']
}
}
]
},
node: {