Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(creation-flow-cronjob): collapse annotations/labels and remove dockerfile step #1797

Merged
merged 2 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ export function StepConfigureFeature() {

const onBack = () => {
const pathCreate = `${SERVICES_URL(organizationId, projectId, environmentId)}${jobURL}`
if (dockerfileForm.getValues('dockerfile_path') || dockerfileForm.getValues('dockerfile_raw')) {
if (
(dockerfileForm.getValues('dockerfile_path') || dockerfileForm.getValues('dockerfile_raw')) &&
jobType !== 'CRON_JOB'
) {
navigate(pathCreate + SERVICES_JOB_CREATION_DOCKERFILE_URL)
} else {
navigate(pathCreate + SERVICES_JOB_CREATION_GENERAL_URL)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ export function StepGeneralFeature() {
}
setGeneralData(cloneData)
const pathCreate = `${SERVICES_URL(organizationId, projectId, environmentId)}${jobURL}`
if (data.serviceType === ServiceTypeEnum.APPLICATION) {

if (data.serviceType === ServiceTypeEnum.APPLICATION && jobType !== 'CRON_JOB') {
navigate(pathCreate + SERVICES_JOB_CREATION_DOCKERFILE_URL)
} else {
navigate(pathCreate + SERVICES_JOB_CREATION_CONFIGURE_URL)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import * as Collapsible from '@radix-ui/react-collapsible'
import {
type CronJobResponse,
type JobLifecycleTypeEnum,
type LifecycleJobResponse,
type Organization,
} from 'qovery-typescript-axios'
import { type FormEventHandler } from 'react'
import { type FormEventHandler, useState } from 'react'
import { useFormContext } from 'react-hook-form'
import { useNavigate, useParams } from 'react-router-dom'
import { match } from 'ts-pattern'
Expand All @@ -14,7 +15,7 @@ import { EntrypointCmdInputs, JobGeneralSettings } from '@qovery/shared/console-
import { type JobType, ServiceTypeEnum } from '@qovery/shared/enums'
import { type JobGeneralData } from '@qovery/shared/interfaces'
import { SERVICES_URL } from '@qovery/shared/routes'
import { Button, Heading, Section } from '@qovery/shared/ui'
import { Button, Heading, Icon, Section } from '@qovery/shared/ui'
import { findTemplateData } from '../../../feature/page-job-create-feature/page-job-create-feature'
import { serviceTemplates } from '../../../feature/page-new-feature/service-templates'

Expand All @@ -27,6 +28,7 @@ export interface StepGeneralProps {

export function StepGeneral(props: StepGeneralProps) {
const { organizationId = '', environmentId = '', projectId = '', slug, option } = useParams()
const [openExtraAttributes, setOpenExtraAttributes] = useState(false)
const navigate = useNavigate()
const { formState, watch } = useFormContext<JobGeneralData>()
const watchServiceType = watch('serviceType')
Expand Down Expand Up @@ -156,11 +158,28 @@ export function StepGeneral(props: StepGeneralProps) {
</Section>
)}

<Section className="gap-4">
<Heading>Extra labels/annotations</Heading>
<LabelSetting />
<AnnotationSetting />
</Section>
<Collapsible.Root open={openExtraAttributes} onOpenChange={setOpenExtraAttributes} asChild>
<Section className="gap-4">
<div className="flex justify-between">
<Heading>Extra labels/annotations</Heading>
<Collapsible.Trigger className="flex items-center gap-2 text-sm font-medium">
{openExtraAttributes ? (
<>
Hide <Icon iconName="chevron-up" />
</>
) : (
<>
Show <Icon iconName="chevron-down" />
</>
)}
</Collapsible.Trigger>
</div>{' '}
<Collapsible.Content className="flex flex-col gap-4">
<LabelSetting />
<AnnotationSetting />
</Collapsible.Content>
</Section>
</Collapsible.Root>

<div className="flex justify-between">
<Button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export function JobGeneralSettings(props: JobGeneralSettingProps) {
</div>
) : (
<div data-testid="container-fields" className="space-y-4">
<GeneralContainerSettings organization={props.organization} isSetting />
<GeneralContainerSettings organization={props.organization} isSetting={props.isEdition} />
</div>
))}
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ export interface JobGeneralData {
root_path?: string
// only for cron job, lifecycle job dockerfile info are in DockerfileSettingsData
dockerfile_path?: string

// template
// dockerfile_mode: 'YES' | 'NO'
}

export interface JobConfigureData {
Expand Down
Loading