1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

fixing more type errors

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2022-04-13 08:46:25 -04:00
parent 595bb715a9
commit bef48872fe
2 changed files with 12 additions and 9 deletions

View File

@ -21,7 +21,7 @@ export type NamespaceSelectSort = (left: string, right: string) => number;
export interface NamespaceSelectProps<IsMulti extends boolean> extends Omit<SelectProps<{ namespace: string }, IsMulti>, "options" | "value"> { export interface NamespaceSelectProps<IsMulti extends boolean> extends Omit<SelectProps<{ namespace: string }, IsMulti>, "options" | "value"> {
showIcons?: boolean; showIcons?: boolean;
sort?: NamespaceSelectSort; sort?: NamespaceSelectSort;
value: string | null; value: string | null | undefined;
} }
interface Dependencies { interface Dependencies {

View File

@ -30,6 +30,7 @@ import { Notifications } from "../../notifications";
import type { NavigateToHelmReleases } from "../../../../common/front-end-routing/routes/cluster/helm/releases/navigate-to-helm-releases.injectable"; import type { NavigateToHelmReleases } from "../../../../common/front-end-routing/routes/cluster/helm/releases/navigate-to-helm-releases.injectable";
import navigateToHelmReleasesInjectable from "../../../../common/front-end-routing/routes/cluster/helm/releases/navigate-to-helm-releases.injectable"; import navigateToHelmReleasesInjectable from "../../../../common/front-end-routing/routes/cluster/helm/releases/navigate-to-helm-releases.injectable";
import assert from "assert"; import assert from "assert";
import type { SingleValue } from "react-select";
export interface InstallCharProps { export interface InstallCharProps {
tab: DockTab; tab: DockTab;
@ -87,9 +88,9 @@ class NonInjectedInstallChart extends Component<InstallCharProps & Dependencies>
this.props.installChartStore.setData(this.tabId, { ...this.chartData, ...data }); this.props.installChartStore.setData(this.tabId, { ...this.chartData, ...data });
} }
onVersionChange = (version: string | null) => { onVersionChange = (option: SingleValue<{ version: string }>) => {
if (version) { if (option) {
this.save({ version, values: "" }); this.save({ ...option, values: "" });
this.props.installChartStore.loadValues(this.tabId); this.props.installChartStore.loadValues(this.tabId);
} }
}; };
@ -103,9 +104,9 @@ class NonInjectedInstallChart extends Component<InstallCharProps & Dependencies>
this.error = error.toString(); this.error = error.toString();
}); });
onNamespaceChange = (namespace: string | null) => { onNamespaceChange = (option: SingleValue<{ namespace: string }>) => {
if (namespace) { if (option) {
this.save({ namespace }); this.save(option);
} }
}; };
@ -178,6 +179,8 @@ class NonInjectedInstallChart extends Component<InstallCharProps & Dependencies>
} }
const { repo, name, version, namespace, releaseName } = chartData; const { repo, name, version, namespace, releaseName } = chartData;
const versionOptions = versions.map(version => ({ version }));
const selectedVersionOption = versionOptions.find(opt => opt.version === version);
return ( return (
<div className="InstallChart flex column"> <div className="InstallChart flex column">
@ -190,8 +193,8 @@ class NonInjectedInstallChart extends Component<InstallCharProps & Dependencies>
<span>Version</span> <span>Version</span>
<Select <Select
className="chart-version" className="chart-version"
value={version} value={selectedVersionOption}
options={versions} options={versionOptions}
onChange={this.onVersionChange} onChange={this.onVersionChange}
menuPlacement="top" menuPlacement="top"
themeName="outlined" themeName="outlined"