1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-19 05:09:43 +02:00

feat: Trello board JSON import (#352)

Closes #27, closes #105
This commit is contained in:
Christoph Enne 2022-12-16 23:48:06 +01:00 committed by GitHub
parent c880a72f02
commit 948485c861
20 changed files with 537 additions and 89 deletions

View file

@ -7,7 +7,7 @@ import actions from '../../../actions';
import api from '../../../api';
import { createLocalId } from '../../../utils/local-id';
export function* createBoard(projectId, data) {
export function* createBoard(projectId, { import: boardImport, ...data }) {
const nextData = {
...data,
position: yield select(selectors.selectNextBoardPosition, projectId),
@ -30,7 +30,19 @@ export function* createBoard(projectId, data) {
({
item: board,
included: { boardMemberships },
} = yield call(request, api.createBoard, projectId, nextData));
} = yield boardImport
? call(
request,
api.createBoardWithImport,
projectId,
{
...nextData,
importType: boardImport.type,
importFile: boardImport.file,
},
localId,
)
: call(request, api.createBoard, projectId, nextData));
} catch (error) {
yield put(actions.createBoard.failure(localId, error));
return;
@ -46,8 +58,12 @@ export function* createBoardInCurrentProject(data) {
yield call(createBoard, projectId, data);
}
export function* handleBoardCreate(board) {
yield put(actions.handleBoardCreate(board));
export function* handleBoardCreate(board, requestId) {
const isExists = yield select(selectors.selectIsBoardWithIdExists, requestId);
if (!isExists) {
yield put(actions.handleBoardCreate(board));
}
}
export function* fetchBoard(id) {