diff --git a/src/renderer/components/+helm-charts/helm-chart-details.scss b/src/renderer/components/+helm-charts/helm-chart-details.scss index 9f6d64223d..b82512dff4 100644 --- a/src/renderer/components/+helm-charts/helm-chart-details.scss +++ b/src/renderer/components/+helm-charts/helm-chart-details.scss @@ -14,6 +14,10 @@ box-sizing: content-box; } + div.intro-logo { + width: 100px; + } + .Select__option { span.deprecated { text-decoration: line-through; diff --git a/src/renderer/components/+helm-charts/helm-chart-details.tsx b/src/renderer/components/+helm-charts/helm-chart-details.tsx index 180f17145a..cbe776ef0a 100644 --- a/src/renderer/components/+helm-charts/helm-chart-details.tsx +++ b/src/renderer/components/+helm-charts/helm-chart-details.tsx @@ -46,6 +46,7 @@ interface Dependencies { @observer class NonInjectedHelmChartDetails extends Component { + private readonly imgLoadingFailed = observable.set(); // The IDs of the HelmChart instances readonly chartVersions = observable.array(); readonly selectedChart = observable.box(); readonly readme = observable.box(undefined); @@ -118,14 +119,32 @@ class NonInjectedHelmChartDetails extends Component + ); + } + + return ( + evt.currentTarget.classList.add("visible")} + onError={() => this.imgLoadingFailed.add(chart.getId())} + /> + ); + } + renderIntroduction(selectedChart: HelmChart) { return (
- event.currentTarget.src = HelmLogoPlaceholder} - /> + {this.renderIcon(selectedChart)}
{selectedChart.getDescription()} diff --git a/src/renderer/components/+helm-charts/helm-charts.tsx b/src/renderer/components/+helm-charts/helm-charts.tsx index 23175c199b..f567e42301 100644 --- a/src/renderer/components/+helm-charts/helm-charts.tsx +++ b/src/renderer/components/+helm-charts/helm-charts.tsx @@ -12,11 +12,13 @@ import type { HelmChart } from "../../../common/k8s-api/endpoints/helm-charts.ap import { HelmChartDetails } from "./helm-chart-details"; import { ItemListLayout } from "../item-object-list/list-layout"; import type { IComputedValue } from "mobx"; +import { observable } from "mobx"; import { withInjectables } from "@ogre-tools/injectable-react"; import { SiblingsInTabLayout } from "../layout/siblings-in-tab-layout"; import helmChartsRouteParametersInjectable from "./helm-charts-route-parameters.injectable"; import type { NavigateToHelmCharts } from "../../../common/front-end-routing/routes/cluster/helm/charts/navigate-to-helm-charts.injectable"; import navigateToHelmChartsInjectable from "../../../common/front-end-routing/routes/cluster/helm/charts/navigate-to-helm-charts.injectable"; +import HelmLogoPlaceholder from "./helm-placeholder.svg"; enum columnId { name = "name", @@ -37,6 +39,8 @@ interface Dependencies { @observer class NonInjectedHelmCharts extends Component { + private readonly imgLoadingFailed = observable.set(); // The IDs of the HelmChart instances + componentDidMount() { helmChartStore.loadAll(); } @@ -76,6 +80,22 @@ class NonInjectedHelmCharts extends Component { this.showDetails(null); }; + private renderIcon(chart: HelmChart) { + const icon = chart.getIcon(); + + if (!icon || this.imgLoadingFailed.has(chart.getId())) { + return
; + } + + return ( + evt.currentTarget.classList.add("visible")} + onError={() => this.imgLoadingFailed.add(chart.getId())} + /> + ); + } + render() { return ( @@ -114,10 +134,7 @@ class NonInjectedHelmCharts extends Component { ]} renderTableContents={chart => [
- evt.currentTarget.classList.add("visible")} - /> + {this.renderIcon(chart)}
, chart.getName(), chart.getDescription(),