summaryrefslogtreecommitdiffstats
path: root/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditor.js
blob: 76ea36db98145f1186a93c2e99a7e677b26efa51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { connect } from 'react-redux';
import ValidationHelper from 'sdc-app/common/helpers/ValidationHelper.js';
import LimitEditor from './LimitEditor.jsx';

const mapStateToProps = ({ licenseModel: { limitEditor } }) => {
    let { data, genericFieldInfo, formReady } = limitEditor;
    let isFormValid = ValidationHelper.checkFormValid(genericFieldInfo);

    return {
        data,
        genericFieldInfo,
        isFormValid,
        formReady
    };
};

const mapActionsToProps = dispatch => {
    return {
        onDataChanged: (deltaData, formName, customValidations) =>
            ValidationHelper.dataChanged(dispatch, {
                deltaData,
                formName,
                customValidations
            }),
        onValidateForm: formName =>
            ValidationHelper.validateForm(dispatch, formName)
    };
};

export default connect(mapStateToProps, mapActionsToProps)(LimitEditor);