mirror of
https://github.com/mattermost/focalboard.git
synced 2024-11-24 08:22:29 +02:00
fix trello import
This commit is contained in:
parent
400c5a108c
commit
2e7427d2f3
@ -5,6 +5,7 @@ import minimist from 'minimist'
|
|||||||
import {exit} from 'process'
|
import {exit} from 'process'
|
||||||
import {ArchiveUtils} from '../util/archive'
|
import {ArchiveUtils} from '../util/archive'
|
||||||
import {Block} from '../../webapp/src/blocks/block'
|
import {Block} from '../../webapp/src/blocks/block'
|
||||||
|
import {Board} from '../../webapp/src/blocks/board'
|
||||||
import {IPropertyOption, IPropertyTemplate, createBoard} from '../../webapp/src/blocks/board'
|
import {IPropertyOption, IPropertyTemplate, createBoard} from '../../webapp/src/blocks/board'
|
||||||
import {createBoardView} from '../../webapp/src/blocks/boardView'
|
import {createBoardView} from '../../webapp/src/blocks/boardView'
|
||||||
import {createCard} from '../../webapp/src/blocks/card'
|
import {createCard} from '../../webapp/src/blocks/card'
|
||||||
@ -50,23 +51,23 @@ function main() {
|
|||||||
const input = JSON.parse(inputData) as Trello
|
const input = JSON.parse(inputData) as Trello
|
||||||
|
|
||||||
// Convert
|
// Convert
|
||||||
const blocks = convert(input)
|
const [boards, blocks] = convert(input)
|
||||||
|
|
||||||
// Save output
|
// Save output
|
||||||
// TODO: Stream output
|
// TODO: Stream output
|
||||||
const outputData = ArchiveUtils.buildBlockArchive(blocks)
|
const outputData = ArchiveUtils.buildBlockArchive(boards, blocks)
|
||||||
fs.writeFileSync(outputFile, outputData)
|
fs.writeFileSync(outputFile, outputData)
|
||||||
|
|
||||||
console.log(`Exported to ${outputFile}`)
|
console.log(`Exported to ${outputFile}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
function convert(input: Trello): Block[] {
|
function convert(input: Trello): [Board[], Block[]] {
|
||||||
|
const boards: Board[] = []
|
||||||
const blocks: Block[] = []
|
const blocks: Block[] = []
|
||||||
|
|
||||||
// Board
|
// Board
|
||||||
const board = createBoard()
|
const board = createBoard()
|
||||||
console.log(`Board: ${input.name}`)
|
console.log(`Board: ${input.name}`)
|
||||||
board.rootId = board.id
|
|
||||||
board.title = input.name
|
board.title = input.name
|
||||||
board.description = input.desc
|
board.description = input.desc
|
||||||
|
|
||||||
@ -93,13 +94,13 @@ function convert(input: Trello): Block[] {
|
|||||||
options
|
options
|
||||||
}
|
}
|
||||||
board.cardProperties = [cardProperty]
|
board.cardProperties = [cardProperty]
|
||||||
blocks.push(board)
|
boards.push(board)
|
||||||
|
|
||||||
// Board view
|
// Board view
|
||||||
const view = createBoardView()
|
const view = createBoardView()
|
||||||
view.title = 'Board View'
|
view.title = 'Board View'
|
||||||
view.fields.viewType = 'board'
|
view.fields.viewType = 'board'
|
||||||
view.rootId = board.id
|
view.boardId = board.id
|
||||||
view.parentId = board.id
|
view.parentId = board.id
|
||||||
blocks.push(view)
|
blocks.push(view)
|
||||||
|
|
||||||
@ -109,7 +110,7 @@ function convert(input: Trello): Block[] {
|
|||||||
|
|
||||||
const outCard = createCard()
|
const outCard = createCard()
|
||||||
outCard.title = card.name
|
outCard.title = card.name
|
||||||
outCard.rootId = board.id
|
outCard.boardId = board.id
|
||||||
outCard.parentId = board.id
|
outCard.parentId = board.id
|
||||||
|
|
||||||
// Map lists to Select property options
|
// Map lists to Select property options
|
||||||
@ -130,7 +131,7 @@ function convert(input: Trello): Block[] {
|
|||||||
// console.log(`\t${card.desc}`)
|
// console.log(`\t${card.desc}`)
|
||||||
const text = createTextBlock()
|
const text = createTextBlock()
|
||||||
text.title = card.desc
|
text.title = card.desc
|
||||||
text.rootId = board.id
|
text.boardId = board.id
|
||||||
text.parentId = outCard.id
|
text.parentId = outCard.id
|
||||||
blocks.push(text)
|
blocks.push(text)
|
||||||
|
|
||||||
@ -150,7 +151,7 @@ function convert(input: Trello): Block[] {
|
|||||||
} else {
|
} else {
|
||||||
checkBlock.fields.value = false
|
checkBlock.fields.value = false
|
||||||
}
|
}
|
||||||
checkBlock.rootId = outCard.rootId
|
checkBlock.boardId = board.id
|
||||||
checkBlock.parentId = outCard.id
|
checkBlock.parentId = outCard.id
|
||||||
blocks.push(checkBlock)
|
blocks.push(checkBlock)
|
||||||
|
|
||||||
@ -164,7 +165,7 @@ function convert(input: Trello): Block[] {
|
|||||||
console.log('')
|
console.log('')
|
||||||
console.log(`Found ${input.cards.length} card(s).`)
|
console.log(`Found ${input.cards.length} card(s).`)
|
||||||
|
|
||||||
return blocks
|
return [boards, blocks]
|
||||||
}
|
}
|
||||||
|
|
||||||
function showHelp() {
|
function showHelp() {
|
||||||
|
Loading…
Reference in New Issue
Block a user