diff --git a/app/src/composables/use-item/use-item.ts b/app/src/composables/use-item/use-item.ts index ff8129467e..e4bda86f4f 100644 --- a/app/src/composables/use-item/use-item.ts +++ b/app/src/composables/use-item/use-item.ts @@ -17,7 +17,7 @@ export function useItem(collection: Ref, primaryKey: Ref primaryKey.value === '+'); const isBatch = computed(() => typeof primaryKey.value === 'string' && primaryKey.value.includes(',')); - const isSingle = computed(() => !!collectionInfo.value?.single); + const isSingle = computed(() => !!collectionInfo.value?.system?.single); const endpoint = computed(() => { return collection.value.startsWith('directus_') diff --git a/app/src/interfaces/many-to-one/many-to-one.vue b/app/src/interfaces/many-to-one/many-to-one.vue index fd7ccf29fa..63a010e750 100644 --- a/app/src/interfaces/many-to-one/many-to-one.vue +++ b/app/src/interfaces/many-to-one/many-to-one.vue @@ -336,12 +336,10 @@ export default defineComponent({ }); const relatedCollection = computed(() => { - if (!relation.value) return null; - return collectionsStore.getCollection(relation.value.one_collection); + return collectionsStore.getCollection(relation.value.one_collection)! }); - const { collection } = toRefs(relatedCollection.value); - const { primaryKeyField: relatedPrimaryKeyField } = useCollection(collection as Ref); + const { primaryKeyField: relatedPrimaryKeyField } = useCollection(relatedCollection.value.collection); return { relation, relatedCollection, relatedPrimaryKeyField }; } @@ -363,7 +361,7 @@ export default defineComponent({ function usePreview() { const displayTemplate = computed(() => { if (props.template !== null) return props.template; - return collectionInfo.value?.display_template; + return collectionInfo.value?.system?.display_template; }); const requiredFields = computed(() => { diff --git a/app/src/interfaces/one-to-many/one-to-many.vue b/app/src/interfaces/one-to-many/one-to-many.vue index b5fa3af0f9..60f4898db9 100644 --- a/app/src/interfaces/one-to-many/one-to-many.vue +++ b/app/src/interfaces/one-to-many/one-to-many.vue @@ -138,8 +138,7 @@ export default defineComponent({ }); const relatedCollection = computed(() => { - if (!relation.value) return null; - return collectionsStore.getCollection(relation.value.many_collection); + return collectionsStore.getCollection(relation.value.many_collection)!; }); const { primaryKeyField: relatedPrimaryKeyField } = useCollection(relatedCollection.value.collection); diff --git a/app/src/interfaces/translations/translations.vue b/app/src/interfaces/translations/translations.vue index efce052034..32a11c8e95 100644 --- a/app/src/interfaces/translations/translations.vue +++ b/app/src/interfaces/translations/translations.vue @@ -110,13 +110,10 @@ export default defineComponent({ }); const relatedCollection = computed(() => { - if (!relation.value) return null; - return collectionsStore.getCollection(relation.value.many_collection); + return collectionsStore.getCollection(relation.value.many_collection)!; }); - const { collection } = toRefs(relatedCollection.value); - - const { primaryKeyField: relatedPrimaryKeyField } = useCollection(collection as Ref); + const { primaryKeyField: relatedPrimaryKeyField } = useCollection(relatedCollection.value.collection); return { relation, relatedCollection, relatedPrimaryKeyField }; } diff --git a/app/src/modules/collections/composables/use-navigation.ts b/app/src/modules/collections/composables/use-navigation.ts index f89106f3de..039d603c17 100644 --- a/app/src/modules/collections/composables/use-navigation.ts +++ b/app/src/modules/collections/composables/use-navigation.ts @@ -38,7 +38,7 @@ export default function useNavigation() { const navItem: NavItem = { collection: collection, name: collectionInfo.name, - icon: collectionInfo.icon, + icon: collectionInfo.system?.icon || 'box', to: `/collections/${collection}`, }; @@ -57,7 +57,7 @@ export default function useNavigation() { const navItem: NavItem = { collection: collection.collection, name: collection.name, - icon: collection.icon, + icon: collection.system?.icon || 'box', to: `/collections/${collection.collection}`, }; diff --git a/app/src/modules/collections/routes/browse-or-detail/browse-or-detail.vue b/app/src/modules/collections/routes/browse-or-detail/browse-or-detail.vue index dbceb7df77..4029d54ab5 100644 --- a/app/src/modules/collections/routes/browse-or-detail/browse-or-detail.vue +++ b/app/src/modules/collections/routes/browse-or-detail/browse-or-detail.vue @@ -26,7 +26,7 @@ export default defineComponent({ const isSingle = computed(() => { const collectionInfo = collectionsStore.getCollection(props.collection); - return !!collectionInfo?.single === true; + return !!collectionInfo?.system?.single === true; }); return { component, isSingle }; diff --git a/app/src/modules/settings/routes/data-model/collections/collections.vue b/app/src/modules/settings/routes/data-model/collections/collections.vue index 30e5c0420b..b9f38d81e9 100644 --- a/app/src/modules/settings/routes/data-model/collections/collections.vue +++ b/app/src/modules/settings/routes/data-model/collections/collections.vue @@ -178,8 +178,7 @@ export default defineComponent({ return sortBy( collectionsStore.state.collections .filter((collection) => collection.collection.startsWith('directus_') === false) - .filter((collection) => collection.system === null) - .map((collection) => ({ ...collection, system: { icon: 'block' }})), + .filter((collection) => collection.system === null), 'collection' ); }); diff --git a/app/src/modules/settings/routes/data-model/collections/components/collection-options/collection-options.vue b/app/src/modules/settings/routes/data-model/collections/components/collection-options/collection-options.vue index 37abb34963..8a1ac2bae7 100644 --- a/app/src/modules/settings/routes/data-model/collections/components/collection-options/collection-options.vue +++ b/app/src/modules/settings/routes/data-model/collections/components/collection-options/collection-options.vue @@ -1,6 +1,6 @@