Skip to content

Commit

Permalink
NO-ISSUE: Adapting code for decoupling tasks (#2592)
Browse files Browse the repository at this point in the history
* Adapting code for decoupling tasks

* Changes related with decoupling
  • Loading branch information
ammont82 authored Jul 12, 2024
1 parent 9564741 commit 7267cff
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 19 deletions.
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>
);

0 comments on commit 7267cff

Please sign in to comment.