mirror of
https://github.com/inventree/InvenTree.git
synced 2026-04-14 23:38:53 +00:00
Linkify search results (#11719)
* Linkify search results - Closes https://github.com/inventree/InvenTree/issues/11717 * Divide search results
This commit is contained in:
@@ -7,6 +7,7 @@ import {
|
|||||||
Anchor,
|
Anchor,
|
||||||
Center,
|
Center,
|
||||||
Checkbox,
|
Checkbox,
|
||||||
|
Divider,
|
||||||
Drawer,
|
Drawer,
|
||||||
Group,
|
Group,
|
||||||
Loader,
|
Loader,
|
||||||
@@ -38,7 +39,11 @@ import { ModelType } from '@lib/enums/ModelType';
|
|||||||
import { UserRoles } from '@lib/enums/Roles';
|
import { UserRoles } from '@lib/enums/Roles';
|
||||||
import { apiUrl } from '@lib/functions/Api';
|
import { apiUrl } from '@lib/functions/Api';
|
||||||
import { cancelEvent } from '@lib/functions/Events';
|
import { cancelEvent } from '@lib/functions/Events';
|
||||||
import { eventModified, navigateToLink } from '@lib/functions/Navigation';
|
import {
|
||||||
|
eventModified,
|
||||||
|
getDetailUrl,
|
||||||
|
navigateToLink
|
||||||
|
} from '@lib/functions/Navigation';
|
||||||
import { showNotification } from '@mantine/notifications';
|
import { showNotification } from '@mantine/notifications';
|
||||||
import { api } from '../../App';
|
import { api } from '../../App';
|
||||||
import { useUserSettingsState } from '../../states/SettingsStates';
|
import { useUserSettingsState } from '../../states/SettingsStates';
|
||||||
@@ -158,10 +163,12 @@ function QueryResultGroup({
|
|||||||
</Group>
|
</Group>
|
||||||
</Accordion.Control>
|
</Accordion.Control>
|
||||||
<Accordion.Panel>
|
<Accordion.Panel>
|
||||||
<Stack aria-label={`search-group-results-${query.model}`}>
|
<Stack gap={'xs'} aria-label={`search-group-results-${query.model}`}>
|
||||||
{query.results.results.map((result: any) => (
|
{query.results.results.map((result: any, index: number) => (
|
||||||
|
<>
|
||||||
<Anchor
|
<Anchor
|
||||||
underline='never'
|
underline='never'
|
||||||
|
href={getDetailUrl(query.model, result.pk, true)}
|
||||||
onClick={(event: any) =>
|
onClick={(event: any) =>
|
||||||
onResultClick(query.model, result.pk, event)
|
onResultClick(query.model, result.pk, event)
|
||||||
}
|
}
|
||||||
@@ -169,6 +176,15 @@ function QueryResultGroup({
|
|||||||
>
|
>
|
||||||
<RenderInstance instance={result} model={query.model} />
|
<RenderInstance instance={result} model={query.model} />
|
||||||
</Anchor>
|
</Anchor>
|
||||||
|
{index < query.results.results.length - 1 && (
|
||||||
|
<Divider
|
||||||
|
p={0}
|
||||||
|
m={0}
|
||||||
|
variant='dashed'
|
||||||
|
key={`divider-${query.model}-${result.pk}`}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
))}
|
))}
|
||||||
</Stack>
|
</Stack>
|
||||||
</Accordion.Panel>
|
</Accordion.Panel>
|
||||||
|
|||||||
Reference in New Issue
Block a user