|
@@ -14,6 +14,7 @@ export class WekanCreator {
|
|
board: null,
|
|
board: null,
|
|
cards: {},
|
|
cards: {},
|
|
lists: {},
|
|
lists: {},
|
|
|
|
+ swimlanes: {},
|
|
};
|
|
};
|
|
// The object creator Wekan Id, indexed by the object Wekan id
|
|
// The object creator Wekan Id, indexed by the object Wekan id
|
|
// (so we only parse actions once!)
|
|
// (so we only parse actions once!)
|
|
@@ -23,6 +24,8 @@ export class WekanCreator {
|
|
|
|
|
|
// Map of labels Wekan ID => Wekan ID
|
|
// Map of labels Wekan ID => Wekan ID
|
|
this.labels = {};
|
|
this.labels = {};
|
|
|
|
+ // Map of swimlanes Wekan ID => Wekan ID
|
|
|
|
+ this.swimlanes = {};
|
|
// Map of lists Wekan ID => Wekan ID
|
|
// Map of lists Wekan ID => Wekan ID
|
|
this.lists = {};
|
|
this.lists = {};
|
|
// Map of cards Wekan ID => Wekan ID
|
|
// Map of cards Wekan ID => Wekan ID
|
|
@@ -121,6 +124,13 @@ export class WekanCreator {
|
|
})]);
|
|
})]);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ checkSwimlanes(wekanSwimlanes) {
|
|
|
|
+ check(wekanSwimlanes, [Match.ObjectIncluding({
|
|
|
|
+ archived: Boolean,
|
|
|
|
+ title: String,
|
|
|
|
+ })]);
|
|
|
|
+ }
|
|
|
|
+
|
|
checkChecklists(wekanChecklists) {
|
|
checkChecklists(wekanChecklists) {
|
|
check(wekanChecklists, [Match.ObjectIncluding({
|
|
check(wekanChecklists, [Match.ObjectIncluding({
|
|
cardId: String,
|
|
cardId: String,
|
|
@@ -213,6 +223,7 @@ export class WekanCreator {
|
|
dateLastActivity: this._now(),
|
|
dateLastActivity: this._now(),
|
|
description: card.description,
|
|
description: card.description,
|
|
listId: this.lists[card.listId],
|
|
listId: this.lists[card.listId],
|
|
|
|
+ swimlaneId: this.swimlanes[card.swimlaneId],
|
|
sort: card.sort,
|
|
sort: card.sort,
|
|
title: card.title,
|
|
title: card.title,
|
|
// we attribute the card to its creator if available
|
|
// we attribute the card to its creator if available
|
|
@@ -402,6 +413,24 @@ export class WekanCreator {
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ createSwimlanes(wekanSwimlanes, boardId) {
|
|
|
|
+ wekanSwimlanes.forEach((swimlane) => {
|
|
|
|
+ const swimlaneToCreate = {
|
|
|
|
+ archived: swimlane.archived,
|
|
|
|
+ boardId,
|
|
|
|
+ // We are being defensing here by providing a default date (now) if the
|
|
|
|
+ // creation date wasn't found on the action log. This happen on old
|
|
|
|
+ // Wekan boards (eg from 2013) that didn't log the 'createList' action
|
|
|
|
+ // we require.
|
|
|
|
+ createdAt: this._now(this.createdAt.swimlanes[swimlane._id]),
|
|
|
|
+ title: swimlane.title,
|
|
|
|
+ };
|
|
|
|
+ const swimlaneId = Swimlanes.direct.insert(swimlaneToCreate);
|
|
|
|
+ Swimlanes.direct.update(swimlaneId, {$set: {'updatedAt': this._now()}});
|
|
|
|
+ this.swimlanes[swimlane._id] = swimlaneId;
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
createChecklists(wekanChecklists) {
|
|
createChecklists(wekanChecklists) {
|
|
wekanChecklists.forEach((checklist, checklistIndex) => {
|
|
wekanChecklists.forEach((checklist, checklistIndex) => {
|
|
// Create the checklist
|
|
// Create the checklist
|
|
@@ -474,6 +503,11 @@ export class WekanCreator {
|
|
const listId = activity.listId;
|
|
const listId = activity.listId;
|
|
this.createdAt.lists[listId] = activity.createdAt;
|
|
this.createdAt.lists[listId] = activity.createdAt;
|
|
break;
|
|
break;
|
|
|
|
+ }
|
|
|
|
+ case 'createSwimlane': {
|
|
|
|
+ const swimlaneId = activity.swimlaneId;
|
|
|
|
+ this.createdAt.swimlanes[swimlaneId] = activity.createdAt;
|
|
|
|
+ break;
|
|
}}
|
|
}}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
@@ -595,6 +629,7 @@ export class WekanCreator {
|
|
this.checkBoard(board);
|
|
this.checkBoard(board);
|
|
this.checkLabels(board.labels);
|
|
this.checkLabels(board.labels);
|
|
this.checkLists(board.lists);
|
|
this.checkLists(board.lists);
|
|
|
|
+ this.checkSwimlanes(board.swimlanes);
|
|
this.checkCards(board.cards);
|
|
this.checkCards(board.cards);
|
|
this.checkChecklists(board.checklists);
|
|
this.checkChecklists(board.checklists);
|
|
} catch (e) {
|
|
} catch (e) {
|
|
@@ -613,6 +648,7 @@ export class WekanCreator {
|
|
this.parseActivities(board);
|
|
this.parseActivities(board);
|
|
const boardId = this.createBoardAndLabels(board);
|
|
const boardId = this.createBoardAndLabels(board);
|
|
this.createLists(board.lists, boardId);
|
|
this.createLists(board.lists, boardId);
|
|
|
|
+ this.createSwimlanes(board.swimlanes, boardId);
|
|
this.createCards(board.cards, boardId);
|
|
this.createCards(board.cards, boardId);
|
|
this.createChecklists(board.checklists);
|
|
this.createChecklists(board.checklists);
|
|
this.importActivities(board.activities, boardId);
|
|
this.importActivities(board.activities, boardId);
|