Web: Client: Settings: SSO: fix disable save button
This commit is contained in:
parent
934dc28abe
commit
60469f901e
@ -17,6 +17,7 @@ const SubmitResetButtons = (props) => {
|
||||
confirmationResetModal,
|
||||
isSubmitLoading,
|
||||
hasErrors,
|
||||
hasChanges,
|
||||
} = props;
|
||||
|
||||
return (
|
||||
@ -28,7 +29,7 @@ const SubmitResetButtons = (props) => {
|
||||
primary
|
||||
size="small"
|
||||
tabIndex={23}
|
||||
isDisabled={hasErrors}
|
||||
isDisabled={hasErrors || !hasChanges}
|
||||
isLoading={isSubmitLoading}
|
||||
/>
|
||||
<Button
|
||||
@ -52,6 +53,7 @@ export default inject(({ ssoStore }) => {
|
||||
confirmationResetModal,
|
||||
isSubmitLoading,
|
||||
hasErrors,
|
||||
hasChanges,
|
||||
} = ssoStore;
|
||||
|
||||
return {
|
||||
@ -62,5 +64,6 @@ export default inject(({ ssoStore }) => {
|
||||
confirmationResetModal,
|
||||
isSubmitLoading,
|
||||
hasErrors,
|
||||
hasChanges,
|
||||
};
|
||||
})(observer(SubmitResetButtons));
|
||||
|
@ -10,6 +10,7 @@ import {
|
||||
} from "@appserver/common/api/settings";
|
||||
import toastr from "../helpers/toastr";
|
||||
import { BINDING_POST, BINDING_REDIRECT } from "../helpers/constants";
|
||||
import isEqual from "lodash/isEqual";
|
||||
|
||||
class SsoFormStore {
|
||||
isSsoEnabled = false;
|
||||
@ -136,15 +137,18 @@ class SsoFormStore {
|
||||
isSubmitLoading = false;
|
||||
isGeneratedCertificate = false;
|
||||
|
||||
defaultSettings = null;
|
||||
|
||||
constructor() {
|
||||
makeAutoObservable(this);
|
||||
}
|
||||
|
||||
onPageLoad = async () => {
|
||||
try {
|
||||
const response = await getCurrentSsoSettings();
|
||||
this.isSsoEnabled = response.enableSso;
|
||||
this.setFieldsFromObject(response);
|
||||
const res = await getCurrentSsoSettings();
|
||||
this.isSsoEnabled = res.enableSso;
|
||||
this.defaultSettings = res;
|
||||
this.setFieldsFromObject(res);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
@ -360,6 +364,8 @@ class SsoFormStore {
|
||||
await submitSsoForm(data);
|
||||
toastr.success(t("Settings:SuccessfullySaveSettingsMessage"));
|
||||
this.isSubmitLoading = false;
|
||||
this.SPMetadata = true;
|
||||
this.defaultSettings = settings;
|
||||
} catch (err) {
|
||||
toastr.error(err);
|
||||
console.error(err);
|
||||
@ -593,6 +599,11 @@ class SsoFormStore {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
get hasChanges() {
|
||||
const currentSettings = this.getSettings();
|
||||
return !isEqual(currentSettings, this.defaultSettings);
|
||||
}
|
||||
}
|
||||
|
||||
export default SsoFormStore;
|
||||
|
Loading…
Reference in New Issue
Block a user