Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 1805899: Make selected items show check mark in dropdown #4489

Merged
merged 1 commit into from Feb 26, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 7 additions & 2 deletions frontend/public/components/resource-dropdown.tsx
Expand Up @@ -7,10 +7,11 @@ import * as fuzzy from 'fuzzysearch';

import { Dropdown, ResourceIcon } from './utils';
import {
apiVersionForReference,
K8sKind,
K8sResourceKindReference,
modelFor,
referenceForModel,
apiVersionForReference,
} from '../module/k8s';
import { Badge, Checkbox } from '@patternfly/react-core';

Expand Down Expand Up @@ -122,6 +123,10 @@ const ResourceListDropdown_: React.SFC<ResourceListDropdownProps> = (props) => {
return fuzzy(_.toLower(text), _.toLower(model.kind));
};

const handleSelected = (value: string) => {
onChange(referenceForModel(modelFor(value)));
};

return (
<Dropdown
menuClassName="dropdown-menu--text-wrap"
Expand All @@ -135,7 +140,7 @@ const ResourceListDropdown_: React.SFC<ResourceListDropdownProps> = (props) => {
</Badge>
</div>
}
onChange={onChange}
onChange={handleSelected}
autocompleteFilter={autocompleteFilter}
autocompletePlaceholder="Select Resource"
/>
Expand Down