Skip to content

Commit

Permalink
merged development
Browse files Browse the repository at this point in the history
  • Loading branch information
mariana-furyk committed Dec 4, 2023
2 parents 0441e53 + 96e2e58 commit b91c623
Show file tree
Hide file tree
Showing 80 changed files with 1,122 additions and 1,336 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"@monaco-editor/react": "^4.1.3",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.3",
"@reduxjs/toolkit": "^1.8.1",
"axios": "^0.21.1",
"axios": "^0.22.0",
"bfj": "^7.0.2",
"browserslist": "^4.18.1",
"camelcase": "^6.2.1",
Expand All @@ -24,7 +24,7 @@
"final-form-arrays": "^3.0.2",
"fs-extra": "^10.0.0",
"identity-obj-proxy": "^3.0.0",
"iguazio.dashboard-react-controls": "1.7.1",
"iguazio.dashboard-react-controls": "1.8.0",
"is-wsl": "^1.1.0",
"js-base64": "^2.5.2",
"js-yaml": "^3.13.1",
Expand Down
16 changes: 11 additions & 5 deletions src/actions/featureStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ import {
getFeatureVectorIdentifier
} from '../utils/getUniqueIdentifier'
import { parseFeatureSets } from '../utils/parseFeatureSets'
import { largeResponseCatchHandler } from '../utils/largeResponseCatchHandler'

const featureStoreActions = {
createNewFeatureSet: (project, data) => dispatch => {
Expand Down Expand Up @@ -180,8 +181,9 @@ const featureStoreActions = {

return response.data?.feature_sets
})
.catch(err => {
dispatch(featureStoreActions.fetchFeatureSetsFailure(err.message))
.catch(error => {
dispatch(featureStoreActions.fetchFeatureSetsFailure(error.message))
largeResponseCatchHandler(error, 'Failed to fetch feature sets', dispatch)
})
},
fetchFeatureSetsBegin: () => ({
Expand Down Expand Up @@ -239,7 +241,7 @@ const featureStoreActions = {
type: FETCH_FEATURE_VECTOR_SUCCESS,
payload: featureSets
}),
fetchFeatureVectors: (project, filters, config) => dispatch => {
fetchFeatureVectors: (project, filters, config = {}, skipErrorNotification) => dispatch => {
dispatch(featureStoreActions.fetchFeatureVectorsBegin())

return featureStoreApi
Expand All @@ -253,8 +255,12 @@ const featureStoreActions = {

return response.data.feature_vectors
})
.catch(err => {
dispatch(featureStoreActions.fetchFeatureVectorsFailure(err))
.catch(error => {
dispatch(featureStoreActions.fetchFeatureVectorsFailure(error))

if (!skipErrorNotification) {
largeResponseCatchHandler(error, 'Failed to fetch feature vectors', dispatch)
}
})
},
fetchFeatureVectorsBegin: () => ({
Expand Down
64 changes: 18 additions & 46 deletions src/actions/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ illegal under applicable law, and the grant of the foregoing license
under the Apache 2.0 license is conditioned upon your compliance with
such restriction.
*/
import { get } from 'lodash'
import functionsApi from '../api/functions-api'
import yaml from 'js-yaml'
import {
Expand Down Expand Up @@ -86,7 +85,8 @@ import {
} from '../constants'
import { FORBIDDEN_ERROR_STATUS_CODE } from 'igz-controls/constants'
import { generateCategories, generateHubCategories } from '../utils/generateTemplatesCategories'
import { setNotification } from '../reducers/notificationReducer'
import { largeResponseCatchHandler } from '../utils/largeResponseCatchHandler'
import { showErrorNotification } from '../utils/notifications.util'

const functionsActions = {
createNewFunction: (project, data) => dispatch => {
Expand Down Expand Up @@ -185,17 +185,8 @@ const functionsActions = {
return templates
})
.catch(error => {
const errorMsg = get(error, 'response.data.detail', "Function's template failed to load")

dispatch(functionsActions.fetchFunctionTemplateFailure(error))
dispatch(
setNotification({
status: error.response?.status || 400,
id: Math.random(),
message: errorMsg,
error
})
)
showErrorNotification(dispatch, error, "Function's template failed to load")
})
},
fetchFunctionTemplateSuccess: selectFunction => ({
Expand All @@ -209,22 +200,21 @@ const functionsActions = {
type: FETCH_FUNCTION_TEMPLATE_FAILURE,
payload: err
}),
fetchFunctions:
(project, filters, setLargeRequestErrorMessage) =>
dispatch => {
dispatch(functionsActions.fetchFunctionsBegin())
fetchFunctions: (project, filters, config) => dispatch => {
dispatch(functionsActions.fetchFunctionsBegin())

return functionsApi
.getFunctions(project, filters, null, setLargeRequestErrorMessage)
.then(({ data }) => {
dispatch(functionsActions.fetchFunctionsSuccess(data.funcs))
return functionsApi
.getFunctions(project, filters, config)
.then(({ data }) => {
dispatch(functionsActions.fetchFunctionsSuccess(data.funcs))

return data.funcs
})
.catch(err => {
dispatch(functionsActions.fetchFunctionsFailure(err.message))
})
},
return data.funcs
})
.catch(error => {
dispatch(functionsActions.fetchFunctionsFailure(error.message))
largeResponseCatchHandler(error, 'Failed to fetch functions', dispatch)
})
},
fetchFunctionsBegin: () => ({
type: FETCH_FUNCTIONS_BEGIN
}),
Expand Down Expand Up @@ -264,17 +254,8 @@ const functionsActions = {
return response.data
})
.catch(error => {
const errorMsg = get(error, 'response.data.detail', 'The function failed to load')
dispatch(functionsActions.fetchHubFunctionTemplateFailure(error))

dispatch(
setNotification({
status: error.response?.status || 400,
id: Math.random(),
message: errorMsg,
error
})
)
showErrorNotification(dispatch, error, 'The function failed to load')
})
},
fetchHubFunctionTemplateSuccess: () => ({
Expand All @@ -300,16 +281,7 @@ const functionsActions = {
return templatesData
})
.catch(error => {
const errorMsg = get(error, 'response.data.detail', 'Functions failed to load')

dispatch(
setNotification({
status: error.response?.status || 400,
id: Math.random(),
message: errorMsg,
error
})
)
showErrorNotification(dispatch, error, 'Functions failed to load')
})
},

Expand Down
29 changes: 9 additions & 20 deletions src/actions/jobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ illegal under applicable law, and the grant of the foregoing license
under the Apache 2.0 license is conditioned upon your compliance with
such restriction.
*/
import { get } from 'lodash'
import jobsApi from '../api/jobs-api'
import functionsApi from '../api/functions-api'
import {
Expand Down Expand Up @@ -76,7 +75,8 @@ import {
SET_URL
} from '../constants'
import { getNewJobErrorMsg } from '../components/JobWizard/JobWizard.util'
import { setNotification } from '../reducers/notificationReducer'
import { showErrorNotification } from '../utils/notifications.util'
import { largeResponseCatchHandler } from '../utils/largeResponseCatchHandler'

const jobsActions = {
abortJob: (project, job) => dispatch => {
Expand Down Expand Up @@ -148,20 +148,19 @@ const jobsActions = {
type: EDIT_JOB_FAILURE,
payload: error
}),
fetchAllJobRuns: (project, filters, jobName, setLargeRequestErrorMessage) => dispatch => {
fetchAllJobRuns: (project, filters, config, jobName) => dispatch => {
dispatch(jobsActions.fetchAllJobRunsBegin())

return jobsApi
.getAllJobRuns(project, jobName, filters, setLargeRequestErrorMessage)
.getAllJobRuns(project, filters, config, jobName)
.then(({ data }) => {
dispatch(jobsActions.fetchAllJobRunsSuccess(data.runs || []))

return data.runs
})
.catch(error => {
dispatch(jobsActions.fetchAllJobRunsFailure(error))

throw error
largeResponseCatchHandler(error, 'Failed to fetch jobs', dispatch)
})
},
fetchAllJobRunsBegin: () => ({
Expand Down Expand Up @@ -210,17 +209,8 @@ const jobsActions = {
return res.data.func
})
.catch(error => {
const errorMsg = get(error, 'response.data.detail', 'Job’s function failed to load')

dispatch(jobsActions.fetchJobFunctionFailure(error))
dispatch(
setNotification({
status: error.response?.status || 400,
id: Math.random(),
message: errorMsg,
error
})
)
showErrorNotification(dispatch, error, 'Job’s function failed to load')
})
},
fetchJobFunctionBegin: () => ({
Expand Down Expand Up @@ -280,12 +270,12 @@ const jobsActions = {
fetchJobLogsSuccess: () => ({
type: FETCH_JOB_LOGS_SUCCESS
}),
fetchJobs: (project, filters, scheduled, setLargeRequestErrorMessage) => dispatch => {
fetchJobs: (project, filters, config, scheduled) => dispatch => {
const getJobs = scheduled ? jobsApi.getScheduledJobs : jobsApi.getJobs

dispatch(jobsActions.fetchJobsBegin())

return getJobs(project, filters, setLargeRequestErrorMessage)
return getJobs(project, filters, config)
.then(({ data }) => {
const newJobs = scheduled
? (data || {}).schedules
Expand All @@ -298,8 +288,7 @@ const jobsActions = {
})
.catch(error => {
dispatch(jobsActions.fetchJobsFailure(error))

throw error
largeResponseCatchHandler(error, 'Failed to fetch jobs', dispatch)
})
},
fetchSpecificJobs: (project, filters, jobList) => () => {
Expand Down
30 changes: 16 additions & 14 deletions src/actions/projects.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ import {
} from 'igz-controls/constants'

import { parseSummaryData } from '../utils/parseSummaryData'
import { showErrorNotification } from '../utils/notifications.util'

const projectsAction = {
addProjectLabel: (label, labels) => ({
Expand Down Expand Up @@ -218,11 +219,11 @@ const projectsAction = {
type: FETCH_PROJECT_DATASETS_SUCCESS,
payload: datasets
}),
fetchProjectFailedJobs: (project, cancelToken) => dispatch => {
fetchProjectFailedJobs: (project, signal) => dispatch => {
dispatch(projectsAction.fetchProjectFailedJobsBegin())

return projectsApi
.getProjectFailedJobs(project, cancelToken)
.getProjectFailedJobs(project, signal)
.then(response => {
dispatch(projectsAction.fetchProjectFailedJobsSuccess(response?.data.runs))

Expand Down Expand Up @@ -257,11 +258,11 @@ const projectsAction = {
dispatch(projectsAction.fetchProjectFilesFailure(error.message))
})
},
fetchProjectFeatureSets: (project, cancelToken) => dispatch => {
fetchProjectFeatureSets: (project, signal) => dispatch => {
dispatch(projectsAction.fetchProjectFeatureSetsBegin())

return projectsApi
.getProjectFeatureSets(project, cancelToken)
.getProjectFeatureSets(project, signal)
.then(response => {
dispatch(projectsAction.fetchProjectFeatureSetsSuccess(response.data?.feature_sets))

Expand Down Expand Up @@ -293,11 +294,11 @@ const projectsAction = {
type: FETCH_PROJECT_FILES_SUCCESS,
payload: files
}),
fetchProjectFunctions: (project, cancelToken) => dispatch => {
fetchProjectFunctions: (project, signal) => dispatch => {
dispatch(projectsAction.fetchProjectFunctionsBegin())

return projectsApi
.getProjectFunctions(project, cancelToken)
.getProjectFunctions(project, signal)
.then(response => {
dispatch(projectsAction.fetchProjectFunctionsSuccess(response?.data.funcs))

Expand Down Expand Up @@ -355,11 +356,11 @@ const projectsAction = {
type: FETCH_PROJECT_JOBS_SUCCESS,
payload: jobs
}),
fetchProjectModels: (project, cancelToken) => dispatch => {
fetchProjectModels: (project, signal) => dispatch => {
dispatch(projectsAction.fetchProjectModelsBegin())

return projectsApi
.getProjectModels(project, cancelToken)
.getProjectModels(project, signal)
.then(response => {
dispatch(projectsAction.fetchProjectModelsSuccess(response?.data.artifacts))

Expand All @@ -380,11 +381,11 @@ const projectsAction = {
type: FETCH_PROJECT_MODELS_SUCCESS,
payload: models
}),
fetchProjectRunningJobs: (project, cancelToken) => dispatch => {
fetchProjectRunningJobs: (project, signal) => dispatch => {
dispatch(projectsAction.fetchProjectRunningJobsBegin())

return projectsApi
.getProjectRunningJobs(project, cancelToken)
.getProjectRunningJobs(project, signal)
.then(response => {
dispatch(projectsAction.fetchProjectRunningJobsSuccess(response?.data.runs))

Expand Down Expand Up @@ -499,8 +500,9 @@ const projectsAction = {

return response.data.projects
})
.catch(err => {
dispatch(projectsAction.fetchProjectsFailure(err))
.catch(error => {
dispatch(projectsAction.fetchProjectsFailure(error), dispatch)
showErrorNotification(dispatch, error, 'Failed to fetch projects')
})
},
fetchProjectsBegin: () => ({ type: FETCH_PROJECTS_BEGIN }),
Expand Down Expand Up @@ -535,11 +537,11 @@ const projectsAction = {
type: FETCH_PROJECTS_SUCCESS,
payload: projectsList
}),
fetchProjectsSummary: cancelToken => dispatch => {
fetchProjectsSummary: signal => dispatch => {
dispatch(projectsAction.fetchProjectsSummaryBegin())

return projectsApi
.getProjectSummaries(cancelToken)
.getProjectSummaries(signal)
.then(({ data: { project_summaries } }) => {
dispatch(projectsAction.fetchProjectsSummarySuccess(parseSummaryData(project_summaries)))

Expand Down
10 changes: 7 additions & 3 deletions src/actions/workflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
} from '../constants'
import { parseWorkflows } from '../utils/parseWorkflows'
import { parseWorkflow } from '../components/Workflow/workflow.util'
import { largeResponseCatchHandler } from '../utils/largeResponseCatchHandler'

const workflowActions = {
fetchWorkflow: (project, workflowId) => dispatch => {
Expand Down Expand Up @@ -58,15 +59,18 @@ const workflowActions = {
type: FETCH_WORKFLOW_FAILURE,
payload: error
}),
fetchWorkflows: (project, filter, setLargeRequestErrorMessage) => dispatch => {
fetchWorkflows: (project, filter, config) => dispatch => {
dispatch(workflowActions.fetchWorkflowsBegin())

return workflowApi
.getWorkflows(project, filter, setLargeRequestErrorMessage)
.getWorkflows(project, filter, config)
.then(response =>
dispatch(workflowActions.fetchWorkflowsSuccess(parseWorkflows(response.data.runs)))
)
.catch(error => dispatch(workflowActions.fetchWorkflowsFailure(error)))
.catch(error => {
dispatch(workflowActions.fetchWorkflowsFailure(error))
largeResponseCatchHandler(error, 'Failed to fetch workflows', dispatch)
})
},
fetchWorkflowsBegin: () => ({
type: FETCH_WORKFLOWS_BEGIN
Expand Down
Loading

0 comments on commit b91c623

Please sign in to comment.