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