sharing extensions

Signed-off-by: Jakob Röhrl <jakob.roehrl@web.de>
This commit is contained in:
Jakob Röhrl
2019-05-21 13:56:39 +02:00
committed by Julius Härtl
parent 3cb811bb79
commit b8cb364f00
2 changed files with 37 additions and 11 deletions

View File

@@ -1,6 +1,6 @@
<template>
<div>
<multiselect v-model="addAcl" :options="sharees" label="label"
<multiselect v-model="addAcl" :options="unallocatedSharees" label="label"
@input="clickAddAcl" @search-change="asyncFind">
<template #option="scope">
{{ scope.option.label }}
@@ -33,16 +33,17 @@
<label for="checkbox">{{ t('deck', 'Manage') }}</label>
<button v-tooltip="t('deck', 'Delete')" class="icon-delete" @click="clickDeleteAcl(acl)" />
</li>
</ul>
<CollaborationView />
<collection-list v-if="board.id" :id="board.id"
:name="board.title" type="deck" />
</div>
</template>
<script>
import { Avatar, Multiselect } from 'nextcloud-vue'
import CollaborationView from '../CollaborationView'
import { CollectionList } from 'nextcloud-vue-collections'
import { mapGetters } from 'vuex'
export default {
@@ -50,7 +51,7 @@ export default {
components: {
Avatar,
Multiselect,
CollaborationView
CollectionList
},
props: {
board: {
@@ -68,7 +69,24 @@ export default {
computed: {
...mapGetters({
sharees: 'sharees'
}),
unallocatedSharees() {
let ret = []
let allocatedSharees = []
for (var user in this.board.acl) {
allocatedSharees.push(this.board.acl[user].participant.uid)
}
this.sharees.forEach(function(sharee) {
if (allocatedSharees.indexOf(sharee.value.shareWith) === -1) {
ret.push(sharee)
}
})
return ret
}
},
methods: {
asyncFind(query) {

View File

@@ -134,6 +134,9 @@ export default new Vuex.Store({
setSharees(state, sharees) {
state.sharees = sharees
},
addShareesGroups(state, groups) {
state.sharees.push(...groups)
},
setBoardFilter(state, filter) {
state.boardFilter = filter
},
@@ -168,6 +171,9 @@ export default new Vuex.Store({
// acl mutators
addAclToCurrentBoard(state, acl) {
console.log(state.currentBoard)
let id = acl.participant.uid
state.currentBoard.acl[id] = acl
console.log(state.currentBoard)
},
updateAclFromCurrentBoard(state, acl) {
for (var acl_ in state.currentBoard.acl) {
@@ -178,11 +184,12 @@ export default new Vuex.Store({
}
},
deleteAclFromCurrentBoard(state, acl) {
for (var acl_ in state.currentBoard.acl) {
if (state.currentBoard.acl[acl_].participant.uid === acl.participant.uid) {
delete state.currentBoard.acl[acl_]
break
}
const removeIndex = state.currentBoard.acl.findIndex((a) => {
return a.participant.uid === acl.participant.uid
})
if (removeIndex > -1) {
state.currentBoard.acl.splice(removeIndex, 1)
}
}
},
@@ -245,6 +252,7 @@ export default new Vuex.Store({
params.append('itemType', 1)
axios.get(OC.linkToOCS('apps/files_sharing/api/v1') + 'sharees', { params }).then((response) => {
commit('setSharees', response.data.ocs.data.users)
// commit('addShareesGroups', response.data.ocs.data.groups)
})
},
setBoardFilter({ commmit }, filter) {