last stand

Signed-off-by: Jakob <jakob.roehrl@web.de>
This commit is contained in:
Jakob
2019-07-26 11:17:59 +02:00
committed by Julius Härtl
parent 4e67c3172b
commit ac9fef5f05
9 changed files with 85 additions and 67 deletions

View File

@@ -95,6 +95,7 @@ export default {
.then((board) => {
this.$store.dispatch('setCurrentBoard', board)
this.$store.dispatch('loadStacks', board)
this.$store.dispatch('setAssignableUsers', board.users)
this.loading = false
this.$store.state.labels = board.labels
})

View File

@@ -35,7 +35,7 @@
</AppSidebarTab>
<AppSidebarTab name="Deleted items" icon="icon-delete">
<DeletedTabSidebard :board="board" />
<DeletedTabSidebar :board="board" />
</AppSidebarTab>
<AppSidebarTab name="Timeline" icon="icon-activity">
@@ -49,7 +49,7 @@
import { mapState } from 'vuex'
import SharingTabSidebard from './SharingTabSidebard'
import TagsTabSidebard from './TagsTabSidebard'
import DeletedTabSidebard from './DeletedTabSidebard'
import DeletedTabSidebar from './DeletedTabSidebar'
import TimelineTabSidebard from './TimelineTabSidebard'
import { AppSidebar, AppSidebarTab } from 'nextcloud-vue'
@@ -60,7 +60,7 @@ export default {
AppSidebarTab,
SharingTabSidebard,
TagsTabSidebard,
DeletedTabSidebard,
DeletedTabSidebar,
TimelineTabSidebard
},
computed: {

View File

@@ -2,11 +2,12 @@
<div>
<h3>{{ t('deck', 'Deleted stacks') }}</h3>
<ul>
<li v-for="deletedStack in deletedStacks" :key="deletedStack.id">
<span class="icon icon-deck" />
<span class="title">{{ deletedStack.title }}</span>
<span class="live-relative-timestamp" />
<button
:title="t('settings', 'Undo')"
class="app-navigation-entry-deleted-button icon-history"
@@ -43,7 +44,7 @@
<script>
import { mapState } from 'vuex'
export default {
name: 'DeletedTabSidebard',
name: 'DeletedTabSidebar',
components: {
},
@@ -63,8 +64,7 @@ export default {
computed: {
...mapState({
deletedStacks: state => state.stack.deletedStacks,
deletedCards: state => state.stack.deletedCards,
currentBoard: state => state.currentBoard
deletedCards: state => state.stack.deletedCards
})
},
@@ -74,7 +74,7 @@ export default {
methods: {
getData() {
this.isLoading = true
this.$store.dispatch('deletedItems', this.currentBoard.id).then(response => {
this.$store.dispatch('deletedItems', this.board.id).then(response => {
this.isLoading = false
})
},

View File

@@ -38,31 +38,32 @@
</multiselect>
<p>Assign to user</p>
{{ unallocatedSharees }}
<hr>
{{ addAclToCard }}
<multiselect v-model="addAclToCard" :multiple="true" :options="unallocatedSharees"
label="participant"
track-by="shareWith"
@select="assignUserToCard" @remove="removeUserFromCard" @search-change="asyncFind">
assignd:
{{ copiedCard.assignedUsers }}
<multiselect v-model="assignedUsers" :multiple="true" :options="assignableUsers"
label="displayname"
track-by="primaryKey"
@select="assignUserToCard" @remove="removeUserFromCard">
<template #option="scope">
{{ scope.option.label }}
{{ scope.option.displayname }}
</template>
</multiselect>
<p>Due to</p>
<DatetimePicker v-model="copiedCard.duedate" type="datetime" lang="en"
format="YYYY-MM-DD HH:mm" confirm @change="setDue()" />
<button v-tooltip="t('deck', 'Delete')" v-if="copiedCard.duedate" class="icon-delete"
@click="removeDue()" />
<hr>
<p>{{ subtitle }}</p>
</AppSidebarTab>
<AppSidebarTab name="Description" icon="icon-description">
<textarea v-model="copiedCard.description" type="text" autofocus />
<input type="button" class="icon-confirm" @click="saveDesc()">
<!-- <textarea v-model="copiedCard.description" type="text" autofocus />
<input type="button" class="icon-confirm" @click="saveDesc()"> -->
<markdown-editor ref="markdownEditor" v-model="desc" :configs="{autosave: {enabled: true, uniqueId: 'unique'}}" />
<markdown-editor ref="markdownEditor" v-model="desc" :configs="{autofocus: true, autosave: {enabled: true, uniqueId: 'unique'}, toolbar: false}" />
</AppSidebarTab>
<AppSidebarTab name="Attachments" icon="icon-files-dark">
{{ currentCard.attachments }}
@@ -89,7 +90,7 @@ export default {
},
data() {
return {
addAclToCard: null,
assignedUsers: null,
addedLabelToCard: null,
isLoading: false,
copiedCard: null,
@@ -101,7 +102,7 @@ export default {
...mapState({
currentCard: state => state.currentCard,
currentBoard: state => state.currentBoard,
sharees: 'sharees'
assignableUsers: state => state.assignableUsers
}),
subtitle() {
let lastModified = this.currentCard.lastModified
@@ -109,16 +110,6 @@ export default {
return t('deck', 'Modified') + ': ' + lastModified + ' ' + t('deck', 'Created') + ': ' + createdAt
},
unallocatedSharees() {
return this.sharees
/* return this.sharees.filter((sharee) => {
return Object.values(this.board.acl).findIndex((acl) => {
return acl.participant.uid === sharee.value.shareWith
})
}) */
},
toolbarActions() {
return [
{
@@ -142,52 +133,38 @@ export default {
currentCard() {
this.copiedCard = JSON.parse(JSON.stringify(this.currentCard))
this.allLabels = this.currentCard.labels
this.addAclToCard = this.currentCard.assignedUsers
this.assignedUsers = this.currentCard.assignedUsers.map((item) => item.participant)
this.desc = this.currentCard.description
},
desc() {
this.$store.dispatch('updateCardDesc', this.desc)
this.copiedCard.description = this.desc
this.saveDesc()
}
},
created() {
},
methods: {
setDue() {
this.$store.dispatch('updateCardDue', this.copiedCard)
},
removeDue() {
this.copiedCard.duedate = null
this.$store.dispatch('updateCardDue', this.copiedCard)
},
saveDesc() {
this.$store.dispatch('updateCardDesc', this.copiedCard)
},
asyncFind(query) {
this.isLoading = true
this.$store.dispatch('loadSharees').then(response => {
this.isLoading = false
})
},
closeSidebar() {
this.$router.push({ name: 'board' })
},
assignUserToCard(user) {
// this.copiedCard.assignedUsers.push(user)
this.copiedCard.newUserUid = user.value.shareWith
this.copiedCard.newUserUid = user.uid
this.$store.dispatch('assignCardToUser', this.copiedCard)
/* this.addAclForAPI = {
type: 0,
participant: this.addAcl.value.shareWith,
permissionEdit: false,
permissionShare: false,
permissionManage: false
}
this.$store.dispatch('addAclToCurrentBoard', this.addAclForAPI) */
},
removeUserFromCard(user) {
this.copiedCard.removeUserUid = user.uid
this.$store.dispatch('removeUserFromCard', this.copiedCard)
},
addLabelToCard(newLabel) {

View File

@@ -29,7 +29,7 @@
<div v-if="card.duedate" :class="dueIcon">
<span>{{ dueTimeDiff }}</span>
</div>
<div v-if="true" class="card-tasks icon icon-checkmark">
<div v-if="card.description && card.description.match(/\[\s*\]/g)" class="card-tasks icon icon-checkmark">
<span>0/0</span>
</div>
<div v-if="card.assignedUsers" class="card-assigned-users">

View File

@@ -75,8 +75,6 @@ export class CardApi {
}
assignUser(card) {
console.log(card)
console.log(card.newUserUid)
return axios.post(this.url(`/cards/${card.id}/assign`), { userId: card.newUserUid })
.then(
(response) => {
@@ -91,6 +89,21 @@ export class CardApi {
})
}
removeUser(card) {
return axios.delete(this.url(`/cards/${card.id}/assign/${card.removeUserUid}`))
.then(
(response) => {
return Promise.resolve(response.data)
},
(err) => {
return Promise.reject(err)
}
)
.catch((err) => {
return Promise.reject(err)
})
}
archiveCard(card) {
return axios.put(this.url(`/cards/${card.id}/archive`))
.then(

View File

@@ -62,11 +62,20 @@ export default {
state.cards[existingIndex].title = card.title
}
},
assignCardToUser(state, card) {
// let existingIndex = state.cards.findIndex(_card => _card.id === card.id)
/* if (existingIndex !== -1) {
} */
assignCardToUser(state, user) {
let existingIndex = state.cards.findIndex(_card => _card.id === user.cardId)
if (existingIndex !== -1) {
state.cards[existingIndex].assignedUsers.push(user)
}
},
removeUserFromCard(state, user) {
let existingIndex = state.cards.findIndex(_card => _card.id === user.cardId)
if (existingIndex !== -1) {
let foundIndex = state.cards[existingIndex].assignedUsers.findIndex(_user => _user.id === user.id)
if (foundIndex !== -1) {
state.cards[existingIndex].assignedUsers.splice(foundIndex, 1)
}
}
},
updateCardDesc(state, card) {
let existingIndex = state.cards.findIndex(_card => _card.id === card.id)
@@ -120,8 +129,14 @@ export default {
},
assignCardToUser({ commit }, card) {
apiClient.assignUser(card)
.then(() => {
commit('assignCardToUser')
.then((user) => {
commit('assignCardToUser', user)
})
},
removeUserFromCard({ commit }, card) {
apiClient.removeUser(card)
.then((user) => {
commit('removeUserFromCard', user)
})
},
addLabel({ commit }, data) {

View File

@@ -54,6 +54,7 @@ export default new Vuex.Store({
currentCard: null,
boards: [],
sharees: [],
assignableUsers: [],
boardFilter: BOARD_FILTERS.ALL
},
getters: {
@@ -140,6 +141,9 @@ export default new Vuex.Store({
state.sharees = shareesUsersAndGroups.users
state.sharees.push(...shareesUsersAndGroups.groups)
},
setAssignableUsers(state, users) {
state.assignableUsers = users
},
setBoardFilter(state, filter) {
state.boardFilter = filter
},
@@ -265,6 +269,7 @@ export default new Vuex.Store({
commit('setSharees', response.data.ocs.data)
})
},
setBoardFilter({ commmit }, filter) {
commmit('setBoardFilter', filter)
},
@@ -280,6 +285,9 @@ export default new Vuex.Store({
setCurrentBoard({ commit }, board) {
commit('setCurrentBoard', board)
},
setAssignableUsers({ commit }, board) {
commit('setAssignableUsers', board)
},
setCurrentCard({ commit }, card) {
commit('setCurrentCard', card)
},

View File

@@ -68,9 +68,13 @@ export default {
}
},
setDeletedStacks(state, delStacks) {
state.deletedStacks.push(delStacks[0])
state.deletedStacks = []
if (delStacks.length > 0) {
state.deletedStacks.push(delStacks[0])
}
},
setDeletedCards(state, delCards) {
state.deletedCards = []
state.deletedCards.push(delCards)
}
},