Skip to content

Commit 3428b17

Browse files
feat: error msg on CreateNewCardCustomPicker & only show available boards
Signed-off-by: Luka Trovic <luka@nextcloud.com>
1 parent 3337d00 commit 3428b17

1 file changed

Lines changed: 26 additions & 14 deletions

File tree

src/views/CreateNewCardCustomPicker.vue

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ import Description from '../components/card/Description.vue'
128128
import CardPlusOutline from 'vue-material-design-icons/CardPlusOutline.vue'
129129
import FormatColumnsIcon from 'vue-material-design-icons/FormatColumns.vue'
130130
import DeckIcon from '../components/icons/DeckIcon.vue'
131+
import { showError } from '../helpers/errors.js'
131132
132133
const cardApi = new CardApi()
133134
const apiClient = new BoardApi()
@@ -216,7 +217,7 @@ export default {
216217
fetchBoards() {
217218
axios.get(generateUrl('/apps/deck/boards')).then((response) => {
218219
this.boards = response.data.filter((board) => {
219-
return board?.permissions?.PERMISSION_EDIT
220+
return board?.permissions?.PERMISSION_EDIT && !board?.archived && !board?.deletedAt
220221
})
221222
this.loading = false
222223
})
@@ -239,19 +240,30 @@ export default {
239240
},
240241
async createCard() {
241242
this.creating = true
242-
const response = await cardApi.addCard({
243-
boardId: this.selectedBoard.id,
244-
stackId: this.selectedStack.id,
245-
title: this.card.title,
246-
description: this.card.description,
247-
duedate: this.card.duedate,
248-
labels: this.card.labels.map(label => label.id),
249-
users: this.card.assignedUsers.map(user => { return { id: user.uid, type: user.type } }),
250-
})
251-
this.newCard = response
252-
this.creating = false
253-
this.created = true
254-
this.$emit('submit', window.location.protocol + '//' + window.location.host + generateUrl('/apps/deck') + `/card/${this.newCard.id}`)
243+
244+
try {
245+
const response = await cardApi.addCard({
246+
boardId: this.selectedBoard.id,
247+
stackId: this.selectedStack.id,
248+
title: this.card.title,
249+
description: this.card.description,
250+
duedate: this.card.duedate,
251+
labels: this.card.labels.map(label => label.id),
252+
users: this.card.assignedUsers.map(user => {
253+
return {
254+
id: user.uid,
255+
type: user.type,
256+
}
257+
}),
258+
})
259+
this.newCard = response
260+
this.creating = false
261+
this.created = true
262+
this.$emit('submit', window.location.protocol + '//' + window.location.host + generateUrl('/apps/deck') + `/card/${this.newCard.id}`)
263+
} catch (e) {
264+
this.creating = false
265+
showError(e)
266+
}
255267
},
256268
onSelectLabel(label) {
257269
this.card.labels.push(label)

0 commit comments

Comments
 (0)