mirror of https://github.com/grafana/grafana.git
FolderPicker: Don't show parent folder when not searching (#111756)
This commit is contained in:
parent
a9ef73607d
commit
98779838ab
|
@ -173,6 +173,11 @@ function Row({ index, style: virtualStyles, data }: RowProps) {
|
|||
) : null;
|
||||
}
|
||||
|
||||
// We don't have a direct value of whether things are coming from user searching but this seems to be a good
|
||||
// approximation as when searching all items will be at top level, while things that are actually in the top level
|
||||
// when just looking at a folders tree should not have parent.
|
||||
const isSearchItem = level === 0 && item.parentUID !== undefined;
|
||||
|
||||
return (
|
||||
// don't need a key handler here, it's handled at the input level in NestedFolderPicker
|
||||
// eslint-disable-next-line jsx-a11y/click-events-have-key-events
|
||||
|
@ -222,7 +227,7 @@ function Row({ index, style: virtualStyles, data }: RowProps) {
|
|||
<Text truncate>{item.title}</Text>
|
||||
<FolderRepo folder={item} />
|
||||
</label>
|
||||
<FolderParent item={items[index]} />
|
||||
{isSearchItem && <FolderParent item={items[index]} />}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue