@@ -55,6 +55,7 @@ import { UPDATE } from '@/audit/UserActionType'
5555import { ADMIN_UI_SETTINGS } from 'Plugins/admin/redux/audit/Resources'
5656import { getErrorMessage } from 'Plugins/schema/utils/errorHandler'
5757import type { RootState } from '@/redux/sagas/types/audit'
58+ import customColors from '@/customColors'
5859
5960const PAGING_SIZE_OPTIONS = [ 1 , 5 , 10 , 20 ] as const
6061const DEFAULT_PAGING_SIZE = PAGING_SIZE_OPTIONS [ 2 ]
@@ -76,10 +77,8 @@ const SettingsPage: React.FC = () => {
7677
7778 const { hasCedarReadPermission, hasCedarWritePermission, authorizeHelper } = useCedarling ( )
7879
79- const authState = useSelector ( ( state : RootState ) => ( {
80- userinfo : state . authReducer ?. userinfo ,
81- clientId : state . authReducer ?. config ?. clientId ,
82- } ) )
80+ const userinfo = useSelector ( ( state : RootState ) => state . authReducer ?. userinfo )
81+ const clientId = useSelector ( ( state : RootState ) => state . authReducer ?. config ?. clientId )
8382
8483 const {
8584 data : config ,
@@ -189,11 +188,11 @@ const SettingsPage: React.FC = () => {
189188 dispatch ( getOAuth2ConfigResponse ( { config : updatedConfig } ) )
190189
191190 await logAudit ( {
192- userinfo : authState . userinfo ?? undefined ,
191+ userinfo : userinfo ?? undefined ,
193192 action : UPDATE ,
194193 resource : ADMIN_UI_SETTINGS ,
195194 message : 'Application settings updated' ,
196- client_id : authState . clientId ,
195+ client_id : clientId ,
197196 payload : {
198197 sessionTimeoutInMins : values . sessionTimeoutInMins ,
199198 acrValues : values . acrValues ,
@@ -260,6 +259,26 @@ const SettingsPage: React.FC = () => {
260259 additionalParametersError && ( formik . submitCount > 0 || formik . touched ?. additionalParameters ) ,
261260 )
262261
262+ const additionalParametersErrorText = useMemo ( ( ) : string | null => {
263+ const err = additionalParametersError
264+ if ( ! err ) return null
265+ if ( typeof err === 'string' ) return err
266+ if ( Array . isArray ( err ) ) {
267+ for ( const item of err ) {
268+ if ( ! item ) continue
269+ if ( typeof item === 'string' ) return item
270+ if ( typeof item === 'object' ) {
271+ const maybeKey = ( item as { key ?: unknown } ) . key
272+ const maybeValue = ( item as { value ?: unknown } ) . value
273+ if ( typeof maybeKey === 'string' ) return maybeKey
274+ if ( typeof maybeValue === 'string' ) return maybeValue
275+ }
276+ }
277+ return null
278+ }
279+ return null
280+ } , [ additionalParametersError ] )
281+
263282 const renderErrorAlert = ( ) => {
264283 if ( ! hasQueryError ) return null
265284
@@ -494,7 +513,9 @@ const SettingsPage: React.FC = () => {
494513 </ Col >
495514 </ FormGroup >
496515 { showAdditionalParametersError && (
497- < div style = { { color : '#dc3545' } } > { additionalParametersError } </ div >
516+ < div style = { { color : customColors . accentRed } } >
517+ { additionalParametersErrorText || t ( 'messages.field_required' ) }
518+ </ div >
498519 ) }
499520 </ AccordionBody >
500521 </ Accordion >
0 commit comments