mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Use image, not thumbnail
This commit is contained in:
parent
180421cf3a
commit
9caad9ea9f
@ -9,6 +9,8 @@ INVENTREE_API_TEXT = """
|
|||||||
v179 - 2024-03-01 : https://github.com/inventree/InvenTree/pull/6605
|
v179 - 2024-03-01 : https://github.com/inventree/InvenTree/pull/6605
|
||||||
- Adds "subcategories" count to PartCategory serializer
|
- Adds "subcategories" count to PartCategory serializer
|
||||||
- Adds "sublocations" count to StockLocation serializer
|
- Adds "sublocations" count to StockLocation serializer
|
||||||
|
- Adds "image" field to PartBrief serializer
|
||||||
|
- Adds "image" field to CompanyBrief serializer
|
||||||
|
|
||||||
v178 - 2024-02-29 : https://github.com/inventree/InvenTree/pull/6604
|
v178 - 2024-02-29 : https://github.com/inventree/InvenTree/pull/6604
|
||||||
- Adds "external_stock" field to the Part API endpoint
|
- Adds "external_stock" field to the Part API endpoint
|
||||||
|
@ -42,11 +42,13 @@ class CompanyBriefSerializer(InvenTreeModelSerializer):
|
|||||||
"""Metaclass options."""
|
"""Metaclass options."""
|
||||||
|
|
||||||
model = Company
|
model = Company
|
||||||
fields = ['pk', 'url', 'name', 'description', 'image']
|
fields = ['pk', 'url', 'name', 'description', 'image', 'thumbnail']
|
||||||
|
|
||||||
url = serializers.CharField(source='get_absolute_url', read_only=True)
|
url = serializers.CharField(source='get_absolute_url', read_only=True)
|
||||||
|
|
||||||
image = serializers.CharField(source='get_thumbnail_url', read_only=True)
|
image = InvenTreeImageSerializerField(read_only=True)
|
||||||
|
|
||||||
|
thumbnail = serializers.CharField(source='get_thumbnail_url', read_only=True)
|
||||||
|
|
||||||
|
|
||||||
class AddressSerializer(InvenTreeModelSerializer):
|
class AddressSerializer(InvenTreeModelSerializer):
|
||||||
|
@ -288,6 +288,7 @@ class PartBriefSerializer(InvenTree.serializers.InvenTreeModelSerializer):
|
|||||||
'revision',
|
'revision',
|
||||||
'full_name',
|
'full_name',
|
||||||
'description',
|
'description',
|
||||||
|
'image',
|
||||||
'thumbnail',
|
'thumbnail',
|
||||||
'active',
|
'active',
|
||||||
'assembly',
|
'assembly',
|
||||||
@ -313,6 +314,7 @@ class PartBriefSerializer(InvenTree.serializers.InvenTreeModelSerializer):
|
|||||||
self.fields.pop('pricing_min')
|
self.fields.pop('pricing_min')
|
||||||
self.fields.pop('pricing_max')
|
self.fields.pop('pricing_max')
|
||||||
|
|
||||||
|
image = InvenTree.serializers.InvenTreeImageSerializerField(read_only=True)
|
||||||
thumbnail = serializers.CharField(source='get_thumbnail_url', read_only=True)
|
thumbnail = serializers.CharField(source='get_thumbnail_url', read_only=True)
|
||||||
|
|
||||||
# Pricing fields
|
# Pricing fields
|
||||||
|
@ -7,10 +7,14 @@ import { ModelType } from '../enums/ModelType';
|
|||||||
export function getDetailUrl(model: ModelType, pk: number | string): string {
|
export function getDetailUrl(model: ModelType, pk: number | string): string {
|
||||||
const modelInfo = ModelInformationDict[model];
|
const modelInfo = ModelInformationDict[model];
|
||||||
|
|
||||||
|
if (pk === undefined || pk === null) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
if (!!pk && modelInfo && modelInfo.url_detail) {
|
if (!!pk && modelInfo && modelInfo.url_detail) {
|
||||||
return modelInfo.url_detail.replace(':pk', pk.toString());
|
return modelInfo.url_detail.replace(':pk', pk.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
console.error(`No detail URL found for model ${model}!`);
|
console.error(`No detail URL found for model ${model} <${pk}>`);
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
@ -181,7 +181,7 @@ export default function BuildDetail() {
|
|||||||
<DetailsImage
|
<DetailsImage
|
||||||
appRole={UserRoles.part}
|
appRole={UserRoles.part}
|
||||||
apiPath={ApiEndpoints.part_list}
|
apiPath={ApiEndpoints.part_list}
|
||||||
src={build.part_detail?.thumbnail}
|
src={build.part_detail?.image ?? build.part_detail?.thumbnail}
|
||||||
pk={build.part}
|
pk={build.part}
|
||||||
/>
|
/>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
|
@ -202,7 +202,10 @@ export default function StockDetail() {
|
|||||||
<DetailsImage
|
<DetailsImage
|
||||||
appRole={UserRoles.part}
|
appRole={UserRoles.part}
|
||||||
apiPath={ApiEndpoints.part_list}
|
apiPath={ApiEndpoints.part_list}
|
||||||
src={stockitem.part_detail?.thumbnail}
|
src={
|
||||||
|
stockitem.part_detail?.image ??
|
||||||
|
stockitem?.part_detail?.thumbnail
|
||||||
|
}
|
||||||
pk={stockitem.part}
|
pk={stockitem.part}
|
||||||
/>
|
/>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
|
Loading…
Reference in New Issue
Block a user