mirror of
https://github.com/directus/directus.git
synced 2026-02-11 19:35:04 -05:00
@@ -121,6 +121,7 @@ export default defineComponent({
|
||||
});
|
||||
|
||||
item.value = response.data.data;
|
||||
|
||||
if (item.value) {
|
||||
if (te(`field_options.directus_activity.${item.value.action}`))
|
||||
item.value.action_translated = t(`field_options.directus_activity.${item.value.action}`);
|
||||
|
||||
@@ -126,11 +126,13 @@ const name = computed(() => translate(props.bookmark.bookmark));
|
||||
|
||||
function useEditBookmark() {
|
||||
const editActive = ref(false);
|
||||
|
||||
const editValue = reactive({
|
||||
name: props.bookmark.bookmark,
|
||||
icon: props.bookmark?.icon ?? 'bookmark',
|
||||
color: props.bookmark?.color ?? null,
|
||||
});
|
||||
|
||||
const editSaving = ref(false);
|
||||
|
||||
return { editActive, editValue, editSave, editSaving, editCancel };
|
||||
|
||||
@@ -73,6 +73,7 @@ export default defineComponent({
|
||||
|
||||
const dense = computed(() => collectionsStore.visibleCollections.length > 5);
|
||||
const showSearch = computed(() => collectionsStore.visibleCollections.length > 20);
|
||||
|
||||
const hasHiddenCollections = computed(
|
||||
() => collectionsStore.allCollections.length > collectionsStore.visibleCollections.length
|
||||
);
|
||||
|
||||
@@ -604,6 +604,7 @@ export default defineComponent({
|
||||
icon: bookmark.icon,
|
||||
color: bookmark.color,
|
||||
});
|
||||
|
||||
router.push(`/content/${newBookmark.collection}?bookmark=${newBookmark.id}`);
|
||||
|
||||
bookmarkDialogActive.value = false;
|
||||
@@ -628,6 +629,7 @@ export default defineComponent({
|
||||
const updatePermissions = permissionsStore.permissions.find(
|
||||
(permission) => permission.action === 'update' && permission.collection === collection.value
|
||||
);
|
||||
|
||||
return !!updatePermissions;
|
||||
});
|
||||
|
||||
@@ -639,6 +641,7 @@ export default defineComponent({
|
||||
const updatePermissions = permissionsStore.permissions.find(
|
||||
(permission) => permission.action === 'update' && permission.collection === collection.value
|
||||
);
|
||||
|
||||
if (!updatePermissions) return false;
|
||||
if (!updatePermissions.fields) return false;
|
||||
if (updatePermissions.fields.includes('*')) return true;
|
||||
@@ -652,6 +655,7 @@ export default defineComponent({
|
||||
const deletePermissions = permissionsStore.permissions.find(
|
||||
(permission) => permission.action === 'delete' && permission.collection === collection.value
|
||||
);
|
||||
|
||||
return !!deletePermissions;
|
||||
});
|
||||
|
||||
@@ -662,6 +666,7 @@ export default defineComponent({
|
||||
const createPermissions = permissionsStore.permissions.find(
|
||||
(permission) => permission.action === 'create' && permission.collection === collection.value
|
||||
);
|
||||
|
||||
return !!createPermissions;
|
||||
});
|
||||
|
||||
|
||||
@@ -286,6 +286,7 @@ export default defineComponent({
|
||||
if (!props.file) return null;
|
||||
if (!props.file.folder) return;
|
||||
loading.value = true;
|
||||
|
||||
try {
|
||||
const response = await api.get(`/folders/${props.file.folder}`, {
|
||||
params: {
|
||||
|
||||
@@ -76,6 +76,7 @@ export default defineModule({
|
||||
const permission = permissions.find(
|
||||
(permission) => permission.collection === 'directus_files' && permission.action === 'read'
|
||||
);
|
||||
|
||||
return !!permission;
|
||||
},
|
||||
});
|
||||
|
||||
@@ -317,6 +317,7 @@ export default defineComponent({
|
||||
onBeforeRouteLeave(() => {
|
||||
selection.value = [];
|
||||
});
|
||||
|
||||
onBeforeRouteUpdate(() => {
|
||||
selection.value = [];
|
||||
});
|
||||
@@ -494,6 +495,7 @@ export default defineComponent({
|
||||
const updatePermissions = permissionsStore.permissions.find(
|
||||
(permission) => permission.action === 'update' && permission.collection === 'directus_files'
|
||||
);
|
||||
|
||||
return !!updatePermissions;
|
||||
});
|
||||
|
||||
@@ -504,6 +506,7 @@ export default defineComponent({
|
||||
const deletePermissions = permissionsStore.permissions.find(
|
||||
(permission) => permission.action === 'delete' && permission.collection === 'directus_files'
|
||||
);
|
||||
|
||||
return !!deletePermissions;
|
||||
});
|
||||
|
||||
@@ -514,6 +517,7 @@ export default defineComponent({
|
||||
const createPermissions = permissionsStore.permissions.find(
|
||||
(permission) => permission.action === 'create' && permission.collection === 'directus_files'
|
||||
);
|
||||
|
||||
return !!createPermissions;
|
||||
});
|
||||
|
||||
@@ -524,6 +528,7 @@ export default defineComponent({
|
||||
const createPermissions = permissionsStore.permissions.find(
|
||||
(permission) => permission.action === 'create' && permission.collection === 'directus_folders'
|
||||
);
|
||||
|
||||
return !!createPermissions;
|
||||
});
|
||||
|
||||
|
||||
@@ -244,6 +244,7 @@ const { confirmLeave, leaveTo } = useEditsGuard(hasEdits);
|
||||
|
||||
const confirmDelete = ref(false);
|
||||
const editActive = ref(false);
|
||||
|
||||
const fileSrc = computed(() => {
|
||||
if (item.value && item.value.modified_on) {
|
||||
return `assets/${props.primaryKey}?cache-buster=${item.value.modified_on}&key=system-large-contain`;
|
||||
|
||||
@@ -165,8 +165,10 @@ function generateFields(updates: StateUpdates, state: State, { getCurrent }: Hel
|
||||
const junctionCurrent = getCurrent('relations.o2m.field');
|
||||
const junctionRelated = getCurrent('relations.m2o.field');
|
||||
const relatedCollection = getCurrent('relations.m2o.related_collection');
|
||||
|
||||
const relatedPrimaryKeyField =
|
||||
fieldsStore.getPrimaryKeyFieldForCollection(relatedCollection) ?? getCurrent('collections.related.fields[0]');
|
||||
|
||||
const sort = getCurrent('relations.o2m.meta.sort_field');
|
||||
|
||||
if (junctionCollection && junctionCurrent && fieldExists(junctionCollection, junctionCurrent) === false) {
|
||||
@@ -218,6 +220,7 @@ export function setDefaults(updates: StateUpdates, state: State, { getCurrent }:
|
||||
const fieldsStore = useFieldsStore();
|
||||
|
||||
const currentCollection = state.collection!;
|
||||
|
||||
const currentCollectionPrimaryKeyField =
|
||||
fieldsStore.getPrimaryKeyFieldForCollection(currentCollection)?.field ?? 'id';
|
||||
|
||||
|
||||
@@ -96,6 +96,7 @@ export function setDefaults(updates: StateUpdates, state: State, { getCurrent }:
|
||||
const fieldsStore = useFieldsStore();
|
||||
|
||||
const currentCollection = state.collection!;
|
||||
|
||||
const currentCollectionPrimaryKeyField =
|
||||
fieldsStore.getPrimaryKeyFieldForCollection(currentCollection)?.field ?? 'id';
|
||||
|
||||
@@ -105,11 +106,13 @@ export function setDefaults(updates: StateUpdates, state: State, { getCurrent }:
|
||||
set(updates, 'relations.o2m.field', `${currentCollection}_${currentCollectionPrimaryKeyField}`);
|
||||
set(updates, 'relations.m2o.collection', junctionName);
|
||||
set(updates, 'relations.m2o.field', 'item');
|
||||
|
||||
set(
|
||||
updates,
|
||||
'relations.m2o.meta.one_allowed_collections',
|
||||
getCurrent('relations.m2o.meta.one_allowed_collections') ?? []
|
||||
);
|
||||
|
||||
set(updates, 'relations.m2o.meta.one_collection_field', 'collection');
|
||||
}
|
||||
|
||||
|
||||
@@ -125,6 +125,7 @@ export function autoGenerateJunctionFields(updates: StateUpdates, state: State,
|
||||
|
||||
const currentCollection = state.collection!;
|
||||
const currentPrimaryKeyField = fieldsStore.getPrimaryKeyFieldForCollection(currentCollection)?.field ?? 'id';
|
||||
|
||||
const relatedCollection =
|
||||
updates.relations?.m2o?.related_collection ?? getCurrent('relations.m2o.related_collection');
|
||||
|
||||
@@ -251,8 +252,10 @@ function generateFields(updates: StateUpdates, state: State, { getCurrent }: Hel
|
||||
const junctionRelated = getCurrent('relations.m2o.field');
|
||||
const sort = getCurrent('relations.o2m.meta.sort_field');
|
||||
const relatedCollection = getCurrent('relations.m2o.related_collection');
|
||||
|
||||
const relatedPrimaryKeyField =
|
||||
fieldsStore.getPrimaryKeyFieldForCollection(relatedCollection) ?? getCurrent('collections.related.fields[0]');
|
||||
|
||||
const existsJunctionRelated = relationsStore.relations.find(
|
||||
(relation) => relation.collection === junctionCollection && relation.field === junctionRelated
|
||||
);
|
||||
|
||||
@@ -118,6 +118,7 @@ export function updateJunctionRelated(updates: StateUpdates, _state: State, { ge
|
||||
const fieldsStore = useFieldsStore();
|
||||
|
||||
const relatedCollection = getCurrent('relations.m2o.related_collection');
|
||||
|
||||
const relatedCollectionPrimaryKeyField =
|
||||
fieldsStore.getPrimaryKeyFieldForCollection(relatedCollection)?.field ?? 'id';
|
||||
|
||||
@@ -289,8 +290,10 @@ function generateFields(updates: StateUpdates, state: State, { getCurrent }: Hel
|
||||
const junctionCurrent = getCurrent('relations.o2m.field');
|
||||
const junctionRelated = getCurrent('relations.m2o.field');
|
||||
const relatedCollection = getCurrent('relations.m2o.related_collection');
|
||||
|
||||
const relatedPrimaryKeyField =
|
||||
fieldsStore.getPrimaryKeyFieldForCollection(relatedCollection) ?? getCurrent('collections.related.fields[0]');
|
||||
|
||||
const sort = getCurrent('relations.o2m.sort_field');
|
||||
|
||||
if (junctionCollection && junctionCurrent && fieldExists(junctionCollection, junctionCurrent) === false) {
|
||||
@@ -342,6 +345,7 @@ export function setDefaults(updates: StateUpdates, state: State, { getCurrent }:
|
||||
const fieldsStore = useFieldsStore();
|
||||
|
||||
const currentCollection = state.collection!;
|
||||
|
||||
const currentCollectionPrimaryKeyField =
|
||||
fieldsStore.getPrimaryKeyFieldForCollection(currentCollection)?.field ?? 'id';
|
||||
|
||||
@@ -353,6 +357,7 @@ export function setDefaults(updates: StateUpdates, state: State, { getCurrent }:
|
||||
set(updates, 'relations.m2o.related_collection', getCurrent('relations.m2o.related_collection') ?? 'languages');
|
||||
|
||||
const languagesCollection = getCurrent('relations.m2o.related_collection');
|
||||
|
||||
const languagesCollectionPrimaryKeyField =
|
||||
fieldsStore.getPrimaryKeyFieldForCollection(languagesCollection)?.field ?? 'id';
|
||||
|
||||
|
||||
@@ -36,17 +36,20 @@ describe('Actions', () => {
|
||||
describe('startEditing', () => {
|
||||
it('New Field', () => {
|
||||
const fieldDetailStore = useFieldDetailStore();
|
||||
|
||||
const testValue: { collection: string; field: string; localType: 'presentation' } = {
|
||||
collection: 'collection_a',
|
||||
field: '+',
|
||||
localType: 'presentation',
|
||||
};
|
||||
|
||||
fieldDetailStore.startEditing(testValue.collection, testValue.field, testValue.localType);
|
||||
expect(fieldDetailStore.collection).toEqual(testValue.collection);
|
||||
expect(fieldDetailStore.field.collection).toEqual(testValue.collection);
|
||||
expect(fieldDetailStore.editing).toEqual(testValue.field);
|
||||
expect(fieldDetailStore.localType).toEqual(testValue.localType);
|
||||
});
|
||||
|
||||
it('Existing Field — M2O', () => {
|
||||
const mockedField = {
|
||||
collection: 'collection_a',
|
||||
@@ -58,6 +61,7 @@ describe('Actions', () => {
|
||||
},
|
||||
name: 'Collection A Field',
|
||||
};
|
||||
|
||||
const fieldsStore = useFieldsStore();
|
||||
(fieldsStore.getField as Mock).mockReturnValue(mockedField);
|
||||
|
||||
@@ -79,6 +83,7 @@ describe('Actions', () => {
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
const relationsStore = useRelationsStore();
|
||||
(relationsStore.getRelationsForField as Mock).mockReturnValue(mockedRelations);
|
||||
|
||||
@@ -90,6 +95,7 @@ describe('Actions', () => {
|
||||
expect(fieldDetailStore.field.name).toEqual(mockedField.name);
|
||||
expect(fieldDetailStore.localType).toEqual('m2o');
|
||||
expect(fieldDetailStore.relations.o2m).toEqual(undefined);
|
||||
|
||||
expect(fieldDetailStore.relations.m2o).toEqual(
|
||||
mockedRelations.find(
|
||||
(relation) => relation.collection === mockedField.collection && relation.field === mockedField.field
|
||||
@@ -97,6 +103,7 @@ describe('Actions', () => {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
it.todo('Existing Field — M2M');
|
||||
});
|
||||
|
||||
@@ -104,18 +111,22 @@ describe('Alterations', () => {
|
||||
describe('files', () => {
|
||||
it('autoGenerateJunctionRelation has changed', () => {
|
||||
const fieldDetailStore = useFieldDetailStore();
|
||||
|
||||
const testValue: { collection: string; field: string; localType: 'files' } = {
|
||||
collection: 'collection_a',
|
||||
field: '+',
|
||||
localType: 'files',
|
||||
};
|
||||
|
||||
fieldDetailStore.startEditing(testValue.collection, testValue.field, testValue.localType);
|
||||
|
||||
const fieldsStore = useFieldsStore();
|
||||
|
||||
(fieldsStore.getPrimaryKeyFieldForCollection as Mock).mockReturnValue({
|
||||
collection: 'collection_a',
|
||||
field: 'id',
|
||||
});
|
||||
|
||||
expect(fieldDetailStore.collection).toEqual(testValue.collection);
|
||||
expect(fieldDetailStore.field.collection).toEqual(testValue.collection);
|
||||
expect(fieldDetailStore.editing).toEqual(testValue.field);
|
||||
@@ -125,6 +136,7 @@ describe('Alterations', () => {
|
||||
expect(fieldDetailStore.relations.m2o?.field).toEqual('directus_files_id');
|
||||
|
||||
fieldDetailStore.update({ autoGenerateJunctionRelation: false });
|
||||
|
||||
fieldDetailStore.update({
|
||||
relations: {
|
||||
o2m: {
|
||||
@@ -132,6 +144,7 @@ describe('Alterations', () => {
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
fieldDetailStore.update({ autoGenerateJunctionRelation: true });
|
||||
|
||||
expect(fieldDetailStore.relations.o2m?.collection).toEqual('collection_a_files');
|
||||
|
||||
@@ -115,6 +115,7 @@ export const useFieldDetailStore = defineStore({
|
||||
this.loading = true;
|
||||
const response = await api.get(`/fields/${collection}/${field}`);
|
||||
const fetchedFieldMeta = response.data?.data?.meta;
|
||||
|
||||
this.$patch({
|
||||
field: {
|
||||
meta: {
|
||||
@@ -169,6 +170,7 @@ export const useFieldDetailStore = defineStore({
|
||||
|
||||
for (const relation of Object.values(this.relations)) {
|
||||
if (!relation || !relation.collection || !relation.field) continue;
|
||||
|
||||
if (
|
||||
// Duplicate checks for O2M & M2O
|
||||
(relation.collection === relation.related_collection && relation.field === relation.meta?.one_field) ||
|
||||
|
||||
@@ -196,6 +196,7 @@ export default defineComponent({
|
||||
'interface',
|
||||
computed(() => props.field.meta?.interface ?? null)
|
||||
);
|
||||
|
||||
const interfaceName = computed(() => inter.value?.name ?? null);
|
||||
|
||||
const hidden = computed(() => props.field.meta?.hidden === true);
|
||||
@@ -259,11 +260,13 @@ export default defineComponent({
|
||||
const duplicateActive = ref(false);
|
||||
const duplicateName = ref(props.field.field + '_copy');
|
||||
const duplicating = ref(false);
|
||||
|
||||
const collections = computed(() =>
|
||||
collectionsStore.collections
|
||||
.map(({ collection }) => collection)
|
||||
.filter((collection) => collection.startsWith('directus_') === false)
|
||||
);
|
||||
|
||||
const duplicateTo = ref(props.field.collection);
|
||||
|
||||
return {
|
||||
|
||||
@@ -69,6 +69,7 @@ const arrows = computed(() => {
|
||||
|
||||
if (props.arrowInfo?.id === panel.id && props.arrowInfo?.type === 'resolve') {
|
||||
const { x, y } = getPoints(panel, RESOLVE_OFFSET);
|
||||
|
||||
arrows.push({
|
||||
id: panel.id + '_resolve',
|
||||
d: createLine(x, y, props.arrowInfo.pos.x, props.arrowInfo.pos.y),
|
||||
@@ -77,6 +78,7 @@ const arrows = computed(() => {
|
||||
});
|
||||
} else if (resolveChild) {
|
||||
const { x, y, toX, toY } = getPoints(panel, RESOLVE_OFFSET, resolveChild);
|
||||
|
||||
arrows.push({
|
||||
id: panel.id + '_resolve',
|
||||
d: createLine(x, y, toX as number, toY as number),
|
||||
@@ -85,6 +87,7 @@ const arrows = computed(() => {
|
||||
});
|
||||
} else if (props.editMode && !props.arrowInfo && (panel.id === '$trigger' || props.hoveredPanel === panel.id)) {
|
||||
const { x: resolveX, y: resolveY } = getPoints(panel, RESOLVE_OFFSET);
|
||||
|
||||
arrows.push({
|
||||
id: panel.id + '_resolve',
|
||||
d: createLine(resolveX, resolveY, resolveX + 3 * 20, resolveY),
|
||||
@@ -96,6 +99,7 @@ const arrows = computed(() => {
|
||||
|
||||
if (props.arrowInfo?.id === panel.id && props.arrowInfo?.type === 'reject') {
|
||||
const { x, y } = getPoints(panel, REJECT_OFFSET);
|
||||
|
||||
arrows.push({
|
||||
id: panel.id + '_reject',
|
||||
d: createLine(x, y, props.arrowInfo.pos.x, props.arrowInfo.pos.y),
|
||||
@@ -104,6 +108,7 @@ const arrows = computed(() => {
|
||||
});
|
||||
} else if (rejectChild) {
|
||||
const { x, y, toX, toY } = getPoints(panel, REJECT_OFFSET, rejectChild);
|
||||
|
||||
arrows.push({
|
||||
id: panel.id + '_reject',
|
||||
d: createLine(x, y, toX as number, toY as number),
|
||||
@@ -112,6 +117,7 @@ const arrows = computed(() => {
|
||||
});
|
||||
} else if (props.editMode && !props.arrowInfo && panel.id !== '$trigger' && props.hoveredPanel === panel.id) {
|
||||
const { x: rejectX, y: rejectY } = getPoints(panel, REJECT_OFFSET);
|
||||
|
||||
arrows.push({
|
||||
id: panel.id + '_reject',
|
||||
d: createLine(rejectX, rejectY, rejectX + 3 * 20, rejectY),
|
||||
@@ -182,6 +188,7 @@ const arrows = computed(() => {
|
||||
}
|
||||
|
||||
const arrowSize = 8;
|
||||
|
||||
const arrow = `M ${points.at(-1)} L ${points
|
||||
.at(-1)
|
||||
?.clone()
|
||||
|
||||
@@ -183,6 +183,7 @@ const operationOptions = computed(() => {
|
||||
|
||||
function saveOperation() {
|
||||
saving.value = true;
|
||||
|
||||
emit('save', {
|
||||
flow: props.primaryKey,
|
||||
name: operationName.value || generatedName.value,
|
||||
|
||||
@@ -236,6 +236,7 @@ const pointermove = (event: PointerEvent) => {
|
||||
rafId = window.requestAnimationFrame(() => {
|
||||
moving.value = true;
|
||||
if (!down) return;
|
||||
|
||||
const arrowInfo: ArrowInfo =
|
||||
down === 'parent'
|
||||
? {
|
||||
|
||||
@@ -61,6 +61,7 @@ function saveTrigger() {
|
||||
...(props.flow ?? {}),
|
||||
...flowEdits.value,
|
||||
});
|
||||
|
||||
emit('update:open', false);
|
||||
}
|
||||
|
||||
|
||||
@@ -230,6 +230,7 @@ const flowsStore = useFlowsStore();
|
||||
const stagedFlow = ref<Partial<FlowRaw>>({});
|
||||
|
||||
const fetchedFlow = ref<FlowRaw>();
|
||||
|
||||
const flow = computed<FlowRaw | undefined>({
|
||||
get() {
|
||||
if (!fetchedFlow.value) return undefined;
|
||||
@@ -261,6 +262,7 @@ async function loadCurrentFlow() {
|
||||
fields: ['*', 'operations.*'],
|
||||
},
|
||||
});
|
||||
|
||||
fetchedFlow.value = response.data.data;
|
||||
} catch (err: any) {
|
||||
unexpectedError(err);
|
||||
@@ -688,6 +690,7 @@ function getNearAttachment(pos: Vector2) {
|
||||
(panel.x - 1) * 20 + ATTACHMENT_OFFSET.x,
|
||||
(panel.y - 1) * 20 + ATTACHMENT_OFFSET.y
|
||||
);
|
||||
|
||||
if (attachmentPos.distanceTo(pos) <= 40) return panel.id as string;
|
||||
}
|
||||
|
||||
|
||||
@@ -245,6 +245,7 @@ async function toggleFlowStatusById(id: string, value: string) {
|
||||
await api.patch(`/flows/${id}`, {
|
||||
status: value === 'active' ? 'inactive' : 'active',
|
||||
});
|
||||
|
||||
await flowsStore.hydrate();
|
||||
} catch (error) {
|
||||
unexpectedError(error as Error);
|
||||
|
||||
@@ -280,6 +280,7 @@ export default defineComponent({
|
||||
const updatePermissions = permissionsStore.permissions.find(
|
||||
(permission) => permission.action === 'update' && permission.collection === collection.value
|
||||
);
|
||||
|
||||
return !!updatePermissions;
|
||||
});
|
||||
|
||||
@@ -290,6 +291,7 @@ export default defineComponent({
|
||||
const deletePermissions = permissionsStore.permissions.find(
|
||||
(permission) => permission.action === 'delete' && permission.collection === collection.value
|
||||
);
|
||||
|
||||
return !!deletePermissions;
|
||||
});
|
||||
|
||||
@@ -300,6 +302,7 @@ export default defineComponent({
|
||||
const createPermissions = permissionsStore.permissions.find(
|
||||
(permission) => permission.action === 'create' && permission.collection === collection.value
|
||||
);
|
||||
|
||||
return !!createPermissions;
|
||||
});
|
||||
|
||||
|
||||
@@ -305,6 +305,7 @@ function useValues() {
|
||||
layout_options: null,
|
||||
filter: null,
|
||||
};
|
||||
|
||||
if (isNew.value === true) return defaultValues;
|
||||
if (preset.value === null) return defaultValues;
|
||||
|
||||
|
||||
@@ -193,6 +193,7 @@ export default defineComponent({
|
||||
const usersCreatePermission = permissionsStore.permissions.find(
|
||||
(permission) => permission.collection === 'directus_users' && permission.action === 'create'
|
||||
);
|
||||
|
||||
const rolesReadPermission = permissionsStore.permissions.find(
|
||||
(permission) => permission.collection === 'directus_roles' && permission.action === 'read'
|
||||
);
|
||||
|
||||
@@ -195,6 +195,7 @@ export default defineComponent({
|
||||
deep: { users: { _limit: 0 } },
|
||||
},
|
||||
});
|
||||
|
||||
role.value = response.data.data;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ export default function useNavigation(): { roles: Ref<BasicRole[] | null>; loadi
|
||||
fields: ['id', 'name', 'icon', 'admin_access'],
|
||||
},
|
||||
});
|
||||
|
||||
roles.value = rolesResponse.data.data;
|
||||
} catch (error: any) {
|
||||
unexpectedError(error);
|
||||
|
||||
@@ -244,6 +244,7 @@ const canInviteUsers = computed(() => {
|
||||
const usersCreatePermission = permissionsStore.permissions.find(
|
||||
(permission) => permission.collection === 'directus_users' && permission.action === 'create'
|
||||
);
|
||||
|
||||
const rolesReadPermission = permissionsStore.permissions.find(
|
||||
(permission) => permission.collection === 'directus_roles' && permission.action === 'read'
|
||||
);
|
||||
@@ -258,6 +259,7 @@ const { batchEditAllowed, batchDeleteAllowed, createAllowed } = usePermissions()
|
||||
onBeforeRouteLeave(() => {
|
||||
selection.value = [];
|
||||
});
|
||||
|
||||
onBeforeRouteUpdate(() => {
|
||||
selection.value = [];
|
||||
});
|
||||
@@ -340,6 +342,7 @@ function usePermissions() {
|
||||
const updatePermissions = permissionsStore.permissions.find(
|
||||
(permission) => permission.action === 'update' && permission.collection === 'directus_users'
|
||||
);
|
||||
|
||||
return !!updatePermissions;
|
||||
});
|
||||
|
||||
@@ -350,6 +353,7 @@ function usePermissions() {
|
||||
const deletePermissions = permissionsStore.permissions.find(
|
||||
(permission) => permission.action === 'delete' && permission.collection === 'directus_users'
|
||||
);
|
||||
|
||||
return !!deletePermissions;
|
||||
});
|
||||
|
||||
@@ -360,6 +364,7 @@ function usePermissions() {
|
||||
const createPermissions = permissionsStore.permissions.find(
|
||||
(permission) => permission.action === 'create' && permission.collection === 'directus_users'
|
||||
);
|
||||
|
||||
return !!createPermissions;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user