[#3000] disallowed relations to views from non-view collections
This commit is contained in:
@@ -31,6 +31,8 @@
|
||||
let isSingle = field.options?.maxSelect == 1;
|
||||
let oldIsSingle = isSingle;
|
||||
|
||||
$: selectCollections = $collections.filter((c) => c.type != "view");
|
||||
|
||||
// load defaults
|
||||
$: if (CommonHelper.isEmpty(field.options)) {
|
||||
loadDefaults();
|
||||
@@ -101,11 +103,11 @@
|
||||
>
|
||||
<ObjectSelect
|
||||
id={uniqueId}
|
||||
searchable={$collections.length > 5}
|
||||
searchable={selectCollections.length > 5}
|
||||
selectPlaceholder={"Select collection *"}
|
||||
noOptionsText="No collections found"
|
||||
selectionKey="id"
|
||||
items={$collections}
|
||||
items={selectCollections}
|
||||
readonly={!interactive || field.id}
|
||||
bind:keyOfSelected={field.options.collectionId}
|
||||
>
|
||||
@@ -224,7 +226,7 @@
|
||||
<CollectionUpsertPanel
|
||||
bind:this={upsertPanel}
|
||||
on:save={(e) => {
|
||||
if (e?.detail?.collection?.id) {
|
||||
if (e?.detail?.collection?.id && e.detail.collection.type != "view") {
|
||||
field.options.collectionId = e.detail.collection.id;
|
||||
}
|
||||
}}
|
||||
|
||||
@@ -27,12 +27,13 @@
|
||||
}
|
||||
|
||||
$: if (needLoad(list, value)) {
|
||||
isLoading = true;
|
||||
// Move the load function to the end of the execution queue.
|
||||
//
|
||||
// It helps reducing the layout shifts (the relation field has fixed height skeleton loader)
|
||||
// and allows the other form fields to load sooner.
|
||||
clearTimeout(loadTimeoutId);
|
||||
loadTimeoutId = setTimeout(load, 0);
|
||||
loadTimeoutId = setTimeout(load, 50);
|
||||
}
|
||||
|
||||
function needLoad() {
|
||||
@@ -91,6 +92,10 @@
|
||||
}
|
||||
|
||||
list = list;
|
||||
|
||||
// ensure that any record that was deleted during the request
|
||||
// is also removed from the relation value
|
||||
listToValue();
|
||||
} catch (err) {
|
||||
ApiClient.error(err);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user