-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2335 from jpuzz0/RHOAIENG-1451-disable-deleted-ve…
…rsions RHOAIENG-1451: Detect deleted pipeline versions on pipeline runs table, disable, show tooltip
- Loading branch information
Showing
10 changed files
with
87 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
42 changes: 42 additions & 0 deletions
42
frontend/src/concepts/pipelines/content/PipelineVersionLink.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,42 @@ | ||
import React from 'react'; | ||
import { Link } from 'react-router-dom'; | ||
|
||
import { Skeleton, Tooltip } from '@patternfly/react-core'; | ||
|
||
import usePipelineVersionById from '~/concepts/pipelines/apiHooks/usePipelineVersionById'; | ||
import { usePipelinesAPI } from '~/concepts/pipelines/context'; | ||
import { ResourceReferenceKF } from '~/concepts/pipelines/kfTypes'; | ||
import { NoRunContent } from '~/concepts/pipelines/content/tables/renderUtils'; | ||
|
||
interface PipelineVersionLinkProps { | ||
resourceRef: ResourceReferenceKF | undefined; | ||
loadingIndicator?: React.ReactElement; | ||
} | ||
|
||
export const PipelineVersionLink: React.FC<PipelineVersionLinkProps> = ({ | ||
resourceRef, | ||
loadingIndicator, | ||
}) => { | ||
const { namespace } = usePipelinesAPI(); | ||
const versionName = resourceRef?.name; | ||
const versionId = resourceRef?.key.id; | ||
const [version, isVersionLoaded, error] = usePipelineVersionById(versionId); | ||
|
||
if (!resourceRef) { | ||
return <NoRunContent />; | ||
} | ||
|
||
if (!isVersionLoaded && !error) { | ||
return loadingIndicator || <Skeleton />; | ||
} | ||
|
||
if (!version) { | ||
return ( | ||
<Tooltip content={<div>"{versionName}" no longer exists.</div>} position="right"> | ||
<div className="pf-v5-u-disabled-color-100 pf-v5-c-truncate__start">{versionName}</div> | ||
</Tooltip> | ||
); | ||
} | ||
|
||
return <Link to={`/pipelines/${namespace}/pipeline/view/${versionId}`}>{versionName}</Link>; | ||
}; |
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
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