mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
refactor with some bulletproofing
Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com>
This commit is contained in:
parent
6d43dbb8eb
commit
856e1ad449
@ -37,14 +37,15 @@ const Placeholder = observer((props: PlaceholderProps<any, boolean>) => {
|
||||
const getPlaceholder = (): React.ReactNode => {
|
||||
const namespaces = namespaceStore.contextNamespaces;
|
||||
|
||||
switch (namespaceStore.selectedNamespaces.length) {
|
||||
case 0:
|
||||
if (!namespaceStore.selectedNamespaces.length || !namespaces.length) {
|
||||
return <>All namespaces</>;
|
||||
case 1:
|
||||
return <>Namespace: {namespaces[0]}</>;
|
||||
default:
|
||||
return <>Namespaces: {namespaces.join(", ")}</>;
|
||||
}
|
||||
|
||||
if (namespaces.length === 1) {
|
||||
return <>Namespace: {namespaces[0]}</>;
|
||||
}
|
||||
|
||||
return <>Namespaces: {namespaces.join(", ")}</>;
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
Loading…
Reference in New Issue
Block a user