-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Pipeline Job titles are partially handled
- Loading branch information
Showing
18 changed files
with
410 additions
and
89 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
29 changes: 29 additions & 0 deletions
29
frontend/src/concepts/pipelines/content/PipelineJobReferenceName.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,29 @@ | ||
import React from 'react'; | ||
import { Text, TextVariants } from '@patternfly/react-core'; | ||
import { getPipelineJobExecutionCount } from '~/concepts/pipelines/content/tables/utils'; | ||
import { PipelineCoreResourceKF } from '~/concepts/pipelines/kfTypes'; | ||
import { usePipelinesAPI } from '~/concepts/pipelines/context'; | ||
|
||
type PipelineJobReferenceNameProps = { | ||
resource: PipelineCoreResourceKF; | ||
}; | ||
|
||
const PipelineJobReferenceName: React.FC<PipelineJobReferenceNameProps> = ({ resource }) => { | ||
const { getJobInformation } = usePipelinesAPI(); | ||
const { data, loading } = getJobInformation(resource); | ||
|
||
return ( | ||
<> | ||
{loading ? ( | ||
'loading...' | ||
) : data ? ( | ||
<Text component={TextVariants.p} className="pf-u-pb-sm"> | ||
Run {getPipelineJobExecutionCount(resource.name)} of {data?.name} | ||
</Text> | ||
) : ( | ||
'' | ||
)} | ||
</> | ||
); | ||
}; | ||
export default PipelineJobReferenceName; |
41 changes: 41 additions & 0 deletions
41
frontend/src/concepts/pipelines/content/PipelineRunTypeLabel.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,41 @@ | ||
import React from 'react'; | ||
import { Label, Tooltip } from '@patternfly/react-core'; | ||
import { | ||
PipelineRunLabels, | ||
getPipelineCoreResourceJobReference, | ||
getPipelineCoreResourcePipelineReference, | ||
} from '~/concepts/pipelines/content/tables/utils'; | ||
import { PipelineCoreResourceKF } from '~/concepts/pipelines/kfTypes'; | ||
|
||
type PipelineRunTypeLabelProps = { | ||
resource: PipelineCoreResourceKF; | ||
}; | ||
const PipelineRunTypeLabel: React.FC<PipelineRunTypeLabelProps> = ({ resource }) => { | ||
const jobReference = getPipelineCoreResourceJobReference(resource); | ||
const pipelineReference = getPipelineCoreResourcePipelineReference(resource); | ||
|
||
return ( | ||
<> | ||
{jobReference ? ( | ||
<> | ||
<Tooltip content={'Created by a scheduled run'}> | ||
<Label color="blue">{PipelineRunLabels.RECURRING}</Label> | ||
</Tooltip> | ||
</> | ||
) : !pipelineReference ? ( | ||
<> | ||
<Tooltip content={<div>Created by a scheduled run that was deleted</div>}> | ||
<Label color="blue">{PipelineRunLabels.RECURRING}</Label> | ||
</Tooltip> | ||
</> | ||
) : ( | ||
<> | ||
<Tooltip content={<div>Run once immediately after creation</div>}> | ||
<Label color="blue">{PipelineRunLabels.ONEOFF}</Label> | ||
</Tooltip> | ||
</> | ||
)} | ||
</> | ||
); | ||
}; | ||
export default PipelineRunTypeLabel; |
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
39 changes: 39 additions & 0 deletions
39
frontend/src/concepts/pipelines/content/pipelinesDetails/PipelineDetailsTitle.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,39 @@ | ||
import React from 'react'; | ||
import { Label, Split, SplitItem } from '@patternfly/react-core'; | ||
import { PipelineRunKF } from '~/concepts/pipelines/kfTypes'; | ||
import { computeRunStatus } from '~/concepts/pipelines/content/utils'; | ||
import PipelineRunTypeLabel from '~/concepts/pipelines/content/PipelineRunTypeLabel'; | ||
|
||
type RunJobTitleProps = { | ||
run: PipelineRunKF; | ||
statusIcon?: boolean; | ||
hasJobReference?: boolean; | ||
pipelineRunLabel?: boolean; | ||
}; | ||
|
||
const PipelineDetailsTitle: React.FC<RunJobTitleProps> = ({ | ||
run, | ||
statusIcon, | ||
pipelineRunLabel, | ||
}) => { | ||
const { icon, label } = computeRunStatus(run); | ||
|
||
return ( | ||
<> | ||
<Split hasGutter> | ||
<SplitItem>{run.name}</SplitItem> | ||
{pipelineRunLabel && ( | ||
<SplitItem> | ||
<PipelineRunTypeLabel resource={run} /> | ||
</SplitItem> | ||
)} | ||
{statusIcon && ( | ||
<SplitItem> | ||
<Label icon={icon}>{label}</Label> | ||
</SplitItem> | ||
)} | ||
</Split> | ||
</> | ||
); | ||
}; | ||
export default PipelineDetailsTitle; |
Oops, something went wrong.