disable undo and empty name validation 25/60125/1
authorYarin Dekel <yarind@amdocs.com>
Sun, 12 Aug 2018 11:05:47 +0000 (14:05 +0300)
committerYarin Dekel <yarind@amdocs.com>
Sun, 12 Aug 2018 11:08:41 +0000 (14:08 +0300)
Issue-ID: SDC-1628
Change-Id: I48cd1a16677e16f464a75b7aae8eb0992dd86a34
Signed-off-by: Yarin Dekel <yarind@amdocs.com>
workflow-designer-ui/src/main/frontend/src/features/version/inputOutput/InputOutputView.jsx
workflow-designer-ui/src/main/frontend/src/features/version/inputOutput/inputOutputSelectors.js
workflow-designer-ui/src/main/frontend/src/features/version/inputOutput/inputOutputValidations.js
workflow-designer-ui/src/main/frontend/src/features/version/versionController/VersionController.js
workflow-designer-ui/src/main/frontend/src/features/version/versionController/VersionControllerView.jsx
workflow-designer-ui/src/main/frontend/src/features/version/versionController/views/ActionButtons.js
workflow-designer-ui/src/main/frontend/src/features/version/versionSaga.js
workflow-designer-ui/src/main/frontend/src/i18n/languages.json

index 2eadd22..2ef9ef7 100644 (file)
@@ -129,6 +129,8 @@ class InputOutputView extends React.Component {
                 errorMessage = I18n.t('workflow.inputOutput.invalidCharacters');
             } else if (error.alreadyExists && error.alreadyExists.includes(i)) {
                 errorMessage = I18n.t('workflow.inputOutput.alreadyExists');
+            } else if (error.emptyName && error.emptyName.includes(i)) {
+                errorMessage = I18n.t('workflow.inputOutput.emptyName');
             }
 
             return (
index 09dcc26..db07bce 100644 (file)
@@ -71,7 +71,11 @@ export const getInputErrors = createSelector(
     getErrorsInputOutput,
     ({ inputs }) =>
         !isEmpty(inputs) &&
-        Boolean(inputs.alreadyExists.length || inputs.invalidCharacters.length)
+        Boolean(
+            inputs.alreadyExists.length ||
+                inputs.invalidCharacters.length ||
+                inputs.emptyName.length
+        )
 );
 
 export const getOutputErrors = createSelector(
@@ -79,7 +83,9 @@ export const getOutputErrors = createSelector(
     ({ outputs }) =>
         !isEmpty(outputs) &&
         Boolean(
-            outputs.alreadyExists.length || outputs.invalidCharacters.length
+            outputs.alreadyExists.length ||
+                outputs.invalidCharacters.length ||
+                outputs.emptyName.length
         )
 );
 
index a300e21..50a6421 100644 (file)
@@ -38,6 +38,16 @@ export const getValidationsError = dataRows => {
         return result;
     }, []);
 
+    error.emptyName = dataRows.reduce((result, value, key) => {
+        const name = value.name;
+
+        if (!name) {
+            result.push(key);
+        }
+
+        return result;
+    }, []);
+
     error.invalidCharacters = dataRows.reduce((result, value, key) => {
         const groupKey = value.name;
 
index 2fc7195..fd62c56 100644 (file)
@@ -30,6 +30,7 @@ import {
     certifyVersionAction
 } from 'features/version/versionController/versionControllerConstants';
 import { workflowVersionFetchRequestedAction } from '../versionConstants';
+import { getIsCertified } from 'features/version/general/generalSelectors';
 import { getIOErrors } from 'features/version/inputOutput/inputOutputSelectors';
 
 function mapStateToProps(state) {
@@ -38,9 +39,9 @@ function mapStateToProps(state) {
         workflowId: getWorkflowId(state),
         versionsList: getSortedVersions(state),
         savedParams: getSavedObjParams(state),
-        currentWorkflowVersion: state.currentVersion.general,
-        versionState: state.currentVersion.general.state,
-        getIOErrors: getIOErrors(state)
+        getIOErrors: getIOErrors(state),
+        isCertifyDisable: getIsCertified(state),
+        currentWorkflowVersion: state.currentVersion.general
     };
 }
 
index 20d5d73..38321c3 100644 (file)
@@ -19,7 +19,6 @@ import PropTypes from 'prop-types';
 import ActionButtons from 'features/version/versionController/views/ActionButtons';
 import VersionContainer from 'features/version/versionController/views/VersionsContainer';
 import WorkflowTitle from 'features/version/versionController/views/WorkflowTitle';
-import { versionState as versionStateType } from 'features/version/versionConstants';
 
 export default class VersionControllerView extends Component {
     static propTypes = {
@@ -35,10 +34,10 @@ export default class VersionControllerView extends Component {
         savedParams: PropTypes.object,
         saveParamsToServer: PropTypes.func,
         workflowId: PropTypes.string,
-        versionState: PropTypes.string,
         certifyVersion: PropTypes.func,
         changeVersion: PropTypes.func,
-        getIOErrors: PropTypes.bool
+        getIOErrors: PropTypes.bool,
+        isCertifyDisable: PropTypes.bool
     };
 
     constructor(props) {
@@ -60,9 +59,14 @@ export default class VersionControllerView extends Component {
         const {
             certifyVersion,
             workflowId,
-            currentWorkflowVersion
+            currentWorkflowVersion,
+            savedParams
         } = this.props;
-        certifyVersion({ workflowId, versionId: currentWorkflowVersion.id });
+        certifyVersion({
+            workflowId,
+            versionId: currentWorkflowVersion.id,
+            params: savedParams
+        });
     };
 
     versionChangeCallback = versionId => {
@@ -84,12 +88,9 @@ export default class VersionControllerView extends Component {
             currentWorkflowVersion,
             workflowName,
             versionsList,
-            versionState,
-            getIOErrors
+            getIOErrors,
+            isCertifyDisable
         } = this.props;
-        let isCertifyDisable =
-            versionState &&
-            versionState.toLowerCase() === versionStateType.CERTIFIED;
         return (
             <div className="version-controller-bar">
                 <WorkflowTitle workflowName={workflowName} />
index a2f0338..224b249 100644 (file)
@@ -46,7 +46,7 @@ const ActionButtons = props => {
                         dataTestId="vc-undo-btn"
                         name="version-controller-undo"
                         tooltipText={I18n.t('buttons.undoBtn')}
-                        disabled={false}
+                        disabled={certifyDisabled}
                         onClick={onUndoClick}
                     />
                     <Separator />
index be52579..d8d7fd8 100644 (file)
@@ -76,7 +76,6 @@ function* watchSubmitVersion(action) {
 
 function* watchUpdateVersion(action) {
     try {
-        //const { composition, ...versionData } = action.payload;
         const {
             workflowId,
             params: { composition, ...versionData }
@@ -105,6 +104,11 @@ function* watchUpdateVersion(action) {
 
 function* watchCertifyVersion(action) {
     try {
+        const { workflowId, params } = action.payload;
+        yield call(versionApi.updateVersion, {
+            workflowId,
+            params: params
+        });
         yield call(versionApi.certifyVersion, {
             ...action.payload
         });
index 5fd444a..7aabada 100644 (file)
@@ -58,7 +58,8 @@
                 "CANCEL": "CANCEL",
                 "confirmDlete": "Are you sure you want to delete \"%{name}\"?",
                 "alreadyExists": "Already exists",
-                "invalidCharacters": "Alphanumeric and underscore only"
+                "invalidCharacters": "Alphanumeric and underscore only",
+                "emptyName": "Empty Name"
             },
             "composition": {
                 "bpmnError" : "BPMN.IO Error"