* ['c', 'd']
*/
+import _isNumber from 'lodash/isNumber';
+import _each from 'lodash/each';
+import _flatten from 'lodash/flatten';
+import _union from 'lodash/union';
+
var rw = rw || {
// Angular specific for now but can be modified in one location if need ever be
BaseController: function() {
},
sum : function(total, i, key, value) {
- if (_.isNumber(value)) {
+ if (_isNumber(value)) {
total[key] = (i === 0 ? value : (total[key] + value));
}
},
sum2 : function(key) {
return function(prev, cur, i) {
var value = cur[key];
- if (_.isNumber(value)) {
+ if (_isNumber(value)) {
if (typeof(prev) === 'undefined') {
return value;
} else {
max : function(key) {
return function(prev, cur, i) {
var value = cur[key];
- if (_.isNumber(value)) {
+ if (_isNumber(value)) {
if (typeof(prev) === 'undefined') {
return value;
} else if (prev < value) {
operation(total, i, key, value);
};
for (i = 0; i < rows.length; i++) {
- _.each(rows[i], f);
+ _each(rows[i], f);
}
}
};
rw.vnf = {
ports: function(service) {
- return _.flatten(jsonPath.eval(service, '$.connector[*].interface[*].port'));
+ return _flatten(jsonPath.eval(service, '$.connector[*].interface[*].port'));
},
fabricPorts: function(service) {
- return _.flatten(jsonPath.eval(service, '$.vm[*].fabric.port'));
+ return _flatten(jsonPath.eval(service, '$.vm[*].fabric.port'));
}
};
}
var i = 0;
var self = this;
- _.each(children, function(child) {
+ _each(children, function(child) {
self.visit.call(self, child, parent, i, listType);
i += 1;
});
rw.vcs = {
allVms : function() {
- return _.flatten([this.jpath('$.collection[*].vm'), this.jpath('$.collection[*].collection[*].vm')], true);
+ return _flatten([this.jpath('$.collection[*].vm'), this.jpath('$.collection[*].collection[*].vm')], true);
},
vms: function(n) {
getChildren: function(n) {
switch (rw.vcs.nodeType(n)) {
case 'rwcolony':
- return 'vm' in n ? _.union(n.collection, n.vm) : n.collection;
+ return 'vm' in n ? _union(n.collection, n.vm) : n.collection;
case 'rwcluster':
return n.vm;
case 'RWVM':
},
jpath : function(jpath, n) {
- return _.flatten(jsonPath.eval(n || this, jpath), true);
+ return _flatten(jsonPath.eval(n || this, jpath), true);
}
};
//Login needs to be refactored. Too many cross dependencies
var AuthActions = require('../widgets/login/loginAuthActions.js');
var $ = require('jquery');
-var rw = require('utils/rw.js');
+import rw from './rw.js';
var API_SERVER = rw.getSearchParams(window.location).api_server;
-let NODE_PORT = require('utils/rw.js').getSearchParams(window.location).api_port || ((window.location.protocol == 'https:') ? 8443 : 8000);
+let NODE_PORT = rw.getSearchParams(window.location).api_port || ((window.location.protocol == 'https:') ? 8443 : 8000);
var SockJS = require('sockjs-client');
var Utils = {};
*
*/
import React from 'react';
-import _ from 'lodash';
+import _isArrayLike from 'lodash/isArrayLike';
+import _isObjectLike from 'lodash/isObjectLike';
+import _isEmpty from 'lodash/isEmpty';
/**
*
var listNode = null;
var self = this;
- if (_.isArrayLike(data) && _.isObjectLike(data)) {
+ if (_isArrayLike(data) && _isObjectLike(data)) {
var children = [];
data.forEach(function(element, index, array) {
- if ( _.isArrayLike(element) || _.isObjectLike(element)) {
+ if ( _isArrayLike(element) || _isObjectLike(element)) {
children.push(self.createList(element, iter+1));
} else {
children.push(React.createElement(itemTag, {
key: iter,
className: groupClass }, children);
}
- else if (_.isObjectLike(data)) {
+ else if (_isObjectLike(data)) {
var children = [];
for (var key in data) {
- if ( _.isArrayLike(data[key]) || _.isObjectLike(data[key])) {
+ if ( _isArrayLike(data[key]) || _isObjectLike(data[key])) {
children.push(
React.createElement(listHeaderTag, {
key: key + '_header',
return React.createElement("div", {
className: "listy" },
- _.isEmpty(data) ?
+ _isEmpty(data) ?
this.noDataMessage() :
this.createList(data)
)
if (!obj)
return new Error('Validation failed. "%" is undefined', fullAttr);
- if (!obj.hasOwnProperty("tag") || _.isEmpty(obj.tag))
+ if (!obj.hasOwnProperty("tag") || _isEmpty(obj.tag))
return new Error('Validation failed. "%s" missing attribute "tag"', fullAttr);
if (!obj.hasOwnProperty("className") || obj.className == undefined)
return new Error('Validation failed. "%s" missing attribute "className"', fullAttr);
import Utils from 'utils/utils.js';
import Button from 'widgets/button/rw.button.js';
import './login.scss'
-let rw = require('utils/rw.js');
+import rw from 'utils/rw.js';
+
class LoginScreen extends React.Component{
constructor(props) {
super(props);
import Utils from 'utils/utils.js';
import Crouton from 'react-crouton';
import TreeView from 'react-treeview';
-import _ from 'lodash';
+import _isEqual from 'lodash/isEqual';
+import _merge from 'lodash/merge';
+import _indexOf from 'lodash/indexOf';
import '../../../node_modules/react-treeview/react-treeview.css';
import './eventCenter.scss';
if (props.newNotificationEvent && props.newNotificationMsg) {
if (latestNotification) {
latestNotification = JSON.parse(latestNotification);
- if (!_.isEqual(props.newNotificationMsg, latestNotification)) {
+ if (!_isEqual(props.newNotificationMsg, latestNotification)) {
stateObject.newNotificationEvent = props.newNotificationEvent;
stateObject.newNotificationMsg = props.newNotificationMsg;
sessionStorage.setItem('latestNotification', JSON.stringify(stateObject.newNotificationMsg));
}
if (notificationList) {
- stateObject.notifications = _.merge(notificationList, props.notifications);
+ stateObject.notifications = _merge(notificationList, props.notifications);
} else {
stateObject.notifications = props.notifications;
}
notificationFields.eventTime = notification.eventTime;
Object.keys(notification).map((notificationKey) => {
- if (_.indexOf(['source', 'eventTime'], notificationKey) == -1) {
+ if (_indexOf(['source', 'eventTime'], notificationKey) == -1) {
notificationFields.eventKey = notificationKey;
notificationFields.details = notification[notificationFields.eventKey];
}
import SkyquakeContainerStore from './skyquakeContainerStore.js';
// import Breadcrumbs from 'react-breadcrumbs';
import Utils from 'utils/utils.js';
-import _ from 'lodash';
import Crouton from 'react-crouton';
import ScreenLoader from 'widgets/screen-loader/screenLoader.jsx';
import './skyquakeApp.scss';
import Alt from './skyquakeAltInstance.js';
import $ from 'jquery';
import SkyquakeContainerActions from './skyquakeContainerActions'
+import rw from 'utils/rw.js';
+import Utils from 'utils/utils.js';
-let Utils = require('utils/utils.js');
-let API_SERVER = require('utils/rw.js').getSearchParams(window.location).api_server;
+let API_SERVER = rw.getSearchParams(window.location).api_server;
let HOST = API_SERVER;
-let NODE_PORT = require('utils/rw.js').getSearchParams(window.location).api_port || ((window.location.protocol == 'https:') ? 8443 : 8000);
-let DEV_MODE = require('utils/rw.js').getSearchParams(window.location).dev_mode || false;
-let RW_REST_API_PORT = require('utils/rw.js').getSearchParams(window.location).rw_rest_api_port || 8008;
+let NODE_PORT = rw.getSearchParams(window.location).api_port || ((window.location.protocol == 'https:') ? 8443 : 8000);
+let DEV_MODE = rw.getSearchParams(window.location).dev_mode || false;
+let RW_REST_API_PORT = rw.getSearchParams(window.location).rw_rest_api_port || 8008;
if (DEV_MODE) {
HOST = window.location.protocol + '//' + window.location.hostname;
import Alt from './skyquakeAltInstance.js';
import SkyquakeContainerSource from './skyquakeContainerSource.js';
import SkyquakeContainerActions from './skyquakeContainerActions';
-import _ from 'lodash';
+import _indexOf from 'lodash/indexOf';
//Temporary, until api server is on same port as webserver
-var rw = require('utils/rw.js');
+import rw from 'utils/rw.js';
+
var API_SERVER = rw.getSearchParams(window.location).api_server;
var UPLOAD_SERVER = rw.getSearchParams(window.location).upload_server;
} else {
// Temp to test before adding multi-sources
data.notification.source = streamSource;
- if (_.indexOf(self.notifications, data.notification) == -1) {
+ if (_indexOf(self.notifications, data.notification) == -1) {
// newly appreared event.
// Add to the notifications list and setState
self.notifications.unshift(data.notification);
import 'style/common.scss';
//Temporary, until api server is on same port as webserver
-var rw = require('utils/rw.js');
+import rw from 'utils/rw.js';
+
var API_SERVER = rw.getSearchParams(window.location).api_server;
var UPLOAD_SERVER = rw.getSearchParams(window.location).upload_server;
import ReactDOM from 'react-dom';
import d3 from 'd3';
import DashboardCard from '../dashboard_card/dashboard_card.jsx';
-import _ from 'lodash';
+import _cloneDeep from 'lodash/cloneDeep';
import $ from 'jquery';
import './topologyTree.scss';
//this.props.selectNode(props.data);
}
if(this.svg) {
- this.update(_.cloneDeep(props.data));
+ this.update(_cloneDeep(props.data));
// this.selectedID = props.data.id;
}
}
import React from 'react';
import Button from 'widgets/button/rw.button.js';
-import _ from 'lodash';
+import _cloneDeep from 'lodash/cloneDeep';
import SkyquakeComponent from 'widgets/skyquake_container/skyquakeComponent.jsx';
import Crouton from 'react-crouton';
import TextInput from 'widgets/form_controls/textInput.jsx';
}
}
- let newAccount = _.cloneDeep(removeTrailingWhitespace(Account));
+ let newAccount = _cloneDeep(removeTrailingWhitespace(Account));
delete newAccount.params;
newAccount.nestedParams &&
newAccount.nestedParams['container-name'] &&
*/
'use strict';
-import _ from 'lodash'
+import _includes from 'lodash/includes'
import cc from 'change-case'
import React from 'react'
import PureRenderMixin from 'react-addons-pure-render-mixin'
);
},
onDragOver(event) {
- const isDraggingFiles = _.includes(event.dataTransfer.types, 'Files');
+ const isDraggingFiles = _includes(event.dataTransfer.types, 'Files');
if (!isDraggingFiles) {
event.preventDefault();
event.dataTransfer.dropEffect = 'copy';
*/
'use strict';
-import _ from 'lodash'
+import _includes from 'lodash/includes'
import React from 'react'
import ReactDOM from 'react-dom'
import messages from './messages'
uiTransientState.isDrop = false;
uiTransientState.isDragging = true;
uiTransientState.wasTrayOpen = this.state.isTrayOpen;
- uiTransientState.isDraggingFiles = _.includes(e.dataTransfer.types, 'Files');
+ uiTransientState.isDraggingFiles = _includes(e.dataTransfer.types, 'Files');
const dragState = ComposerAppStore.getState().drag || {};
if (uiTransientState.isDraggingFiles || (dragState.type === 'catalog-item')) {
CatalogPanelTrayActions.open();
*/
'use strict';
-import _ from 'lodash'
+import _cloneDeep from 'lodash/cloneDeep'
import React from 'react';
import PureRenderMixin from 'react-addons-pure-render-mixin'
import messages from './messages'
const selectedContainer = selected[0];
if (selectedContainer) {
bodyComponent = <CatalogItemDetailsEditor container={selectedContainer} width={this.props.layout.right} />;
- const edit = _.cloneDeep(selectedContainer.model);
+ const edit = _cloneDeep(selectedContainer.model);
json = serializers.serialize(edit) || edit;
}
const jsonViewerTitle = selectedContainer ? selectedContainer.model.name : 'nothing selected';
*/
'use strict';
-import _ from 'lodash'
+import _includes from 'lodash/includes'
+import _isArray from 'lodash/isArray'
+import _cloneDeep from 'lodash/cloneDeep'
import utils from '../libraries/utils'
import React from 'react'
import ClassNames from 'classnames'
import '../styles/EditDescriptorModelProperties.scss'
function getDescriptorMetaBasicForType(type) {
- const basicPropertiesFilter = d => _.includes(DESCRIPTOR_MODEL_FIELDS[type], d.name);
+ const basicPropertiesFilter = d => _includes(DESCRIPTOR_MODEL_FIELDS[type], d.name);
return DescriptorModelMetaFactory.getModelMetaForType(type, basicPropertiesFilter) || {properties: []};
}
function getDescriptorMetaAdvancedForType(type) {
- const advPropertiesFilter = d => !_.includes(DESCRIPTOR_MODEL_FIELDS[type], d.name);
+ const advPropertiesFilter = d => !_includes(DESCRIPTOR_MODEL_FIELDS[type], d.name);
return DescriptorModelMetaFactory.getModelMetaForType(type, advPropertiesFilter) || {properties: []};
}
}
if (isLeafRef) {
- let fullFieldKey = _.isArray(fieldKey) ? fieldKey.join(':') : fieldKey;
+ let fullFieldKey = _isArray(fieldKey) ? fieldKey.join(':') : fieldKey;
let containerRef = container;
while (containerRef.parent) {
fullFieldKey = containerRef.parent.key + ':' + fullFieldKey;
}
if (isBoolean) {
- let fullFieldKey = _.isArray(fieldKey) ? fieldKey.join(':') : fieldKey;
+ let fullFieldKey = _isArray(fieldKey) ? fieldKey.join(':') : fieldKey;
let containerRef = container;
while (containerRef.parent) {
fullFieldKey = containerRef.parent.key + ':' + fullFieldKey;
isTopCase = true;
choiceObject = utils.resolvePath(this.model, [selected].join('.'));
}
- utils.assignPathValue(stateObject, [selected].join('.'), _.cloneDeep(choiceObject));
+ utils.assignPathValue(stateObject, [selected].join('.'), _cloneDeep(choiceObject));
if(selected) {
if(this.model.uiState.choice.hasOwnProperty(name)) {
//If selectedOptionValue is present, take first item in string which represents the case name.
const valueProperty = caseByNameMap[selectedOptionValue ? selectedOptionValue.split('.')[0] : undefined] || {properties: []};
const isLeaf = Property.isLeaf(valueProperty);
- const hasProperties = _.isArray(valueProperty.properties) && valueProperty.properties.length;
+ const hasProperties = _isArray(valueProperty.properties) && valueProperty.properties.length;
const isMissingDescriptorMeta = !hasProperties && !Property.isLeaf(valueProperty);
//Some magic that prevents errors for arising
const valueResponse = valueProperty.properties && valueProperty.properties.length ? valueProperty.properties.map(valuePropertyFn) : (!isMissingDescriptorMeta) ? build(container, valueProperty, path.concat(valueProperty.name), utils.resolvePath(container.model, path.concat(valueProperty.name).join('.')) || container.model[valueProperty.name]) :
property.properties = uiState.properties;
}
- const hasProperties = _.isArray(property.properties) && property.properties.length;
+ const hasProperties = _isArray(property.properties) && property.properties.length;
const isMissingDescriptorMeta = !hasProperties && !Property.isLeaf(property);
// ensure value is not undefined for non-leaf property types
value = isArray ? [] : {};
}
}
- const valueAsArray = _.isArray(value) ? value : isLeafList && typeof value === 'undefined' ? [] : [value];
+ const valueAsArray = _isArray(value) ? value : isLeafList && typeof value === 'undefined' ? [] : [value];
const isMetaField = property.name === 'meta';
const isCVNFD = property.name === 'constituent-vnfd';
//https://raw.githubusercontent.com/RIFTIO/RIFT.ware/master/rift-shell
-import _ from 'lodash'
+import _cloneDeep from 'lodash/cloneDeep'
+import _findIndex from 'lodash/findIndex'
import React from 'react';
import ReactDOM from 'react-dom';
import TreeView from 'react-treeview';
let splitUrl = url.split('/');
let fileName = splitUrl[splitUrl.length - 1];
folder.pop;
- let fullPath = _.cloneDeep(folder);
+ let fullPath = _cloneDeep(folder);
fullPath.push(fileName);
fullPath = fullPath.join('/');
folder = folder.join('/');
- let fileIndex = _.findIndex(files[folder], function(f) {
+ let fileIndex = _findIndex(files[folder], function(f) {
return f.name == fullPath;
})
if (fileIndex == -1) {
*/
'use strict';
-import _ from 'lodash'
import $ from 'jquery'
import alt from '../../alt'
import utils from '../../libraries/utils'
* Created by onvelocity on 10/2/15.
*/
-import _ from 'lodash'
import d3 from 'd3'
import UID from './UniqueId'
import SelectionManager from './SelectionManager'
'use strict';
-import _ from 'lodash'
import d3 from 'd3'
import UID from './UniqueId'
import React from 'react'
*/
'use strict';
-import _ from 'lodash'
import d3 from 'd3'
import math from './math'
import ClassNames from 'classnames'
'use strict';
-import _ from 'lodash'
+import _isArray from 'lodash/isArray'
import d3 from 'd3'
/**
Array.from(document.querySelectorAll(`svg .forwarding-graph-paths`)).forEach(d => {
d3.select(d).classed('-is-highlighting', true);
});
- const list = _.isArray(rsp) ? rsp : [rsp];
+ const list = _isArray(rsp) ? rsp : [rsp];
list.forEach(rsp => {
Array.from(document.querySelectorAll(`[data-id="${rsp.id}"]`)).forEach(d => {
d.parentNode.appendChild(d);
* Created by onvelocity on 2/10/16.
*/
import alt from '../../../alt'
-import _ from 'lodash'
import d3 from 'd3'
import math from '../math'
import ClassNames from 'classnames'
* Created by onvelocity on 8/23/15.
*/
-import _ from 'lodash'
+import _isArray from 'lodash/isArray'
import guid from '../guid'
import Position from '../graph/Position'
import IconFactory from './IconFactory'
updateModelList(modelFieldName, modelFieldValue, descriptorClass = DescriptorModel, newItemAddedSuccessCallback = () => {}) {
// value can be Array of (DescriptorModel | json model), DescriptorModel, or json model
- if (_.isArray(modelFieldValue)) {
+ if (_isArray(modelFieldValue)) {
this.model[modelFieldName] = modelFieldValue.map(d => d instanceof descriptorClass ? d.model : d);
return true;
}
'use strict';
-import _ from 'lodash'
+import _isEmpty from 'lodash/isEmpty'
+import _cloneDeep from 'lodash/cloneDeep'
import d3 from 'd3'
import UID from './../UniqueId'
import guid from '../guid'
}
return (containerList, obj) => {
- if (_.isEmpty(obj)) {
+ if (_isEmpty(obj)) {
return containerList;
}
switch (obj.uiState.type) {
} else {
model = vnfdToWrap;
}
- return new VirtualNetworkFunctionReadOnlyWrapper(_.cloneDeep(model), parent);
+ return new VirtualNetworkFunctionReadOnlyWrapper(_cloneDeep(model), parent);
}
static newClassifier(model, parent) {
'use strict';
-import _ from 'lodash'
+import _cloneDeep from 'lodash/cloneDeep'
import utils from './../utils'
import DescriptorModelMetaProperty from './DescriptorModelMetaProperty'
import CommonUtils from 'utils/utils';
// resolve paths like 'nsd' or 'vnfd.vdu' or 'nsd.constituent-vnfd'
const found = utils.resolvePath(modelMetaByPropertyNameMap, getPathForType(typeOrPath));
if (found) {
- const uiState = _.cloneDeep(found[':meta']);
+ const uiState = _cloneDeep(found[':meta']);
uiState.properties = uiState.properties.filter(filterProperties);
return uiState;
}
'use strict';
-import _ from 'lodash'
+import _includes from 'lodash/includes'
+import _isArray from 'lodash/isArray'
import guid from './../guid'
import changeCase from 'change-case'
import InstanceCounter from './../InstanceCounter'
return !/^(leaf|leaf_list)$/.test(property.type);
},
isSimpleList(property = {}) {
- return _.includes(DescriptorModelFields.simpleList, property.name);
+ return _includes(DescriptorModelFields.simpleList, property.name);
},
isPrimativeDataType(property = {}) {
const Property = this;
if (uiState.name === 'name') {
return changeCase.param(parentMeta.name) + '-' + InstanceCounter.count(parentMeta[':qualified-type']);
}
- if (_.isArray(parentMeta.key) && _.includes(parentMeta.key, uiState.name)) {
+ if (_isArray(parentMeta.key) && _includes(parentMeta.key, uiState.name)) {
if (/uuid/.test(uiState['data-type'])) {
return guid();
}
* Created by onvelocity on 10/20/15.
*/
-import _ from 'lodash'
+import _isNumber from 'lodash/isNumber'
+import _cloneDeep from 'lodash/cloneDeep'
+import _isEmpty from 'lodash/isEmpty'
+import _omit from 'lodash/omit'
+import _pick from 'lodash/pick'
import utils from './../utils'
import DescriptorModelFields from './DescriptorModelFields'
import DescriptorModelMetaFactory from './DescriptorModelMetaFactory'
// remove empty / blank value fields
function clean(m) {
Object.keys(m).forEach(k => {
- const isEmptyObject = typeof m[k] === 'object' && _.isEmpty(m[k]);
+ const isEmptyObject = typeof m[k] === 'object' && _isEmpty(m[k]);
if (typeof m[k] === 'undefined' || isEmptyObject || m[k] === '') {
delete m[k];
}
if (k === 'uiState') {
if (isMetaAllowed) {
// remove any transient ui state properties
- const uiState = _.pick(m.uiState, DescriptorModelFields.meta);
- if (!_.isEmpty(uiState)) {
+ const uiState = _pick(m.uiState, DescriptorModelFields.meta);
+ if (!_isEmpty(uiState)) {
// uiState field must be a string
m['meta'] = JSON.stringify(uiState);
}
nsd: {
serialize(nsdModel) {
if(!nsdFields) nsdFields = DescriptorModelMetaFactory.getModelFieldNamesForType('nsd').concat('uiState');
- const confd = _.pick(nsdModel, nsdFields);
+ const confd = _pick(nsdModel, nsdFields);
// vnfd is defined in the ETSI etsi_gs reference manual but RIFT does not use it
delete confd.vnfd;
};
if (d['vnf-configuration']) {
- const vnfConfig = _.cloneDeep(d['vnf-configuration']);
+ const vnfConfig = _cloneDeep(d['vnf-configuration']);
const configType = vnfConfig['config-type'] || 'none';
// make sure we send the correct values based on config type
if (configType === 'none') {
constituentVNFD['vnf-configuration'] = {'config-type': 'none'};
const configPriority = utils.resolvePath(vnfConfig, 'input-params.config-priority');
- const configPriorityValue = _.isNumber(configPriority) ? configPriority : d.uiState['member-vnf-index'];
+ const configPriorityValue = _isNumber(configPriority) ? configPriority : d.uiState['member-vnf-index'];
utils.assignPathValue(constituentVNFD['vnf-configuration'], 'input-params.config-priority', configPriorityValue);
} else {
// remove any unused configuration options
vld: {
serialize(vldModel) {
if(!vldFields) vldFields = DescriptorModelMetaFactory.getModelFieldNamesForType('nsd.vld');
- const confd = _.pick(vldModel, vldFields);
+ const confd = _pick(vldModel, vldFields);
const property = 'vnfd-connection-point-ref';
// TODO: There is a bug in RIFT-REST that is not accepting empty
},
'vnfd-connection-point-ref': {
serialize(ref) {
- return _.pick(ref, ['member-vnf-index-ref', 'vnfd-id-ref', 'vnfd-connection-point-ref']);
+ return _pick(ref, ['member-vnf-index-ref', 'vnfd-id-ref', 'vnfd-connection-point-ref']);
}
},
'internal-connection-point': {
serialize(ref) {
- return _.pick(ref, ['id-ref']);
+ return _pick(ref, ['id-ref']);
}
},
'constituent-vnfd': {
serialize(cvnfdModel) {
if(!cvnfdFields) cvnfdFields = DescriptorModelMetaFactory.getModelFieldNamesForType('nsd.constituent-vnfd');
- return _.pick(cvnfdModel, cvnfdFields);
+ return _pick(cvnfdModel, cvnfdFields);
}
},
vnfd: {
serialize(vnfdModel) {
if(!vnfdFields) vnfdFields = DescriptorModelMetaFactory.getModelFieldNamesForType('vnfd').concat('uiState');
- const confd = _.pick(vnfdModel, vnfdFields);
+ const confd = _pick(vnfdModel, vnfdFields);
confd.vdu = confd.vdu.map(d => DescriptorModelSerializer.serialize(d));
return cleanEmptyTopKeys(confd);
}
},
vdu: {
serialize(vduModel) {
- const copy = _.cloneDeep(vduModel);
+ const copy = _cloneDeep(vduModel);
for (let k in copy) {
checkForChoiceAndRemove(k, copy, vduModel)
}
- const confd = _.omit(copy, ['uiState']);
+ const confd = _omit(copy, ['uiState']);
return cleanEmptyTopKeys(confd);
}
}
function cleanEmptyTopKeys(m){
Object.keys(m).forEach(k => {
- const isEmptyObject = typeof m[k] === 'object' && _.isEmpty(m[k]);
+ const isEmptyObject = typeof m[k] === 'object' && _isEmpty(m[k]);
if (typeof m[k] === 'undefined' || isEmptyObject || m[k] === '') {
delete m[k];
}
'use strict';
-import _ from 'lodash'
+import _isFunction from 'lodash/isFunction'
+import _isArray from 'lodash/isArray'
+import _isObject from 'lodash/isObject'
+import _cloneDeep from 'lodash/cloneDeep'
import DescriptorTemplates from './DescriptorTemplates'
import DescriptorModelMetaFactory from './DescriptorModelMetaFactory'
function init(m) {
keys(m).map(key => {
const value = m[key];
- if (_.isFunction(value)) {
+ if (_isFunction(value)) {
m[key] = value(m, key, model);
}
- if (_.isArray(value)) {
+ if (_isArray(value)) {
value.forEach(v => init(v));
}
- if (_.isObject(value)) {
+ if (_isObject(value)) {
init(value);
}
});
createModelForType(type) {
const template = DescriptorTemplates[type];
if (template) {
- const model = _.cloneDeep(template);
+ const model = _cloneDeep(template);
return resolveInitHandlers(model);
}
}
'use strict';
-import _ from 'lodash'
import Classifier from './Classifier'
import DescriptorModel from '../DescriptorModel'
import RecordServicePath from './RecordServicePath'
'use strict';
-import _ from 'lodash'
import ColorGroups from '../../ColorGroups'
import DescriptorModel from '../DescriptorModel'
import ForwardingGraph from './ForwardingGraph'
'use strict';
-import _ from 'lodash'
import DescriptorModel from '../DescriptorModel'
import RspConnectionPointRef from './RspConnectionPointRef'
import DescriptorModelFactory from '../DescriptorModelFactory'
'use strict';
-import changeCase from 'change-case';
+import _cloneDeep from 'lodash/cloneDeep';
+import _isArray from 'lodash/isArray';
+import _map from 'lodash/map';
+import _flatten from 'lodash/flatten';
+import _find from 'lodash/find';
+import _toNumber from 'lodash/toNumber';
+import _isNumber from 'lodash/isNumber';
+import _clone from 'lodash/clone';
export default {
addAuthorizationStub(xhr) {
},
getResults (topLevelObject, pathArray) {
- let objectCopy = _.cloneDeep(topLevelObject);
+ let objectCopy = _cloneDeep(topLevelObject);
let i = pathArray.length;
let results = [];
while(pathArray[pathArray.length - i]) {
- if (_.isArray(objectCopy[pathArray[pathArray.length - i]])) {
+ if (_isArray(objectCopy[pathArray[pathArray.length - i]])) {
if (i == 2) {
- results = _.map(objectCopy[pathArray[pathArray.length - i]], pathArray[pathArray.length - 1]);
+ results = _map(objectCopy[pathArray[pathArray.length - i]], pathArray[pathArray.length - 1]);
} else {
objectCopy = objectCopy[pathArray[pathArray.length - i]];
}
- } else if (_.isArray(objectCopy)) {
+ } else if (_isArray(objectCopy)) {
objectCopy.map((object) => {
- if (_.isArray(object[pathArray[pathArray.length - i]])) {
+ if (_isArray(object[pathArray[pathArray.length - i]])) {
if (i == 2) {
- results = results.concat(_.map(object[pathArray[pathArray.length - i]], pathArray[pathArray.length - 1]));
+ results = results.concat(_map(object[pathArray[pathArray.length - i]], pathArray[pathArray.length - 1]));
}
}
})
getAbsoluteResults (topLevelObject, pathArray) {
let i = pathArray.length;
- let objectCopy = _.cloneDeep(topLevelObject);
+ let objectCopy = _cloneDeep(topLevelObject);
let results = [];
let fragment = pathArray[pathArray.length - i]
while (fragment) {
if (i == 1) {
// last fragment
- if (_.isArray(objectCopy)) {
+ if (_isArray(objectCopy)) {
// results will be obtained from a map
- results = _.map(objectCopy, fragment);
+ results = _map(objectCopy, fragment);
} else {
// object
if (fragment.match(/\[.*\]/g)) {
}
}
} else {
- if (_.isArray(objectCopy)) {
+ if (_isArray(objectCopy)) {
// is array
- objectCopy = _.map(objectCopy, fragment);
+ objectCopy = _map(objectCopy, fragment);
// If any of the deeper object is an array, flatten the entire list.
// This would usually be a bad leafref going out of its scope.
// Log it too
for (let i = 0; i < objectCopy.length; i++) {
- if (_.isArray(objectCopy[i])) {
- objectCopy = _.flatten(objectCopy);
+ if (_isArray(objectCopy[i])) {
+ objectCopy = _flatten(objectCopy);
console.log('This might be a bad leafref. Verify with backend team.')
break;
}
let key = fragment.split('[')[0];
let searchObject = {};
searchObject[predicateKey] = predicateValue;
- let found = _.find(objectCopy[key], searchObject);
+ let found = _find(objectCopy[key], searchObject);
if (found) {
objectCopy = found;
} else {
predicateValue != NaN &&
predicateValue != Infinity &&
predicateValue != -Infinity) {
- let numericalPredicateValue = _.toNumber(predicateValue);
- if (_.isNumber(numericalPredicateValue)) {
+ let numericalPredicateValue = _toNumber(predicateValue);
+ if (_isNumber(numericalPredicateValue)) {
searchObject[predicateKey] = numericalPredicateValue;
- found = _.find(objectCopy[key], searchObject);
+ found = _find(objectCopy[key], searchObject);
}
}
if (found) {
},
resolveLeafRefPath (catalogs, leafRefPath, fieldKey, path, container) {
- let pathCopy = _.clone(path);
+ let pathCopy = _clone(path);
// Strip any prefixes
let leafRefPathCopy = leafRefPath.replace(/[\w\d]*:/g, '');
// Strip any spaces
if (fieldKeyArray.length == 1) {
for (let key in catalogs) {
for (let subKey in catalogs[key]) {
- let found = _.find(catalogs[key][subKey], {id: fieldKeyArray[0]});
+ let found = _find(catalogs[key][subKey], {id: fieldKeyArray[0]});
if (found) {
results = this.getAbsoluteResults(found, pathArray.splice(-i, i));
return results;
} else if (fieldKeyArray.length == 2) {
for (let key in catalogs) {
for (let subKey in catalogs[key]) {
- let found = _.find(catalogs[key][subKey], {id: fieldKeyArray[0]});
+ let found = _find(catalogs[key][subKey], {id: fieldKeyArray[0]});
if (found) {
for (let foundKey in found) {
- // let topLevel = _.find(found[foundKey], {id: fieldKeyArray[1]});
+ // let topLevel = _find(found[foundKey], {id: fieldKeyArray[1]});
if (foundKey == fieldKeyArray[1]) {
results = this.getAbsoluteResults(found[foundKey], pathArray.splice(-i, i));
return results;
*/
'use strict';
-import _ from 'lodash'
import $ from 'jquery'
import alt from '../alt'
import utils from '../libraries/utils'
*/
'use strict';
-import _ from 'lodash'
+import _pick from 'lodash/pick'
+import _isEqual from 'lodash/isEqual'
+import _cloneDeep from 'lodash/cloneDeep'
import cc from 'change-case'
import alt from '../alt'
import UID from '../libraries/UniqueId'
const areCatalogItemsMetaDataEqual = function (a, b) {
const metaProps = ['id', 'name', 'short-name', 'description', 'vendor', 'version'];
- const aMetaData = _.pick(a, metaProps);
- const bMetaData = _.pick(b, metaProps);
- return _.isEqual(aMetaData, bMetaData);
+ const aMetaData = _pick(a, metaProps);
+ const bMetaData = _pick(b, metaProps);
+ return _isEqual(aMetaData, bMetaData);
};
function createItem (type) {
vnfd.uiState['instance-ref-count'] = instanceRefCount;
}
// create an instance of this vnfd to carry transient ui state properties
- const instance = _.cloneDeep(vnfd);
+ const instance = _cloneDeep(vnfd);
instance.uiState['member-vnf-index'] = d['member-vnf-index'];
instance['vnf-configuration'] = d['vnf-configuration'];
instance['start-by-default'] = d['start-by-default'];
ComposerAppActions.showError.defer({
errorMessage: 'Cannot edit NSD/VNFD with references to instantiated Network Services'
});
- return _.cloneDeep(d);
+ return _cloneDeep(d);
} else {
item.uiState.modified = modified;
requiresSave = true;
ComposerAppActions.showError.defer({
errorMessage: 'Cannot edit NSD/VNFD with references to instantiated Network Services'
});
- return _.cloneDeep(d);
+ return _cloneDeep(d);
} else {
itemDescriptor.model.uiState.modified = true;
this.addSnapshot(itemDescriptor.model);
duplicateSelectedCatalogItem() {
const item = this.getFirstSelectedCatalogItem();
if (item) {
- const newItem = _.cloneDeep(item);
+ const newItem = _cloneDeep(item);
newItem.name = newItem.name + ' Copy';
newItem.id = guid();
UID.assignUniqueId(newItem.uiState);
*/
'use strict';
-import _ from 'lodash'
+import _delay from 'lodash/delay'
+import _pick from 'lodash/pick'
import alt from '../alt'
import guid from '../libraries/guid'
import numeral from 'numeral'
delete catalogPackage.checkStatusTimeoutId;
statusCheckFunction(catalogPackage).catch(exception);
};
- catalogPackage.checkStatusTimeoutId = _.delay(delayCallback, defaults.checkStatusDelayInSeconds * 1000);
+ catalogPackage.checkStatusTimeoutId = _delay(delayCallback, defaults.checkStatusDelayInSeconds * 1000);
}
}
uploadCatalogPackage(file) {
file.id = file.id || guid();
- const catalogPackage = _.pick(file, packagePropertyNames);
+ const catalogPackage = _pick(file, packagePropertyNames);
catalogPackage.icon = file.riftAction === 'onboard' ? imgOnboard : imgUpdate;
catalogPackage.type = 'upload';
this.addPackage(catalogPackage);
*/
'use strict';
-import _ from 'lodash'
+import _isNumber from 'lodash/isNumber'
+import _cloneDeep from 'lodash/cloneDeep'
+import _isEmpty from 'lodash/isEmpty'
+import _mergeWith from 'lodash/mergeWith'
+import _uniqBy from 'lodash/uniqBy'
+import _isEqual from 'lodash/isEqual'
+import _findIndex from 'lodash/findIndex'
+import _remove from 'lodash/remove'
import d3 from 'd3'
import alt from '../alt'
import UID from '../libraries/UniqueId'
const getDefault = (name, defaultValue) => {
const val = window.localStorage.getItem('defaults-' + name);
if (val) {
- if (_.isNumber(val)) {
+ if (_isNumber(val)) {
if (val < 0) {
return setDefault(name, 0);
}
d.cpNumber = ++cpNumber;
containers.filter(d => DescriptorModelFactory.isVnfdConnectionPointRef(d)).filter(ref => ref.key === d.key).forEach(ref => ref.cpNumber = d.cpNumber);
});
- this.setState({containers: containers, item: _.cloneDeep(item)});
+ this.setState({containers: containers, item: _cloneDeep(item)});
}
SelectionManager.refreshOutline();
}
applyDefaultLayout() {
if (this.item && this.item.uiState && this.item.uiState.containerPositionMap) {
- if (!_.isEmpty(this.item.uiState.containerPositionMap)) {
+ if (!_isEmpty(this.item.uiState.containerPositionMap)) {
this.item.uiState.containerPositionMap = {};
CatalogItemsActions.catalogItemMetaDataChanged.defer(this.item);
}
if (isFullScreen()) {
const layout = comp.layout;
- const restoreLayout = _.cloneDeep(layout);
+ const restoreLayout = _cloneDeep(layout);
uiTransientState.restoreLayout = restoreLayout;
layout.left = 0;
layout.right = 0;
if (self.fileMonitoringSocketID) {
let newState = {};
if(data.hasOwnProperty('contents')) {
- filesState = addInputState( _.cloneDeep(this.filesState),data);
- // filesState = _.merge(self.filesState, addInputState({},data));
+ filesState = addInputState( _cloneDeep(this.filesState),data);
let normalizedData = normalizeTree(data);
newState = {
files: {
- data: _.mergeWith(normalizedData.data, self.files.data, function(obj, src) {
- return _.uniqBy(obj? obj.concat(src) : src, 'name');
+ data: _mergeWith(normalizedData.data, self.files.data, function(obj, src) {
+ return _uniqBy(obj? obj.concat(src) : src, 'name');
}),
id: normalizedData.id
},
files: false
}
}
- if(!_.isEqual(newState.files, this.files) || ! _.isEqual(newState.fileState, this.fileState)) {
+ if(!_isEqual(newState.files, this.files) || ! _isEqual(newState.fileState, this.fileState)) {
this.setState(newState);
}
updateFileLocationInput = (data) => {
let name = data.name;
let value = data.value;
- var filesState = _.cloneDeep(this.filesState);
+ var filesState = _cloneDeep(this.filesState);
filesState[name] = value;
this.setState({
filesState: filesState
if(!data.refresh) {
let path = data.path;
let fileName = data.fileName;
- let files = _.cloneDeep(this.files);
+ let files = _cloneDeep(this.files);
let loadingIndex = files.data[path].push({
status: 'DOWNLOADING',
name: path + '/' + fileName
openDownloadMonitoringSocketSuccess = (id) => {
let self = this;
let ws = window.multiplexer.channel(id);
- let downloadJobs = _.cloneDeep(self.downloadJobs);
+ let downloadJobs = _cloneDeep(self.downloadJobs);
let newFiles = false;
ws.onmessage = (socket) => {
if (self.files && self.files.length > 0) {
try {
jobs = JSON.parse(socket.data);
} catch(e) {}
- newFiles = _.cloneDeep(self.files);
+ newFiles = _cloneDeep(self.files);
jobs.map(function(j) {
//check if not in completed state
let fullPath = j['package-path'];
let path = fullPath.split('/');
let fileName = path.pop();
path = path.join('/');
- let index = _.findIndex(self.files.data[path], function(o){
+ let index = _findIndex(self.files.data[path], function(o){
return fullPath == o.name
});
if((index > -1) && newFiles.data[path][index]) {
}
deleteFileSuccess = (data) => {
let path = data.path.split('/')
- let files = _.cloneDeep(this.files);
+ let files = _cloneDeep(this.files);
path.pop();
path = path.join('/');
let pathFiles = files.data[path]
- _.remove(pathFiles, function(c) {
+ _remove(pathFiles, function(c) {
return c.name == data.path;
});
/*global describe, beforeEach, it, expect, xit, xdescribe */
'use strict';
-import _ from 'lodash'
+import _cloneDeep from 'lodash/cloneDeep'
import DescriptorModelSerializer from '../../../src/libraries/model/DescriptorModelSerializer'
import DescriptorModelFactory from '../../../src/libraries/model/DescriptorModelFactory'
import SampleCatalogs from 'json!../../../src/assets/ping-pong-catalog.json'
describe('buildCatalogItemFactory', () => {
let containers;
beforeEach(() => {
- const nsdJson = _.cloneDeep(SampleCatalogs[0].descriptors[0]);
+ const nsdJson = _cloneDeep(SampleCatalogs[0].descriptors[0]);
// the CatalogItemsStore adds the type to the uiState field when the catalog is loaded
nsdJson.uiState = {type: 'nsd'};
// the user will open a catalog item by dbl clicking on it in the ui that is when we
expect(result).toEqual([]);
});
it('parses an NSD object', () => {
- const nsdJson = _.cloneDeep(SampleCatalogs[0].descriptors[0]);
+ const nsdJson = _cloneDeep(SampleCatalogs[0].descriptors[0]);
nsdJson.uiState = {type: 'nsd'};
const factory = DescriptorModelFactory.buildCatalogItemFactory(SampleCatalogs);
const result = [nsdJson].reduce(factory, [])[0];
});
describe('DescriptorModelSerializer', () => {
it('outputs the same JSON that was parsed by the .buildCatalogItemFactory method', () => {
- const inputJSON = _.cloneDeep(TestCatalogs[0].descriptors[0]);
+ const inputJSON = _cloneDeep(TestCatalogs[0].descriptors[0]);
inputJSON.uiState = {type: 'nsd'};
const factory = DescriptorModelFactory.buildCatalogItemFactory(TestCatalogs);
const parsedModel = [inputJSON].reduce(factory, []);
/*global describe, beforeEach, it, expect, xit */
'use strict';
-import _ from 'lodash'
import DescriptorModel from 'libraries/model/DescriptorModel'
class TestDescriptorModel extends DescriptorModel {
import React from 'react';
import Button from 'widgets/button/rw.button.js';
-import _ from 'lodash';
+import _cloneDeep from 'lodash/cloneDeep';
import SkyquakeComponent from 'widgets/skyquake_container/skyquakeComponent.jsx';
import Crouton from 'react-crouton';
import TextInput from 'widgets/form_controls/textInput.jsx';
}
}
- let newAccount = _.cloneDeep(removeTrailingWhitespace(Account));
+ let newAccount = _cloneDeep(removeTrailingWhitespace(Account));
delete newAccount.params;
newAccount.nestedParams &&
newAccount.nestedParams['container-name'] &&
import GUID from 'utils/guid.js';
import AppHeaderActions from 'widgets/header/headerActions.js';
import Alt from '../alt';
-import _ from 'lodash';
+import _cloneDeep from 'lodash/cloneDeep';
+import _find from 'lodash/find';
class LaunchNetworkServiceStore {
},
updateSSHkeyRef: function(i, j, remove){
return function(e) {
- let usersList = _.cloneDeep(self.usersList)
+ let usersList = _cloneDeep(self.usersList)
let keys = usersList[i]['ssh-authorized-key'];
if(!remove) {
let keyRef = JSON.parse(e.target.value).name;
// Create a filtered NSD payload from the decorated one as RW.REST cannot handle extra parameters now
let nsdPayload = {};
- nsdPayload = _.cloneDeep(_.find(this.state.nsd[0].descriptors, {id: this.state.selectedNSDid}));
+ nsdPayload = _cloneDeep(_find(this.state.nsd[0].descriptors, {id: this.state.selectedNSDid}));
if (nsdPayload != {}) {
nsdPayload['meta'] && delete nsdPayload['meta'];
import NsListPanel from './nsListPanel/nsListPanel.jsx';
import Crouton from 'react-crouton'
import AppHeader from 'widgets/header/header.jsx';
-import Utils from 'utils/utils.js';
import './launchpad.scss';
let ReactCSSTransitionGroup = require('react-addons-css-transition-group');
var LaunchpadFleetActions = require('./launchpadFleetActions.js');
*
*/
import Alt from './alt';
-
+import _filter from 'lodash/filter';
+import _extend from 'lodash/extend';
+import _debounce from 'lodash/debounce';
var FleetSource = require('./launchpadFleetSource.js');
var FleetActions = require('./launchpadFleetActions.js');
import CardActions from './launchpad_card/launchpadCardActions.js';
var FleetStore;
-var _ = require('underscore');
-// _.debounce(function(){});
function FleetStoreConstructor() {
var self = this;
this.fleets = [];
let deletingNSRs = [];
if (self.nsrs) {
- deletingNSRs = _.filter(self.nsrs, function(nsr) {
+ deletingNSRs = _filter(self.nsrs, function(nsr) {
return nsr.deleting == true;
});
};
deletingNSRs.forEach(function(deletingNSR) {
data.nsrs.map(nsr => {
if (nsr.id == deletingNSR.id) {
- _.extend(nsr, deletingNSR);
+ _extend(nsr, deletingNSR);
}
});
});
FleetStoreConstructor.prototype.getNsrInstancesError = function(data) {
console.log('ERROR', data)
};
-FleetStoreConstructor.prototype.handleUpdateControlInput = _.debounce(function(data) {
+FleetStoreConstructor.prototype.handleUpdateControlInput = _debounce(function(data) {
var opt = data[0];
FleetStore.nsrControl(opt.operation, opt.url, data[1])
}, 500).bind(null);
import RecordViewStore from '../recordViewer/recordViewStore.js';
import Button from 'widgets/button/rw.button.js';
import Utils from 'utils/utils.js';
-import _ from 'underscore';
import UpTime from 'widgets/uptime/uptime.jsx';
import './nsrScalingGroups.scss';
import JobListCard from '../launchpad_card/jobListCard.jsx';
import NSVirtualLinks from '../virtual_links/nsVirtualLinks.jsx';
import LaunchpadFleetStore from '../launchpadFleetStore.js';
-
+import _forEach from 'lodash/forEach';
import Prism from 'prismjs';
import 'prismjs/themes/prism.css';
// </pre>
function buildProperties(obj) {
let p = [];
- _.forEach(obj, function(v, k) {
+ _forEach(obj, function(v, k) {
p.push(
<div style={{margin: '0.5rem 0.5rem'}} key={k + '-' + vi}>
<div style={{margin: '0 0.5rem',
// import source
// import AppHeaderActions from 'widgets/header/headerActions.js';
import Alt from '../alt';
-import _ from 'underscore';
+import _find from 'lodash/find';
+import _indexOf from 'lodash/indexOf';
+import _extend from 'lodash/extend';
class RecordViewStore {
constructor() {
sgInstance['vnfrs'] && sgInstance['vnfrs'].map((vnfr, vnfrIndex) => {
scaledVnfrs.push(vnfr);
- let vnfrObj = _.findWhere(nsrs.vnfrs, {id: vnfr});
+ let vnfrObj = _find(nsrs.vnfrs, {id: vnfr});
scaledVnfNav.vnfr.push({
name: vnfrObj['short-name'],
id: vnfr,
// Non-scaled VNFRs
nsrs.vnfrs.map(function(vnfr, vnfrIndex) {
- if (_.indexOf(scaledVnfrs, vnfr.id) == -1) {
+ if (_indexOf(scaledVnfrs, vnfr.id) == -1) {
nav.push({
name: vnfr["short-name"],
id: vnfr.id,
};
}
- navigatorState = _.extend(navigatorState, {
+ navigatorState = _extend(navigatorState, {
recordData: recordData,
recordType: type,
cardLoading: false,
import GUID from 'utils/guid.js';
import AppHeaderActions from 'widgets/header/headerActions.js';
import Alt from '../alt';
-import _ from 'lodash';
+import _cloneDeep from 'lodash/cloneDeep';
+import _merge from 'lodash/merge';
export default class SshKeyStore {
keys: [],
entities: {}
};
- this.dataCache = _.cloneDeep(this.data);
+ this.dataCache = _cloneDeep(this.data);
this.newKey = {
name: '',
key: ''
cancelEditSshKeyPair = (k) => {
let self = this;
return function(e) {
- let data = _.cloneDeep(self.data);
+ let data = _cloneDeep(self.data);
data.entities[k].key = self.dataCache.entities[k].key;
data.entities[k].isEditable = false;
self.setState({data:data});
isEditable: false
};
this.setState({
- dataCache: _.cloneDeep(keys),
+ dataCache: _cloneDeep(keys),
data: keys,
newKey: {
name: '',
isEditable: false
};
this.setState({
- dataCache: _.cloneDeep(keys),
+ dataCache: _cloneDeep(keys),
data: keys,
newKey: {
name: '',
keys.keys.splice(keys.keys.indexOf(data.name), 1);
delete keys.entities[data.name];
this.setState({
- dataCache: _.cloneDeep(keys),
+ dataCache: _cloneDeep(keys),
data: keys
})
}
let flattened = this.flattenKeys(data);
this.setState({
data: flattened,
- dataCache: _.cloneDeep(flattened)
+ dataCache: _cloneDeep(flattened)
})
}
updateSshKeyPair = (k, field) => {
};
data && data.map(function(d){
fd.keys.push(d.name);
- fd.entities[d.name] = _.merge({isEditable: false}, d)
+ fd.entities[d.name] = _merge({isEditable: false}, d)
});
return fd;
}
import DashboardCard from 'widgets/dashboard_card/dashboard_card.jsx';
import Listy from 'widgets/listy/listy.js';
-import _ from 'underscore';
+import _isEmpty from 'lodash/isEmpty';
export default class TopologyDetail extends React.Component {
constructor(props) {
}
detailData(data) {
- if (_.isEmpty(data)) {
+ if (_isEmpty(data)) {
return {};
} else {
return {
*/
import React from 'react';
import Utils from 'utils/utils.js';
-import _ from 'lodash';
import './nsVirtualLinks.scss';
import NSVirtualLinkCreateStore from './nsVirtualLinkCreateStore.js';
import SkyquakeComponent from 'widgets/skyquake_container/skyquakeComponent.jsx';
import NSVirtualLinkCreateActions from './nsVirtualLinkCreateActions.js';
import NSVirtualLinkCreateSource from './nsVirtualLinkCreateSource.js';
import Alt from '../alt';
-import _ from 'lodash';
+import _cloneDeep from 'lodash/cloneDeep';
+import _pickBy from 'lodash/pickBy';
+import _identity from 'lodash/identity';
class NSVirtualLinkCreateStore {
constructor() {
}
updateFirstLevelKey = (key, e) => {
- let vld = _.cloneDeep(this.vld);
+ let vld = _cloneDeep(this.vld);
let value = e.target.nodeName == "SELECT" ? JSON.parse(e.target.value) : e.target.value;
vld[key] = value;
this.setState({
}
updateSecondLevelKey = (firstLevelKey, secondLevelKey, e) => {
- let vld = _.cloneDeep(this.vld);
+ let vld = _cloneDeep(this.vld);
if (!vld[firstLevelKey]) {
vld[firstLevelKey] = {};
}
}
updateVLDInitParamsValue = (currentVLDInitParamsType, e) => {
- let vld = _.cloneDeep(this.vld);
+ let vld = _cloneDeep(this.vld);
this.vldInitParamsTypes.map((vldInitParamType) => {
if (currentVLDInitParamsType == vldInitParamType) {
let value = e.target.nodeName == "SELECT" ? JSON.parse(e.target.value) : e.target.value;
}
updateFirstLevelListKeyChange = (listName, index, keyName, e) => {
- let vld = _.cloneDeep(this.vld);
+ let vld = _cloneDeep(this.vld);
!vld[listName] && (vld[listName] = []);
addConnectionPointRef = () => {
let vld = {};
if (this.vld) {
- vld = _.cloneDeep(this.vld);
+ vld = _cloneDeep(this.vld);
if (!vld['vnfd-connection-point-ref']) {
vld['vnfd-connection-point-ref'] = [];
}
}
removeConnectionPointRef = (vnfdConnectionPointRefIndex) => {
- let vld = _.cloneDeep(this.vld);
+ let vld = _cloneDeep(this.vld);
vld['vnfd-connection-point-ref'].splice(vnfdConnectionPointRefIndex, 1);
this.setState({
vld: vld
cleanupPayload = (mode, vld) => {
// Do necessary cleanup here
- let cleanVld = _.pickBy(vld, _.identity);
+ let cleanVld = _pickBy(vld, _identity);
return cleanVld;
}
import React from 'react';
import RecordViewStore from '../recordViewer/recordViewStore.js';
import Utils from 'utils/utils.js';
-import _ from 'lodash';
+import _isArray from 'lodash/isArray';
import './nsVirtualLinks.scss';
import UpTime from 'widgets/uptime/uptime.jsx';
import NSVirtualLinksStore from './nsVirtualLinksStore.js';
let value = this.resolvePath(this.props.virtualLink, field.key);
let textFields = [];
- if (_.isArray(value)) {
+ if (_isArray(value)) {
value.map((v, idx) => {
let transformedValue = this.transformValue(field, v);
textFields.push(
import NSVirtualLinkCreateStore from './nsVirtualLinkCreateStore.js';
import Button from 'widgets/button/rw.button.js';
import Utils from 'utils/utils.js';
-import _ from 'lodash';
+import _find from 'lodash/find';
import './nsVirtualLinks.scss';
import UpTime from 'widgets/uptime/uptime.jsx';
import NSVirtualLinkDetails from './nsVirtualLinkDetails.jsx';
handleSelectVirtualLinkClick = (virtualLinkId, event) => {
this.setState({
mode: 'viewing',
- selectedVirtualLink: this.props.data && this.props.data['decorated-vlrs'] && _.find(this.props.data['decorated-vlrs'], {id: virtualLinkId}),
+ selectedVirtualLink: this.props.data && this.props.data['decorated-vlrs'] && _find(this.props.data['decorated-vlrs'], {id: virtualLinkId}),
editingVirtualLink: null
});
}
event.stopPropagation();
this.setState({
mode: 'editing',
- editingVirtualLink: this.props.data && this.props.data['nsd'] && this.props.data['nsd']['vld'] && _.find(this.props.data['nsd']['vld'], {id: vldId}),
- selectedVirtualLink: this.props.data && this.props.data['decorated-vlrs'] && _.find(this.props.data['decorated-vlrs'], {id: vlrId})
+ editingVirtualLink: this.props.data && this.props.data['nsd'] && this.props.data['nsd']['vld'] && _find(this.props.data['nsd']['vld'], {id: vldId}),
+ selectedVirtualLink: this.props.data && this.props.data['decorated-vlrs'] && _find(this.props.data['decorated-vlrs'], {id: vlrId})
});
}
*
*/
import React from 'react';
-import _ from 'lodash';
+import _isEmpty from 'lodash/isEmpty';
+import _find from 'lodash/find';
+import _cloneDeep from 'lodash/cloneDeep';
import './logging.scss';
import Button from 'widgets/button/rw.button.js';
getData() {
LoggingStore.getLoggingConfig();
this.setState({
- isLoading: _.isEmpty(this.state.loggingConfig)
+ isLoading: _isEmpty(this.state.loggingConfig)
});
}
componentWillUnmount = () => {
this.context.router.push({pathname: ''});
}
// removeCategoryNulls(config) {
- // let cleanConfig = _.cloneDeep(config);
+ // let cleanConfig = _cloneDeep(config);
// let cleanSeverities = [];
// config.defaultSeverities.map(function(d) {
// if (d.severity) {
// return cleanConfig;
// }
cleanupConfig(config) {
- let cleanConfig = _.cloneDeep(config);
+ let cleanConfig = _cloneDeep(config);
let cleanSeverities = [];
cleanConfig.defaultSeverities && cleanConfig.defaultSeverities.map((defSev) => {
if (defSev.severity) {
// for RIFT-14856 so that default severities map to syslog sink
// Find first syslog sink with (WTF - no type on sinks!) name syslog.
- let syslogSink = this.state.loggingConfig.sinks && _.find(this.state.loggingConfig.sinks, {
+ let syslogSink = this.state.loggingConfig.sinks && _find(this.state.loggingConfig.sinks, {
name: 'syslog'
});
let defaultSyslogSeverities = [];
this.state.loggingConfig && this.state.loggingConfig.defaultSeverities && this.state.loggingConfig.defaultSeverities.map((defaultSeverity) => {
// Mapping between default categories and names inside a sink
- let syslogFilterCategory = (syslogSink.filter && syslogSink.filter.category && _.find(syslogSink.filter.category, {
+ let syslogFilterCategory = (syslogSink.filter && syslogSink.filter.category && _find(syslogSink.filter.category, {
name: defaultSeverity.category
})) || {
name: defaultSeverity.category,
* limitations under the License.
*
*/
-import _ from 'lodash';
+import _cloneDeep from 'lodash/cloneDeep';
+import _findIndex from 'lodash/findIndex';
+import _remove from 'lodash/remove';
import LoggingActions from './loggingActions.js';
import LoggingSource from './loggingSource.js';
getLoggingConfigSuccess = (data) => {
console.log("LoggingStore.getLoggingConfigSuccess called. data=", data);
// Do we need to do a deep clone?
- const initialLoggingConfig = _.cloneDeep(data);
+ const initialLoggingConfig = _cloneDeep(data);
console.log("initialLoggingConfig=", initialLoggingConfig);
this.setState({
loggingConfig: data,
putLoggingConfigSuccess = (data) => {
console.log("LoggingStore.putLoggingConfigSuccess called. data=", data);
- const initialLoggingConfig = _.cloneDeep(this.loggingConfig);
+ const initialLoggingConfig = _cloneDeep(this.loggingConfig);
this.setState({
isLoading: false,
initialLoggingConfig: initialLoggingConfig
resetLoggingConfigData = (data) => {
console.log('LoggingStore.resetLoggingConfigData called. data=', data);
// Do we need to do a deep clone?
- const loggingConfig = _.cloneDeep(this.initialLoggingConfig);
+ const loggingConfig = _cloneDeep(this.initialLoggingConfig);
this.setState({
loggingConfig: loggingConfig
});
console.log("LoggingStore.updateCategoryDefaultSeverity:", catsev);
// find the category
- let catIndex = _.findIndex(this.loggingConfig.defaultSeverities, function(o) {
+ let catIndex = _findIndex(this.loggingConfig.defaultSeverities, function(o) {
return o.category == catsev.category;
});
console.log("catIndex=", catIndex);
// find the category (name) in the syslog sink
let self = this;
- let loggingConfig = _.cloneDeep(this.loggingConfig);
+ let loggingConfig = _cloneDeep(this.loggingConfig);
let syslogSinkIndex = -1;
let nulledCategories = this.nulledCategories;
if (sink.name == 'syslog') {
if (sink.filter) {
if (sink.filter.category) {
- let catIndex = _.findIndex(sink.filter.category, {
+ let catIndex = _findIndex(sink.filter.category, {
name: catsev.name
});
if (catIndex != -1) {
// missing elements is not allowed!
// When backend supports it, in loggingSource change the order of operations
// // Delete first followed by save/put.
- _.remove(loggingConfig.sinks[sinkIndex].filter.category, {
+ _remove(loggingConfig.sinks[sinkIndex].filter.category, {
name: catsev.name
});
} else {
sink.filter.category[catIndex] = catsev;
}
} else {
- _.remove(nulledCategories, (v) => v == catsev.name);
+ _remove(nulledCategories, (v) => v == catsev.name);
this.setState({
nulledCategories: nulledCategories
});