diff options
Diffstat (limited to 'workflow-designer-ui/src/main/frontend/src/features/version/versionController')
5 files changed, 65 insertions, 119 deletions
diff --git a/workflow-designer-ui/src/main/frontend/src/features/version/versionController/VersionController.js b/workflow-designer-ui/src/main/frontend/src/features/version/versionController/VersionController.js index 7f8769cc..8c37a0e3 100644 --- a/workflow-designer-ui/src/main/frontend/src/features/version/versionController/VersionController.js +++ b/workflow-designer-ui/src/main/frontend/src/features/version/versionController/VersionController.js @@ -21,8 +21,8 @@ import { getVersions, getSortedVersions } from 'features/workflow/overview/overviewSelectors'; -import { isWorkflowArchive } from 'features/workflow/workflowSelectors'; import { + isWorkflowArchive, getWorkflowId, getWorkflowName } from 'features/workflow/workflowSelectors'; @@ -30,11 +30,16 @@ import { saveParamsAction, certifyVersionAction } from 'features/version/versionController/versionControllerConstants'; -import { workflowVersionFetchRequestedAction } from '../versionConstants'; +import { + workflowVersionFetchRequestedAction, + toggleCompositionUpdate, + getIsCompositionUpdating +} from 'features/version/versionConstants'; import { getIsCertified } from 'features/version/general/generalSelectors'; import { getIOErrors } from 'features/version/inputOutput/inputOutputSelectors'; import { getCompositionHasErrors } from 'features/version/composition/compositionSelectors'; import { pluginContextSelector } from 'wfapp/pluginContext/pluginContextSelector'; + function mapStateToProps(state) { return { workflowName: getWorkflowName(state), @@ -45,7 +50,8 @@ function mapStateToProps(state) { isCertifyDisable: getIsCertified(state), isArchive: isWorkflowArchive(state), currentWorkflowVersion: state.currentVersion.general, - pluginContext: pluginContextSelector(state) + pluginContext: pluginContextSelector(state), + isCompositionUpdating: getIsCompositionUpdating(state) }; } @@ -55,7 +61,9 @@ function mapDispatchToProps(dispatch) { saveParamsToServer: params => dispatch(saveParamsAction(params)), certifyVersion: payload => dispatch(certifyVersionAction(payload)), changeVersion: payload => - dispatch(workflowVersionFetchRequestedAction(payload)) + dispatch(workflowVersionFetchRequestedAction(payload)), + toggleCompositionUpdate: payload => + dispatch(toggleCompositionUpdate(payload)) }; } diff --git a/workflow-designer-ui/src/main/frontend/src/features/version/versionController/VersionControllerView.jsx b/workflow-designer-ui/src/main/frontend/src/features/version/versionController/VersionControllerView.jsx index ef5e1168..730d92fb 100644 --- a/workflow-designer-ui/src/main/frontend/src/features/version/versionController/VersionControllerView.jsx +++ b/workflow-designer-ui/src/main/frontend/src/features/version/versionController/VersionControllerView.jsx @@ -45,7 +45,9 @@ export default class VersionControllerView extends Component { hasErrors: PropTypes.bool, isArchive: PropTypes.bool, operationMode: PropTypes.bool, - pluginContext: PropTypes.object + pluginContext: PropTypes.object, + isCompositionUpdating: PropTypes.bool, + toggleCompositionUpdate: PropTypes.func }; constructor(props) { @@ -118,7 +120,9 @@ export default class VersionControllerView extends Component { hasErrors, isCertifyDisable, isArchive, - operationMode + operationMode, + isCompositionUpdating, + toggleCompositionUpdate } = this.props; const isReadonly = isCertifyDisable || hasErrors || isArchive; return ( @@ -147,11 +151,13 @@ export default class VersionControllerView extends Component { )} {!operationMode && ( <ActionButtons + isCompositionUpdating={isCompositionUpdating} saveDisabled={isReadonly} onSaveClick={this.sendSaveParamsToServer} certifyDisabled={isReadonly} onCertifyClick={this.certifyVersion} onUndoClick={this.undoClickCallback} + toggleCompositionUpdate={toggleCompositionUpdate} /> )} </div> diff --git a/workflow-designer-ui/src/main/frontend/src/features/version/versionController/__tests__/VersionControllerView_snapshot-test.js b/workflow-designer-ui/src/main/frontend/src/features/version/versionController/__tests__/VersionControllerView_snapshot-test.js index 5dfb5737..2bcfa300 100644 --- a/workflow-designer-ui/src/main/frontend/src/features/version/versionController/__tests__/VersionControllerView_snapshot-test.js +++ b/workflow-designer-ui/src/main/frontend/src/features/version/versionController/__tests__/VersionControllerView_snapshot-test.js @@ -16,7 +16,7 @@ import React from 'react'; import renderer from 'react-test-renderer'; -import VersionControllerView from 'features/version/versionController/VersionControllerView'; +import VersionsContainer from 'features/version/versionController/views/VersionsContainer'; describe('Version Controller View Snapshot', () => { it('renders correctly', () => { @@ -27,6 +27,7 @@ describe('Version Controller View Snapshot', () => { description: 'Initial version, bug fix for previous version that fixed an exception when the port was occupied', status: 'Draft', + state: 'Draft', creationTime: 1530687330460, modificationTime: 1530687330575, archivedStatus: 'ACTIVE' @@ -37,6 +38,7 @@ describe('Version Controller View Snapshot', () => { description: 'Test version, bug fix for previous version that fixed an exception when the port was occupied', status: 'Draft', + state: 'Draft', creationTime: 1530687330461, modificationTime: 1530687330576, archivedStatus: 'ACTIVE', @@ -45,7 +47,7 @@ describe('Version Controller View Snapshot', () => { ]; const tree = renderer .create( - <VersionControllerView + <VersionsContainer viewableVersions={versionList} currentWorkflowVersion={versionList[0]} /> diff --git a/workflow-designer-ui/src/main/frontend/src/features/version/versionController/__tests__/__snapshots__/VersionControllerView_snapshot-test.js.snap b/workflow-designer-ui/src/main/frontend/src/features/version/versionController/__tests__/__snapshots__/VersionControllerView_snapshot-test.js.snap index 1c8ffba3..ea135fce 100644 --- a/workflow-designer-ui/src/main/frontend/src/features/version/versionController/__tests__/__snapshots__/VersionControllerView_snapshot-test.js.snap +++ b/workflow-designer-ui/src/main/frontend/src/features/version/versionController/__tests__/__snapshots__/VersionControllerView_snapshot-test.js.snap @@ -2,122 +2,38 @@ exports[`Version Controller View Snapshot renders correctly 1`] = ` <div - className="version-controller-bar" + className="version-section-wrapper" > <div - className="version-section-wrapper" + className="version-status-container" > - <div - className="group-name-wrapper" + version + <select + className="version-selector" + data-test-id="vc-versions-select-box" + onChange={[Function]} + value="7b5f6b086613470985082df2c0f6c713" > - <div - className="group-name" + <option + data-test-id="vc-version-option" + value="7b5f6b086613470985082df2c0f6c713" > - - </div> - </div> - </div> - <div - className="vc-container " - > - <div - className="version-section-wrapper" - > - <div - className="version-status-container" + 1.0 DRAFT + </option> + <option + data-test-id="vc-version-option" + value="7b5f6b086613470985082df2c0f6c666" > - version - <select - className="version-selector" - data-test-id="vc-versions-select-box" - onChange={[Function]} - value="7b5f6b086613470985082df2c0f6c713" - /> - <span - className="version-selector-more-versions" - data-test-id="vc-versions-page-link" - onClick={[Function]} - > - viewOverview - </span> - </div> - </div> - <div - className="save-submit-cancel-container" + 2.0 Draft + </option> + </select> + <span + className="version-selector-more-versions" + data-test-id="vc-versions-page-link" + onClick={undefined} > - <div - className="action-buttons" - > - <div - className="select-action-buttons" - > - <div - className="separator vc-separator" - /> - <div - className="action-button-wrapper clickable" - onClick={[Function]} - > - <div - className="action-buttons-svg" - > - <div - className="svg-icon-wrapper bottom" - data-test-id="vc-save-btn" - disabled={undefined} - onClick={undefined} - > - <test-file-stub - className="svg-icon __version-controller-save" - /> - <span - className="svg-icon-label action-button-label" - > - saveBtn - </span> - </div> - </div> - </div> - <div - className="separator vc-separator" - /> - <div - className="action-button-wrapper clickable" - onClick={[Function]} - > - <div - className="action-buttons-svg" - > - <div - className="svg-icon-wrapper bottom" - data-test-id="vc-undo-btn" - disabled={undefined} - onClick={undefined} - > - <test-file-stub - className="svg-icon __version-controller-undo" - /> - <span - className="svg-icon-label action-button-label" - > - undoBtn - </span> - </div> - </div> - </div> - <div - className="separator vc-separator" - /> - <button - className="sdc-button sdc-button__primary certifyBtn " - disabled={false} - onClick={[Function]} - > - certifyBtn - </button> - </div> - </div> - </div> + viewOverview + </span> </div> </div> `; diff --git a/workflow-designer-ui/src/main/frontend/src/features/version/versionController/views/ActionButtons.js b/workflow-designer-ui/src/main/frontend/src/features/version/versionController/views/ActionButtons.js index e2a7dc54..472b3a0b 100644 --- a/workflow-designer-ui/src/main/frontend/src/features/version/versionController/views/ActionButtons.js +++ b/workflow-designer-ui/src/main/frontend/src/features/version/versionController/views/ActionButtons.js @@ -19,12 +19,15 @@ import { I18n } from 'react-redux-i18n'; import { Button } from 'sdc-ui/lib/react'; import PropTypes from 'prop-types'; import SvgButton from 'features/version/versionController/views/SvgButton'; +import CompositionUpdate from 'features/version/composition/CompositionUpdate'; const ActionButtons = props => { const { onSaveClick, certifyDisabled, onCertifyClick, + isCompositionUpdating, + toggleCompositionUpdate, onUndoClick, saveDisabled } = props; @@ -58,9 +61,18 @@ const ActionButtons = props => { className="certifyBtn" btnType="primary" disabled={certifyDisabled} - onClick={onCertifyClick}> + onClick={() => toggleCompositionUpdate(true)}> {I18n.t('buttons.certifyBtn')} </Button> + + {isCompositionUpdating && ( + <CompositionUpdate + certifyBack={() => { + toggleCompositionUpdate(false); + onCertifyClick(); + }} + /> + )} </div> </div> </div> @@ -72,7 +84,9 @@ ActionButtons.propTypes = { certifyDisabled: PropTypes.bool, onCertifyClick: PropTypes.func, onUndoClick: PropTypes.func, - saveDisabled: PropTypes.bool + saveDisabled: PropTypes.bool, + isCompositionUpdating: PropTypes.bool, + toggleCompositionUpdate: PropTypes.func }; export default ActionButtons; |