[#976] added optional RelationOptions.DisplayFields and refactored the relation picker UI

This commit is contained in:
Gani Georgiev
2023-01-23 21:57:35 +02:00
parent 4c73e16f54
commit 4c010847e3
106 changed files with 1845 additions and 981 deletions
+19 -21
View File
@@ -51,26 +51,24 @@ export function removeCollection(collection) {
export async function loadCollections(activeId = null) {
isCollectionsLoading.set(true);
activeCollection.set({});
collections.set([]);
return ApiClient.collections.getFullList(200, {
"sort": "+created",
})
.then((items) => {
collections.set(CommonHelper.sortCollections(items));
const item = activeId && CommonHelper.findByKey(items, "id", activeId);
if (item) {
activeCollection.set(item);
} else if (items.length) {
activeCollection.set(items[0]);
}
try {
let items = await ApiClient.collections.getFullList(200, {
"sort": "+created",
})
.catch((err) => {
ApiClient.errorResponseHandler(err);
})
.finally(() => {
isCollectionsLoading.set(false);
});
items = CommonHelper.sortCollections(items);
collections.set(items);
const item = activeId && CommonHelper.findByKey(items, "id", activeId);
if (item) {
activeCollection.set(item);
} else if (items.length) {
activeCollection.set(items[0]);
}
} catch (err) {
ApiClient.errorResponseHandler(err);
}
isCollectionsLoading.set(false);
}