Skip to content

Commit

Permalink
Merge pull request #2947 from Gkrumbach07/bug/RHOAIENG-8635-upgrade-f…
Browse files Browse the repository at this point in the history
…rom-2-8-delete-pipeline-server-button

remove isAdmin logic for EnsureCompatiblePipelineServer empty state
  • Loading branch information
openshift-merge-bot[bot] authored Jun 26, 2024
2 parents f3e6a95 + 3e4c833 commit 077bcd4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ describe('Pipelines', () => {
});
});

it('incompatible dpsa version shows error', () => {
it('incompatible dpsa version shows error with delete option for regular user', () => {
initIntercepts({});
pipelinesGlobal.visit(projectName);
cy.interceptK8sList(
Expand All @@ -496,10 +496,10 @@ describe('Pipelines', () => {
pipelinesGlobal.visit(projectName);
pipelinesGlobal.isApiAvailable();
pipelinesGlobal.findIsServerIncompatible().should('exist');
pipelinesGlobal.findDeletePipelineServerButton().should('not.exist');
pipelinesGlobal.findDeletePipelineServerButton().should('exist');
});

it('incompatible dpsa version shows error with delete option for admins', () => {
it('incompatible dpsa version shows error with delete option for admin', () => {
asProductAdminUser();
initIntercepts({});
pipelinesGlobal.visit(projectName);
Expand Down
37 changes: 17 additions & 20 deletions frontend/src/concepts/pipelines/EnsureCompatiblePipelineServer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
import { ExclamationTriangleIcon } from '@patternfly/react-icons';
import ExternalLink from '~/components/ExternalLink';
import NoPipelineServer from '~/concepts/pipelines/NoPipelineServer';
import { useUser } from '~/redux/selectors';
import { DeleteServerModal, usePipelinesAPI } from './context';

// TODO: Fix doc link to go to more docs on v2
Expand All @@ -29,13 +28,8 @@ 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 Down Expand Up @@ -63,25 +57,28 @@ const EnsureCompatiblePipelineServer: React.FC<EnsureCompatiblePipelineServerPro
}
/>
<EmptyStateBody>
<p>{bodyText}</p>
<p>
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&apos;s pipeline server and create a new one.
</p>
<ExternalLink
text="Learn more about supported versions and data recovery"
to={DOCS_LINK}
/>
</EmptyStateBody>
{isAdmin && (
<EmptyStateFooter>
<EmptyStateActions>
<Button
data-testid="delete-pipeline-server-button"
variant="primary"
onClick={() => setIsDeleting(true)}
>
Delete pipeline server
</Button>
</EmptyStateActions>
</EmptyStateFooter>
)}

<EmptyStateFooter>
<EmptyStateActions>
<Button
data-testid="delete-pipeline-server-button"
variant="primary"
onClick={() => setIsDeleting(true)}
>
Delete pipeline server
</Button>
</EmptyStateActions>
</EmptyStateFooter>
</EmptyState>
</Bullseye>
<DeleteServerModal isOpen={isDeleting} onClose={() => setIsDeleting(false)} />
Expand Down

0 comments on commit 077bcd4

Please sign in to comment.