grid-template-rows: 70px 1fr;
height: 100vh;
}
+
+ .disabled {
+ pointer-events: none;
+ opacity: 0.4;
+ }
}
<textarea
className="custom-textarea field-section sdc-input__input"
data-test-id="new-version-description"
+ disabled={false}
onChange={[Function]}
value=""
/>
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);
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">
</div>
<div className="general-page-content">
<Description
- description={description}
+ description={versionInfo.description}
onDataChange={onDataChange}
+ disabled={isCertified}
/>
<VersionInfo>
<LabeledValue
GeneralView.propTypes = {
onDataChange: PropTypes.func,
- description: PropTypes.string,
- created: PropTypes.string,
- modified: PropTypes.string
+ versionInfo: PropTypes.object,
+ isCertified: PropTypes.bool
};
export default GeneralView;
* 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
+);
getTypes,
getError
} from 'features/version/inputOutput/inputOutputSelectors';
+import { getIsCertified } from 'features/version/general/generalSelectors';
import {
changeError,
showInputs,
search: getSearch(state),
dataRows: getDataRows(state),
types: getTypes(state),
- error: getError(state)
+ error: getError(state),
+ isCertified: getIsCertified(state)
});
const mapDispatchToProps = dispatch => ({
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';
};
render() {
- const { isShowInputs, search, handleAdd } = this.props;
+ const { isShowInputs, search, handleAdd, isCertified } = this.props;
const addLabel = isShowInputs
? I18n.t('workflow.inputOutput.addInput')
/>
</div>
<div
- className="input-output__add"
+ className={cn('input-output__add', {
+ disabled: isCertified
+ })}
data-test-id="wf-input-output-add"
onClick={handleAdd}>
<SVGIcon
</div>
<div className="input-output__table">
<TableHead />
- <TableBody>{dataRowsView}</TableBody>
+ <TableBody isCertified={isCertified}>
+ {dataRowsView}
+ </TableBody>
</div>
</div>
);
),
types: PropTypes.array,
error: PropTypes.object,
+ isCertified: PropTypes.bool,
handleChangeError: PropTypes.func,
handleShowInputs: PropTypes.func,
handleShowOutputs: PropTypes.func,
import React from 'react';
import PropTypes from 'prop-types';
+import cn from 'classnames';
class TableBody extends React.Component {
handleNameInputChange = params => {
};
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
};
<textarea
className="custom-textarea field-section sdc-input__input"
data-test-id="description"
+ disabled={false}
onChange={[Function]}
value=""
/>
<textarea
className="custom-textarea field-section sdc-input__input"
data-test-id="description"
+ disabled={false}
onChange={[Function]}
value="desc 1"
/>
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">
onDataChange({ description: event.target.value });
}}
className="custom-textarea field-section sdc-input__input"
+ disabled={disabled}
/>
</div>
</div>
Description.propTypes = {
description: PropTypes.string,
onDataChange: PropTypes.func,
- dataTestId: PropTypes.string
+ dataTestId: PropTypes.string,
+ disabled: PropTypes.bool
+};
+
+Description.defaultProps = {
+ disabled: false
};
export default Description;