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

fix crd-list.tsx

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2022-04-12 14:59:09 -04:00
parent b2d36493ae
commit f72880fa44

View File

@ -48,9 +48,11 @@ export class CustomResourceDefinitions extends React.Component {
return crdStore.items; // show all by default
}
toggleSelection = (groups: readonly string[]) => {
toggleSelection = (options: readonly ({ group: string })[]) => {
const groups = options.map(({ group }) => group);
this.selectedGroups.replace(groups);
crdGroupsUrlParam.set([...groups]);
crdGroupsUrlParam.set(groups);
};
private getPlaceholder() {
@ -101,13 +103,13 @@ export class CustomResourceDefinitions extends React.Component {
<Select
className="group-select"
placeholder={this.getPlaceholder()}
options={Object.keys(crdStore.groups)}
options={Object.keys(crdStore.groups).map(group => ({ group }))}
onChange={this.toggleSelection}
closeMenuOnSelect={false}
controlShouldRenderValue={false}
isOptionSelected={opt => this.selectedGroups.has(opt)}
isOptionSelected={opt => this.selectedGroups.has(opt.group)}
isMulti={true}
formatOptionLabel={(group) => (
formatOptionLabel={({ group }) => (
<div className="flex gaps align-center">
<Icon small material="folder" />
<span>{group}</span>
@ -115,11 +117,11 @@ export class CustomResourceDefinitions extends React.Component {
<Icon
small
material="check"
className="box right"
className="box right"
/>
)}
</div>
)}
)}
/>
</>
),