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(({