diff options
Diffstat (limited to 'openecomp-ui/src/sdc-app/flows')
-rw-r--r-- | openecomp-ui/src/sdc-app/flows/FlowsActions.js | 46 | ||||
-rw-r--r-- | openecomp-ui/src/sdc-app/flows/FlowsEditorModal.js | 16 | ||||
-rw-r--r-- | openecomp-ui/src/sdc-app/flows/FlowsEditorModalView.jsx | 15 | ||||
-rw-r--r-- | openecomp-ui/src/sdc-app/flows/FlowsListEditor.js | 20 | ||||
-rw-r--r-- | openecomp-ui/src/sdc-app/flows/FlowsListEditorView.jsx | 43 | ||||
-rw-r--r-- | openecomp-ui/src/sdc-app/flows/FlowsListReducer.js | 20 |
6 files changed, 70 insertions, 90 deletions
diff --git a/openecomp-ui/src/sdc-app/flows/FlowsActions.js b/openecomp-ui/src/sdc-app/flows/FlowsActions.js index 9fb65f37d4..4ad7dcfdc8 100644 --- a/openecomp-ui/src/sdc-app/flows/FlowsActions.js +++ b/openecomp-ui/src/sdc-app/flows/FlowsActions.js @@ -1,22 +1,25 @@ -/*! - * 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 RestAPIUtil from 'nfvo-utils/RestAPIUtil.js'; import Configuration from 'sdc-app/config/Configuration.js'; import { actionTypes, enums } from './FlowsConstants.js'; import SequenceDiagramModelHelper from './SequenceDiagramModelHelper.js'; +import { actionTypes as modalActionTypes } from 'nfvo-components/modal/GlobalModalConstants.js'; +import { modalContentMapper } from 'sdc-app/common/modal/ModalContentMapper.js'; +import i18n from 'nfvo-utils/i18n/i18n.js'; function baseUrl(serviceId, artifactId = '') { const restCatalogPrefix = Configuration.get('restCatalogPrefix'); @@ -97,7 +100,7 @@ const FlowsActions = Object.freeze({ readonly }); if (!readonly) { - FlowsActions.openFlowDetailsEditor(dispatch); + FlowsActions.openEditCreateWFModal(dispatch); } } else { Object.keys(artifacts).forEach(artifact => @@ -194,14 +197,6 @@ const FlowsActions = Object.freeze({ ); }, - openFlowDetailsEditor(dispatch, flow) { - dispatch({ type: actionTypes.OPEN_FLOW_DETAILS_EDITOR, flow }); - }, - - closeFlowDetailsEditor(dispatch) { - dispatch({ type: actionTypes.CLOSE_FLOW_DETAILS_EDITOR }); - }, - openFlowDiagramEditor(dispatch, { flow }) { dispatch({ type: actionTypes.OPEN_FLOW_DIAGRAM_EDITOR, flow }); }, @@ -212,6 +207,27 @@ const FlowsActions = Object.freeze({ reset(dispatch) { dispatch({ type: actionTypes.RESET }); + }, + openEditCreateWFModal(dispatch, flow) { + dispatch({ type: actionTypes.OPEN_FLOW_DETAILS_EDITOR, flow }); + dispatch({ + type: modalActionTypes.GLOBAL_MODAL_SHOW, + data: { + modalComponentName: modalContentMapper.FLOWS_EDITOR, + modalComponentProps: { + isNewArtifact: Boolean(flow && flow.uniqueId) + }, + title: flow + ? i18n('Edit Workflow') + : i18n('Create New Workflow') + } + }); + }, + closeEditCreateWFModal(dispatch) { + dispatch({ + type: modalActionTypes.GLOBAL_MODAL_CLOSE + }); + dispatch({ type: actionTypes.CLOSE_FLOW_DETAILS_EDITOR }); } }); diff --git a/openecomp-ui/src/sdc-app/flows/FlowsEditorModal.js b/openecomp-ui/src/sdc-app/flows/FlowsEditorModal.js index b45a9fc54e..4ef12faa0e 100644 --- a/openecomp-ui/src/sdc-app/flows/FlowsEditorModal.js +++ b/openecomp-ui/src/sdc-app/flows/FlowsEditorModal.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 FlowsEditorModalView from './FlowsEditorModalView.jsx'; @@ -50,10 +50,10 @@ export const mapStateToProps = ({ flows }) => { const mapActionsToProps = (dispatch, { isNewArtifact }) => { return { onSubmit: flow => { - FlowsActions.closeFlowDetailsEditor(dispatch); + FlowsActions.closeEditCreateWFModal(dispatch); FlowsActions.createOrUpdateFlow(dispatch, { flow }, isNewArtifact); }, - onCancel: () => FlowsActions.closeFlowDetailsEditor(dispatch), + onCancel: () => FlowsActions.closeEditCreateWFModal(dispatch), onDataChanged: deltaData => ValidationHelper.dataChanged(dispatch, { deltaData, diff --git a/openecomp-ui/src/sdc-app/flows/FlowsEditorModalView.jsx b/openecomp-ui/src/sdc-app/flows/FlowsEditorModalView.jsx index 8c805cca9c..6ac316ed5c 100644 --- a/openecomp-ui/src/sdc-app/flows/FlowsEditorModalView.jsx +++ b/openecomp-ui/src/sdc-app/flows/FlowsEditorModalView.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, { Component } from 'react'; import i18n from 'nfvo-utils/i18n/i18n.js'; @@ -38,7 +38,8 @@ class FlowsEditorModalView extends Component { onReset={onCancel} formReady={formReady} isValid={isFormValid} - onValidateForm={() => onValidateForm()}> + onValidateForm={() => onValidateForm()} + btnClassName="sdc-modal__footer"> <Input type="text" name="name" diff --git a/openecomp-ui/src/sdc-app/flows/FlowsListEditor.js b/openecomp-ui/src/sdc-app/flows/FlowsListEditor.js index 2718c19aaa..c96415cafb 100644 --- a/openecomp-ui/src/sdc-app/flows/FlowsListEditor.js +++ b/openecomp-ui/src/sdc-app/flows/FlowsListEditor.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 FlowsActions from './FlowsActions.js'; @@ -20,8 +20,6 @@ import FlowsListEditorView from './FlowsListEditorView.jsx'; export const mapStateToProps = ({ flows }) => { let { flowList = [], - isDisplayModal, - isModalInEditMode, shouldShowWorkflowsEditor = true, data = undefined, readonly @@ -33,9 +31,7 @@ export const mapStateToProps = ({ flows }) => { return { flowList, - isDisplayModal, isCheckedOut, - isModalInEditMode, shouldShowWorkflowsEditor, currentFlow: data, readonly @@ -44,9 +40,9 @@ export const mapStateToProps = ({ flows }) => { const mapActionsToProps = dispatch => { return { - onAddWorkflowClick: () => FlowsActions.openFlowDetailsEditor(dispatch), + onAddWorkflowClick: () => FlowsActions.openEditCreateWFModal(dispatch), onEditFlowDetailsClick: flow => - FlowsActions.openFlowDetailsEditor(dispatch, flow), + FlowsActions.openEditCreateWFModal(dispatch, flow), onEditFlowDiagramClick: flow => FlowsActions.fetchArtifact(dispatch, { flow }), onDeleteFlowClick: flow => FlowsActions.deleteFlow(dispatch, { flow }), diff --git a/openecomp-ui/src/sdc-app/flows/FlowsListEditorView.jsx b/openecomp-ui/src/sdc-app/flows/FlowsListEditorView.jsx index d1c0c9a3df..f0a4635213 100644 --- a/openecomp-ui/src/sdc-app/flows/FlowsListEditorView.jsx +++ b/openecomp-ui/src/sdc-app/flows/FlowsListEditorView.jsx @@ -1,34 +1,30 @@ -/*! - * 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, { Component } from 'react'; import PropTypes from 'prop-types'; import i18n from 'nfvo-utils/i18n/i18n.js'; -import Modal from 'nfvo-components/modal/Modal.jsx'; import ListEditorView from 'nfvo-components/listEditor/ListEditorView.jsx'; import ListEditorItemView from 'nfvo-components/listEditor/ListEditorItemView.jsx'; -import FlowsEditorModal from './FlowsEditorModal.js'; import SequenceDiagram from './SequenceDiagram.jsx'; class FlowsListEditorView extends Component { static propTypes = { flowList: PropTypes.array, currentFlow: PropTypes.object, - isDisplayModal: PropTypes.bool, - isModalInEditMode: PropTypes.bool, isCheckedOut: PropTypes.bool, shouldShowWorkflowsEditor: PropTypes.bool, readonly: PropTypes.bool, @@ -57,7 +53,7 @@ class FlowsListEditorView extends Component { } renderWorkflowsEditor() { - let { isDisplayModal, onAddWorkflowClick, isCheckedOut } = this.props; + let { onAddWorkflowClick, isCheckedOut } = this.props; const { localFilter } = this.state; return ( @@ -72,35 +68,10 @@ class FlowsListEditorView extends Component { this.renderWorkflowListItem(flow, isCheckedOut) )} </ListEditorView> - - {isDisplayModal && this.renderWorkflowEditorModal()} </div> ); } - renderWorkflowEditorModal() { - let { isDisplayModal, isModalInEditMode } = this.props; - return ( - <Modal - show={isDisplayModal} - animation={true} - className="onborading-modal workflows-editor-modal"> - <Modal.Header> - <Modal.Title> - {`${ - isModalInEditMode - ? i18n('Edit Workflow') - : i18n('Create New Workflow') - }`} - </Modal.Title> - </Modal.Header> - <Modal.Body> - <FlowsEditorModal isNewArtifact={!isModalInEditMode} /> - </Modal.Body> - </Modal> - ); - } - renderSequenceDiagramTool() { let { onSequenceDiagramSaveClick, diff --git a/openecomp-ui/src/sdc-app/flows/FlowsListReducer.js b/openecomp-ui/src/sdc-app/flows/FlowsListReducer.js index 0279824ac4..56d389bbe5 100644 --- a/openecomp-ui/src/sdc-app/flows/FlowsListReducer.js +++ b/openecomp-ui/src/sdc-app/flows/FlowsListReducer.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 { actionTypes, FLOWS_EDITOR_FORM } from './FlowsConstants.js'; @@ -71,17 +71,13 @@ export default (state = {}, action) => { validations: [{ type: 'required', data: true }] } }, - data: action.flow, - isDisplayModal: true, - isModalInEditMode: Boolean(action.flow && action.flow.uniqueId) + data: action.flow }; case actionTypes.CLOSE_FLOW_DETAILS_EDITOR: return { ...state, - data: undefined, - isDisplayModal: false, - isModalInEditMode: false + data: undefined }; case actionTypes.OPEN_FLOW_DIAGRAM_EDITOR: return { |