diff --git a/app/src/components/v-chip/v-chip.vue b/app/src/components/v-chip/v-chip.vue index d385c9a6e7..30dbe930e8 100644 --- a/app/src/components/v-chip/v-chip.vue +++ b/app/src/components/v-chip/v-chip.vue @@ -75,8 +75,8 @@ export default defineComponent({ diff --git a/app/src/interfaces/one-to-many/options.vue b/app/src/interfaces/one-to-many/options.vue index 1ac74395b9..aa0ab974d5 100644 --- a/app/src/interfaces/one-to-many/options.vue +++ b/app/src/interfaces/one-to-many/options.vue @@ -1,11 +1,11 @@ @@ -17,10 +17,18 @@ import { useRelationsStore } from '@/stores/'; export default defineComponent({ props: { + collection: { + type: String, + required: true, + }, fieldData: { type: Object as PropType, default: null, }, + relations: { + type: Array as PropType, + default: () => [], + }, value: { type: Object as PropType, default: null, @@ -33,26 +41,24 @@ export default defineComponent({ get() { return props.value?.fields; }, - set(newTemplate: string) { + set(newFields: string) { emit('input', { ...(props.value || {}), - fields: newTemplate, + fields: newFields, }); }, }); - const collection = computed(() => { - const collection = props.fieldData.meta?.collection; - const field = props.fieldData.field; - - if (collection == null || field == null) return null; - - const relationData: Relation[] = relationsStore.getRelationsForField(collection, field); - - return relationData.find((r) => r.one_collection === collection && r.one_field === field)?.many_collection; + const relatedCollection = computed(() => { + if (!props.fieldData || !props.relations || props.relations.length === 0) return null; + const { field } = props.fieldData; + const relatedRelation = props.relations.find( + (relation) => relation.one_collection === props.collection && relation.one_field === field + ); + return relatedRelation?.many_collection || null; }); - return { fields, collection }; + return { fields, relatedCollection }; }, }); @@ -60,7 +66,7 @@ export default defineComponent({ diff --git a/app/src/lang/en-US/index.json b/app/src/lang/en-US/index.json index bbe13d0df8..065da128ac 100644 --- a/app/src/lang/en-US/index.json +++ b/app/src/lang/en-US/index.json @@ -10,6 +10,8 @@ "only_show_the_file_extension": "Only show the file extension", "textarea": "Textarea", + "add_field": "Add Field", + "role_name": "Role Name", "db_only_click_to_configure": "Database Only: Click to Configure ", @@ -1036,6 +1038,8 @@ } }, + "no_fields_in_collection": "There are no fields in \"{collection}\" yet", + "do_nothing": "Do Nothing", "generate_and_save_uuid": "Generate and Save UUID", "save_current_user_id": "Save Current User ID", diff --git a/app/src/lang/en-US/interfaces.json b/app/src/lang/en-US/interfaces.json index df6183ea09..4a962fef3e 100644 --- a/app/src/lang/en-US/interfaces.json +++ b/app/src/lang/en-US/interfaces.json @@ -132,7 +132,7 @@ "one-to-many": "One to Many", "description": "Select multiple related items", "readable_fields_copy": "Select the fields that the user can view", - "no_collection": "No matching relation could be found" + "no_collection": "The collection could not be found" }, "radio-buttons": { "radio-buttons": "Radio Buttons", diff --git a/app/src/modules/settings/routes/data-model/field-detail/components/interface.vue b/app/src/modules/settings/routes/data-model/field-detail/components/interface.vue index c1da0d9529..2af73fbab3 100644 --- a/app/src/modules/settings/routes/data-model/field-detail/components/interface.vue +++ b/app/src/modules/settings/routes/data-model/field-detail/components/interface.vue @@ -24,7 +24,9 @@ @@ -33,7 +35,7 @@