0
0
Fork 0
mirror of https://github.com/verdigado/organization_folders.git synced 2024-12-06 11:22:41 +01:00

finished implementing resource settings subresource creation; frontend design improvements

This commit is contained in:
Jonathan Treffler 2024-11-27 00:05:26 +01:00
parent 5d22b44c6d
commit 21d8e780cf
2 changed files with 33 additions and 12 deletions

View file

@ -15,13 +15,13 @@ const permissionGroups = computed(() => {
return [ return [
{ {
field: "managersAclPermission", field: "managersAclPermission",
label: "Resourcenadministrator*innen", label: "Manager*innen",
value: props.resource.managersAclPermission, value: props.resource.managersAclPermission,
mask: 31, mask: 31,
}, },
{ {
field: "membersAclPermission", field: "membersAclPermission",
label: "Resourcenmitglieder", label: "Mitglieder",
value: props.resource.membersAclPermission, value: props.resource.membersAclPermission,
mask: 31, mask: 31,
}, },

View file

@ -34,11 +34,11 @@ const resourceNameValid = computed(() => {
}); });
const saveName = async () => { const saveName = async () => {
resource.value = await api.updateResource(resource.value.id, { name: currentResourceName.value }, "model+members"); resource.value = await api.updateResource(resource.value.id, { name: currentResourceName.value }, "model+members+subresources");
}; };
const saveInheritManagers = async (inheritManagers) => { const saveInheritManagers = async (inheritManagers) => {
resource.value = await api.updateResource(resource.value.id, { inheritManagers }, "model+members"); resource.value = await api.updateResource(resource.value.id, { inheritManagers }, "model+members+subresources");
}; };
watch(() => props.resourceId, async (newResourceId) => { watch(() => props.resourceId, async (newResourceId) => {
@ -50,16 +50,22 @@ watch(() => props.resourceId, async (newResourceId) => {
const saveActive = async (active) => { const saveActive = async (active) => {
resourceActiveLoading.value = true; resourceActiveLoading.value = true;
resource.value = await api.updateResource(resource.value.id, { active }, "model+members"); resource.value = await api.updateResource(resource.value.id, { active }, "model+members+subresources");
resourceActiveLoading.value = false; resourceActiveLoading.value = false;
}; };
const savePermission = async ({ field, value }) => { const savePermission = async ({ field, value }) => {
resource.value = await api.updateResource(resource.value.id, { resource.value = await api.updateResource(resource.value.id, {
[field]: value, [field]: value,
}, "model+members"); }, "model+members+subresources");
}; };
const deleteResource = async (closeDialog) => {
await api.deleteResource(resource.value.id);
closeDialog();
backButtonClicked();
}
const switchToSnapshotRestoreView = () => { const switchToSnapshotRestoreView = () => {
}; };
@ -111,6 +117,21 @@ const backButtonClicked = () => {
}; };
const createSubResource = async (type, name) => {
resource.value.subResources.push(await api.createResource({
type,
organizationFolderId: resource.value.organizationFolderId,
name,
parentResourceId: resource.value.id,
active: true,
inheritManagers: true,
membersAclPermission: 0,
managersAclPermission: 31,
inheritedAclPermission: 1,
}));
}
</script> </script>
<template> <template>
@ -118,7 +139,7 @@ const backButtonClicked = () => {
:has-back-button="true" :has-back-button="true"
:has-next-step-button="false" :has-next-step-button="false"
:has-last-step-button="false" :has-last-step-button="false"
:title="'Resource Settings'" :title="resource?.type === api.ResourceTypes.FOLDER ? 'Folder Settings' : 'Settings'"
:loading="loading" :loading="loading"
v-slot="" v-slot=""
@back-button-pressed="backButtonClicked"> @back-button-pressed="backButtonClicked">
@ -136,7 +157,7 @@ const backButtonClicked = () => {
@trailing-button-click="saveName" @trailing-button-click="saveName"
@blur="() => currentResourceName = currentResourceName.trim()" @blur="() => currentResourceName = currentResourceName.trim()"
@keyup.enter="saveName" /> @keyup.enter="saveName" />
<NcCheckboxRadioSwitch :checked="resource.inheritManagers" @update:checked="saveInheritManagers">Manager aus oberer Ebene vererben</NcCheckboxRadioSwitch> <NcCheckboxRadioSwitch style="margin-top: 12px;" :checked="resource.inheritManagers" @update:checked="saveInheritManagers">Manager aus oberer Ebene vererben</NcCheckboxRadioSwitch>
</div> </div>
<h3>Berechtigungen</h3> <h3>Berechtigungen</h3>
<Permissions :resource="resource" @permissionUpdated="savePermission" /> <Permissions :resource="resource" @permissionUpdated="savePermission" />
@ -159,7 +180,7 @@ const backButtonClicked = () => {
:loading="resourceActiveLoading" :loading="resourceActiveLoading"
type="checkbox" type="checkbox"
@update:checked="saveActive"> @update:checked="saveActive">
Resource aktiv Ordner aktiv
</NcCheckboxRadioSwitch> </NcCheckboxRadioSwitch>
</div> </div>
<ConfirmDeleteDialog title="Ordner löschen" <ConfirmDeleteDialog title="Ordner löschen"
@ -172,7 +193,7 @@ const backButtonClicked = () => {
:disabled="resource.active" :disabled="resource.active"
type="error" type="error"
@click="open"> @click="open">
Gruppe löschen Ordner löschen
</NcButton> </NcButton>
</template> </template>
<template #content> <template #content>
@ -189,14 +210,14 @@ const backButtonClicked = () => {
<NcLoadingIcon v-if="loading" /> <NcLoadingIcon v-if="loading" />
<Delete v-else :size="20" /> <Delete v-else :size="20" />
</template> </template>
Gruppe löschen Ordner löschen
</NcButton> </NcButton>
</template> </template>
</ConfirmDeleteDialog> </ConfirmDeleteDialog>
</div> </div>
<div class="header-button-group"> <div class="header-button-group">
<h3>Unter-Resourcen</h3> <h3>Unter-Resourcen</h3>
<CreateResourceButton /> <CreateResourceButton @create="createSubResource" />
</div> </div>
<ResourceList :resources="resource?.subResources" @click:resource="subResourceClicked" /> <ResourceList :resources="resource?.subResources" @click:resource="subResourceClicked" />
</ModalView> </ModalView>