Skip to content

Commit

Permalink
Addressed non-logic feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
rebeccaalpert committed Jul 2, 2021
1 parent 1df0a85 commit 858d95c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,21 @@ const InstallingHintBlock: React.FC<OperatorHubItemDetailsHintBlockProps> = ({
subscription,
}) => {
const { t } = useTranslation();
const [installedCSV] = useK8sWatchResource<ClusterServiceVersionKind>(
subscription?.status?.installedCSV
? {
kind: referenceForModel(ClusterServiceVersionModel),
name: subscription?.status?.installedCSV,
namespace: subscription?.metadata?.namespace,
isList: false,
namespaced: true,
}
: null,
);
const nsPath = `/k8s/${namespace ? `ns/${namespace}` : 'all-namespaces'}`;
const to = `${nsPath}/subscriptions/${subscription.metadata.name ?? ''}`;
const to = installedCSV
? `${nsPath}/clusterserviceversions/${installedCSV?.metadata?.name}/subscription`
: `${nsPath}/subscriptions/${subscription.metadata.name ?? ''}`;
return (
<HintBlock className="co-catalog-page__hint" title={t('olm~Installing Operator')}>
<p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,10 @@ const ANNOTATIONS_WITH_JSON = [
];

const clusterServiceVersionFor = (
packageManifest: PackageManifestKind,
clusterServiceVersions: ClusterServiceVersionKind[],
version: string,
csvName: string,
): ClusterServiceVersionKind => {
return clusterServiceVersions?.find(
(csv) => csv.metadata.name === `${packageManifest.metadata.name}.${version}`,
);
return clusterServiceVersions?.find((csv) => csv.metadata.name === csvName);
};

const installPlanFor = (
Expand Down Expand Up @@ -219,9 +216,8 @@ export const OperatorHubList: React.FC<OperatorHubListProps> = ({
)(namespace);

const clusterServiceVersion = clusterServiceVersionFor(
pkg,
clusterServiceVersions?.data,
currentCSVDesc?.version,
subscription?.status?.currentCSV,
);

const installPlan = installPlanFor(subscription, installPlans?.data);
Expand Down
1 change: 1 addition & 0 deletions frontend/packages/operator-lifecycle-manager/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ export type SubscriptionKind = {
installPlanRef?: ObjectReference;
state?: SubscriptionState;
lastUpdated?: string;
currentCSV?: string;
};
} & K8sResourceCommon;

Expand Down

0 comments on commit 858d95c

Please sign in to comment.