Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NO-ISSUE: Adapting code for decoupling tasks #2592

Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { NewFeatureSupportLevelProvider } from '../featureSupportLevels';
import { usePullSecret } from '../../hooks';
import { Cluster } from '@openshift-assisted/types/assisted-installer-service';
import { useFeatureDetection } from '../../hooks/use-feature-detection';
import { BrowserRouter } from 'react-router-dom';

type AssistedInstallerDetailCardProps = {
aiClusterId: string;
Expand Down Expand Up @@ -59,12 +60,14 @@ const ClusterLoadFailed = ({ clusterId, error }: { clusterId: Cluster['id']; err
</Title>
</CardHeader>
<CardBody>
<ErrorState
title="Failed to fetch the cluster"
fetchData={fetchCluster}
actions={[<BackButton key={'cancel'} to={OCM_CLUSTER_LIST_LINK} />]}
content={error}
/>
<BrowserRouter>
<ErrorState
title="Failed to fetch the cluster"
fetchData={fetchCluster}
actions={[<BackButton key={'cancel'} to={OCM_CLUSTER_LIST_LINK} />]}
content={error}
/>
</BrowserRouter>
</CardBody>
</Card>
);
Expand All @@ -78,10 +81,12 @@ const LoadingDefaultConfigFailedCard = () => (
</Title>
</CardHeader>
<CardBody>
<ErrorState
title="Failed to retrieve the default configuration"
actions={[<BackButton key={'cancel'} to={OCM_CLUSTER_LIST_LINK} />]}
/>
<BrowserRouter>
<ErrorState
title="Failed to retrieve the default configuration"
actions={[<BackButton key={'cancel'} to={OCM_CLUSTER_LIST_LINK} />]}
/>
</BrowserRouter>
</CardBody>
</Card>
);
Expand Down
11 changes: 5 additions & 6 deletions libs/ui-lib/lib/ocm/components/clusters/ClusterBreadcrumbs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@ const ClusterBreadcrumbs = ({ clusterName }: { clusterName?: string }) => (
<PageSection variant={PageSectionVariants.light}>
{(clusterName || isInOcm) && (
<Breadcrumb>
<BreadcrumbItem>
<Link to={'/'}>Clusters</Link>
</BreadcrumbItem>
<BreadcrumbItem render={() => <Link to={'/'}>Clusters</Link>} />

{clusterName ? (
<BreadcrumbItem>
<Link to={`${routeBasePath}/clusters`}>Assisted Clusters</Link>
</BreadcrumbItem>
<BreadcrumbItem
render={() => <Link to={`${routeBasePath}/clusters`}>Assisted Clusters</Link>}
/>
) : (
<BreadcrumbItem isActive>Assisted Clusters</BreadcrumbItem>
)}
Expand Down
6 changes: 3 additions & 3 deletions libs/ui-lib/lib/ocm/components/ui/Buttons/BackButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export type BackButtonProps = {
variant?: ButtonProps['variant'];
};
export const BackButton = ({ to, variant = 'secondary' }: BackButtonProps) => (
<Button variant={variant} component={(props) => <Link to={to} {...props} />}>
Back
</Button>
<Link to={to}>
<Button variant={variant}>Back</Button>
</Link>
);
Loading