Skip to content

Commit

Permalink
Chartref issues (#134)
Browse files Browse the repository at this point in the history
* fix: chart is optional, handling chartRef
* fix: preventing undefined error
* Making sourceRef linkable
  • Loading branch information
laszlocph authored Oct 16, 2024
1 parent f3b3b97 commit 7ae5591
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
6 changes: 3 additions & 3 deletions web/src/ExpandedFooter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@ export function ExpandedFooter(props) {
{
name: "Kustomizations",
href: "#",
count: fluxState.kustomizations.length,
count: fluxState.kustomizations?.length,
},
{
name: "Helm Releases",
href: "#",
count: fluxState.helmReleases.length,
count: fluxState.helmReleases?.length,
},
{
name: "Terraform",
href: "#",
count: fluxState.tfResources.length,
count: fluxState.tfResources?.length,
},
{ name: "Flux Runtime", href: "#", count: undefined },
{ name: "Flux Events", href: "#", count: undefined },
Expand Down
20 changes: 16 additions & 4 deletions web/src/HelmRevisionWidget.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,35 @@ export function HelmRevisionWidget(props) {
const reconciling = reconcilingCondition && reconcilingConditions[0].status === "True"

const sourceRef = helmRelease.spec.chart ? helmRelease.spec.chart.spec.sourceRef : helmRelease.spec.chartRef

const namespace = sourceRef.namespace ? sourceRef.namespace : helmRelease.metadata.namespace
const navigationHandler = () => handleNavigationSelect("Sources", namespace, sourceRef.name, sourceRef.kind)

return (
<>
{!ready && reconciling && !stalled &&
<span>
<span>Attempting: </span>
<span>Reconciling new version: </span>
<NavigationButton handleNavigation={navigationHandler}>
{helmRelease.spec.chart &&
<span>{helmRelease.spec.chart.spec.version}@{helmRelease.spec.chart.spec.chart}</span>
}
{helmRelease.spec.chartRef &&
<span>{`${helmRelease.spec.chartRef.namespace}/${helmRelease.spec.chartRef.name}`}</span>
}
</NavigationButton>
</span>
}
{!ready && stalled &&
<span className='bg-orange-400'>
<span>Last Attempted: </span>
{/* <span>{lastAttemptedRevision}@{version.chartName}</span> */}
<span>Reconciliation stalled: </span>
<NavigationButton handleNavigation={navigationHandler}>
{helmRelease.spec.chart &&
<span>{helmRelease.spec.chart.spec.version}@{helmRelease.spec.chart.spec.chart}</span>
}
{helmRelease.spec.chartRef &&
<span>{`${helmRelease.spec.chartRef.namespace}/${helmRelease.spec.chartRef.name}`}</span>
}
</NavigationButton>
</span>
}
<span className={`block ${ready || reconciling ? '' : 'font-normal text-neutral-600'} field`}>
Expand Down

0 comments on commit 7ae5591

Please sign in to comment.