-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[RHOAIENG-3887] Run Schedules - UX cleanup
- Loading branch information
Showing
14 changed files
with
338 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
frontend/src/concepts/pipelines/content/createRun/contentSections/RunTypeSection.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import React from 'react'; | ||
|
||
import { Alert, AlertActionCloseButton, Button, FormSection } from '@patternfly/react-core'; | ||
import { useNavigate, useParams } from 'react-router-dom'; | ||
|
||
import { PipelineRunTabTitle, PipelineRunType } from '~/pages/pipelines/global/runs'; | ||
import { | ||
CreateRunPageSections, | ||
runPageSectionTitles, | ||
} from '~/concepts/pipelines/content/createRun/const'; | ||
import { PipelineRunSearchParam } from '~/concepts/pipelines/content/types'; | ||
import { routePipelineRunsNamespace } from '~/routes'; | ||
|
||
interface RunTypeSectionProps { | ||
runType: PipelineRunType; | ||
} | ||
|
||
export const RunTypeSection: React.FC<RunTypeSectionProps> = ({ runType }) => { | ||
const navigate = useNavigate(); | ||
const { namespace } = useParams(); | ||
const [isAlertOpen, setIsAlertOpen] = React.useState(true); | ||
|
||
let runTypeValue = 'Run once immediately after creation'; | ||
let alertProps = { | ||
title: 'Go to Schedules to create schedules that execute recurring runs', | ||
label: `Go to ${PipelineRunTabTitle.Schedules}`, | ||
navSearch: `?${PipelineRunSearchParam.RunType}=${PipelineRunType.Scheduled}`, | ||
}; | ||
|
||
if (runType === PipelineRunType.Scheduled) { | ||
runTypeValue = 'Schedule recurring run'; | ||
alertProps = { | ||
title: 'Go to Active runs to create a run that executes once immediately after creation.', | ||
label: `Go to ${PipelineRunTabTitle.Active}`, | ||
navSearch: `?${PipelineRunSearchParam.RunType}=${PipelineRunType.Active}`, | ||
}; | ||
} | ||
|
||
return ( | ||
<FormSection | ||
id={CreateRunPageSections.RUN_TYPE} | ||
title={runPageSectionTitles[CreateRunPageSections.RUN_TYPE]} | ||
> | ||
{runTypeValue} | ||
|
||
{isAlertOpen && ( | ||
<Alert | ||
isInline | ||
variant="info" | ||
title={alertProps.title} | ||
actionLinks={ | ||
<Button | ||
isInline | ||
variant="link" | ||
onClick={() => | ||
navigate({ | ||
pathname: routePipelineRunsNamespace(namespace), | ||
search: alertProps.navSearch, | ||
}) | ||
} | ||
> | ||
{alertProps.label} | ||
</Button> | ||
} | ||
actionClose={<AlertActionCloseButton onClose={() => setIsAlertOpen(false)} />} | ||
/> | ||
)} | ||
</FormSection> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.