[#7312] excluded id from the excerpt list

This commit is contained in:
Gani Georgiev
2025-11-08 23:31:03 +02:00
parent 501ab0e6be
commit 63a9d045a1
38 changed files with 83 additions and 50 deletions

View File

@@ -54,6 +54,7 @@
</Field>
</div>
<!-- @todo add warning mentioning that ids take part of the uploaded files path and there could be some filesystem compatibility issues with too loose pattern -->
<div class="col-sm-6">
<Field class="form-field" name="fields.{key}.pattern" let:uniqueId>
<label for={uniqueId}>

View File

@@ -134,7 +134,7 @@
const result = await ApiClient.collection(selectedCollection.id).getList(page, batchSize, {
filter: normalizedFilter,
sort: sort,
fields: "*:excerpt(100)",
fields: CommonHelper.getExcerptCollectionFieldsList(selectedCollection),
skipTotal: 1,
requestKey: uniqueId + "loadImagePicker",
});

View File

@@ -148,6 +148,7 @@
const listFields = editorFields
.map((f) => f.name + ":excerpt(200)")
// @todo exclude id and single rel fields from the excerpt list
.concat(relFields.map((field) => "expand." + field.name + ".*:excerpt(200)"));
if (listFields.length) {
listFields.unshift("*");

View File

@@ -98,7 +98,7 @@
ApiClient.collection(collectionId).getFullList({
batch: batchSize,
filter: filters.join("||"),
fields: "*:excerpt(200)",
fields: CommonHelper.getExcerptCollectionFieldsList(collection),
expand: getExpand(),
requestKey: null,
}),
@@ -162,7 +162,7 @@
const result = await ApiClient.collection(collectionId).getList(page, batchSize, {
filter: CommonHelper.normalizeSearchFilter(filter, fallbackSearchFields),
sort: sort,
fields: "*:excerpt(200)",
fields: CommonHelper.getExcerptCollectionFieldsList(collection),
skipTotal: 1,
expand: getExpand(),
requestKey: uniqueId + "loadList",
@@ -190,7 +190,7 @@
try {
const reloaded = await ApiClient.collection(collectionId).getOne(record.id, {
fields: "*:excerpt(200)",
fields: CommonHelper.getExcerptCollectionFieldsList(collection),
expand: getExpand(),
requestKey: uniqueId + "reload" + record.id,
});

View File

@@ -64,10 +64,12 @@
isLoading = true;
const fieldCollection = $collections.find((c) => c.id == field.collectionId);
let expands = [];
const presentableRelFields = $collections
.find((c) => c.id == field.collectionId)
?.fields?.filter((f) => !f.hidden && f.presentable && f.type == "relation");
const presentableRelFields = fieldCollection?.fields?.filter(
(f) => !f.hidden && f.presentable && f.type == "relation",
);
for (const field of presentableRelFields) {
expands = expands.concat(CommonHelper.getExpandPresentableRelFields(field, $collections, 2));
}
@@ -84,7 +86,7 @@
loadPromises.push(
ApiClient.collection(field.collectionId).getFullList(batchSize, {
filter: filters.join("||"),
fields: "*:excerpt(200)",
fields: CommonHelper.getExcerptCollectionFieldsList(fieldCollection),
expand: expands.join(","),
requestKey: null,
}),