From 9c388dc49927d8e1ec1b82a22c2718f90dd1fdeb Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Tue, 12 Apr 2022 14:49:37 -0400 Subject: [PATCH] fix namespace-select.tsx Signed-off-by: Sebastian Malton --- .../+namespaces/namespace-select.tsx | 28 ++++++++++--------- .../+role-bindings/dialog.tsx | 2 +- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/renderer/components/+namespaces/namespace-select.tsx b/src/renderer/components/+namespaces/namespace-select.tsx index e1a4f1b083..4fde4104c4 100644 --- a/src/renderer/components/+namespaces/namespace-select.tsx +++ b/src/renderer/components/+namespaces/namespace-select.tsx @@ -18,25 +18,16 @@ import namespaceStoreInjectable from "./namespace-store/namespace-store.injectab export type NamespaceSelectSort = (left: string, right: string) => number; -export interface NamespaceSelectProps extends SelectProps { +export interface NamespaceSelectProps extends Omit, "options" | "value"> { showIcons?: boolean; sort?: NamespaceSelectSort; - options?: undefined; + value: string | null; } interface Dependencies { namespaceStore: NamespaceStore; } -export function formatNamespaceOptionWithIcon(namespace: string) { - return ( - <> - - {namespace} - - ); -} - function getOptions(namespaceStore: NamespaceStore, sort: NamespaceSelectSort | undefined) { return computed(() => { const baseOptions = namespaceStore.items.map(ns => ns.getName()); @@ -45,7 +36,7 @@ function getOptions(namespaceStore: NamespaceStore, sort: NamespaceSelectSort | baseOptions.sort(sort); } - return baseOptions; + return baseOptions.map(namespace => ({ namespace })); }); } @@ -55,6 +46,7 @@ const NonInjectedNamespaceSelect = observer(({ formatOptionLabel, sort, className, + value, ...selectProps }: Dependencies & NamespaceSelectProps) => { const [baseOptions, setBaseOptions] = useState(getOptions(namespaceStore, sort)); @@ -65,7 +57,17 @@ const NonInjectedNamespaceSelect = observer(({