summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsvishnev <shlomo-stanisla.vishnevetskiy@amdocs.com>2018-05-08 16:15:21 +0300
committerEinav Keidar <einavw@amdocs.com>2018-05-09 07:26:12 +0000
commit3b0bea525ed2051f3635dfd6800f156601aa8c0d (patch)
tree0b11b67e72d5905dc3b4988afdccd85d596e4b88
parent738df130864363bcb8b18c3b726f0587acaf74fd (diff)
nic creation issue fix
Issue-ID: SDC-1274 Change-Id: Ifd9297d3559f1b8820b0a64f063f1211b6957dd4 Signed-off-by: svishnev <shlomo-stanisla.vishnevetskiy@amdocs.com>
-rw-r--r--openecomp-ui/src/nfvo-components/input/validation/Form.jsx20
-rw-r--r--openecomp-ui/src/nfvo-components/loader/LoaderReducer.js14
-rw-r--r--openecomp-ui/src/nfvo-components/modal/Modal.jsx30
-rw-r--r--openecomp-ui/src/nfvo-utils/RestAPIUtil.js4
-rw-r--r--openecomp-ui/src/nfvo-utils/json/JSONSchema.js2
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/network/NICCreation/NICCreationView.jsx51
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/network/nicEditorComponents/NameAndPurpose.jsx21
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/storage/SoftwareProductComponentStorageView.jsx20
8 files changed, 92 insertions, 70 deletions
diff --git a/openecomp-ui/src/nfvo-components/input/validation/Form.jsx b/openecomp-ui/src/nfvo-components/input/validation/Form.jsx
index 62fc29a55c..b5db67c027 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 @@ class Form extends React.Component {
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 @@ class Form extends React.Component {
labledButtons={labledButtons}
submitButtonText={submitButtonText}
cancelButtonText={cancelButtonText}
- ref={buttons => (this.buttons = buttons)}
+ ref={this.setButtonsRef}
isReadOnlyMode={isReadOnlyMode}
/>
)}
@@ -88,14 +88,19 @@ class Form extends React.Component {
);
}
- 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 @@ class Form extends React.Component {
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 1d0f6790e1..3f9eb17db3 100644
--- a/openecomp-ui/src/nfvo-components/loader/LoaderReducer.js
+++ b/openecomp-ui/src/nfvo-components/loader/LoaderReducer.js
@@ -26,13 +26,6 @@ export default (
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 @@ export default (
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 cfd757501f..2f70a6ac1b 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 @@ export default class Modal extends React.Component {
)
);
}
+
+ 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 6be5db765c..a8b40d32a6 100644
--- a/openecomp-ui/src/nfvo-utils/RestAPIUtil.js
+++ b/openecomp-ui/src/nfvo-utils/RestAPIUtil.js
@@ -79,10 +79,6 @@ function handleSuccess(responseHeaders, requestHeaders) {
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 53d288f3ae..028d82fc7a 100644
--- a/openecomp-ui/src/nfvo-utils/json/JSONSchema.js
+++ b/openecomp-ui/src/nfvo-utils/json/JSONSchema.js
@@ -110,7 +110,7 @@ export default class JSONSchema {
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 88525c051d..6789ba4816 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 Input from 'nfvo-components/input/validation/Input.jsx';
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 @@ class NICCreationView extends React.Component {
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 @@ class NICCreationView extends React.Component {
<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 @@ class NICCreationView extends React.Component {
);
}
- 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 5a89239dc6..634b43f616 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 @@ const NameAndPurpose = ({
genericFieldInfo,
isReadOnlyMode,
name,
- description,
- isManual
+ description
}) => {
return (
<GridSection hastLastColSet>
@@ -35,7 +34,7 @@ const NameAndPurpose = ({
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 ac7e4a8053..653e0ac310 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 @@ const SnapshotBackupSection = ({
'storage/snapshotBackup/snapshotFrequency': snapshotFrequency
})
}
- label={i18n('Backup Storage Size (GB)')}
+ label={i18n(
+ 'ComponentQuestionnaire/storage/snapshotBackup/snapshotFrequency'
+ )}
type="number"
isValid={
qgenericFieldInfo[