Commit dd31207e by Alex Khomenko Committed by GitHub

Search: minor fixes (#23984)

* Search: Use folder id as key when present

* Search: Do not render modals if not open
parent 88e9fccb
......@@ -46,7 +46,7 @@ export const ConfirmDeleteModal: FC<Props> = ({ results, onDeleteItems, isOpen,
});
};
return (
return isOpen ? (
<ConfirmModal
isOpen={isOpen}
title="Delete"
......@@ -59,7 +59,7 @@ export const ConfirmDeleteModal: FC<Props> = ({ results, onDeleteItems, isOpen,
onConfirm={deleteItems}
onDismiss={onDismiss}
/>
);
) : null;
};
const getStyles = stylesFactory((theme: GrafanaTheme) => {
......
......@@ -44,7 +44,7 @@ export const MoveToFolderModal: FC<Props> = ({ results, onMoveItems, isOpen, onD
}
};
return (
return isOpen ? (
<Modal
className={styles.modal}
title="Choose Dashboard Folder"
......@@ -71,7 +71,7 @@ export const MoveToFolderModal: FC<Props> = ({ results, onMoveItems, isOpen, onD
</HorizontalGroup>
</>
</Modal>
);
) : null;
};
const getStyles = stylesFactory((theme: GrafanaTheme) => {
......
......@@ -36,7 +36,7 @@ export const SearchResults: FC<Props> = ({
<div className={styles.wrapper}>
{results.map(section => {
return (
<div aria-label="Search section" className={styles.section} key={section.title}>
<div aria-label="Search section" className={styles.section} key={section.id || section.title}>
<SectionHeader onSectionClick={onToggleSection} {...{ onToggleChecked, editable, section }} />
<div aria-label="Search items" className={styles.sectionItems}>
{section.expanded && section.items.map(item => <SearchItem key={item.id} {...itemProps} item={item} />)}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment