mirror of
https://github.com/mattermost/focalboard.git
synced 2025-01-23 18:34:02 +02:00
Add the ability to import checklists from Trello (#1430)
* Add the ability to import checklists from Trello * Fix various lint and import issues
This commit is contained in:
parent
58f6b8031a
commit
f51b33dd87
@ -9,6 +9,7 @@ import {IPropertyOption, IPropertyTemplate, createBoard} from '../../webapp/src/
|
||||
import {createBoardView} from '../../webapp/src/blocks/boardView'
|
||||
import {createCard} from '../../webapp/src/blocks/card'
|
||||
import {createTextBlock} from '../../webapp/src/blocks/textBlock'
|
||||
import {createCheckboxBlock} from '../../webapp/src/blocks/checkboxBlock'
|
||||
import {Trello} from './trello'
|
||||
import {Utils} from './utils'
|
||||
|
||||
@ -135,6 +136,29 @@ function convert(input: Trello): Block[] {
|
||||
|
||||
outCard.fields.contentOrder = [text.id]
|
||||
}
|
||||
|
||||
// Add Checklists
|
||||
if (card.idChecklists && card.idChecklists.length > 0) {
|
||||
card.idChecklists.forEach(checklistID => {
|
||||
const lookup = input.checklists.find(e => e.id === checklistID)
|
||||
if (lookup) {
|
||||
lookup.checkItems.forEach(trelloCheckBox=> {
|
||||
const checkBlock = createCheckboxBlock()
|
||||
checkBlock.title = trelloCheckBox.name
|
||||
if (trelloCheckBox.state === 'complete') {
|
||||
checkBlock.fields.value = true
|
||||
} else {
|
||||
checkBlock.fields.value = false
|
||||
}
|
||||
checkBlock.rootId = outCard.rootId
|
||||
checkBlock.parentId = outCard.id
|
||||
blocks.push(checkBlock)
|
||||
|
||||
outCard.fields.contentOrder.push(checkBlock.id)
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
console.log('')
|
||||
|
Loading…
x
Reference in New Issue
Block a user