mirror of
https://github.com/directus/directus.git
synced 2026-02-12 03:35:07 -05:00
Default field sort order to database ordinal sort
And use alphabetical where appropriate Fixes #4341
This commit is contained in:
@@ -1,8 +0,0 @@
|
||||
import { TranslateResult } from 'vue-i18n';
|
||||
|
||||
export type FieldTree = {
|
||||
field: string;
|
||||
name: string | TranslateResult;
|
||||
key: string;
|
||||
children?: FieldTree[];
|
||||
};
|
||||
@@ -1,5 +1,4 @@
|
||||
import { Ref, computed } from '@vue/composition-api';
|
||||
import { FieldTree } from './types';
|
||||
import { useFieldsStore, useRelationsStore } from '@/stores/';
|
||||
import { Field, Relation } from '@/types';
|
||||
import { cloneDeep } from 'lodash';
|
||||
@@ -18,7 +17,7 @@ export default function useFieldTree(
|
||||
return { tree };
|
||||
|
||||
function parseLevel(collection: string, parentPath: string | null, level = 0) {
|
||||
const fieldsInLevel = cloneDeep(fieldsStore.getFieldsForCollection(collection))
|
||||
const fieldsInLevel = cloneDeep(fieldsStore.getFieldsForCollectionAlphabetical(collection))
|
||||
.filter((field: Field) => {
|
||||
const shown =
|
||||
field.meta?.special?.includes('alias') !== true && field.meta?.special?.includes('no-data') !== true;
|
||||
@@ -60,62 +59,4 @@ export default function useFieldTree(
|
||||
|
||||
return fieldsInLevel;
|
||||
}
|
||||
|
||||
// const tree = computed<FieldTree[]>(() => {
|
||||
// return [...fieldsStore.getFieldsForCollection(collection.value), ...(inject?.fields || [])]
|
||||
// .filter((field: Field) => {
|
||||
// const shown =
|
||||
// field.meta?.special?.includes('alias') !== true &&
|
||||
// field.meta?.special?.includes('no-data') !== true;
|
||||
// return shown;
|
||||
// })
|
||||
// .map((field: Field) => parseField(field, []));
|
||||
|
||||
// function parseField(field: Field, parents: Field[]) {
|
||||
// const fieldInfo: FieldTree = {
|
||||
// field: field.field,
|
||||
// name: field.name,
|
||||
// };
|
||||
|
||||
// if (parents.length === 2) {
|
||||
// return fieldInfo;
|
||||
// }
|
||||
|
||||
// const relations = [
|
||||
// ...relationsStore.getRelationsForField(field.collection, field.field),
|
||||
// ...(inject?.relations || []).filter(
|
||||
// (relation) =>
|
||||
// (relation.many_collection === field.collection && relation.many_field === field.field) ||
|
||||
// (relation.one_collection === field.collection && relation.one_field === field.field)
|
||||
// ),
|
||||
// ];
|
||||
|
||||
// if (relations.length > 0) {
|
||||
// const relatedFields = relations
|
||||
// .map((relation: Relation) => {
|
||||
// const relatedCollection =
|
||||
// relation.many_collection === field.collection
|
||||
// ? relation.one_collection
|
||||
// : relation.many_collection;
|
||||
|
||||
// if (relation.junction_field === field.field) return [];
|
||||
|
||||
// return fieldsStore.getFieldsForCollection(relatedCollection).filter((field: Field) => {
|
||||
// const shown =
|
||||
// field.meta?.special?.includes('alias') !== true &&
|
||||
// field.meta?.special?.includes('no-data') !== true;
|
||||
// return shown;
|
||||
// });
|
||||
// })
|
||||
// .flat()
|
||||
// .map((childField: Field) => parseField(childField, [...parents, field]));
|
||||
|
||||
// fieldInfo.children = relatedFields;
|
||||
// }
|
||||
|
||||
// return fieldInfo;
|
||||
// }
|
||||
// });
|
||||
|
||||
// return { tree };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user