Skip to content

Commit

Permalink
Add useUser hook to EnsureCompatiblePipelineServer component
Browse files Browse the repository at this point in the history
Add paragraph tags to body text in EnsureCompatiblePipelineServer component

Update pipeline rendering message
  • Loading branch information
Gkrumbach07 committed Apr 12, 2024
1 parent 4ab9c17 commit 213873c
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions frontend/src/concepts/pipelines/EnsureCompatiblePipelineServer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { ExclamationTriangleIcon } from '@patternfly/react-icons';
import DeletePipelineServerModal from '~/concepts/pipelines/content/DeletePipelineServerModal';
import ExternalLink from '~/components/ExternalLink';
import NoPipelineServer from '~/concepts/pipelines/NoPipelineServer';
import { useUser } from '~/redux/selectors';
import { usePipelinesAPI } from './context';

// TODO: Fix doc link to go to more docs on v2
Expand All @@ -29,8 +30,13 @@ const EnsureCompatiblePipelineServer: React.FC<EnsureCompatiblePipelineServerPro
children,
}) => {
const { pipelinesServer } = usePipelinesAPI();
const { isAdmin } = useUser();
const [isDeleting, setIsDeleting] = React.useState(false);

const bodyText = isAdmin
? "Rendering of this pipeline version in the UI is no longer supported, but it can still be accessed via the API or OpenShift Console. To remove unsupported versions, delete this project's pipeline server and create a new one."
: 'Rendering of this pipeline version in the UI is no longer supported. To access this pipeline, contact your administrator.';

if (pipelinesServer.initializing) {
return (
<Bullseye>
Expand All @@ -49,7 +55,7 @@ const EnsureCompatiblePipelineServer: React.FC<EnsureCompatiblePipelineServerPro
<Bullseye data-testid="incompatible-pipelines-server">
<EmptyState variant={EmptyStateVariant.lg}>
<EmptyStateHeader
titleText="This pipeline version is no longer supported"
titleText="Pipeline version cannot be rendered"
icon={
<EmptyStateIcon
color="var(--pf-v5-global--warning-color--100)"
Expand All @@ -58,20 +64,21 @@ const EnsureCompatiblePipelineServer: React.FC<EnsureCompatiblePipelineServerPro
}
/>
<EmptyStateBody>
To remove unsupported versions, delete this project&lsquo;s pipeline server and create
a new one.{' '}
<p>{bodyText}</p>
<ExternalLink
text="Learn more about supported versions and data recovery"
to={DOCS_LINK}
/>
</EmptyStateBody>
<EmptyStateFooter>
<EmptyStateActions>
<Button variant="primary" onClick={() => setIsDeleting(true)}>
Delete pipeline server
</Button>
</EmptyStateActions>
</EmptyStateFooter>
{isAdmin && (
<EmptyStateFooter>
<EmptyStateActions>
<Button variant="primary" onClick={() => setIsDeleting(true)}>
Delete pipeline server
</Button>
</EmptyStateActions>
</EmptyStateFooter>
)}
</EmptyState>
</Bullseye>
<DeletePipelineServerModal isOpen={isDeleting} onClose={() => setIsDeleting(false)} />
Expand Down

0 comments on commit 213873c

Please sign in to comment.