Skip to content

Commit

Permalink
fix: hide namespace filter in cluster mode
Browse files Browse the repository at this point in the history
  • Loading branch information
mortada-codes committed Apr 19, 2023
1 parent 963a2a8 commit 4e6a3ad
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions src/components/molecules/ResourceFilter/ResourceFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ const ResourceFilter = ({active, onToggle}: Props) => {
const [localResourceFilter, setLocalResourceFilter] = useState<ResourceFilterType>(filtersMap);
const [wasLocalUpdate, setWasLocalUpdate] = useState<boolean>(false);
const folderTree = useFileFolderTreeSelectData('all');
const filterBodyHeight = isInClusterMode ? NAVIGATOR_FILTER_BODY_HEIGHT - 56 : NAVIGATOR_FILTER_BODY_HEIGHT;

const autocompleteOptions = useMemo(() => {
return {
Expand Down Expand Up @@ -253,7 +254,7 @@ const ResourceFilter = ({active, onToggle}: Props) => {
return (
<S.Container>
<Filter
height={NAVIGATOR_FILTER_BODY_HEIGHT}
height={filterBodyHeight}
search={localResourceFilter?.name}
onClear={handleClear}
onSearch={handleSearched}
Expand Down Expand Up @@ -300,18 +301,20 @@ const ResourceFilter = ({active, onToggle}: Props) => {
/>
</FilterField>

<FilterField name="Namespace">
<Select
mode="tags"
style={{width: '100%'}}
placeholder="Select one or more namespaces.."
value={localResourceFilter.namespaces}
options={autocompleteOptions.namespaces}
onChange={onNamespaceChangeHandler}
onClear={onNamespaceClearHandler}
allowClear
/>
</FilterField>
{!isInClusterMode && (
<FilterField name="Namespace">
<Select
mode="tags"
style={{width: '100%'}}
placeholder="Select one or more namespaces.."
value={localResourceFilter.namespaces}
options={autocompleteOptions.namespaces}
onChange={onNamespaceChangeHandler}
onClear={onNamespaceClearHandler}
allowClear
/>
</FilterField>
)}

<FilterField name="Labels">
<NewKeyValueInput onAddKeyValue={handleUpsertLabelFilter} keyOptions={autocompleteOptions.labels} />
Expand Down

0 comments on commit 4e6a3ad

Please sign in to comment.