-
Notifications
You must be signed in to change notification settings - Fork 309
card dashboard #1934
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
card dashboard #1934
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
3c5f68e
card dashboard
jakobroehrl 0748133
Enrich card results
juliusknorr 3a4bbac
Move scss variables to dedicated file
juliusknorr 348fc66
Allow to use card item without being available in global card store
juliusknorr 014d7aa
Fix api routes
juliusknorr 818ffa2
ocs route
jakobroehrl 66f6a3e
times
jakobroehrl f4a6060
remove unused imports
jakobroehrl a73b761
Allow editing cards on filtered views
juliusknorr 341eb47
Cleanup backend methods
juliusknorr b199442
Rename to overview
juliusknorr 06078c8
Cleanup frontend code
juliusknorr 1392892
Fix lint errors
juliusknorr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
card dashboard
Signed-off-by: Jakob Röhrl <[email protected]>
- Loading branch information
commit 3c5f68e0c33aaf3a47d20b0c01254518ec29cb6b
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,163 @@ | ||
| <?php | ||
| /** | ||
| * @copyright Copyright (c) 2016 Julius Härtl <[email protected]> | ||
| * | ||
| * @author Julius Härtl <[email protected]> | ||
| * @author Maxence Lange <[email protected]> | ||
| * | ||
| * @license GNU AGPL version 3 or any later version | ||
| * | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU Affero General Public License as | ||
| * published by the Free Software Foundation, either version 3 of the | ||
| * License, or (at your option) any later version. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU Affero General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Affero General Public License | ||
| * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| * | ||
| */ | ||
|
|
||
| namespace OCA\Deck\Service; | ||
|
|
||
| use OCA\Deck\Activity\ActivityManager; | ||
| use OCA\Deck\Activity\ChangeSet; | ||
| use OCA\Deck\Db\Acl; | ||
| use OCA\Deck\Db\AclMapper; | ||
| use OCA\Deck\Db\AssignedUsersMapper; | ||
| use OCA\Deck\Db\ChangeHelper; | ||
| use OCA\Deck\Db\IPermissionMapper; | ||
| use OCA\Deck\Db\CardMapper; | ||
| use OCA\Deck\Db\Label; | ||
| use OCA\Deck\Db\Stack; | ||
| use OCA\Deck\Db\StackMapper; | ||
| use OCA\Deck\NoPermissionException; | ||
| use OCA\Deck\Notification\NotificationHelper; | ||
| use OCP\AppFramework\Db\DoesNotExistException; | ||
| use OCP\IGroupManager; | ||
| use OCP\IL10N; | ||
| use OCA\Deck\Db\Board; | ||
| use OCA\Deck\Db\BoardMapper; | ||
| use OCA\Deck\Db\LabelMapper; | ||
| use OCP\IUserManager; | ||
| use OCA\Deck\BadRequestException; | ||
| use Symfony\Component\EventDispatcher\EventDispatcherInterface; | ||
| use Symfony\Component\EventDispatcher\GenericEvent; | ||
|
|
||
| class DashboardService { | ||
| private $boardMapper; | ||
| private $stackMapper; | ||
| private $labelMapper; | ||
| private $aclMapper; | ||
| private $cardMapper; | ||
| private $l10n; | ||
| private $permissionService; | ||
| private $notificationHelper; | ||
| private $assignedUsersMapper; | ||
| private $userManager; | ||
| private $groupManager; | ||
| private $userId; | ||
| private $activityManager; | ||
| /** @var EventDispatcherInterface */ | ||
| private $eventDispatcher; | ||
| private $changeHelper; | ||
|
|
||
| public function __construct( | ||
| BoardMapper $boardMapper, | ||
| StackMapper $stackMapper, | ||
| IL10N $l10n, | ||
| LabelMapper $labelMapper, | ||
| AclMapper $aclMapper, | ||
| CardMapper $cardMapper, | ||
| PermissionService $permissionService, | ||
| NotificationHelper $notificationHelper, | ||
| AssignedUsersMapper $assignedUsersMapper, | ||
| IUserManager $userManager, | ||
| IGroupManager $groupManager, | ||
| ActivityManager $activityManager, | ||
| EventDispatcherInterface $eventDispatcher, | ||
| ChangeHelper $changeHelper, | ||
| $userId | ||
| ) { | ||
| $this->boardMapper = $boardMapper; | ||
| $this->stackMapper = $stackMapper; | ||
jakobroehrl marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| $this->labelMapper = $labelMapper; | ||
| $this->aclMapper = $aclMapper; | ||
| $this->cardMapper = $cardMapper; | ||
| $this->l10n = $l10n; | ||
| $this->permissionService = $permissionService; | ||
| $this->notificationHelper = $notificationHelper; | ||
| $this->assignedUsersMapper = $assignedUsersMapper; | ||
| $this->userManager = $userManager; | ||
| $this->groupManager = $groupManager; | ||
| $this->activityManager = $activityManager; | ||
| $this->eventDispatcher = $eventDispatcher; | ||
| $this->changeHelper = $changeHelper; | ||
| $this->userId = $userId; | ||
| } | ||
|
|
||
| /** | ||
| * Set a different user than the current one, e.g. when no user is available in occ | ||
| * | ||
| * @param string $userId | ||
| */ | ||
| public function setUserId(string $userId): void { | ||
| $this->userId = $userId; | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * @return array | ||
| */ | ||
| public function findAllWithDue($userId) { | ||
| $userInfo = $this->getBoardPrerequisites(); | ||
| $userBoards = $this->findAllBoardsFromUser($userInfo); | ||
| $allDueCards = []; | ||
| foreach ($userBoards as $userBoard) { | ||
| $allDueCards[] = $this->cardMapper->findAllWithDue($userBoard->getId()); | ||
jakobroehrl marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
| return $allDueCards; | ||
| } | ||
|
|
||
| /** | ||
| * @return array | ||
| */ | ||
| public function findMyAssignedCards($userId) { | ||
| $userInfo = $this->getBoardPrerequisites(); | ||
| $userBoards = $this->findAllBoardsFromUser($userInfo); | ||
| $allAssignedCards = []; | ||
| foreach ($userBoards as $userBoard) { | ||
| $allAssignedCards[] = $this->cardMapper->findMyAssignedCards($userBoard->getId(), $this->userId); | ||
| } | ||
| return $allAssignedCards; | ||
| } | ||
|
|
||
| /** | ||
| * @return array | ||
| */ | ||
| private function findAllBoardsFromUser($userInfo, $since = -1) { | ||
| $userBoards = $this->boardMapper->findAllByUser($userInfo['user'], null, null, $since); | ||
| $groupBoards = $this->boardMapper->findAllByGroups($userInfo['user'], $userInfo['groups'],null, null, $since); | ||
| $circleBoards = $this->boardMapper->findAllByCircles($userInfo['user'], null, null, $since); | ||
| return array_merge($userBoards, $groupBoards, $circleBoards); | ||
| } | ||
|
|
||
| /** | ||
| * @return array | ||
| */ | ||
| private function getBoardPrerequisites() { | ||
| $groups = $this->groupManager->getUserGroupIds( | ||
| $this->userManager->get($this->userId) | ||
| ); | ||
| return [ | ||
| 'user' => $this->userId, | ||
| 'groups' => $groups | ||
| ]; | ||
| } | ||
|
|
||
|
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.