add: export board/cards/lists to CSV/TSV

This commit is contained in:
Bryan Mutai 2020-05-10 23:58:15 +03:00
parent 1742bcd9b1
commit a570c4a861
9 changed files with 474 additions and 217 deletions

View file

@ -128,10 +128,9 @@ export class CsvCreator {
};
// create labels
const labelsToCreate = new Set();
for (let i = 1; i < csvData.length; i++) {
//get the label column
if (csvData[i][this.fieldIndex.labels]) {
const labelsToCreate = new Set();
for (const importedLabel of csvData[i][this.fieldIndex.labels].split(
' ',
)) {
@ -139,23 +138,23 @@ export class CsvCreator {
labelsToCreate.add(importedLabel);
}
}
for (const label of labelsToCreate) {
let labelName, labelColor;
if (label.indexOf('-') > -1) {
labelName = label.split('-')[0];
labelColor = label.split('-')[1];
} else {
labelName = label;
}
const labelToCreate = {
_id: Random.id(6),
color: labelColor ? labelColor : 'black',
name: labelName,
};
boardToCreate.labels.push(labelToCreate);
}
}
}
for (const label of labelsToCreate) {
let labelName, labelColor;
if (label.indexOf('-') > -1) {
labelName = label.split('-')[0];
labelColor = label.split('-')[1];
} else {
labelName = label;
}
const labelToCreate = {
_id: Random.id(6),
color: labelColor ? labelColor : 'black',
name: labelName,
};
boardToCreate.labels.push(labelToCreate);
}
const boardId = Boards.direct.insert(boardToCreate);
Boards.direct.update(boardId, {