mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-08 22:45:45 +01:00
disable button after submit-method is triggered and rename state 'valid' to 'changed' as it does not check validity
This commit is contained in:
@@ -24,7 +24,7 @@ type State = {
|
|||||||
loginAttemptLimitTimeout: boolean,
|
loginAttemptLimitTimeout: boolean,
|
||||||
loginAttemptLimit: boolean
|
loginAttemptLimit: boolean
|
||||||
},
|
},
|
||||||
valid: boolean
|
changed: boolean
|
||||||
};
|
};
|
||||||
|
|
||||||
class ConfigForm extends React.Component<Props, State> {
|
class ConfigForm extends React.Component<Props, State> {
|
||||||
@@ -61,7 +61,7 @@ class ConfigForm extends React.Component<Props, State> {
|
|||||||
loginAttemptLimitTimeout: false,
|
loginAttemptLimitTimeout: false,
|
||||||
loginAttemptLimit: false
|
loginAttemptLimit: false
|
||||||
},
|
},
|
||||||
valid: false
|
changed: false
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,6 +77,9 @@ class ConfigForm extends React.Component<Props, State> {
|
|||||||
|
|
||||||
submit = (event: Event) => {
|
submit = (event: Event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
this.setState({
|
||||||
|
changed: false
|
||||||
|
});
|
||||||
this.props.submitForm(this.state.config);
|
this.props.submitForm(this.state.config);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -158,7 +161,9 @@ class ConfigForm extends React.Component<Props, State> {
|
|||||||
<SubmitButton
|
<SubmitButton
|
||||||
loading={loading}
|
loading={loading}
|
||||||
label={t("config-form.submit")}
|
label={t("config-form.submit")}
|
||||||
disabled={!configUpdatePermission || this.hasError() || !this.state.valid}
|
disabled={
|
||||||
|
!configUpdatePermission || this.hasError() || !this.state.changed
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</form>
|
</form>
|
||||||
);
|
);
|
||||||
@@ -175,7 +180,7 @@ class ConfigForm extends React.Component<Props, State> {
|
|||||||
...this.state.error,
|
...this.state.error,
|
||||||
[name]: !isValid
|
[name]: !isValid
|
||||||
},
|
},
|
||||||
valid: true
|
changed: true
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user