Skip to content

Commit

Permalink
fix: reset of kind and namespace in ResourceFilter
Browse files Browse the repository at this point in the history
  • Loading branch information
devcatalin committed Sep 3, 2021
1 parent 5ed65e6 commit d926d6c
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/components/molecules/ResourceFilter/ResourceFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ const ResourceFilter = (props: {onChange?: (filter: ResourceFilterType) => void}

const resetFilters = () => {
setName(undefined);
setKind(undefined);
setNamespace(undefined);
setKind(ALL_OPTIONS);
setNamespace(ALL_OPTIONS);
setLabels({});
setAnnotations({});
};
Expand Down Expand Up @@ -127,8 +127,8 @@ const ResourceFilter = (props: {onChange?: (filter: ResourceFilterType) => void}
}
const updatedFilters = {
name,
kind,
namespace,
kind: kind === ALL_OPTIONS ? undefined : kind,
namespace: namespace === ALL_OPTIONS ? undefined : namespace,
labels,
annotations,
};
Expand All @@ -152,7 +152,7 @@ const ResourceFilter = (props: {onChange?: (filter: ResourceFilterType) => void}
</FieldContainer>
<FieldContainer>
<FieldLabel>Kind:</FieldLabel>
<Select showSearch defaultValue={ALL_OPTIONS} onChange={updateKind} style={{width: '100%'}}>
<Select showSearch defaultValue={ALL_OPTIONS} value={kind} onChange={updateKind} style={{width: '100%'}}>
<Select.Option key={ALL_OPTIONS} value={ALL_OPTIONS}>
{ALL_OPTIONS}
</Select.Option>
Expand All @@ -165,7 +165,13 @@ const ResourceFilter = (props: {onChange?: (filter: ResourceFilterType) => void}
</FieldContainer>
<FieldContainer>
<FieldLabel>Namespace:</FieldLabel>
<Select showSearch defaultValue={ALL_OPTIONS} onChange={updateNamespace} style={{width: '100%'}}>
<Select
showSearch
defaultValue={ALL_OPTIONS}
value={namespace}
onChange={updateNamespace}
style={{width: '100%'}}
>
{allNamespaces.map(ns => (
<Select.Option key={ns} value={ns}>
{ns}
Expand Down

0 comments on commit d926d6c

Please sign in to comment.