nic creation issue fix
Issue-ID: SDC-1274
Change-Id: Ifd9297d3559f1b8820b0a64f063f1211b6957dd4
Signed-off-by: svishnev <shlomo-stanisla.vishnevetskiy@amdocs.com>
diff --git a/openecomp-ui/src/nfvo-components/input/validation/Form.jsx b/openecomp-ui/src/nfvo-components/input/validation/Form.jsx
index 62fc29a..b5db67c 100644
--- a/openecomp-ui/src/nfvo-components/input/validation/Form.jsx
+++ b/openecomp-ui/src/nfvo-components/input/validation/Form.jsx
@@ -70,8 +70,8 @@
return (
<form
{...formProps}
- ref={form => (this.form = form)}
- onSubmit={event => this.handleFormValidation(event)}>
+ ref={this.setFormRef}
+ onSubmit={this.handleFormValidation}>
<div className="validation-form-content">
<fieldset disabled={isReadOnlyMode}>{children}</fieldset>
</div>
@@ -80,7 +80,7 @@
labledButtons={labledButtons}
submitButtonText={submitButtonText}
cancelButtonText={cancelButtonText}
- ref={buttons => (this.buttons = buttons)}
+ ref={this.setButtonsRef}
isReadOnlyMode={isReadOnlyMode}
/>
)}
@@ -88,14 +88,19 @@
);
}
- handleFormValidation(event) {
+ handleFormValidation = event => {
event.preventDefault();
if (this.props.onValidateForm && !this.props.formReady) {
return this.props.onValidateForm();
} else {
return this.handleFormSubmit(event);
}
- }
+ };
+
+ setButtonsRef = buttons => (this.buttons = buttons);
+
+ setFormRef = form => (this.form = form);
+
handleFormSubmit(event) {
if (event) {
event.preventDefault();
@@ -128,7 +133,10 @@
this.props.onValidityChanged(this.props.isValid);
}
}
- if (this.props.formReady) {
+ if (
+ this.props.formReady &&
+ this.props.formReady !== prevProps.formReady
+ ) {
// if form validation succeeded -> continue with submit
this.handleFormSubmit();
}
diff --git a/openecomp-ui/src/nfvo-components/loader/LoaderReducer.js b/openecomp-ui/src/nfvo-components/loader/LoaderReducer.js
index 1d0f679..3f9eb17 100644
--- a/openecomp-ui/src/nfvo-components/loader/LoaderReducer.js
+++ b/openecomp-ui/src/nfvo-components/loader/LoaderReducer.js
@@ -26,13 +26,6 @@
fetchingRequests++;
newArray = state.currentlyFetching.slice();
newArray.splice(0, 0, action.url);
- if (DEBUG) {
- console.log('Loader SEND REQUEST url: ' + action.url);
- console.log(
- 'Loader SEND REQUEST number of fetching requests: ' +
- fetchingRequests
- );
- }
return {
fetchingRequests: fetchingRequests,
currentlyFetching: newArray,
@@ -44,13 +37,6 @@
newArray = state.currentlyFetching.filter(item => {
return item !== action.url;
});
- if (DEBUG) {
- console.log('Loader RECEIVE_RESPONSE url: ' + action.url);
- console.log(
- 'Loader RECEIVE_RESPONSE: number of fetching requests: ' +
- fetchingRequests
- );
- }
return {
currentlyFetching: newArray,
fetchingRequests: fetchingRequests,
diff --git a/openecomp-ui/src/nfvo-components/modal/Modal.jsx b/openecomp-ui/src/nfvo-components/modal/Modal.jsx
index cfd7575..2f70a6a 100644
--- a/openecomp-ui/src/nfvo-components/modal/Modal.jsx
+++ b/openecomp-ui/src/nfvo-components/modal/Modal.jsx
@@ -1,22 +1,22 @@
-/*!
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+/*
+ * Copyright © 2016-2018 European Support Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing
- * permissions and limitations under the License.
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
import React from 'react';
import ReactDOM from 'react-dom';
import BootstrapModal from 'react-bootstrap/lib/Modal.js';
-
+import { isEqual } from 'lodash';
let nextModalId = 0;
export default class Modal extends React.Component {
@@ -47,6 +47,18 @@
)
);
}
+
+ componentWillUnmount() {
+ let element = ReactDOM.findDOMNode(this);
+
+ ['wheel', 'mousewheel', 'DOMMouseScroll', 'click'].forEach(
+ eventType => element.removeEventListener(eventType)
+ );
+ }
+
+ shouldComponentUpdate(nextProps) {
+ return !isEqual(this.props, nextProps);
+ }
};
componentWillMount() {
diff --git a/openecomp-ui/src/nfvo-utils/RestAPIUtil.js b/openecomp-ui/src/nfvo-utils/RestAPIUtil.js
index 6be5db7..a8b40d3 100644
--- a/openecomp-ui/src/nfvo-utils/RestAPIUtil.js
+++ b/openecomp-ui/src/nfvo-utils/RestAPIUtil.js
@@ -79,10 +79,6 @@
class RestAPIUtil {
handleRequest(url, type, options = {}, data) {
- if (DEBUG) {
- console.log('axios --> Making REST call (' + type + '): ' + url);
- }
-
applySecurity(options, data);
// TODO see ig necessary or in transformrequest funtion
diff --git a/openecomp-ui/src/nfvo-utils/json/JSONSchema.js b/openecomp-ui/src/nfvo-utils/json/JSONSchema.js
index 53d288f..028d82f 100644
--- a/openecomp-ui/src/nfvo-utils/json/JSONSchema.js
+++ b/openecomp-ui/src/nfvo-utils/json/JSONSchema.js
@@ -110,7 +110,7 @@
if (items && items.length > 0) {
let values = items
.filter(value => value)
- .map(value => ({ enum: value, title: value }));
+ .map(value => ({ enum: value, title: value.toString() }));
enumResult = values;
}
}
diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/network/NICCreation/NICCreationView.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/network/NICCreation/NICCreationView.jsx
index 88525c0..6789ba4 100644
--- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/network/NICCreation/NICCreationView.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/network/NICCreation/NICCreationView.jsx
@@ -1,17 +1,17 @@
-/*!
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+/*
+ * Copyright © 2016-2018 European Support Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing
- * permissions and limitations under the License.
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
import React from 'react';
import PropTypes from 'prop-types';
@@ -20,6 +20,7 @@
import Form from 'nfvo-components/input/validation/Form.jsx';
import GridSection from 'nfvo-components/grid/GridSection.jsx';
import GridItem from 'nfvo-components/grid/GridItem.jsx';
+import isEqual from 'lodash/isEqual.js';
const NICPropType = PropTypes.shape({
id: PropTypes.string,
@@ -35,14 +36,25 @@
onSubmit: PropTypes.func.isRequired,
onCancel: PropTypes.func.isRequired
};
-
+ shouldComponentUpdate(nextProps) {
+ let res = true;
+ const { data, isFormValid, formReady, genericFieldInfo } = this.props;
+ if (
+ isEqual(data, nextProps.data) &&
+ isEqual(isFormValid, nextProps.isFormValid) &&
+ formReady === nextProps.formReady &&
+ isEqual(genericFieldInfo, nextProps.genericFieldInfo)
+ ) {
+ res = false;
+ }
+ return res;
+ }
render() {
let {
data = {},
onDataChanged,
genericFieldInfo,
isFormValid,
- onValidateForm,
formReady
} = this.props;
let { name, description, networkDescription } = data;
@@ -50,16 +62,15 @@
<div>
{genericFieldInfo && (
<Form
- ref={form => (this.form = form)}
hasButtons={true}
- onSubmit={() => this.submit()}
+ onSubmit={this.submit}
submitButtonText={
data.id ? i18n('Save') : i18n('Create')
}
- onReset={() => this.props.onCancel()}
+ onReset={this.cancel}
labledButtons={true}
isValid={isFormValid}
- onValidateForm={() => onValidateForm()}
+ onValidateForm={this.validate}
formReady={formReady}>
<GridSection hasLastColSet>
<GridItem colSpan={4} lastColInRow>
@@ -148,10 +159,18 @@
);
}
- submit() {
+ submit = () => {
const { data: nic, componentId } = this.props;
this.props.onSubmit({ nic, componentId });
- }
+ };
+
+ validate = () => {
+ this.props.onValidateForm();
+ };
+
+ cancel = () => {
+ this.props.onCancel();
+ };
}
export default NICCreationView;
diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/network/nicEditorComponents/NameAndPurpose.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/network/nicEditorComponents/NameAndPurpose.jsx
index 5a89239..634b43f 100644
--- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/network/nicEditorComponents/NameAndPurpose.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/network/nicEditorComponents/NameAndPurpose.jsx
@@ -1,17 +1,17 @@
-/*!
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+/*
+ * Copyright © 2016-2018 European Support Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing
- * permissions and limitations under the License.
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
import React from 'react';
import PropTypes from 'prop-types';
@@ -25,8 +25,7 @@
genericFieldInfo,
isReadOnlyMode,
name,
- description,
- isManual
+ description
}) => {
return (
<GridSection hastLastColSet>
@@ -35,7 +34,7 @@
label={i18n('Name')}
value={name}
data-test-id="nic-name"
- disabled={!isManual}
+ disabled={true}
isRequired={true}
onChange={name => onDataChanged({ name })}
isValid={genericFieldInfo['name'].isValid}
diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/storage/SoftwareProductComponentStorageView.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/storage/SoftwareProductComponentStorageView.jsx
index ac7e4a8..653e0ac 100644
--- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/storage/SoftwareProductComponentStorageView.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/storage/SoftwareProductComponentStorageView.jsx
@@ -1,17 +1,17 @@
-/*!
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+/*
+ * Copyright © 2016-2018 European Support Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing
- * permissions and limitations under the License.
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
import React from 'react';
import PropTypes from 'prop-types';
@@ -161,7 +161,9 @@
'storage/snapshotBackup/snapshotFrequency': snapshotFrequency
})
}
- label={i18n('Backup Storage Size (GB)')}
+ label={i18n(
+ 'ComponentQuestionnaire/storage/snapshotBackup/snapshotFrequency'
+ )}
type="number"
isValid={
qgenericFieldInfo[