16
16
17
17
import { MutableRefObject } from 'react'
18
18
import moment from 'moment'
19
- import { RuntimeParamsAPIResponseType } from '@Shared/types'
19
+ import { RuntimeParamsAPIResponseType , RuntimePluginVariables } from '@Shared/types'
20
20
import { getIsManualApprovalSpecific , sanitizeUserApprovalConfig , stringComparatorBySortOrder } from '@Shared/Helpers'
21
21
import { get , getIsRequestAborted , post } from './Api'
22
22
import { API_STATUS_CODES , GitProviderType , ROUTES } from './Constants'
@@ -324,7 +324,8 @@ const processCDMaterialsApprovalInfo = (enableApproval: boolean, cdMaterialsResu
324
324
}
325
325
}
326
326
327
-
327
+ export const parseRuntimeParams = ( response : RuntimeParamsAPIResponseType ) : RuntimePluginVariables [ ] =>
328
+ ( response ?. runtimePluginVariables ?? [ ] ) . map ( ( variable ) => ( { ...variable , defaultValue : variable . value } ) )
328
329
329
330
const processCDMaterialsMetaInfo = ( cdMaterialsResult ) : CDMaterialsMetaInfo => {
330
331
if ( ! cdMaterialsResult ) {
@@ -346,7 +347,7 @@ const processCDMaterialsMetaInfo = (cdMaterialsResult): CDMaterialsMetaInfo => {
346
347
resourceFilters : cdMaterialsResult . resourceFilters ?? [ ] ,
347
348
totalCount : cdMaterialsResult . totalCount ?? 0 ,
348
349
requestedUserId : cdMaterialsResult . requestedUserId ,
349
- runtimeParams : cdMaterialsResult . runtimeParams . runtimePluginVariables ?? [ ] ,
350
+ runtimeParams : parseRuntimeParams ( cdMaterialsResult . runtimeParams ) ,
350
351
}
351
352
}
352
353
0 commit comments