mirror of
https://github.com/hay-kot/homebox.git
synced 2025-08-02 15:50:27 +00:00
fetch images for item children
This commit is contained in:
parent
56a27abb70
commit
673b81cc50
3 changed files with 20 additions and 10 deletions
|
@ -160,7 +160,6 @@ type (
|
||||||
|
|
||||||
Attachments []ItemAttachment `json:"attachments"`
|
Attachments []ItemAttachment `json:"attachments"`
|
||||||
Fields []ItemField `json:"fields"`
|
Fields []ItemField `json:"fields"`
|
||||||
Children []ItemSummary `json:"children"`
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -241,11 +240,6 @@ func mapItemOut(item *ent.Item) ItemOut {
|
||||||
fields = mapFields(item.Edges.Fields)
|
fields = mapFields(item.Edges.Fields)
|
||||||
}
|
}
|
||||||
|
|
||||||
var children []ItemSummary
|
|
||||||
if item.Edges.Children != nil {
|
|
||||||
children = mapEach(item.Edges.Children, mapItemSummary)
|
|
||||||
}
|
|
||||||
|
|
||||||
var parent *ItemSummary
|
var parent *ItemSummary
|
||||||
if item.Edges.Parent != nil {
|
if item.Edges.Parent != nil {
|
||||||
v := mapItemSummary(item.Edges.Parent)
|
v := mapItemSummary(item.Edges.Parent)
|
||||||
|
@ -279,7 +273,6 @@ func mapItemOut(item *ent.Item) ItemOut {
|
||||||
Notes: item.Notes,
|
Notes: item.Notes,
|
||||||
Attachments: attachments,
|
Attachments: attachments,
|
||||||
Fields: fields,
|
Fields: fields,
|
||||||
Children: children,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,7 +290,6 @@ func (e *ItemsRepository) getOne(ctx context.Context, where ...predicate.Item) (
|
||||||
WithLabel().
|
WithLabel().
|
||||||
WithLocation().
|
WithLocation().
|
||||||
WithGroup().
|
WithGroup().
|
||||||
WithChildren().
|
|
||||||
WithParent().
|
WithParent().
|
||||||
WithAttachments(func(aq *ent.AttachmentQuery) {
|
WithAttachments(func(aq *ent.AttachmentQuery) {
|
||||||
aq.WithDocument()
|
aq.WithDocument()
|
||||||
|
|
|
@ -22,6 +22,7 @@ export type ItemsQuery = {
|
||||||
pageSize?: number;
|
pageSize?: number;
|
||||||
locations?: string[];
|
locations?: string[];
|
||||||
labels?: string[];
|
labels?: string[];
|
||||||
|
parentIds?: string[];
|
||||||
q?: string;
|
q?: string;
|
||||||
fields?: string[];
|
fields?: string[];
|
||||||
};
|
};
|
||||||
|
|
|
@ -404,6 +404,23 @@
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const items = computedAsync(async () => {
|
||||||
|
if (!item.value) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
const resp = await api.items.getAll({
|
||||||
|
parentIds: [item.value.id],
|
||||||
|
});
|
||||||
|
|
||||||
|
if (resp.error) {
|
||||||
|
toast.error("Failed to load items");
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return resp.data.items;
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -565,8 +582,8 @@
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section v-if="!hasNested && item.children.length > 0" class="my-6">
|
<section v-if="items && items.length > 0" class="my-6">
|
||||||
<ItemViewSelectable :items="item.children" />
|
<ItemViewSelectable :items="items" />
|
||||||
</section>
|
</section>
|
||||||
</BaseContainer>
|
</BaseContainer>
|
||||||
</template>
|
</template>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue