Skip to content

Commit fbb6cb3

Browse files
committed
fix: display correct OCIRepository sources for HelmReleases in applications page
Signed-off-by: Abdullah Alqarni <[email protected]>
1 parent a14765b commit fbb6cb3

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

ui/components/AutomationsTable.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,17 @@ function AutomationsTable({
106106
sourceNamespace = sourceRef?.namespace;
107107
} else {
108108
const hr = a as HelmRelease;
109-
sourceKind = Kind.HelmChart;
110-
sourceName = hr.helmChart?.name;
111-
sourceNamespace = hr.helmChart?.namespace;
109+
if (hr.helmChartRef) {
110+
// handle the case when spec.chartRef is set
111+
sourceKind = hr.helmChartRef.kind;
112+
sourceName = hr.helmChartRef.name;
113+
sourceNamespace = hr.helmChartRef.namespace;
114+
} else {
115+
// otherwise, spec.chart must be set
116+
sourceKind = Kind.HelmChart;
117+
sourceName = hr.helmChart?.name;
118+
sourceNamespace = hr.helmChart?.namespace;
119+
}
112120
}
113121

114122
return (

ui/lib/objects.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,19 @@ export class HelmRelease extends FluxObject {
277277
return this.obj.status?.helmChart || "";
278278
}
279279

280+
get helmChartRef(): ObjectRef | undefined {
281+
if (!this.obj.spec?.chartRef) {
282+
return;
283+
}
284+
const chartRef = {
285+
...this.obj.spec.chartRef,
286+
};
287+
if (!chartRef.namespace) {
288+
chartRef.namespace = this.namespace;
289+
}
290+
return chartRef;
291+
}
292+
280293
get helmChart(): HelmChart {
281294
// This isn't a "real" helmchart object - it has much fewer fields,
282295
// and requires some data mangling to work at all

0 commit comments

Comments
 (0)