2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-13 08:21:26 +00:00

[React] API Image Functionality (#5696)

* Improvements to API handling on react UI

- Do not force "/api/" prefix to the base URL of the server
- We will need to fetch media files from the server (at /media/)
- Extend API URL helper functions

* Update some more hard-coded URLs

* Fix search API endpoint

* Fix div for panel tab

* Fix debug msg

* Allow CORS request to /media/

* Add ApiImage component

- Used to fetch images from API which require auth
- Requires some tweaks to back-end CORS settings
- Otherwrise, image loading won't work on new API

* Update build order table

* Remove debug code

* Update part detail page
This commit is contained in:
Oliver
2023-10-16 19:44:09 +11:00
committed by GitHub
parent 65e9ba0633
commit 4de51f4f4f
12 changed files with 143 additions and 54 deletions

View File

@ -1,5 +1,5 @@
import { t } from '@lingui/macro';
import { Text } from '@mantine/core';
import { Group, Text } from '@mantine/core';
import { useMemo } from 'react';
import { useNavigate } from 'react-router-dom';
@ -8,6 +8,7 @@ import { notYetImplemented } from '../../../functions/notifications';
import { shortenString } from '../../../functions/tables';
import { useTableRefresh } from '../../../hooks/TableRefresh';
import { ApiPaths, apiUrl } from '../../../states/ApiState';
import { Thumbnail } from '../../images/Thumbnail';
import { TableColumn } from '../Column';
import { TableFilter } from '../Filter';
import { InvenTreeTable, InvenTreeTableProps } from '../InvenTreeTable';
@ -26,7 +27,14 @@ function partTableColumns(): TableColumn[] {
render: function (record: any) {
// TODO - Link to the part detail page
return (
<Text>{record.full_name}</Text>
<Group spacing="xs" align="left" noWrap={true}>
<Thumbnail
src={record.thumbnail || record.image}
alt={record.name}
size={24}
/>
<Text>{record.full_name}</Text>
</Group>
// <ThumbnailHoverCard
// src={record.thumbnail || record.image}
// text={record.name}