diff --git a/dashboard/src/components/UpgradeForm/UpgradeForm.test.tsx b/dashboard/src/components/UpgradeForm/UpgradeForm.test.tsx index 6006bd3032bd..eb730e25ba82 100644 --- a/dashboard/src/components/UpgradeForm/UpgradeForm.test.tsx +++ b/dashboard/src/components/UpgradeForm/UpgradeForm.test.tsx @@ -164,7 +164,10 @@ it("fetches the available versions", () => { Chart.getAvailablePackageVersions = getAvailablePackageVersions; mountWrapper(defaultStore, ); expect(getAvailablePackageVersions).toHaveBeenCalledWith({ - context: { cluster: defaultProps.cluster, namespace: defaultProps.repoNamespace }, + context: { + cluster: defaultProps.cluster, + namespace: defaultProps.repoNamespace, + }, identifier: defaultProps.packageId, plugin: defaultProps.plugin, } as AvailablePackageReference); @@ -193,7 +196,10 @@ it("fetches the current chart version even if there is already one in the state" ); expect(getAvailablePackageDetail).toHaveBeenCalledWith( { - context: { cluster: defaultProps.cluster, namespace: defaultProps.repoNamespace }, + context: { + cluster: availablePkgDetails[0].availablePackageRef?.context?.cluster, + namespace: defaultProps.repoNamespace, + }, identifier: defaultProps.packageId, plugin: defaultProps.plugin, } as AvailablePackageReference, diff --git a/dashboard/src/components/UpgradeForm/UpgradeForm.tsx b/dashboard/src/components/UpgradeForm/UpgradeForm.tsx index f09e9db9c228..a06f45a2ce8c 100644 --- a/dashboard/src/components/UpgradeForm/UpgradeForm.tsx +++ b/dashboard/src/components/UpgradeForm/UpgradeForm.tsx @@ -81,6 +81,8 @@ function UpgradeForm({ const { availablePackageDetail, versions, schema, values, pkgVersion } = selected; + const packageCluster = availablePackageDetail?.availablePackageRef?.context?.cluster; + const { apps: { isFetching: appsFetching }, charts: { isFetching: chartsFetching }, @@ -91,12 +93,15 @@ function UpgradeForm({ useEffect(() => { dispatch( actions.charts.fetchChartVersions({ - context: { cluster: cluster, namespace: repoNamespace }, + context: { + cluster: packageCluster ?? cluster, + namespace: repoNamespace, + }, plugin: pluginObj, identifier: packageId, } as AvailablePackageReference), ); - }, [dispatch, cluster, repoNamespace, packageId, pluginObj]); + }, [dispatch, packageCluster, repoNamespace, packageId, cluster, pluginObj]); useEffect(() => { if (deployed.values && !modifications) { @@ -122,7 +127,7 @@ function UpgradeForm({ dispatch( actions.charts.fetchChartVersion( { - context: { cluster: cluster, namespace: repoNamespace }, + context: { cluster: packageCluster, namespace: repoNamespace }, plugin: pluginObj, identifier: packageId, } as AvailablePackageReference, @@ -131,7 +136,7 @@ function UpgradeForm({ ); }, [ dispatch, - cluster, + packageCluster, repoNamespace, packageId, deployed.chartVersion?.version?.pkgVersion, @@ -160,7 +165,7 @@ function UpgradeForm({ dispatch( actions.charts.fetchChartVersion( { - context: { cluster: cluster, namespace: repoNamespace }, + context: { cluster: packageCluster, namespace: repoNamespace }, plugin: pluginObj, identifier: packageId, } as AvailablePackageReference,