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

make namespace filter multi select and change onChange (#987)

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2020-09-28 10:30:23 -04:00 committed by GitHub
parent bc228c9e36
commit 34e141e517
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -58,7 +58,7 @@ export class NamespaceSelect extends React.Component<Props> {
const { value, label } = option; const { value, label } = option;
return label || ( return label || (
<> <>
{showIcons && <Icon small material="layers"/>} {showIcons && <Icon small material="layers" />}
{value} {value}
</> </>
); );
@ -91,14 +91,15 @@ export class NamespaceSelectFilter extends React.Component {
closeMenuOnSelect={false} closeMenuOnSelect={false}
isOptionSelected={() => false} isOptionSelected={() => false}
controlShouldRenderValue={false} controlShouldRenderValue={false}
onChange={({ value: namespace }: SelectOption) => toggleContext(namespace)} isMulti
onChange={([{ value }]: SelectOption[]) => toggleContext(value)}
formatOptionLabel={({ value: namespace }: SelectOption) => { formatOptionLabel={({ value: namespace }: SelectOption) => {
const isSelected = hasContext(namespace); const isSelected = hasContext(namespace);
return ( return (
<div className="flex gaps align-center"> <div className="flex gaps align-center">
<FilterIcon type={FilterType.NAMESPACE}/> <FilterIcon type={FilterType.NAMESPACE} />
<span>{namespace}</span> <span>{namespace}</span>
{isSelected && <Icon small material="check" className="box right"/>} {isSelected && <Icon small material="check" className="box right" />}
</div> </div>
) )
}} }}