diff options
author | Malek <malek.zoabi@amdocs.com> | 2018-08-12 12:19:57 +0300 |
---|---|---|
committer | Malek <malek.zoabi@amdocs.com> | 2018-08-12 12:21:19 +0300 |
commit | 9d9e2d5cc6c8ca4ec617d4069162113c1774c497 (patch) | |
tree | 39d4a8b2a828c57d211e7ec89800afd0928053eb /workflow-designer-ui | |
parent | 2b2107ebdb0defc9f87e474995b09bb96463e593 (diff) |
Disable certified workflow inputs
Issue-ID: SDC-1627
Change-Id: I91f4315b156908c591ad7a9c4429fd435ba85861
Signed-off-by: Malek <malek.zoabi@amdocs.com>
Diffstat (limited to 'workflow-designer-ui')
11 files changed, 71 insertions, 39 deletions
diff --git a/workflow-designer-ui/src/main/frontend/resources/scss/components/_layout.scss b/workflow-designer-ui/src/main/frontend/resources/scss/components/_layout.scss index 316412e4..c0cc1091 100644 --- a/workflow-designer-ui/src/main/frontend/resources/scss/components/_layout.scss +++ b/workflow-designer-ui/src/main/frontend/resources/scss/components/_layout.scss @@ -18,4 +18,9 @@ grid-template-rows: 70px 1fr; height: 100vh; } + + .disabled { + pointer-events: none; + opacity: 0.4; + } } diff --git a/workflow-designer-ui/src/main/frontend/src/features/version/create/__tests__/__snapshots__/CreateVersionView_snapshot-test.js.snap b/workflow-designer-ui/src/main/frontend/src/features/version/create/__tests__/__snapshots__/CreateVersionView_snapshot-test.js.snap index 55357b5c..0b15043e 100644 --- a/workflow-designer-ui/src/main/frontend/src/features/version/create/__tests__/__snapshots__/CreateVersionView_snapshot-test.js.snap +++ b/workflow-designer-ui/src/main/frontend/src/features/version/create/__tests__/__snapshots__/CreateVersionView_snapshot-test.js.snap @@ -50,6 +50,7 @@ exports[`Create new version snapshot renders correctly 1`] = ` <textarea className="custom-textarea field-section sdc-input__input" data-test-id="new-version-description" + disabled={false} onChange={[Function]} value="" /> diff --git a/workflow-designer-ui/src/main/frontend/src/features/version/general/General.js b/workflow-designer-ui/src/main/frontend/src/features/version/general/General.js index 37fc0ef2..a757371c 100644 --- a/workflow-designer-ui/src/main/frontend/src/features/version/general/General.js +++ b/workflow-designer-ui/src/main/frontend/src/features/version/general/General.js @@ -18,25 +18,19 @@ import { connect } from 'react-redux'; import GeneralView from 'features/version/general/GeneralView'; import { - getGeneralDescription, - getCreationTime, - getModificationTime + getVersionInfo, + getIsCertified } from 'features/version/general/generalSelectors'; import { workflowVersionDetailsChangedAction } from 'features/version/versionConstants'; -export function mapStateToProps(state) { - return { - description: getGeneralDescription(state), - created: getCreationTime(state), - modified: getModificationTime(state) - }; -} +const mapStateToProps = state => ({ + versionInfo: getVersionInfo(state), + isCertified: getIsCertified(state) +}); -export function mapDispatchToProps(dispatch) { - return { - onDataChange: payload => - dispatch(workflowVersionDetailsChangedAction(payload)) - }; -} +const mapDispatchToProps = dispatch => ({ + onDataChange: payload => + dispatch(workflowVersionDetailsChangedAction(payload)) +}); export default connect(mapStateToProps, mapDispatchToProps)(GeneralView); diff --git a/workflow-designer-ui/src/main/frontend/src/features/version/general/GeneralView.js b/workflow-designer-ui/src/main/frontend/src/features/version/general/GeneralView.js index d10d5784..71d5d7d8 100644 --- a/workflow-designer-ui/src/main/frontend/src/features/version/general/GeneralView.js +++ b/workflow-designer-ui/src/main/frontend/src/features/version/general/GeneralView.js @@ -21,9 +21,13 @@ import { I18n, Translate } from 'react-redux-i18n'; import Description from 'shared/components/Description'; import { VersionInfo, LabeledValue } from 'shared/components/VersionInfo'; -const GeneralView = ({ onDataChange, description, created, modified }) => { - const modifiedValue = I18n.l(modified, { dateFormat: 'date.short' }); - const createdValue = I18n.l(created, { dateFormat: 'date.short' }); +const GeneralView = ({ onDataChange, versionInfo, isCertified }) => { + const modifiedValue = I18n.l(versionInfo.modificationTime, { + dateFormat: 'date.short' + }); + const createdValue = I18n.l(versionInfo.creationTime, { + dateFormat: 'date.short' + }); return ( <div className="general-page"> @@ -32,8 +36,9 @@ const GeneralView = ({ onDataChange, description, created, modified }) => { </div> <div className="general-page-content"> <Description - description={description} + description={versionInfo.description} onDataChange={onDataChange} + disabled={isCertified} /> <VersionInfo> <LabeledValue @@ -52,9 +57,8 @@ const GeneralView = ({ onDataChange, description, created, modified }) => { GeneralView.propTypes = { onDataChange: PropTypes.func, - description: PropTypes.string, - created: PropTypes.string, - modified: PropTypes.string + versionInfo: PropTypes.object, + isCertified: PropTypes.bool }; export default GeneralView; diff --git a/workflow-designer-ui/src/main/frontend/src/features/version/general/generalSelectors.js b/workflow-designer-ui/src/main/frontend/src/features/version/general/generalSelectors.js index 5d8924c2..cc817fc2 100644 --- a/workflow-designer-ui/src/main/frontend/src/features/version/general/generalSelectors.js +++ b/workflow-designer-ui/src/main/frontend/src/features/version/general/generalSelectors.js @@ -13,18 +13,21 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { createSelector } from 'reselect'; -export const getGeneralDescription = state => - state && state.currentVersion.general.description; -export const getVersionInfo = state => state && state.currentVersion.general; +import { createSelector } from 'reselect'; -export const getCreationTime = state => - state && state.currentVersion.general.creationTime; +import { versionState } from 'features/version/versionConstants'; -export const getModificationTime = state => - state && state.currentVersion.general.modificationTime; +export const getVersionInfo = state => state && state.currentVersion.general; export const getVersionsState = createSelector( state => state && state.currentVersion.general.state ); + +export const getIsCertified = createSelector( + getVersionInfo, + versionInfo => + versionInfo && + versionInfo.state && + versionInfo.state.toLowerCase() === versionState.CERTIFIED +); diff --git a/workflow-designer-ui/src/main/frontend/src/features/version/inputOutput/InputOutput.js b/workflow-designer-ui/src/main/frontend/src/features/version/inputOutput/InputOutput.js index 9040eb66..f5b3b8ed 100644 --- a/workflow-designer-ui/src/main/frontend/src/features/version/inputOutput/InputOutput.js +++ b/workflow-designer-ui/src/main/frontend/src/features/version/inputOutput/InputOutput.js @@ -27,6 +27,7 @@ import { getTypes, getError } from 'features/version/inputOutput/inputOutputSelectors'; +import { getIsCertified } from 'features/version/general/generalSelectors'; import { changeError, showInputs, @@ -46,7 +47,8 @@ const mapStateToProps = state => ({ search: getSearch(state), dataRows: getDataRows(state), types: getTypes(state), - error: getError(state) + error: getError(state), + isCertified: getIsCertified(state) }); const mapDispatchToProps = dispatch => ({ 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 0f80117b..2eadd22f 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 @@ -17,6 +17,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { Translate, I18n } from 'react-redux-i18n'; +import cn from 'classnames'; import { SVGIcon } from 'sdc-ui/lib/react'; import SearchInput from 'shared/searchInput/SearchInput'; @@ -148,7 +149,7 @@ class InputOutputView extends React.Component { }; render() { - const { isShowInputs, search, handleAdd } = this.props; + const { isShowInputs, search, handleAdd, isCertified } = this.props; const addLabel = isShowInputs ? I18n.t('workflow.inputOutput.addInput') @@ -180,7 +181,9 @@ class InputOutputView extends React.Component { /> </div> <div - className="input-output__add" + className={cn('input-output__add', { + disabled: isCertified + })} data-test-id="wf-input-output-add" onClick={handleAdd}> <SVGIcon @@ -194,7 +197,9 @@ class InputOutputView extends React.Component { </div> <div className="input-output__table"> <TableHead /> - <TableBody>{dataRowsView}</TableBody> + <TableBody isCertified={isCertified}> + {dataRowsView} + </TableBody> </div> </div> ); @@ -213,6 +218,7 @@ InputOutputView.propTypes = { ), types: PropTypes.array, error: PropTypes.object, + isCertified: PropTypes.bool, handleChangeError: PropTypes.func, handleShowInputs: PropTypes.func, handleShowOutputs: PropTypes.func, diff --git a/workflow-designer-ui/src/main/frontend/src/features/version/inputOutput/views/TableBody.jsx b/workflow-designer-ui/src/main/frontend/src/features/version/inputOutput/views/TableBody.jsx index 052846b3..a85bcfb6 100644 --- a/workflow-designer-ui/src/main/frontend/src/features/version/inputOutput/views/TableBody.jsx +++ b/workflow-designer-ui/src/main/frontend/src/features/version/inputOutput/views/TableBody.jsx @@ -17,6 +17,7 @@ import React from 'react'; import PropTypes from 'prop-types'; +import cn from 'classnames'; class TableBody extends React.Component { handleNameInputChange = params => { @@ -28,13 +29,21 @@ class TableBody extends React.Component { }; render() { - const { children } = this.props; + const { isCertified, children } = this.props; - return <div className="input-output__table__tbody">{children}</div>; + return ( + <div + className={cn('input-output__table__tbody', { + disabled: isCertified + })}> + {children} + </div> + ); } } TableBody.propTypes = { + isCertified: PropTypes.bool, children: PropTypes.node }; diff --git a/workflow-designer-ui/src/main/frontend/src/features/workflow/create/__tests__/__snapshots__/CreateWorkflowView_snapshot-test.js.snap b/workflow-designer-ui/src/main/frontend/src/features/workflow/create/__tests__/__snapshots__/CreateWorkflowView_snapshot-test.js.snap index 1a050ef9..fb9cd835 100644 --- a/workflow-designer-ui/src/main/frontend/src/features/workflow/create/__tests__/__snapshots__/CreateWorkflowView_snapshot-test.js.snap +++ b/workflow-designer-ui/src/main/frontend/src/features/workflow/create/__tests__/__snapshots__/CreateWorkflowView_snapshot-test.js.snap @@ -48,6 +48,7 @@ exports[`New Workflow View Snapshot renders correctly 1`] = ` <textarea className="custom-textarea field-section sdc-input__input" data-test-id="description" + disabled={false} onChange={[Function]} value="" /> diff --git a/workflow-designer-ui/src/main/frontend/src/features/workflow/overview/__tests__/__snapshots__/OverviewView_snapshot-test.js.snap b/workflow-designer-ui/src/main/frontend/src/features/workflow/overview/__tests__/__snapshots__/OverviewView_snapshot-test.js.snap index 7b3326e5..1014e4b6 100644 --- a/workflow-designer-ui/src/main/frontend/src/features/workflow/overview/__tests__/__snapshots__/OverviewView_snapshot-test.js.snap +++ b/workflow-designer-ui/src/main/frontend/src/features/workflow/overview/__tests__/__snapshots__/OverviewView_snapshot-test.js.snap @@ -59,6 +59,7 @@ exports[`OverviewView Snapshot renders correctly 1`] = ` <textarea className="custom-textarea field-section sdc-input__input" data-test-id="description" + disabled={false} onChange={[Function]} value="desc 1" /> diff --git a/workflow-designer-ui/src/main/frontend/src/shared/components/Description/index.js b/workflow-designer-ui/src/main/frontend/src/shared/components/Description/index.js index 4aa48f8a..12bae31a 100644 --- a/workflow-designer-ui/src/main/frontend/src/shared/components/Description/index.js +++ b/workflow-designer-ui/src/main/frontend/src/shared/components/Description/index.js @@ -17,7 +17,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { I18n } from 'react-redux-i18n'; -const Description = ({ description, onDataChange, dataTestId }) => ( +const Description = ({ description, onDataChange, dataTestId, disabled }) => ( <div className="description-part"> <div className="sdc-input"> <div className="sdc-input__label"> @@ -30,6 +30,7 @@ const Description = ({ description, onDataChange, dataTestId }) => ( onDataChange({ description: event.target.value }); }} className="custom-textarea field-section sdc-input__input" + disabled={disabled} /> </div> </div> @@ -38,7 +39,12 @@ const Description = ({ description, onDataChange, dataTestId }) => ( Description.propTypes = { description: PropTypes.string, onDataChange: PropTypes.func, - dataTestId: PropTypes.string + dataTestId: PropTypes.string, + disabled: PropTypes.bool +}; + +Description.defaultProps = { + disabled: false }; export default Description; |