@@ -9,6 +9,6 @@ module.exports = {
|
|||||||
'jsdoc/check-param-names': ['off'],
|
'jsdoc/check-param-names': ['off'],
|
||||||
'jsdoc/no-undefined-types': ['off'],
|
'jsdoc/no-undefined-types': ['off'],
|
||||||
'jsdoc/require-property-description': ['off'],
|
'jsdoc/require-property-description': ['off'],
|
||||||
'import/no-named-as-default-member': ['off']
|
'import/no-named-as-default-member': ['off'],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ return [
|
|||||||
['name' => 'board#deleteAcl', 'url' => '/boards/{boardId}/acl/{aclId}', 'verb' => 'DELETE'],
|
['name' => 'board#deleteAcl', 'url' => '/boards/{boardId}/acl/{aclId}', 'verb' => 'DELETE'],
|
||||||
['name' => 'board#clone', 'url' => '/boards/{boardId}/clone', 'verb' => 'POST'],
|
['name' => 'board#clone', 'url' => '/boards/{boardId}/clone', 'verb' => 'POST'],
|
||||||
['name' => 'board#transferOwner', 'url' => '/boards/{boardId}/transferOwner', 'verb' => 'PUT'],
|
['name' => 'board#transferOwner', 'url' => '/boards/{boardId}/transferOwner', 'verb' => 'PUT'],
|
||||||
|
['name' => 'board#export', 'url' => '/boards/{boardId}/export', 'verb' => 'GET'],
|
||||||
|
|
||||||
// stacks
|
// stacks
|
||||||
['name' => 'stack#index', 'url' => '/stacks/{boardId}', 'verb' => 'GET'],
|
['name' => 'stack#index', 'url' => '/stacks/{boardId}', 'verb' => 'GET'],
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
const { defineConfig } = require('cypress')
|
const { defineConfig } = require('cypress')
|
||||||
|
|
||||||
module.exports = defineConfig({
|
module.exports = defineConfig({
|
||||||
projectId: '1s7wkc',
|
projectId: '1s7wkc',
|
||||||
viewportWidth: 1280,
|
viewportWidth: 1280,
|
||||||
viewportHeight: 720,
|
viewportHeight: 720,
|
||||||
e2e: {
|
e2e: {
|
||||||
// We've imported your old cypress plugins here.
|
// We've imported your old cypress plugins here.
|
||||||
// You may want to clean this up later by importing these.
|
// You may want to clean this up later by importing these.
|
||||||
setupNodeEvents(on, config) {
|
setupNodeEvents(on, config) {
|
||||||
return require('./cypress/plugins/index.js')(on, config)
|
return require('./cypress/plugins/index.js')(on, config)
|
||||||
},
|
},
|
||||||
baseUrl: 'http://nextcloud.local/index.php',
|
baseUrl: 'http://nextcloud.local/index.php',
|
||||||
experimentalSessionAndOrigin: true,
|
experimentalSessionAndOrigin: true,
|
||||||
specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}',
|
specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -309,4 +309,4 @@
|
|||||||
"Failed to transfer the board for {user}" : "Échec du transfert du tableau pour {user}",
|
"Failed to transfer the board for {user}" : "Échec du transfert du tableau pour {user}",
|
||||||
"Are you sure you want to delete the board {title}? This will delete all the data of this board." : "Êtes-vous certain de vouloir supprimer le tableau {title} ? Cela supprimera l'ensemble des données de ce tableau."
|
"Are you sure you want to delete the board {title}? This will delete all the data of this board." : "Êtes-vous certain de vouloir supprimer le tableau {title} ? Cela supprimera l'ensemble des données de ce tableau."
|
||||||
},"pluralForm" :"nplurals=3; plural=(n == 0 || n == 1) ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;"
|
},"pluralForm" :"nplurals=3; plural=(n == 0 || n == 1) ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -169,4 +169,15 @@ class BoardController extends ApiController {
|
|||||||
|
|
||||||
return new DataResponse([], HTTP::STATUS_UNAUTHORIZED);
|
return new DataResponse([], HTTP::STATUS_UNAUTHORIZED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @NoAdminRequired
|
||||||
|
* @param $boardId
|
||||||
|
* @return Board
|
||||||
|
* @throws \OCP\AppFramework\Db\DoesNotExistException
|
||||||
|
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
||||||
|
*/
|
||||||
|
public function export($boardId) {
|
||||||
|
return $this->boardService->export($boardId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ class BoardService {
|
|||||||
public function __construct(
|
public function __construct(
|
||||||
BoardMapper $boardMapper,
|
BoardMapper $boardMapper,
|
||||||
StackMapper $stackMapper,
|
StackMapper $stackMapper,
|
||||||
|
CardMapper $cardMapper,
|
||||||
IConfig $config,
|
IConfig $config,
|
||||||
IL10N $l10n,
|
IL10N $l10n,
|
||||||
LabelMapper $labelMapper,
|
LabelMapper $labelMapper,
|
||||||
@@ -92,7 +93,6 @@ class BoardService {
|
|||||||
PermissionService $permissionService,
|
PermissionService $permissionService,
|
||||||
NotificationHelper $notificationHelper,
|
NotificationHelper $notificationHelper,
|
||||||
AssignmentMapper $assignedUsersMapper,
|
AssignmentMapper $assignedUsersMapper,
|
||||||
CardMapper $cardMapper,
|
|
||||||
IUserManager $userManager,
|
IUserManager $userManager,
|
||||||
IGroupManager $groupManager,
|
IGroupManager $groupManager,
|
||||||
ActivityManager $activityManager,
|
ActivityManager $activityManager,
|
||||||
@@ -105,6 +105,7 @@ class BoardService {
|
|||||||
) {
|
) {
|
||||||
$this->boardMapper = $boardMapper;
|
$this->boardMapper = $boardMapper;
|
||||||
$this->stackMapper = $stackMapper;
|
$this->stackMapper = $stackMapper;
|
||||||
|
$this->cardMapper = $cardMapper;
|
||||||
$this->labelMapper = $labelMapper;
|
$this->labelMapper = $labelMapper;
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
$this->aclMapper = $aclMapper;
|
$this->aclMapper = $aclMapper;
|
||||||
@@ -119,7 +120,6 @@ class BoardService {
|
|||||||
$this->changeHelper = $changeHelper;
|
$this->changeHelper = $changeHelper;
|
||||||
$this->userId = $userId;
|
$this->userId = $userId;
|
||||||
$this->urlGenerator = $urlGenerator;
|
$this->urlGenerator = $urlGenerator;
|
||||||
$this->cardMapper = $cardMapper;
|
|
||||||
$this->connection = $connection;
|
$this->connection = $connection;
|
||||||
$this->boardServiceValidator = $boardServiceValidator;
|
$this->boardServiceValidator = $boardServiceValidator;
|
||||||
}
|
}
|
||||||
@@ -652,6 +652,27 @@ class BoardService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $id
|
||||||
|
* @return Board
|
||||||
|
* @throws DoesNotExistException
|
||||||
|
* @throws \OCA\Deck\NoPermissionException
|
||||||
|
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
||||||
|
* @throws BadRequestException
|
||||||
|
*/
|
||||||
|
public function export($id) : Board {
|
||||||
|
if (is_numeric($id) === false) {
|
||||||
|
throw new BadRequestException('board id must be a number');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->permissionService->checkPermission($this->boardMapper, $id, Acl::PERMISSION_READ);
|
||||||
|
$board = $this->boardMapper->find($id);
|
||||||
|
$this->enrichWithCards($board);
|
||||||
|
$this->enrichWithLabels($board);
|
||||||
|
|
||||||
|
return $board;
|
||||||
|
}
|
||||||
|
|
||||||
private function enrichWithStacks($board, $since = -1) {
|
private function enrichWithStacks($board, $since = -1) {
|
||||||
$stacks = $this->stackMapper->findAll($board->getId(), null, null, $since);
|
$stacks = $this->stackMapper->findAll($board->getId(), null, null, $since);
|
||||||
|
|
||||||
@@ -698,4 +719,23 @@ class BoardService {
|
|||||||
$this->boardMapper->flushCache($boardId, $boardOwnerId);
|
$this->boardMapper->flushCache($boardId, $boardOwnerId);
|
||||||
unset($this->boardsCache[$boardId]);
|
unset($this->boardsCache[$boardId]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function enrichWithCards($board) {
|
||||||
|
$stacks = $this->stackMapper->findAll($board->getId());
|
||||||
|
foreach ($stacks as $stack) {
|
||||||
|
$cards = $this->cardMapper->findAllByStack($stack->getId());
|
||||||
|
$fullCards = [];
|
||||||
|
foreach ($cards as $card) {
|
||||||
|
$fullCard = $this->cardMapper->find($card->getId());
|
||||||
|
array_push($fullCards, $fullCard);
|
||||||
|
}
|
||||||
|
$stack->setCards($fullCards);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (\count($stacks) === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$board->setStacks($stacks);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,6 +72,13 @@
|
|||||||
{{ t('deck', 'Archive board') }}
|
{{ t('deck', 'Archive board') }}
|
||||||
</NcActionButton>
|
</NcActionButton>
|
||||||
|
|
||||||
|
<NcActionButton v-if="!board.archived && board.acl.length === 0" :icon="board.settings['notify-due'] === 'off' ? 'icon-sound' : 'icon-sound-off'" @click="board.settings['notify-due'] === 'off' ? updateSetting('notify-due', 'all') : updateSetting('notify-due', 'off')" />
|
||||||
|
<NcActionButton v-if="canManage && !board.archived"
|
||||||
|
icon="icon-download"
|
||||||
|
:close-after-click="true"
|
||||||
|
@click="actionExport">
|
||||||
|
{{ t('deck', 'Export board') }}
|
||||||
|
</NcActionButton>
|
||||||
<NcActionButton v-if="!board.archived && board.acl.length === 0" :icon="board.settings['notify-due'] === 'off' ? 'icon-sound' : 'icon-sound-off'" @click="board.settings['notify-due'] === 'off' ? updateSetting('notify-due', 'all') : updateSetting('notify-due', 'off')">
|
<NcActionButton v-if="!board.archived && board.acl.length === 0" :icon="board.settings['notify-due'] === 'off' ? 'icon-sound' : 'icon-sound-off'" @click="board.settings['notify-due'] === 'off' ? updateSetting('notify-due', 'all') : updateSetting('notify-due', 'off')">
|
||||||
{{ board.settings['notify-due'] === 'off' ? t('deck', 'Turn on due date reminders') : t('deck', 'Turn off due date reminders') }}
|
{{ board.settings['notify-due'] === 'off' ? t('deck', 'Turn on due date reminders') : t('deck', 'Turn off due date reminders') }}
|
||||||
</NcActionButton>
|
</NcActionButton>
|
||||||
@@ -314,6 +321,9 @@ export default {
|
|||||||
this.isDueSubmenuActive = false
|
this.isDueSubmenuActive = false
|
||||||
this.updateDueSetting = null
|
this.updateDueSetting = null
|
||||||
},
|
},
|
||||||
|
actionExport() {
|
||||||
|
this.boardApi.exportBoard(this.board)
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -149,6 +149,71 @@ export class BoardApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exportBoard(board) {
|
||||||
|
return axios.get(this.url(`/boards/${board.id}/export`))
|
||||||
|
.then(
|
||||||
|
(response) => {
|
||||||
|
const fields = { title: t('deck', 'Card title'), description: t('deck', 'Description'), stackId: t('deck', 'List name'), labels: t('deck', 'Tags'), duedate: t('deck', 'Due date'), createdAt: t('deck', 'Created'), lastModified: t('deck', 'Modified') }
|
||||||
|
let row = ''
|
||||||
|
Object.keys(fields).forEach(field => {
|
||||||
|
row += '"' + fields[field] + '"' + '\t'
|
||||||
|
})
|
||||||
|
|
||||||
|
row = row.slice(0, -1)
|
||||||
|
let CSV = row + '\r\n'
|
||||||
|
|
||||||
|
response.data.stacks.forEach(stack => {
|
||||||
|
stack.cards.forEach(card => {
|
||||||
|
row = ''
|
||||||
|
Object.keys(fields).forEach(field => {
|
||||||
|
if (field === 'createdAt' || field === 'lastModified') {
|
||||||
|
const date = new Date(Number(card[field]) * 1000)
|
||||||
|
row += '"' + date.toLocaleDateString() + '"' + '\t'
|
||||||
|
} else if (field === 'stackId') {
|
||||||
|
row += '"' + stack.title + '"' + '\t'
|
||||||
|
} else if (field === 'labels') {
|
||||||
|
row += '"'
|
||||||
|
card[field].forEach(label => {
|
||||||
|
row += label.title + ', '
|
||||||
|
})
|
||||||
|
if (card[field].length > 0) {
|
||||||
|
row = row.slice(0, -1)
|
||||||
|
}
|
||||||
|
row += '"' + '\t'
|
||||||
|
} else {
|
||||||
|
row += '"' + card[field] + '"' + '\t'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
row = row.slice(0, -1)
|
||||||
|
CSV += row + '\r\n'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
let charCode = []
|
||||||
|
const byteArray = []
|
||||||
|
byteArray.push(255, 254)
|
||||||
|
for (let i = 0; i < CSV.length; ++i) {
|
||||||
|
charCode = CSV.charCodeAt(i)
|
||||||
|
byteArray.push(charCode & 0xff)
|
||||||
|
byteArray.push(charCode / 256 >>> 0)
|
||||||
|
}
|
||||||
|
const blob = new Blob([new Uint8Array(byteArray)], { type: 'text/csv;charset=UTF-16LE;' })
|
||||||
|
const blobUrl = URL.createObjectURL(blob)
|
||||||
|
const a = document.createElement('a')
|
||||||
|
a.href = blobUrl // 'data:' + data
|
||||||
|
a.download = response.data.title + '.csv'
|
||||||
|
a.click()
|
||||||
|
a.remove()
|
||||||
|
return Promise.resolve()
|
||||||
|
},
|
||||||
|
(err) => {
|
||||||
|
return Promise.reject(err)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.catch((err) => {
|
||||||
|
return Promise.reject(err)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// Label API Calls
|
// Label API Calls
|
||||||
deleteLabel(id) {
|
deleteLabel(id) {
|
||||||
return axios.delete(this.url(`/labels/${id}`))
|
return axios.delete(this.url(`/labels/${id}`))
|
||||||
|
|||||||
@@ -114,6 +114,7 @@ class BoardServiceTest extends TestCase {
|
|||||||
$this->service = new BoardService(
|
$this->service = new BoardService(
|
||||||
$this->boardMapper,
|
$this->boardMapper,
|
||||||
$this->stackMapper,
|
$this->stackMapper,
|
||||||
|
$this->cardMapper,
|
||||||
$this->config,
|
$this->config,
|
||||||
$this->l10n,
|
$this->l10n,
|
||||||
$this->labelMapper,
|
$this->labelMapper,
|
||||||
@@ -121,7 +122,6 @@ class BoardServiceTest extends TestCase {
|
|||||||
$this->permissionService,
|
$this->permissionService,
|
||||||
$this->notificationHelper,
|
$this->notificationHelper,
|
||||||
$this->assignedUsersMapper,
|
$this->assignedUsersMapper,
|
||||||
$this->cardMapper,
|
|
||||||
$this->userManager,
|
$this->userManager,
|
||||||
$this->groupManager,
|
$this->groupManager,
|
||||||
$this->activityManager,
|
$this->activityManager,
|
||||||
|
|||||||
Reference in New Issue
Block a user