mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix HelmChartDetails and HelmReleaseDetails Menu (#3986)
This commit is contained in:
parent
d979405023
commit
b9cee0cbc7
@ -23,8 +23,8 @@ import "./helm-chart-details.scss";
|
|||||||
|
|
||||||
import React, { Component } from "react";
|
import React, { Component } from "react";
|
||||||
import { getChartDetails, HelmChart } from "../../../common/k8s-api/endpoints/helm-charts.api";
|
import { getChartDetails, HelmChart } from "../../../common/k8s-api/endpoints/helm-charts.api";
|
||||||
import { observable, autorun, makeObservable } from "mobx";
|
import { observable, makeObservable, reaction } from "mobx";
|
||||||
import { observer } from "mobx-react";
|
import { disposeOnUnmount, observer } from "mobx-react";
|
||||||
import { Drawer, DrawerItem } from "../drawer";
|
import { Drawer, DrawerItem } from "../drawer";
|
||||||
import { boundMethod, stopPropagation } from "../../utils";
|
import { boundMethod, stopPropagation } from "../../utils";
|
||||||
import { MarkdownViewer } from "../markdown-viewer";
|
import { MarkdownViewer } from "../markdown-viewer";
|
||||||
@ -64,20 +64,24 @@ export class HelmChartDetails extends Component<Props> {
|
|||||||
this.abortController?.abort();
|
this.abortController?.abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
chartUpdater = autorun(() => {
|
componentDidMount() {
|
||||||
this.selectedChart = null;
|
disposeOnUnmount(this, [
|
||||||
const { chart: { name, repo, version } } = this.props;
|
reaction(() => this.props.chart, async ({ name, repo, version }) => {
|
||||||
|
try {
|
||||||
|
const { readme, versions } = await getChartDetails(repo, name, { version });
|
||||||
|
|
||||||
getChartDetails(repo, name, { version })
|
this.readme = readme;
|
||||||
.then(result => {
|
this.chartVersions = versions;
|
||||||
this.readme = result.readme;
|
this.selectedChart = versions[0];
|
||||||
this.chartVersions = result.versions;
|
} catch (error) {
|
||||||
this.selectedChart = result.versions[0];
|
this.error = error;
|
||||||
})
|
this.selectedChart = null;
|
||||||
.catch(error => {
|
}
|
||||||
this.error = error;
|
}, {
|
||||||
});
|
fireImmediately: true,
|
||||||
});
|
}),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
@boundMethod
|
@boundMethod
|
||||||
async onVersionChange({ value: chart }: SelectOption<HelmChart>) {
|
async onVersionChange({ value: chart }: SelectOption<HelmChart>) {
|
||||||
@ -135,7 +139,7 @@ export class HelmChartDetails extends Component<Props> {
|
|||||||
value: chart,
|
value: chart,
|
||||||
}))}
|
}))}
|
||||||
isOptionDisabled={({ value: chart }) => chart.deprecated}
|
isOptionDisabled={({ value: chart }) => chart.deprecated}
|
||||||
value={selectedChart.getVersion()}
|
value={selectedChart}
|
||||||
onChange={onVersionChange}
|
onChange={onVersionChange}
|
||||||
/>
|
/>
|
||||||
</DrawerItem>
|
</DrawerItem>
|
||||||
@ -170,10 +174,6 @@ export class HelmChartDetails extends Component<Props> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderContent() {
|
renderContent() {
|
||||||
if (!this.selectedChart) {
|
|
||||||
return <Spinner center />;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.error) {
|
if (this.error) {
|
||||||
return (
|
return (
|
||||||
<div className="box grow">
|
<div className="box grow">
|
||||||
@ -182,6 +182,10 @@ export class HelmChartDetails extends Component<Props> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!this.selectedChart) {
|
||||||
|
return <Spinner center />;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="box grow">
|
<div className="box grow">
|
||||||
{this.renderIntroduction()}
|
{this.renderIntroduction()}
|
||||||
|
|||||||
@ -79,6 +79,7 @@ export class HelmReleaseMenu extends React.Component<Props> {
|
|||||||
{...menuProps}
|
{...menuProps}
|
||||||
className={cssNames("HelmReleaseMenu", className)}
|
className={cssNames("HelmReleaseMenu", className)}
|
||||||
removeAction={this.remove}
|
removeAction={this.remove}
|
||||||
|
removeConfirmationMessage={() => <p>Remove Helm Release <b>{release.name}</b>?</p>}
|
||||||
>
|
>
|
||||||
{this.renderContent()}
|
{this.renderContent()}
|
||||||
</MenuActions>
|
</MenuActions>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user