@@ -108,7 +108,7 @@ export const generateJobWizardData = (
108
108
const functions = selectedFunctionData . functions
109
109
const functionInfo = getFunctionInfo ( selectedFunctionData )
110
110
const defaultResources = frontendSpec ?. default_function_pod_resources ?? { }
111
- const functionParameters = getFunctionParameters ( functions , functionInfo . method )
111
+ const functionParameters = getFunctionParameters ( functions , functionInfo . handler )
112
112
const [ functionPriorityClassName ] = getFunctionPriorityClass ( functions )
113
113
const [ limits ] = getLimits ( functions )
114
114
const [ requests ] = getRequests ( functions )
@@ -123,7 +123,7 @@ export const generateJobWizardData = (
123
123
? getDefaultSchedule ( defaultData . schedule )
124
124
: scheduleDataInitialState
125
125
const jobAdditionalData = {
126
- methodOptions : functionInfo . methodOptions ,
126
+ handlerOptions : functionInfo . handlerOptions ,
127
127
versionOptions : functionInfo . versionOptions
128
128
}
129
129
const currentLimits = parseLimits ( limits , defaultResources . limits , gpuType )
@@ -133,8 +133,8 @@ export const generateJobWizardData = (
133
133
[ RUN_DETAILS_STEP ] : {
134
134
name : functionInfo . name ,
135
135
version : functionInfo . version ,
136
- method : functionInfo . method ,
137
- methodData : functionInfo . methodData ,
136
+ handler : functionInfo . handler ,
137
+ handlerData : functionInfo . handlerData ,
138
138
labels : [ ] ,
139
139
image : parseImageData ( functionInfo . function , frontendSpec , currentProjectName )
140
140
} ,
@@ -209,7 +209,7 @@ export const generateJobWizardDefaultData = (
209
209
if ( isEmpty ( defaultData ) ) return [ { } , { } ]
210
210
211
211
const runInfo = getRunDefaultInfo ( defaultData , selectedFunctionData )
212
- const functionParameters = getFunctionDefaultParameters ( selectedFunctionData , runInfo . method )
212
+ const functionParameters = getFunctionDefaultParameters ( selectedFunctionData , runInfo . handler )
213
213
const [ predefinedParameters , customParameters ] = parseDefaultParameters (
214
214
functionParameters ,
215
215
defaultData . task . spec . parameters ,
@@ -223,7 +223,7 @@ export const generateJobWizardDefaultData = (
223
223
const requests = defaultData . function . spec ?. resources ?. requests
224
224
const gpuType = getLimitsGpuType ( limits )
225
225
const jobAdditionalData = {
226
- methodOptions : runInfo . methodOptions ,
226
+ handlerOptions : runInfo . handlerOptions ,
227
227
versionOptions : runInfo . versionOptions
228
228
}
229
229
const currentLimits = parseLimits ( limits , defaultResources . limits , gpuType )
@@ -236,8 +236,8 @@ export const generateJobWizardDefaultData = (
236
236
[ RUN_DETAILS_STEP ] : {
237
237
name : runInfo . name ,
238
238
version : runInfo . version ,
239
- method : runInfo . method ,
240
- methodData : runInfo . methodData ,
239
+ handler : runInfo . handler ,
240
+ handlerData : runInfo . handlerData ,
241
241
labels : runInfo . labels ,
242
242
image : parseImageData ( selectedFunctionData , frontendSpec , currentProjectName )
243
243
} ,
@@ -297,16 +297,16 @@ export const generateJobWizardDefaultData = (
297
297
return [ jobFormData , jobAdditionalData ]
298
298
}
299
299
300
- export const getMethodData = ( selectedFunctionData , method ) => {
300
+ export const getHandlerData = ( selectedFunctionData , handler ) => {
301
301
const currentFunction = selectedFunctionData ?. functions
302
302
? chain ( selectedFunctionData . functions ) . orderBy ( 'metadata.updated' , 'desc' ) . get ( 0 ) . value ( )
303
303
: selectedFunctionData
304
- const methodData = get ( currentFunction , [ 'spec' , 'entry_points' , method ] , { } )
305
- const outputs = ( methodData ?. outputs ?? [ ] ) . filter ( output => ! isEveryObjectValueEmpty ( output ) )
304
+ const handlerData = get ( currentFunction , [ 'spec' , 'entry_points' , handler ] , { } )
305
+ const outputs = ( handlerData ?. outputs ?? [ ] ) . filter ( output => ! isEveryObjectValueEmpty ( output ) )
306
306
307
307
return {
308
- doc : methodData ?. doc ,
309
- has_kwargs : methodData ?. has_kwargs || false ,
308
+ doc : handlerData ?. doc ,
309
+ has_kwargs : handlerData ?. has_kwargs || false ,
310
310
outputs
311
311
}
312
312
}
@@ -316,10 +316,10 @@ const getFunctionInfo = selectedFunctionData => {
316
316
317
317
if ( ! isEmpty ( functions ) ) {
318
318
const versionOptions = getVersionOptions ( functions )
319
- const methodOptions = getMethodOptions ( functions )
320
- const { defaultVersion, defaultMethod } = getDefaultMethodAndVersion (
319
+ const handlerOptions = getHandlerOptions ( functions )
320
+ const { defaultVersion, defaultHandler } = getDefaultHandlerAndVersion (
321
321
versionOptions ,
322
- methodOptions ,
322
+ handlerOptions ,
323
323
functions
324
324
)
325
325
const currentFunctionVersion = selectedFunctionData . tag || defaultVersion
@@ -328,10 +328,10 @@ const getFunctionInfo = selectedFunctionData => {
328
328
329
329
return {
330
330
name : selectedFunctionData . name ,
331
- method : defaultMethod ,
331
+ handler : defaultHandler ,
332
332
version : currentFunctionVersion ,
333
- methodData : getMethodData ( currentFunction , defaultMethod ) ,
334
- methodOptions ,
333
+ handlerData : getHandlerData ( currentFunction , defaultHandler ) ,
334
+ handlerOptions ,
335
335
versionOptions,
336
336
function : currentFunction || { }
337
337
}
@@ -342,15 +342,15 @@ const getRunDefaultInfo = (defaultData, selectedFunctionData) => {
342
342
return {
343
343
labels : parseChipsData ( defaultData . task ?. metadata ?. labels ) ,
344
344
name : defaultData . task ?. metadata ?. name || '' ,
345
- method : defaultData . task ?. spec ?. handler ,
346
- methodData : getMethodData ( selectedFunctionData , defaultData . task ?. spec ?. handler ) ,
347
- methodOptions : [ ] ,
345
+ handler : defaultData . task ?. spec ?. handler ,
346
+ handlerData : getHandlerData ( selectedFunctionData , defaultData . task ?. spec ?. handler ) ,
347
+ handlerOptions : [ ] ,
348
348
version : '' ,
349
349
versionOptions : [ ]
350
350
}
351
351
}
352
352
353
- const getMethodOptions = selectedFunctions => {
353
+ const getHandlerOptions = selectedFunctions => {
354
354
return chain ( selectedFunctions )
355
355
. map ( func => Object . values ( func . spec ?. entry_points ?? { } ) )
356
356
. flatten ( )
@@ -377,47 +377,47 @@ const getVersionOptions = selectedFunctions => {
377
377
return versionOptions . length ? versionOptions : [ { label : 'latest' , id : TAG_LATEST } ]
378
378
}
379
379
380
- const getDefaultMethod = ( methodOptions , selectedFunctions ) => {
381
- let method = ''
380
+ const getDefaultHandler = ( handlerOptions , selectedFunctions ) => {
381
+ let handler = ''
382
382
383
383
const latestFunction = selectedFunctions . find ( item => item . metadata . tag === TAG_LATEST )
384
384
385
- if ( methodOptions . length ) {
386
- method = methodOptions [ 0 ] ?. id
385
+ if ( handlerOptions . length ) {
386
+ handler = handlerOptions [ 0 ] ?. id
387
387
} else if ( latestFunction ) {
388
- method = latestFunction . spec . default_handler || 'handler'
388
+ handler = latestFunction . spec . default_handler || 'handler'
389
389
} else {
390
- method = selectedFunctions [ 0 ] ?. spec . default_handler || 'handler'
390
+ handler = selectedFunctions [ 0 ] ?. spec . default_handler || 'handler'
391
391
}
392
392
393
- return method
393
+ return handler
394
394
}
395
395
396
- const getDefaultMethodAndVersion = ( versionOptions , methodOptions , selectedFunctions ) => {
396
+ const getDefaultHandlerAndVersion = ( versionOptions , handlerOptions , selectedFunctions ) => {
397
397
const defaultVersion =
398
398
versionOptions . find ( version => version . id === TAG_LATEST ) ?. id || versionOptions [ 0 ] . id || ''
399
399
400
- const defaultMethod = getDefaultMethod ( methodOptions , selectedFunctions )
400
+ const defaultHandler = getDefaultHandler ( handlerOptions , selectedFunctions )
401
401
402
402
return {
403
403
defaultVersion,
404
- defaultMethod
404
+ defaultHandler
405
405
}
406
406
}
407
407
408
- export const getFunctionParameters = ( selectedFunction , method ) => {
408
+ export const getFunctionParameters = ( selectedFunction , handler ) => {
409
409
return chain ( selectedFunction )
410
410
. orderBy ( 'metadata.updated' , 'desc' )
411
411
. map ( func => {
412
- return func . spec . entry_points ? func . spec . entry_points [ method ] ?. parameters ?? [ ] : [ ]
412
+ return func . spec . entry_points ? func . spec . entry_points [ handler ] ?. parameters ?? [ ] : [ ]
413
413
} )
414
414
. flatten ( )
415
415
. unionBy ( 'name' )
416
416
. value ( )
417
417
}
418
418
419
- export const getFunctionDefaultParameters = ( selectedFunction , method ) => {
420
- const functionParameters = get ( selectedFunction , `spec.entry_points[${ method } ].parameters` , [ ] )
419
+ export const getFunctionDefaultParameters = ( selectedFunction , handler ) => {
420
+ const functionParameters = get ( selectedFunction , `spec.entry_points[${ handler } ].parameters` , [ ] )
421
421
422
422
return keyBy ( functionParameters , 'name' )
423
423
}
@@ -1079,7 +1079,7 @@ export const generateJobRequestData = (
1079
1079
// secret_sources: formData[ADVANCED_STEP].secretSourcesTable.map(secretSource => {
1080
1080
// return { kind: secretSource.data.key, source: secretSource.data.value }
1081
1081
// }),
1082
- handler : formData [ RUN_DETAILS_STEP ] . method ?? '' ,
1082
+ handler : formData [ RUN_DETAILS_STEP ] . handler ?? '' ,
1083
1083
input_path : formData [ ADVANCED_STEP ] . inputPath ?? '' ,
1084
1084
output_path : formData [ ADVANCED_STEP ] . outputPath ,
1085
1085
function :
0 commit comments