Skip to content

fix: display correct OCIRepository sources for HelmReleases in applications page #5042

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

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
14 changes: 11 additions & 3 deletions ui/components/AutomationsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,17 @@ function AutomationsTable({
sourceNamespace = sourceRef?.namespace;
} else {
const hr = a as HelmRelease;
sourceKind = Kind.HelmChart;
sourceName = hr.helmChart?.name;
sourceNamespace = hr.helmChart?.namespace;
if (hr.helmChartRef) {
// handle the case when spec.chartRef is set
sourceKind = hr.helmChartRef.kind;
sourceName = hr.helmChartRef.name;
sourceNamespace = hr.helmChartRef.namespace;
} else {
// otherwise, spec.chart must be set
sourceKind = Kind.HelmChart;
sourceName = hr.helmChart?.name;
sourceNamespace = hr.helmChart?.namespace;
}
}

return (
Expand Down
13 changes: 13 additions & 0 deletions ui/lib/objects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,19 @@ export class HelmRelease extends FluxObject {
return this.obj.status?.helmChart || "";
}

get helmChartRef(): ObjectRef | undefined {
if (!this.obj.spec?.chartRef) {
return;
}
const chartRef = {
...this.obj.spec.chartRef,
};
if (!chartRef.namespace) {
chartRef.namespace = this.namespace;
}
return chartRef;
}

get helmChart(): HelmChart {
// This isn't a "real" helmchart object - it has much fewer fields,
// and requires some data mangling to work at all
Expand Down