From aface0df975ad060a6fe76a02d760d4102dcbce2 Mon Sep 17 00:00:00 2001
From: Yarin Dekel <yarind@amdocs.com>
Date: Tue, 31 Jul 2018 10:10:07 +0300
Subject: fix css test and IO squash

Issue-ID: SDC-1575
Change-Id: I89017be62905c5e12848057b3c07f113396db1b5
Signed-off-by: Yarin Dekel <yarind@amdocs.com>
---
 .../frontend/resources/scss/common/_utils.scss     |  1 -
 .../resources/scss/components/_customModal.scss    |  7 ++++-
 .../scss/components/_versionController.scss        | 11 ++++----
 .../frontend/resources/scss/features/_general.scss |  3 ++-
 .../resources/scss/features/_overview.scss         | 18 ++++++++-----
 .../src/features/version/general/generalApi.js     | 15 -----------
 .../version/inputOutput/InputOutputView.jsx        |  4 +--
 .../version/inputOutput/inputOutputConstants.js    |  1 +
 .../version/inputOutput/inputOutputReducer.js      |  5 ++--
 .../version/inputOutput/inputOutputValidations.js  |  2 +-
 .../versionController/VersionControllerView.jsx    | 10 ++++++++
 .../versionController/views/ActionButtons.js       |  7 ++---
 .../frontend/src/features/version/versionSaga.js   |  1 -
 .../create/__tests__/createWorkflowSaga-test.js    | 30 ++++++++++++++++------
 .../features/workflow/create/createWorkflowSaga.js |  8 ++----
 .../src/features/workflow/workflowConstants.js     |  2 +-
 .../src/features/workflow/workflowSelectors.js     |  3 ++-
 17 files changed, 73 insertions(+), 55 deletions(-)
 delete mode 100644 workflow-designer-ui/src/main/frontend/src/features/version/general/generalApi.js

(limited to 'workflow-designer-ui/src')

diff --git a/workflow-designer-ui/src/main/frontend/resources/scss/common/_utils.scss b/workflow-designer-ui/src/main/frontend/resources/scss/common/_utils.scss
index 99b1ff5d..3cf90bc9 100644
--- a/workflow-designer-ui/src/main/frontend/resources/scss/common/_utils.scss
+++ b/workflow-designer-ui/src/main/frontend/resources/scss/common/_utils.scss
@@ -1,5 +1,4 @@
 
-
 /* Prefix */
 
 $box-sizing-prefix: webkit moz spec;
diff --git a/workflow-designer-ui/src/main/frontend/resources/scss/components/_customModal.scss b/workflow-designer-ui/src/main/frontend/resources/scss/components/_customModal.scss
index 48cd4cff..2ee87387 100644
--- a/workflow-designer-ui/src/main/frontend/resources/scss/components/_customModal.scss
+++ b/workflow-designer-ui/src/main/frontend/resources/scss/components/_customModal.scss
@@ -1,6 +1,6 @@
 .sdc-modal {
   .custom-modal-wrapper {
-    padding: 35px 60px 60px 60px;
+    padding: 35px 60px 20px 60px;
     width: auto;
   }
 
@@ -13,4 +13,9 @@
   button:first-child {
     margin-right: 2em;
   }
+}
+
+textarea.field-section.sdc-input__input {
+   height: 75px;
+   padding-top: 5px;
 }
\ No newline at end of file
diff --git a/workflow-designer-ui/src/main/frontend/resources/scss/components/_versionController.scss b/workflow-designer-ui/src/main/frontend/resources/scss/components/_versionController.scss
index eaa3d7dd..45985a65 100644
--- a/workflow-designer-ui/src/main/frontend/resources/scss/components/_versionController.scss
+++ b/workflow-designer-ui/src/main/frontend/resources/scss/components/_versionController.scss
@@ -23,14 +23,12 @@
 		justify-content: space-between;
 		align-items: center;
 		padding-left: 16px;
-		padding-right: 40px;
+		padding-right: 100px;
 		border-left: 1px solid #eaeaea;
 
 		.vc-separator {
 			border-left: 1px solid $silver;
 			height: 37px;
-			margin-left: 5px;
-			margin-right: 5px;
 		}
 
 		.version-status-container {
@@ -119,7 +117,7 @@
 				}
 
 				.certifyBtn {
-					margin-left: 10px;
+					margin-left: 20px;
 				}
 
 				.version-control-buttons {
@@ -130,12 +128,13 @@
 					display: flex;
 					align-items: center;
 					height: 70px;
+					padding: 10px;
 
-					&:hover:not(.disabled) {
+					&:hover {
 						background-color: $silver;
 					}
 
-					&:active:not(.disabled) {
+					&:active {
 						background-color: $light-gray;
 					}
 
diff --git a/workflow-designer-ui/src/main/frontend/resources/scss/features/_general.scss b/workflow-designer-ui/src/main/frontend/resources/scss/features/_general.scss
index 9189c87b..6e8b3522 100644
--- a/workflow-designer-ui/src/main/frontend/resources/scss/features/_general.scss
+++ b/workflow-designer-ui/src/main/frontend/resources/scss/features/_general.scss
@@ -1,6 +1,6 @@
 .general-page {
     @include body-1;
-    padding: 0 100px 20px 100px;
+    padding: 0 131px 20px 100px;
     background-color: #fff;
 
     .general-page-title {
@@ -18,6 +18,7 @@
 
         .description-part textarea {
             height: 200px;
+            padding-top: 5px;
         }
 
         .version-info-part {
diff --git a/workflow-designer-ui/src/main/frontend/resources/scss/features/_overview.scss b/workflow-designer-ui/src/main/frontend/resources/scss/features/_overview.scss
index f384017f..8cb6be74 100644
--- a/workflow-designer-ui/src/main/frontend/resources/scss/features/_overview.scss
+++ b/workflow-designer-ui/src/main/frontend/resources/scss/features/_overview.scss
@@ -13,6 +13,7 @@
 
       .description-part textarea{
         height: 200px;
+        padding-top: 5px;
       }
 
       .save-description {
@@ -26,7 +27,7 @@
         padding: 20px;
         box-sizing: border-box;
         .label {
-          @include body-3;
+          @include body-1;
           margin-bottom: 5px;
         }
         .value {
@@ -70,6 +71,7 @@
 
     .svg-icon-wrapper {
       justify-content: flex-start;
+      margin: 5px;
     }
 
     .create-new-version {
@@ -125,9 +127,11 @@
         }
 
         .tree-view {
-          //background-color: $white;
           flex: 1;
-
+          border-left: 1px solid $silver;
+          &:last-child {
+            border-bottom: 1px solid $silver;
+          }
           .node:not(.selectedNode):hover {
             .outer-circle, .inner-circle {
               transform: scale(1.1);
@@ -145,11 +149,13 @@
       .version-list-items {
         @extend .flex-column;
 
+        .item-version, .item-status {
+          font-size: 12px;
+          font-weight: 600;
+        }
         .version-item-row {
-          border-bottom: 1px solid $silver;
-
           &:last-child {
-            border-bottom: none;
+            border-bottom: 1px solid $silver;
           }
         }
       }
diff --git a/workflow-designer-ui/src/main/frontend/src/features/version/general/generalApi.js b/workflow-designer-ui/src/main/frontend/src/features/version/general/generalApi.js
deleted file mode 100644
index 3c726d1b..00000000
--- a/workflow-designer-ui/src/main/frontend/src/features/version/general/generalApi.js
+++ /dev/null
@@ -1,15 +0,0 @@
-import RestfulAPIUtil from 'services/restAPIUtil';
-import Configuration from 'config/Configuration.js';
-
-function baseUrl() {
-    const restPrefix = Configuration.get('restPrefix');
-    return `${restPrefix}/v1.0/items`;
-}
-
-const Api = {
-    fetchData: () => {
-        return RestfulAPIUtil.fetch(`${baseUrl()}/test`);
-    }
-};
-
-export default Api;
diff --git a/workflow-designer-ui/src/main/frontend/src/features/version/inputOutput/InputOutputView.jsx b/workflow-designer-ui/src/main/frontend/src/features/version/inputOutput/InputOutputView.jsx
index a2a06188..8f779359 100644
--- a/workflow-designer-ui/src/main/frontend/src/features/version/inputOutput/InputOutputView.jsx
+++ b/workflow-designer-ui/src/main/frontend/src/features/version/inputOutput/InputOutputView.jsx
@@ -20,7 +20,7 @@ import { Translate, I18n } from 'react-redux-i18n';
 import { SVGIcon } from 'sdc-ui/lib/react';
 
 import SearchInput from 'shared/searchInput/SearchInput';
-import { getValidtionsError } from 'features/version/inputOutput/inputOutputValidations';
+import { getValidationsError } from 'features/version/inputOutput/inputOutputValidations';
 import Tab from 'features/version/inputOutput/views/Tab';
 import TableHead from 'features/version/inputOutput/views/TableHead';
 import TableBody from 'features/version/inputOutput/views/TableBody';
@@ -31,7 +31,7 @@ class InputOutputView extends React.Component {
     componentDidUpdate() {
         const { dataRows, error, handleChangeError } = this.props;
 
-        const validationsError = getValidtionsError(dataRows);
+        const validationsError = getValidationsError(dataRows);
 
         const isDiff = Object.keys(validationsError).some(errorKey => {
             if (!error.hasOwnProperty(errorKey)) {
diff --git a/workflow-designer-ui/src/main/frontend/src/features/version/inputOutput/inputOutputConstants.js b/workflow-designer-ui/src/main/frontend/src/features/version/inputOutput/inputOutputConstants.js
index a660da5a..6f299926 100644
--- a/workflow-designer-ui/src/main/frontend/src/features/version/inputOutput/inputOutputConstants.js
+++ b/workflow-designer-ui/src/main/frontend/src/features/version/inputOutput/inputOutputConstants.js
@@ -20,6 +20,7 @@ export const INPUTS = 'inputs';
 export const OUTPUTS = 'outputs';
 
 export const STRING = 'String';
+export const DEFAULT_STRING = 'STRING';
 export const BOOLEAN = 'Boolean';
 export const INTEGER = 'Integer';
 export const FLOAT = 'Float';
diff --git a/workflow-designer-ui/src/main/frontend/src/features/version/inputOutput/inputOutputReducer.js b/workflow-designer-ui/src/main/frontend/src/features/version/inputOutput/inputOutputReducer.js
index f63c1254..881322fa 100644
--- a/workflow-designer-ui/src/main/frontend/src/features/version/inputOutput/inputOutputReducer.js
+++ b/workflow-designer-ui/src/main/frontend/src/features/version/inputOutput/inputOutputReducer.js
@@ -18,6 +18,7 @@ import {
     INPUTS,
     OUTPUTS,
     STRING,
+    DEFAULT_STRING,
     BOOLEAN,
     INTEGER,
     FLOAT,
@@ -36,12 +37,12 @@ import {
 export const defaultInputOutput = {
     [INPUTS]: {
         name: '',
-        value: STRING,
+        type: DEFAULT_STRING,
         mandatory: false
     },
     [OUTPUTS]: {
         name: '',
-        value: STRING,
+        type: DEFAULT_STRING,
         mandatory: false
     }
 };
diff --git a/workflow-designer-ui/src/main/frontend/src/features/version/inputOutput/inputOutputValidations.js b/workflow-designer-ui/src/main/frontend/src/features/version/inputOutput/inputOutputValidations.js
index 88a0a77c..a300e215 100644
--- a/workflow-designer-ui/src/main/frontend/src/features/version/inputOutput/inputOutputValidations.js
+++ b/workflow-designer-ui/src/main/frontend/src/features/version/inputOutput/inputOutputValidations.js
@@ -14,7 +14,7 @@
 * limitations under the License.
 */
 
-export const getValidtionsError = dataRows => {
+export const getValidationsError = dataRows => {
     const error = {};
 
     const groupBy = dataRows.reduce((result, value, key) => {
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 a147c0d2..88a2a7b8 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
@@ -69,6 +69,15 @@ export default class VersionControllerView extends Component {
         changeVersion({ versionId, workflowId });
     };
 
+    undoClickCallback = () => {
+        const {
+            currentWorkflowVersion,
+            changeVersion,
+            workflowId
+        } = this.props;
+        changeVersion({ versionId: currentWorkflowVersion.id, workflowId });
+    };
+
     render() {
         const {
             currentWorkflowVersion,
@@ -93,6 +102,7 @@ export default class VersionControllerView extends Component {
                         onSaveClick={this.sendSaveParamsToServer}
                         certifyDisabled={isCertifyDisable}
                         onCertifyClick={this.certifyVersion}
+                        onUndoClick={this.undoClickCallback}
                     />
                 </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 e8cbb4da..b4a08915 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
@@ -22,7 +22,7 @@ import SvgButton from 'features/version/versionController/views/SvgButton';
 const Separator = () => <div className="vc-separator" />;
 
 const ActionButtons = props => {
-    const { onSaveClick, certifyDisabled, onCertifyClick } = props;
+    const { onSaveClick, certifyDisabled, onCertifyClick, onUndoClick } = props;
     return (
         <div className="save-submit-cancel-container">
             <div className="action-buttons">
@@ -41,7 +41,7 @@ const ActionButtons = props => {
                         name="version-controller-undo"
                         tooltipText={I18n.t('buttons.undoBtn')}
                         disabled={false}
-                        onClick={() => console.log('undo')}
+                        onClick={onUndoClick}
                     />
                     <Separator />
                     <Button
@@ -60,7 +60,8 @@ const ActionButtons = props => {
 ActionButtons.propTypes = {
     onSaveClick: PropTypes.func,
     certifyDisabled: PropTypes.bool,
-    onCertifyClick: PropTypes.func
+    onCertifyClick: PropTypes.func,
+    onUndoClick: PropTypes.func
 };
 
 export default ActionButtons;
diff --git a/workflow-designer-ui/src/main/frontend/src/features/version/versionSaga.js b/workflow-designer-ui/src/main/frontend/src/features/version/versionSaga.js
index 244f3da9..9ef88f9b 100644
--- a/workflow-designer-ui/src/main/frontend/src/features/version/versionSaga.js
+++ b/workflow-designer-ui/src/main/frontend/src/features/version/versionSaga.js
@@ -37,7 +37,6 @@ function* fetchVersion(action) {
     try {
         const data = yield call(versionApi.fetchVersion, action.payload);
         const { inputs, outputs, ...rest } = data;
-
         yield all([
             put(setWorkflowVersionAction(rest)),
             put(setInputsOutputs({ inputs, outputs }))
diff --git a/workflow-designer-ui/src/main/frontend/src/features/workflow/create/__tests__/createWorkflowSaga-test.js b/workflow-designer-ui/src/main/frontend/src/features/workflow/create/__tests__/createWorkflowSaga-test.js
index a3d7c7cf..c9782c1b 100644
--- a/workflow-designer-ui/src/main/frontend/src/features/workflow/create/__tests__/createWorkflowSaga-test.js
+++ b/workflow-designer-ui/src/main/frontend/src/features/workflow/create/__tests__/createWorkflowSaga-test.js
@@ -19,12 +19,16 @@ import {
     watchWorkflow,
     watchSubmitWorkflow
 } from 'features/workflow/create/createWorkflowSaga';
+import { put } from 'redux-saga/effects';
 import newWorkflowApi from 'features/workflow/create/createWorkflowApi';
+import { SUBMIT_WORKFLOW } from 'features/workflow/create/createWorkflowConstants';
+import { submitVersionAction } from 'features/version/create/createVersionConstants';
+import { NEW_VERSION } from 'features/workflow/create/createWorkflowConstants';
 import {
-    NEW_VERSION,
-    SUBMIT_WORKFLOW
-} from 'features/workflow/create/createWorkflowConstants';
-import versionApi from 'features/version/versionApi';
+    setWorkflowAction,
+    clearWorkflowAction
+} from 'features/workflow/workflowConstants';
+import { genericNetworkErrorAction } from 'wfapp/appConstants';
 
 describe('New workflow saga test', () => {
     it('Create new workflow', () => {
@@ -46,11 +50,21 @@ describe('New workflow saga test', () => {
         expect(gen.next().value).toEqual(
             call(newWorkflowApi.createNewWorkflow, action.payload)
         );
+        const history = undefined,
+            workflowId = undefined;
         expect(gen.next(action.payload).value).toEqual(
-            call(versionApi.createNewVersion, {
-                workflowId: undefined,
-                ...NEW_VERSION
-            })
+            put(submitVersionAction({ history, workflowId, ...NEW_VERSION }))
         );
+        expect(gen.next().value).toEqual(
+            put(setWorkflowAction({ ...action.payload, id: undefined }))
+        );
+        //handling errors
+        expect(gen.throw({ error: 'error' }).value).toEqual(
+            put(clearWorkflowAction)
+        );
+        expect(gen.next().value).toEqual(
+            put(genericNetworkErrorAction({ error: 'error' }))
+        );
+        expect(gen.next().done).toBe(true);
     });
 });
diff --git a/workflow-designer-ui/src/main/frontend/src/features/workflow/create/createWorkflowSaga.js b/workflow-designer-ui/src/main/frontend/src/features/workflow/create/createWorkflowSaga.js
index 0f057f12..7f988002 100644
--- a/workflow-designer-ui/src/main/frontend/src/features/workflow/create/createWorkflowSaga.js
+++ b/workflow-designer-ui/src/main/frontend/src/features/workflow/create/createWorkflowSaga.js
@@ -20,8 +20,8 @@ import {
     clearWorkflowAction
 } from 'features/workflow/workflowConstants';
 import newWorkflowApi from 'features/workflow/create/createWorkflowApi';
-import versionApi from 'features/version/versionApi';
 import { genericNetworkErrorAction } from 'wfapp/appConstants';
+import { submitVersionAction } from 'features/version/create/createVersionConstants';
 import { NEW_VERSION } from 'features/workflow/create/createWorkflowConstants';
 
 export function* watchSubmitWorkflow(action) {
@@ -33,11 +33,7 @@ export function* watchSubmitWorkflow(action) {
         //Calling to create empty version
         const workflowId = workflow.id;
         const { history } = action.payload;
-        yield call(versionApi.createNewVersion, {
-            workflowId,
-            ...NEW_VERSION
-        });
-        yield call(history.push('/workflow/' + workflowId + '/overview'));
+        yield put(submitVersionAction({ history, workflowId, ...NEW_VERSION }));
         yield put(setWorkflowAction(workflow));
     } catch (error) {
         yield put(clearWorkflowAction);
diff --git a/workflow-designer-ui/src/main/frontend/src/features/workflow/workflowConstants.js b/workflow-designer-ui/src/main/frontend/src/features/workflow/workflowConstants.js
index 06b471ea..cedcafe2 100644
--- a/workflow-designer-ui/src/main/frontend/src/features/workflow/workflowConstants.js
+++ b/workflow-designer-ui/src/main/frontend/src/features/workflow/workflowConstants.js
@@ -18,5 +18,5 @@ import { createAction } from 'redux-actions';
 export const CLEAR_WORKFLOW_DATA = 'workflow/CLEAR_WORKFLOW_DATA';
 export const SET_WORKFLOW = 'workflow/SET_WORKFLOW';
 
-export const setWorkflowAction = createAction(SET_WORKFLOW);
+export const setWorkflowAction = createAction(SET_WORKFLOW, payload => payload);
 export const clearWorkflowAction = { type: CLEAR_WORKFLOW_DATA };
diff --git a/workflow-designer-ui/src/main/frontend/src/features/workflow/workflowSelectors.js b/workflow-designer-ui/src/main/frontend/src/features/workflow/workflowSelectors.js
index 5ea8ff24..140599b8 100644
--- a/workflow-designer-ui/src/main/frontend/src/features/workflow/workflowSelectors.js
+++ b/workflow-designer-ui/src/main/frontend/src/features/workflow/workflowSelectors.js
@@ -14,7 +14,8 @@
 * limitations under the License.
 */
 
-export const getWorkflowName = state => state && state.workflow.data.name;
+export const getWorkflowName = state =>
+    state && state.workflow.data.name && state.workflow.data.name.trim();
 export const getWorkflowId = state => state && state.workflow.data.id;
 export const getWorkflowDescription = state =>
     state && state.workflow.data.description;
-- 
cgit