Skip to content

Commit

Permalink
Disabled the Name label dropdown in topology empty state
Browse files Browse the repository at this point in the history
  • Loading branch information
karthikjeeyar committed Nov 30, 2021
1 parent 331dc23 commit 2ef6d41
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
12 changes: 10 additions & 2 deletions frontend/packages/topology/src/filters/NameLabelFilterDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ import { K8sResourceKind } from '@console/internal/module/k8s';
import { NameLabelFilterValues } from './filter-utils';

type NameLabelFilterDropdownProps = {
isDisabled: boolean;
data: K8sResourceKind[];
onChange: (type: string, value: string, endOfString: boolean) => void;
nameFilterInput: string;
labelFilterInput: string;
};

const NameLabelFilterDropdown: React.FC<NameLabelFilterDropdownProps> = (props) => {
const { data, onChange, nameFilterInput, labelFilterInput } = props;
const { data, onChange, nameFilterInput, labelFilterInput, isDisabled } = props;

const [isOpen, setOpen] = React.useState(false);
const [selected, setSelected] = React.useState(NameLabelFilterValues.Name);
Expand Down Expand Up @@ -45,7 +46,12 @@ const NameLabelFilterDropdown: React.FC<NameLabelFilterDropdownProps> = (props)
<Dropdown
onSelect={onSelect}
toggle={
<DropdownToggle id="toggle-id" onToggle={onToggle} toggleIndicator={CaretDownIcon}>
<DropdownToggle
isDisabled={isDisabled}
id="toggle-id"
onToggle={onToggle}
toggleIndicator={CaretDownIcon}
>
<>
<FilterIcon className="span--icon__right-margin" /> {t(selected)}
</>
Expand Down Expand Up @@ -73,6 +79,8 @@ const NameLabelFilterDropdown: React.FC<NameLabelFilterDropdownProps> = (props)
placeholder={t('topology~Find by name...')}
value={nameFilterInput}
aria-labelledby="toggle-id"
isDisabled={isDisabled}
autoFocus
/>
)}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ const TopologyFilterBar: React.FC<TopologyFilterBarProps> = ({
nameFilterInput={searchQuery}
labelFilterInput={labelFilterInput}
data={resources}
isDisabled={isDisabled}
/>
</ToolbarFilter>
</ToolbarFilter>
Expand Down

0 comments on commit 2ef6d41

Please sign in to comment.