Skip to content

Commit

Permalink
Fix [Function] Revert and fix for empty Batch run on function run (#2991
Browse files Browse the repository at this point in the history
)
  • Loading branch information
mariana-furyk authored Jan 7, 2025
1 parent 462bd56 commit 382da86
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
2 changes: 2 additions & 0 deletions src/components/FunctionsPage/functions.util.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import { setNotification } from '../../reducers/notificationReducer'
import { showErrorNotification } from '../../utils/notifications.util'
import { getFunctionLogs, getFunctionNuclioLogs } from '../../utils/getFunctionLogs'
import { parseIdentifier } from '../../utils'
import { setJobFunction } from '../../reducers/jobReducer'

import { ReactComponent as Delete } from 'igz-controls/images/delete.svg'
import { ReactComponent as Run } from 'igz-controls/images/run.svg'
Expand Down Expand Up @@ -312,6 +313,7 @@ export const generateActionsMenu = (
onClick: funcMin => {
getFullFunction(funcMin).then(func => {
if (func?.project && func?.name && func?.hash && func?.ui?.originalContent) {
dispatch(setJobFunction(func.ui.originalContent))
setJobWizardMode(PANEL_FUNCTION_CREATE_MODE)
} else {
showErrorNotification(dispatch, {}, '', 'Failed to retrieve function data')
Expand Down
13 changes: 5 additions & 8 deletions src/components/JobWizard/JobWizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,9 @@ const JobWizard = ({
}
dispatch(resetModalFilter({ name: JOB_WIZARD_FILTERS }))
dispatch(removeJobFunction())
functionsStore.func && dispatch(functionsActions.removeFunction())
onResolve()
onWizardClose && onWizardClose()
}, [dispatch, functionsStore.func, onResolve, onWizardClose, showSchedule])
}, [dispatch, onResolve, onWizardClose, showSchedule])

const { handleCloseModal, resolveModal } = useModalBlockHistory(closeModal, formRef.current)

Expand Down Expand Up @@ -175,15 +174,13 @@ const JobWizard = ({
}, [fetchFunctionTemplate, fetchHubFunction, isBatchInference, isTrain, resolveModal])

useEffect(() => {
if (!isEmpty(jobsStore.jobFunc) || !isEmpty(functionsStore.func)) {
if (!isEmpty(jobsStore.jobFunc)) {
setSelectedFunctionData({
name: !isEmpty(functionsStore.func)
? functionsStore.func.metadata.name
: jobsStore.jobFunc.metadata.name,
functions: !isEmpty(functionsStore.func) ? [functionsStore.func] : [jobsStore.jobFunc]
name: jobsStore.jobFunc.metadata.name,
functions: [jobsStore.jobFunc]
})
}
}, [functionsStore.func, isEditMode, isRunMode, jobsStore.jobFunc])
}, [isEditMode, isRunMode, jobsStore.jobFunc])

const setJobData = useCallback(
(formState, jobFormData, jobAdditionalData) => {
Expand Down
5 changes: 4 additions & 1 deletion src/reducers/jobReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,9 @@ const jobsSlice = createSlice({
},
setJobsData(state, action) {
state.jobsData = action.payload
},
setJobFunction(state, action) {
state.jobFunc = action.payload
}
},
extraReducers: builder => {
Expand Down Expand Up @@ -380,6 +383,6 @@ const jobsSlice = createSlice({
}
})

export const { removeJobFunction, setJobsData } = jobsSlice.actions
export const { removeJobFunction, setJobsData, setJobFunction } = jobsSlice.actions

export default jobsSlice.reducer

0 comments on commit 382da86

Please sign in to comment.