From 1801b24389baa8e3f7298ff2c41e2512b19c1290 Mon Sep 17 00:00:00 2001
From: Einav Weiss Keidar <einavw@amdocs.com>
Date: Mon, 13 Aug 2018 16:19:46 +0300
Subject: react 16 upgrade

Issue-ID: SDC-1762
Change-Id: I7701f12fc63bb09f8c985c7c893b984701dcbfab
Signed-off-by: Einav Keidar <einavw@amdocs.com>
---
 .../processes/SoftwareProductProcessListView.jsx   | 14 +++----
 .../processes/SoftwareProductProcesses.js          | 27 ++++++++-----
 .../SoftwareProductProcessesActionHelper.js        | 44 ++++++++++++++++++----
 .../SoftwareProductProcessesEditorForm.jsx         | 12 +++---
 .../processes/SoftwareProductProcessesView.jsx     | 41 ++------------------
 5 files changed, 71 insertions(+), 67 deletions(-)

(limited to 'openecomp-ui/src/sdc-app/onboarding/softwareProduct/processes')

diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/processes/SoftwareProductProcessListView.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/processes/SoftwareProductProcessListView.jsx
index cee46abc69..5f1cdb56e6 100644
--- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/processes/SoftwareProductProcessListView.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/processes/SoftwareProductProcessListView.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';
@@ -66,7 +66,7 @@ class SoftwareProductProcessesListView extends React.Component {
                 key={id}
                 className="list-editor-item-view"
                 isReadOnlyMode={isReadOnlyMode}
-                onSelect={() => onEditProcess(process)}
+                onSelect={() => onEditProcess(process, isReadOnlyMode)}
                 onDelete={() => onDeleteProcess(process, version)}>
                 <div className="list-editor-item-view-field">
                     <div className="title">{i18n('Name')}</div>
diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/processes/SoftwareProductProcesses.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/processes/SoftwareProductProcesses.js
index fb44530dae..e00cafb64a 100644
--- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/processes/SoftwareProductProcesses.js
+++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/processes/SoftwareProductProcesses.js
@@ -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 { connect } from 'react-redux';
 import i18n from 'nfvo-utils/i18n/i18n.js';
@@ -38,9 +38,18 @@ export const mapStateToProps = ({ softwareProduct }) => {
 const mapActionsToProps = (dispatch, { softwareProductId, version }) => {
     return {
         onAddProcess: () =>
-            SoftwareProductProcessesActionHelper.openEditor(dispatch),
-        onEditProcess: process =>
-            SoftwareProductProcessesActionHelper.openEditor(dispatch, process),
+            SoftwareProductProcessesActionHelper.openEditor(dispatch, {
+                softwareProductId,
+                version,
+                isReadOnlyMode: false
+            }),
+        onEditProcess: (process, isReadOnlyMode) =>
+            SoftwareProductProcessesActionHelper.openEditor(dispatch, {
+                process,
+                softwareProductId,
+                version,
+                isReadOnlyMode
+            }),
         onDeleteProcess: process =>
             dispatch({
                 type: modalActionTypes.GLOBAL_MODAL_WARNING,
diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/processes/SoftwareProductProcessesActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/processes/SoftwareProductProcessesActionHelper.js
index 7c72c5b892..0e586100b3 100644
--- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/processes/SoftwareProductProcessesActionHelper.js
+++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/processes/SoftwareProductProcessesActionHelper.js
@@ -1,21 +1,27 @@
-/*!
- * 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 { actionTypes } from './SoftwareProductProcessesConstants.js';
 import RestAPIUtil from 'nfvo-utils/RestAPIUtil.js';
 import Configuration from 'sdc-app/config/Configuration.js';
+import i18n from 'nfvo-utils/i18n/i18n.js';
+import {
+    actionTypes as modalActionTypes,
+    modalSizes
+} from 'nfvo-components/modal/GlobalModalConstants.js';
+import { modalContentMapper } from 'sdc-app/common/modal/ModalContentMapper.js';
 
 function baseUrl(vspId, version) {
     let { id: versionId } = version;
@@ -73,10 +79,29 @@ const SoftwareProductActionHelper = {
             });
         });
     },
-    openEditor(dispatch, process = {}) {
+    openEditor(
+        dispatch,
+        { process, softwareProductId, version, isReadOnlyMode }
+    ) {
         dispatch({
             type: actionTypes.SOFTWARE_PRODUCT_PROCESS_EDITOR_OPEN,
-            process
+            process: process ? process : {}
+        });
+        dispatch({
+            type: modalActionTypes.GLOBAL_MODAL_SHOW,
+            data: {
+                modalComponentName: modalContentMapper.PROCESS_EDITOR,
+                modalComponentProps: {
+                    version,
+                    softwareProductId,
+                    isReadOnlyMode,
+                    size: modalSizes.LARGE
+                },
+                bodyClassName: 'edit-process-modal',
+                title: process
+                    ? i18n('Edit Process Details')
+                    : i18n('Create New Process Details')
+            }
         });
     },
 
@@ -95,6 +120,9 @@ const SoftwareProductActionHelper = {
         dispatch({
             type: actionTypes.SOFTWARE_PRODUCT_PROCESS_EDITOR_CLOSE
         });
+        dispatch({
+            type: modalActionTypes.GLOBAL_MODAL_CLOSE
+        });
     },
 
     saveProcess(
diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/processes/SoftwareProductProcessesEditorForm.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/processes/SoftwareProductProcessesEditorForm.jsx
index 6e8254f65b..a858e0f07e 100644
--- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/processes/SoftwareProductProcessesEditorForm.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/processes/SoftwareProductProcessesEditorForm.jsx
@@ -1,12 +1,12 @@
 /*
- * Copyright © 2016-2017 European Support Limited
+ * 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
- * 
+ *
  * 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.
@@ -70,7 +70,8 @@ class SoftwareProductProcessesEditorForm extends React.Component {
                         isValid={this.props.isFormValid}
                         formReady={this.props.formReady}
                         onValidateForm={() => this.props.onValidateForm()}
-                        className="vsp-processes-editor">
+                        className="vsp-processes-editor"
+                        btnClassName="sdc-modal__footer">
                         <div
                             className={`vsp-processes-editor-data${
                                 isReadOnlyMode ? ' disabled' : ''
@@ -129,7 +130,7 @@ class SoftwareProductProcessesEditorForm extends React.Component {
                                     <GridItem colSpan={2}>
                                         <Input
                                             name="vsp-process-description"
-                                            groupClassName="vsp-process-description"
+                                            groupClassName="vsp-process-description no-bottom-margin"
                                             onChange={description =>
                                                 onDataChanged({ description })
                                             }
@@ -169,6 +170,7 @@ class SoftwareProductProcessesEditorForm extends React.Component {
                                             label={i18n('Process Type')}
                                             className="process-type"
                                             data-test-id="process-type"
+                                            groupClassName="no-bottom-margin"
                                             isValid={
                                                 genericFieldInfo.type.isValid
                                             }
diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/processes/SoftwareProductProcessesView.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/processes/SoftwareProductProcessesView.jsx
index 1357c31e12..50421bc824 100644
--- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/processes/SoftwareProductProcessesView.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/processes/SoftwareProductProcessesView.jsx
@@ -1,12 +1,12 @@
 /*
- * Copyright © 2016-2017 European Support Limited
+ * 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
- * 
+ *
  * 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.
@@ -16,8 +16,6 @@
 import React from 'react';
 import PropTypes from 'prop-types';
 import i18n from 'nfvo-utils/i18n/i18n.js';
-import Modal from 'nfvo-components/modal/Modal.jsx';
-import SoftwareProductProcessesEditor from './SoftwareProductProcessesEditor.js';
 import SoftwareProductProcessListView from './SoftwareProductProcessListView.jsx';
 
 class SoftwareProductProcessesView extends React.Component {
@@ -37,7 +35,6 @@ class SoftwareProductProcessesView extends React.Component {
     render() {
         return (
             <div className="software-product-landing-view-right-side vsp-processes-page">
-                {this.renderEditor()}
                 <SoftwareProductProcessListView
                     addButtonTitle={i18n('Add Process Details')}
                     {...this.props}
@@ -45,38 +42,6 @@ class SoftwareProductProcessesView extends React.Component {
             </div>
         );
     }
-
-    renderEditor() {
-        let {
-            currentSoftwareProduct: { id },
-            version,
-            isModalInEditMode,
-            isReadOnlyMode,
-            isDisplayEditor
-        } = this.props;
-        return (
-            <Modal
-                show={isDisplayEditor}
-                bsSize="large"
-                animation={true}
-                className="onborading-modal">
-                <Modal.Header>
-                    <Modal.Title>
-                        {isModalInEditMode
-                            ? i18n('Edit Process Details')
-                            : i18n('Create New Process Details')}
-                    </Modal.Title>
-                </Modal.Header>
-                <Modal.Body className="edit-process-modal">
-                    <SoftwareProductProcessesEditor
-                        softwareProductId={id}
-                        version={version}
-                        isReadOnlyMode={isReadOnlyMode}
-                    />
-                </Modal.Body>
-            </Modal>
-        );
-    }
 }
 
 export default SoftwareProductProcessesView;
-- 
cgit 1.2.3-korg