mirror of
https://github.com/directus/directus.git
synced 2026-01-27 21:17:56 -05:00
Disable relationship setup for existing fields
This commit is contained in:
@@ -12,12 +12,13 @@
|
||||
:items="collectionItems"
|
||||
v-model="junctionCollection"
|
||||
:placeholder="$t('select_one')"
|
||||
:disabled="isExisting"
|
||||
/>
|
||||
</div>
|
||||
<div class="field">
|
||||
<div class="type-label">{{ $t('related_collection') }}</div>
|
||||
<v-select
|
||||
:disabled="type === 'files'"
|
||||
:disabled="type === 'files' || isExisting"
|
||||
:items="collectionItems"
|
||||
v-model="relations[1].one_collection"
|
||||
:placeholder="$t('select_one')"
|
||||
@@ -25,7 +26,7 @@
|
||||
</div>
|
||||
<v-input disabled :value="relations[0].one_primary" />
|
||||
<v-select
|
||||
:disabled="!junctionCollection"
|
||||
:disabled="!junctionCollection || isExisting"
|
||||
:items="junctionFields"
|
||||
v-model="relations[0].many_field"
|
||||
:placeholder="$t('select_one')"
|
||||
@@ -33,7 +34,7 @@
|
||||
<div class="spacer" />
|
||||
<div class="spacer" />
|
||||
<v-select
|
||||
:disabled="!junctionCollection"
|
||||
:disabled="!junctionCollection || isExisting"
|
||||
:items="junctionFields"
|
||||
v-model="relations[1].many_field"
|
||||
:placeholder="$t('select_one')"
|
||||
@@ -63,6 +64,10 @@ export default defineComponent({
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
isExisting: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
setup(props) {
|
||||
const collectionsStore = useCollectionsStore();
|
||||
|
||||
@@ -8,16 +8,21 @@
|
||||
</div>
|
||||
<div class="field">
|
||||
<div class="type-label">{{ $t('related_collection') }}</div>
|
||||
<v-select :placeholder="$t('select_one')" :items="items" v-model="relations[0].one_collection" />
|
||||
<v-select
|
||||
:placeholder="$t('select_one')"
|
||||
:items="items"
|
||||
v-model="relations[0].one_collection"
|
||||
:disabled="isExisting"
|
||||
/>
|
||||
</div>
|
||||
<v-input disabled :value="fieldData.field" />
|
||||
<v-input disabled :value="relatedPrimary" />
|
||||
<v-icon name="arrow_back" />
|
||||
</div>
|
||||
|
||||
<v-divider />
|
||||
<v-divider v-if="!isExisting" />
|
||||
|
||||
<div class="grid">
|
||||
<div class="grid" v-if="!isExisting">
|
||||
<div class="field">
|
||||
<div class="type-label">{{ $t('create_corresponding_field') }}</div>
|
||||
<v-checkbox block :label="correspondingLabel" v-model="hasCorresponding" />
|
||||
@@ -52,6 +57,10 @@ export default defineComponent({
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
isExisting: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
setup(props, { emit }) {
|
||||
const collectionsStore = useCollectionsStore();
|
||||
@@ -106,7 +115,7 @@ export default defineComponent({
|
||||
if (enabled === true) {
|
||||
state.newFields = [
|
||||
{
|
||||
field: '',
|
||||
field: state.relations[0].one_collection,
|
||||
collection: state.relations[0].one_collection,
|
||||
meta: {
|
||||
special: 'o2m',
|
||||
|
||||
@@ -8,12 +8,17 @@
|
||||
</div>
|
||||
<div class="field">
|
||||
<div class="type-label">{{ $t('related_collection') }}</div>
|
||||
<v-select :placeholder="$t('select_one')" :items="items" v-model="collectionMany" />
|
||||
<v-select
|
||||
:placeholder="$t('select_one')"
|
||||
:items="items"
|
||||
v-model="collectionMany"
|
||||
:disabled="isExisting"
|
||||
/>
|
||||
</div>
|
||||
<v-input disabled :value="currentCollectionPrimaryKey.field" />
|
||||
<v-select
|
||||
v-model="relations[0].many_field"
|
||||
:disabled="!relations[0].many_collection"
|
||||
:disabled="!relations[0].many_collection || isExisting"
|
||||
:items="fields"
|
||||
:placeholder="!relations[0].many_collection ? $t('select_one') : $t('select_one')"
|
||||
/>
|
||||
@@ -42,6 +47,10 @@ export default defineComponent({
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
isExisting: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
setup(props, { emit }) {
|
||||
const collectionsStore = useCollectionsStore();
|
||||
|
||||
@@ -1,7 +1,17 @@
|
||||
<template>
|
||||
<relationship-m2o :collection="collection" :type="type" v-if="type === 'm2o' || type === 'file'" />
|
||||
<relationship-o2m :collection="collection" :type="type" v-else-if="type === 'o2m'" />
|
||||
<relationship-m2m :collection="collection" :type="type" v-else-if="type === 'm2m' || type === 'files'" />
|
||||
<relationship-m2o
|
||||
:collection="collection"
|
||||
:is-existing="isExisting"
|
||||
:type="type"
|
||||
v-if="type === 'm2o' || type === 'file'"
|
||||
/>
|
||||
<relationship-o2m :collection="collection" :is-existing="isExisting" :type="type" v-else-if="type === 'o2m'" />
|
||||
<relationship-m2m
|
||||
:collection="collection"
|
||||
:is-existing="isExisting"
|
||||
:type="type"
|
||||
v-else-if="type === 'm2m' || type === 'files'"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
@@ -28,6 +38,10 @@ export default defineComponent({
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
isExisting: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user