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 [
{
field: "managersAclPermission",
label: "Resourcenadministrator*innen",
label: "Manager*innen",
value: props.resource.managersAclPermission,
mask: 31,
},
{
field: "membersAclPermission",
label: "Resourcenmitglieder",
label: "Mitglieder",
value: props.resource.membersAclPermission,
mask: 31,
},

View file

@ -34,11 +34,11 @@ const resourceNameValid = computed(() => {
});
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) => {
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) => {
@ -50,16 +50,22 @@ watch(() => props.resourceId, async (newResourceId) => {
const saveActive = async (active) => {
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;
};
const savePermission = async ({ field, value }) => {
resource.value = await api.updateResource(resource.value.id, {
[field]: value,
}, "model+members");
}, "model+members+subresources");
};
const deleteResource = async (closeDialog) => {
await api.deleteResource(resource.value.id);
closeDialog();
backButtonClicked();
}
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>
<template>
@ -118,7 +139,7 @@ const backButtonClicked = () => {
:has-back-button="true"
:has-next-step-button="false"
:has-last-step-button="false"
:title="'Resource Settings'"
:title="resource?.type === api.ResourceTypes.FOLDER ? 'Folder Settings' : 'Settings'"
:loading="loading"
v-slot=""
@back-button-pressed="backButtonClicked">
@ -136,7 +157,7 @@ const backButtonClicked = () => {
@trailing-button-click="saveName"
@blur="() => currentResourceName = currentResourceName.trim()"
@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>
<h3>Berechtigungen</h3>
<Permissions :resource="resource" @permissionUpdated="savePermission" />
@ -159,7 +180,7 @@ const backButtonClicked = () => {
:loading="resourceActiveLoading"
type="checkbox"
@update:checked="saveActive">
Resource aktiv
Ordner aktiv
</NcCheckboxRadioSwitch>
</div>
<ConfirmDeleteDialog title="Ordner löschen"
@ -172,7 +193,7 @@ const backButtonClicked = () => {
:disabled="resource.active"
type="error"
@click="open">
Gruppe löschen
Ordner löschen
</NcButton>
</template>
<template #content>
@ -189,14 +210,14 @@ const backButtonClicked = () => {
<NcLoadingIcon v-if="loading" />
<Delete v-else :size="20" />
</template>
Gruppe löschen
Ordner löschen
</NcButton>
</template>
</ConfirmDeleteDialog>
</div>
<div class="header-button-group">
<h3>Unter-Resourcen</h3>
<CreateResourceButton />
<CreateResourceButton @create="createSubResource" />
</div>
<ResourceList :resources="resource?.subResources" @click:resource="subResourceClicked" />
</ModalView>