Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions admin-ui/app/routes/Apps/Gluu/GluuCommitDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,12 @@ const GluuCommitDialog = ({
setUserMessage('')
}, [handler, onCloseModal])

const handleAccept = useCallback(() => {
const handleAccept = useCallback(async () => {
if (formik) {
formik.setFieldValue('action_message', userMessage)
}
onAccept(userMessage)
const result = onAccept(userMessage)
await Promise.resolve(result)
closeModal()
}, [formik, onAccept, userMessage, closeModal])

Expand Down
5 changes: 3 additions & 2 deletions admin-ui/app/routes/Apps/Gluu/GluuCommitDialogLegacy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,12 @@ const GluuCommitDialogLegacy = ({
prevModalRef.current = modal
}, [modal])

function handleAccept() {
async function handleAccept() {
if (formik) {
formik.setFieldValue('action_message', userMessage)
}
onAccept(userMessage)
const result = onAccept(userMessage)
await Promise.resolve(result)
handler()
onCloseModal()
setUserMessage('')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,7 @@ import { CEDAR_RESOURCE_SCOPES } from '@/cedarling/constants/resourceScopes'
import { ADMIN_UI_RESOURCES } from '@/cedarling/utility'
import { useAppNavigation, ROUTES } from '@/helpers/navigation'
import { useAcrAudit } from '../AuthN/hooks'
import {
generateLabel,
isRenamedKey,
renamedFieldFromObject,
useAuthServerPropertiesActions,
} from './Properties/utils'
import { generateLabel, isRenamedKey, renamedFieldFromObject } from './Properties/utils'
import { createAppConfigurationSchema } from './Properties/utils/validations'
import type { AppConfiguration, RootState, JsonPatch, AcrPutOperation, Script } from './types'
import type { GluuCommitDialogOperation, JsonValue } from 'Routes/Apps/Gluu/types/index'
Expand All @@ -48,7 +43,6 @@ const AuthPage: React.FC = () => {
const queryClient = useQueryClient()
const { navigateBack } = useAppNavigation()
const { hasCedarWritePermission, authorizeHelper } = useCedarling()
const { logAuthServerPropertiesUpdate } = useAuthServerPropertiesActions()
const { logAcrUpdate } = useAcrAudit()
const configuration = useSelector((state: RootState) => state.jsonConfigReducer.configuration)
const scripts = useSelector((state: RootState) => state.initReducer.scripts)
Expand Down Expand Up @@ -304,21 +298,8 @@ const AuthPage: React.FC = () => {
console.error('Error updating ACR:', error)
}
}
let auditSuccess = true
try {
const auditPayload = {
requestBody: patches,
...(put && put.value ? { defaultAcr: put.value } : {}),
}
auditSuccess = await logAuthServerPropertiesUpdate(message, auditPayload)
} catch (auditError) {
console.error('Error logging audit:', auditError)
auditSuccess = false
}
if (auditSuccess) {
if (patches.length === 0) {
toast.success(t('messages.success_in_saving'))
} else {
toast.warning(t('messages.success_in_saving_audit_failed'))
}
} catch (err) {
console.error('Error updating auth server properties:', err)
Expand All @@ -327,14 +308,13 @@ const AuthPage: React.FC = () => {
toast.error(errorMsg)
}
},
[patches, put, acrs, dispatch, putAcrsMutation, logAcrUpdate, logAuthServerPropertiesUpdate, t],
[patches, put, acrs, dispatch, putAcrsMutation, logAcrUpdate, t],
)
const submitForm = useCallback(
async (message: string) => {
toggle()
await handleSubmit(message)
},
[toggle, handleSubmit],
[handleSubmit],
)

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,6 @@ const ApiConfigForm: React.FC<ApiConfigFormProps> = ({ configuration, onSubmit }

const submitForm = useCallback(
async (userMessage: string) => {
toggle()
try {
await onSubmit(patches, userMessage)
setPatches([])
Expand All @@ -265,7 +264,7 @@ const ApiConfigForm: React.FC<ApiConfigFormProps> = ({ configuration, onSubmit }
toast.error(t('messages.error_in_saving'))
}
},
[toggle, onSubmit, patches, t],
[onSubmit, patches, t],
)

const handleBack = useCallback(() => {
Expand Down
3 changes: 1 addition & 2 deletions admin-ui/plugins/fido/components/DynamicConfiguration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,9 @@ const DynamicConfiguration: React.FC<DynamicConfigurationProps> = ({
if (readOnly) {
return
}
toggle()
handleSubmit(formik.values, userMessage)
},
[handleSubmit, toggle, formik.values, readOnly],
[handleSubmit, formik.values, readOnly],
)

const handleCancel = useCallback(() => {
Expand Down
3 changes: 1 addition & 2 deletions admin-ui/plugins/fido/components/StaticConfiguration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,9 @@ const StaticConfiguration: React.FC<StaticConfigurationProps> = ({
if (readOnly) {
return
}
toggle()
handleSubmit(formik.values, userMessage)
},
[handleSubmit, toggle, formik.values, readOnly],
[handleSubmit, formik.values, readOnly],
)

const handleCancel = useCallback(() => {
Expand Down
3 changes: 1 addition & 2 deletions admin-ui/plugins/scim/components/ScimConfiguration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,9 @@ const ScimConfiguration: React.FC<ScimConfigurationProps> = ({

const submitForm = useCallback(
(userMessage: string): void => {
toggle()
handleSubmit({ ...formik.values, action_message: userMessage })
},
[handleSubmit, toggle, formik.values],
[handleSubmit, formik.values],
)

const handleCancel = useCallback(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ function SmtpForm(props: Readonly<SmtpFormProps>) {
return
}

toggle()
const trimmedValues = trimObjectStrings(
formik.values as unknown as Record<string, unknown>,
) as unknown as SmtpFormValues
Expand Down
Loading