Skip to content

Commit

Permalink
fix(jobs): get service type
Browse files Browse the repository at this point in the history
  • Loading branch information
RemiBonnet committed Nov 30, 2022
1 parent 9d65c94 commit 8574d8a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
@@ -1,3 +1,4 @@
import { JobScheduleEvent } from 'qovery-typescript-axios'
import { useEffect } from 'react'
import { useDispatch, useSelector } from 'react-redux'
import { useParams } from 'react-router-dom'
Expand Down Expand Up @@ -66,7 +67,8 @@ export function PageDeploymentsFeature() {
const j: DeploymentService = {
...job,
execution_id: deployment.id,
type: ServiceTypeEnum.CRON_JOB,
type:
job.schedule?.event === JobScheduleEvent.CRON ? ServiceTypeEnum.CRON_JOB : ServiceTypeEnum.LIFECYCLE_JOB,
}
merged.push(j)
})
Expand Down
5 changes: 3 additions & 2 deletions libs/shared/enums/src/lib/utils/get-service-type.ts
@@ -1,3 +1,4 @@
import { JobScheduleEvent } from 'qovery-typescript-axios'
import {
ApplicationEntity,
ContainerApplicationEntity,
Expand All @@ -16,9 +17,9 @@ export const getServiceType = (data: ApplicationEntity | DatabaseEntity) => {
currentType = ServiceTypeEnum.CONTAINER
} else if (!(data as GitApplicationEntity).build_mode && !(data as ContainerApplicationEntity).image_name && !isJob) {
currentType = ServiceTypeEnum.DATABASE
} else if (isJob && !(data as JobApplicationEntity).schedule) {
} else if (isJob && (data as JobApplicationEntity).schedule?.event !== JobScheduleEvent.CRON) {
currentType = ServiceTypeEnum.CRON_JOB
} else if (isJob && (data as JobApplicationEntity).schedule) {
} else if (isJob && (data as JobApplicationEntity).schedule?.event === JobScheduleEvent.CRON) {
currentType = ServiceTypeEnum.LIFECYCLE_JOB
} else {
currentType = ServiceTypeEnum.APPLICATION
Expand Down

0 comments on commit 8574d8a

Please sign in to comment.