Skip to content

Commit

Permalink
Add error state when pipeline version is deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
ppadti committed Jun 20, 2024
1 parent 520c92a commit 5c4db9f
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,10 @@ class PipelineRunDetails extends RunDetails {
findOutputArtifacts() {
return cy.findByTestId('Output-artifacts');
}

findErrorstate() {
return cy.findByTestId('error-state-title');
}
}

export const pipelineDetails = new PipelineDetails();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ import {
buildMockJobKF,
} from '~/__mocks__';
import {
activeRunsTable,
archivedRunsTable,
archiveExperimentModal,
bulkArchiveExperimentModal,
bulkRestoreExperimentModal,
pipelineRunDetails,
pipelineRunJobTable,
pipelineRunsGlobal,
restoreExperimentModal,
Expand All @@ -27,7 +29,7 @@ import {
ProjectModel,
RouteModel,
} from '~/__tests__/cypress/cypress/utils/models';
import { RecurringRunStatus, StorageStateKF } from '~/concepts/pipelines/kfTypes';
import { RecurringRunStatus, RuntimeStateKF, StorageStateKF } from '~/concepts/pipelines/kfTypes';

const projectName = 'test-project-name';
const initialMockPipeline = buildMockPipelineV2({ display_name: 'Test pipeline' });
Expand All @@ -51,6 +53,14 @@ const mockExperiments = [
}),
];

const mockActiveRuns = buildMockRunKF({
display_name: 'Test active run 4',
run_id: 'run-4',
experiment_id: 'test-experiment-1',
created_at: '2024-02-10T00:00:00Z',
state: RuntimeStateKF.SUCCEEDED,
});

describe('Experiments', () => {
describe('Active experiments', () => {
beforeEach(() => {
Expand Down Expand Up @@ -251,6 +261,35 @@ describe('Experiments', () => {
cy.findByLabelText('Experiment').contains(mockExperiment.display_name);
});

it('should display error state when the pipeline version deleted', () => {
cy.interceptOdh(
'GET /api/service/pipelines/:namespace/:serviceName/apis/v2beta1/runs/:runId',
{
path: {
namespace: projectName,
serviceName: 'dspa',
runId: mockActiveRuns.run_id,
},
},
mockActiveRuns,
);
activeRunsTable.getRowByName('Test active run 4').findColumnName('Test active run 4').click();
pipelineRunDetails.findErrorstate().should('have.text', 'Error loading pipeline run graph');

pipelineRunDetails.findDetailsTab().click();
pipelineRunDetails.findDetailItem('Name').findValue().contains(mockActiveRuns.display_name);
pipelineRunDetails
.findDetailItem('Pipeline version')
.findValue()
.contains('No pipeline version');
pipelineRunDetails.findDetailItem('Project').findValue().contains(projectName);
pipelineRunDetails.findDetailItem('Run ID').findValue().contains(mockActiveRuns.run_id);
pipelineRunDetails
.findDetailItem('Workflow name')
.findValue()
.contains(mockActiveRuns.display_name);
});

it('navigates back to experiments from "Create run" page breadcrumb', () => {
pipelineRunsGlobal.findCreateRunButton().click();
cy.findByLabelText('Breadcrumb').findByText(`Experiments - ${projectName}`).click();
Expand Down Expand Up @@ -370,7 +409,7 @@ const initIntercepts = () => {
{
path: { namespace: projectName, serviceName: 'dspa' },
},
{ runs: [] },
{ runs: [mockActiveRuns] },
);

cy.interceptOdh(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const PipelineRunDetails: PipelineCoreDetailsPageComponent = ({ breadcrumbPath,
);

const loaded = runLoaded && (versionLoaded || !!run?.pipeline_spec);
const error = versionError || runError;
const error = runError;

if (error) {
return (
Expand All @@ -84,7 +84,7 @@ const PipelineRunDetails: PipelineCoreDetailsPageComponent = ({ breadcrumbPath,
);
}

if (!loaded || (!executionsLoaded && !executionsError)) {
if ((!loaded && !versionError) || (!executionsLoaded && !executionsError)) {
return (
<Bullseye>
<Spinner />
Expand Down Expand Up @@ -126,6 +126,7 @@ const PipelineRunDetails: PipelineCoreDetailsPageComponent = ({ breadcrumbPath,
}
loaded={loaded}
loadError={error}
versionError={versionError}
breadcrumb={
<Breadcrumb>
{breadcrumbPath}
Expand Down Expand Up @@ -164,6 +165,7 @@ const PipelineRunDetails: PipelineCoreDetailsPageComponent = ({ breadcrumbPath,
graphContent={
<PipelineTopology
nodes={nodes}
versionError={versionError}
selectedIds={selectedId ? [selectedId] : []}
onSelectionChange={(ids) => {
const firstId = ids[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ const PipelineRunTabDetails: React.FC<PipelineRunTabDetailsProps> = ({ run, work
),
},
]
: versionError
? [{ key: 'Pipeline version', value: 'No pipeline version' }]
: []),
...(pipeline
? [
Expand Down
40 changes: 38 additions & 2 deletions frontend/src/concepts/topology/PipelineTopology.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,33 @@ import {
SELECTION_EVENT,
VisualizationProvider,
} from '@patternfly/react-topology';
import { Bullseye, Spinner } from '@patternfly/react-core';
import {
Bullseye,
EmptyState,
EmptyStateBody,
EmptyStateHeader,
EmptyStateIcon,
EmptyStateVariant,
PageSection,
Spinner,
} from '@patternfly/react-core';
import { ExclamationTriangleIcon } from '@patternfly/react-icons';
import PipelineTopologyEmpty from './PipelineTopologyEmpty';
import useTopologyController from './useTopologyController';
import PipelineVisualizationSurface from './PipelineVisualizationSurface';
import PipelineTopologyEmpty from './PipelineTopologyEmpty';

type PipelineTopologyProps = {
selectedIds?: string[];
onSelectionChange?: (selectionIds: string[]) => void;
nodes: PipelineNodeModel[];
versionError?: Error;
};

const PipelineTopology: React.FC<PipelineTopologyProps> = ({
nodes,
selectedIds,
onSelectionChange,
versionError,
}) => {
const controller = useTopologyController('g1');

Expand All @@ -37,6 +49,30 @@ const PipelineTopology: React.FC<PipelineTopologyProps> = ({
return undefined;
}, [controller, onSelectionChange]);

if (versionError) {
return (
<PageSection className="pf-v5-u-h-100">
<EmptyState variant={EmptyStateVariant.lg} isFullHeight>
<EmptyStateHeader
data-testid="error-state-title"
titleText="Error loading pipeline run graph"
icon={
<EmptyStateIcon
color="var(--pf-v5-global--warning-color--100)"
icon={ExclamationTriangleIcon}
/>
}
headingLevel="h2"
/>
<EmptyStateBody>
Unable to load this run graph because the pipeline version that it belongs to has been
deleted.
</EmptyStateBody>
</EmptyState>
</PageSection>
);
}

if (!nodes.length) {
return <PipelineTopologyEmpty />;
}
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/pages/ApplicationsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type ApplicationsPageProps = {
loaded: boolean;
empty: boolean;
loadError?: Error;
versionError?: Error;
children?: React.ReactNode;
errorMessage?: string;
emptyMessage?: string;
Expand All @@ -44,6 +45,7 @@ const ApplicationsPage: React.FC<ApplicationsPageProps> = ({
loaded,
empty,
loadError,
versionError,
children,
errorMessage,
emptyMessage,
Expand Down Expand Up @@ -97,7 +99,7 @@ const ApplicationsPage: React.FC<ApplicationsPageProps> = ({
);
}

if (!loaded) {
if (!loaded && !versionError) {
return (
loadingContent || (
<PageSection isFilled>
Expand Down

0 comments on commit 5c4db9f

Please sign in to comment.