Merge pull request #414 from mfrances17/issue-374

Prevent LDAP and Kerberos settings saves unless dirty
This commit is contained in:
mfrances17 2021-03-04 15:08:41 -05:00 committed by GitHub
commit b7b33429dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 2 deletions

View file

@ -103,6 +103,7 @@ export const UserFederationKerberosSettings = () => {
}, []);
const setupForm = (component: ComponentRepresentation) => {
form.reset();
Object.entries(component).map((entry) => {
form.setValue(
"config.allowPasswordAuthentication",
@ -177,7 +178,12 @@ export const UserFederationKerberosSettings = () => {
<SettingsCache form={form} showSectionHeading />
<Form onSubmit={form.handleSubmit(save)}>
<ActionGroup>
<Button variant="primary" type="submit" data-testid="kerberos-save">
<Button
isDisabled={!form.formState.isDirty}
variant="primary"
type="submit"
data-testid="kerberos-save"
>
{t("common:save")}
</Button>
<Button

View file

@ -137,6 +137,7 @@ export const UserFederationLdapSettings = () => {
}, []);
const setupForm = (component: ComponentRepresentation) => {
form.reset();
Object.entries(component).map((entry) => {
if (entry[0] === "config") {
convertToFormValues(entry[1], "config", form.setValue);
@ -240,7 +241,12 @@ export const UserFederationLdapSettings = () => {
</ScrollForm>
<Form onSubmit={form.handleSubmit(save)}>
<ActionGroup>
<Button variant="primary" type="submit" data-testid="ldap-save">
<Button
isDisabled={!form.formState.isDirty}
variant="primary"
type="submit"
data-testid="ldap-save"
>
{t("common:save")}
</Button>
<Button