enabled,
newGithubProvisioningStatus,
setNewGithubProvisioningStatus,
+ hasGithubProvisioningTypeChange,
hasGithubProvisioningConfigChange,
resetJitSetting,
saveGroup,
<form
onSubmit={async (e) => {
e.preventDefault();
- if (newGithubProvisioningStatus !== githubProvisioningStatus) {
+ if (hasGithubProvisioningTypeChange) {
setShowConfirmProvisioningModal(true);
} else {
await saveGroup();
const { data: githubProvisioningStatus } = useGithubStatusQuery();
const toggleGithubProvisioning = useToggleGithubProvisioningMutation();
const [newGithubProvisioningStatus, setNewGithubProvisioningStatus] = useState<boolean>();
+ const hasGithubProvisioningTypeChange =
+ newGithubProvisioningStatus !== undefined &&
+ newGithubProvisioningStatus !== githubProvisioningStatus;
const hasGithubProvisioningConfigChange =
- some(GITHUB_JIT_FIELDS, isValueChange) ||
- (newGithubProvisioningStatus !== undefined &&
- newGithubProvisioningStatus !== githubProvisioningStatus);
+ some(GITHUB_JIT_FIELDS, isValueChange) || hasGithubProvisioningTypeChange;
const resetJitSetting = () => {
GITHUB_JIT_FIELDS.forEach((s) => setNewValue(s));
const clientIdIsNotSet = values[GITHUB_CLIENT_ID_FIELD]?.isNotSet;
const changeProvisioning = async () => {
- if (newGithubProvisioningStatus !== githubProvisioningStatus) {
+ if (hasGithubProvisioningTypeChange) {
await toggleGithubProvisioning.mutateAsync(!!newGithubProvisioningStatus);
}
if (!newGithubProvisioningStatus || !githubProvisioningStatus) {
githubProvisioningStatus,
newGithubProvisioningStatus,
setNewGithubProvisioningStatus,
+ hasGithubProvisioningTypeChange,
hasGithubProvisioningConfigChange,
changeProvisioning,
saveGroup,
setNewValue(SAML_GROUP_NAME, value);
};
- const hasScimConfigChange =
- isValueChange(SAML_GROUP_NAME) || (newScimStatus !== undefined && newScimStatus !== scimStatus);
+ const hasScimTypeChange = newScimStatus !== undefined && newScimStatus !== scimStatus;
+ const hasScimConfigChange = isValueChange(SAML_GROUP_NAME) || hasScimTypeChange;
return {
...config,
groupValue,
values,
setNewValue,
+ hasScimTypeChange,
hasScimConfigChange,
newScimStatus,
setNewScimStatus,