Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
429049c
Allow userdefined order and start with drag and drop resorting
juliusknorr Jun 15, 2020
28a01a9
Design enhancements to panels, headings, and edit button
jancborchardt Jul 10, 2020
9cde198
More design fixes to dragging and edit panels
jancborchardt Jul 10, 2020
1448f54
Experiment with fade in dashboard panel header
jancborchardt Jul 10, 2020
0135eed
Dashboard: Adjust headings to new spacing for 44px icons
jancborchardt Jul 11, 2020
90f56dd
Replace vue-smoothdnd with vuedraggable
juliusknorr Jul 22, 2020
e25bab9
Set Dashboard as default app
jancborchardt Jul 21, 2020
4679926
Redirect to files app after login in acceptance tests
juliusknorr Jul 24, 2020
995144f
Dashboard: Fix small misalignment of widget header icon
jancborchardt Jul 31, 2020
da8a29f
Dashboard: Wording change from panels to widgets
jancborchardt Jul 31, 2020
5099a4f
Add binary attributes for dashboard bundles
juliusknorr Jul 27, 2020
c983094
WIP: drag and drop in modal
juliusknorr Jul 27, 2020
bd3d791
Only show display name if set
juliusknorr Jul 31, 2020
ae6be0c
Expose firstRun parameter to frontend
juliusknorr Jul 31, 2020
3be3c34
Status integration
juliusknorr Aug 4, 2020
7e2ded5
Fix default order of widgets
juliusknorr Aug 4, 2020
db86bea
Allow default app to be overwritten by user config
juliusknorr Aug 4, 2020
6accf4d
Fix default height
juliusknorr Aug 4, 2020
018be66
Refactor API to match the widget wording
juliusknorr Aug 4, 2020
d9dcd59
Load sidebar on dashboard
juliusknorr Aug 5, 2020
97feb89
Make header the drag handler
juliusknorr Aug 5, 2020
c97a805
Add first run hint
juliusknorr Aug 5, 2020
7399146
Dashboard: Fix full height of Widgets based on new component
jancborchardt Aug 4, 2020
44310d1
Add dashboard to app info xsd
juliusknorr Aug 5, 2020
61cc356
Fix php cs check
juliusknorr Aug 5, 2020
dbbc675
Fix drag behavior in modal
juliusknorr Aug 5, 2020
258cde1
Bump bundles
juliusknorr Aug 5, 2020
5a06e38
Dashboard app is disabled and there is no need to redirect to files app
MorrisJobke Aug 5, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
/apps/accessibility/js/accessibility.js.map binary
/apps/comments/js/*.js binary
/apps/comments/js/*.js.map binary
/apps/dashboard/js/*.js binary
/apps/dashboard/js/*.js.map binary
/apps/files/js/dist/*.js binary
/apps/files/js/dist/*.js.map binary
/apps/files_sharing/js/dist/*.js binary
Expand Down
1 change: 1 addition & 0 deletions apps/dashboard/appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@
return [
'routes' => [
['name' => 'dashboard#index', 'url' => '/', 'verb' => 'GET'],
['name' => 'dashboard#updateLayout', 'url' => '/layout', 'verb' => 'POST'],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be more compliant to what REST is about I would suggest to restructure this to be a resource, like simply /dashboard/layout and POST the data there

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd look into this in a separate pr since my first attempt for that didn't work out as expected.

]
];
2 changes: 1 addition & 1 deletion apps/dashboard/js/dashboard.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/dashboard/js/dashboard.js.map

Large diffs are not rendered by default.

57 changes: 41 additions & 16 deletions apps/dashboard/lib/Controller/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@

namespace OCA\Dashboard\Controller;

use OCA\Files\Event\LoadSidebar;
use OCA\Viewer\Event\LoadViewer;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\JSONResponse;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\Dashboard\IManager;
use OCP\Dashboard\IPanel;
use OCP\Dashboard\RegisterPanelEvent;
use OCP\Dashboard\IWidget;
use OCP\Dashboard\RegisterWidgetEvent;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IConfig;
use OCP\IInitialStateService;
use OCP\IRequest;

Expand All @@ -44,19 +47,27 @@ class DashboardController extends Controller {
private $eventDispatcher;
/** @var IManager */
private $dashboardManager;
/** @var IConfig */
private $config;
/** @var string */
private $userId;

public function __construct(
string $appName,
IRequest $request,
IInitialStateService $initialStateService,
IEventDispatcher $eventDispatcher,
IManager $dashboardManager
IManager $dashboardManager,
IConfig $config,
$userId
) {
parent::__construct($appName, $request);

$this->inititalStateService = $initialStateService;
$this->eventDispatcher = $eventDispatcher;
$this->dashboardManager = $dashboardManager;
$this->config = $config;
$this->userId = $userId;
}

/**
Expand All @@ -65,23 +76,37 @@ public function __construct(
* @return TemplateResponse
*/
public function index(): TemplateResponse {
$this->eventDispatcher->dispatchTyped(new RegisterPanelEvent($this->dashboardManager));

$dashboardManager = $this->dashboardManager;
$panels = array_map(function (IPanel $panel) {
return [
'id' => $panel->getId(),
'title' => $panel->getTitle(),
'iconClass' => $panel->getIconClass(),
'url' => $panel->getUrl()
];
}, $dashboardManager->getPanels());
$this->inititalStateService->provideInitialState('dashboard', 'panels', $panels);

$this->eventDispatcher->dispatchTyped(new LoadSidebar());
if (class_exists(LoadViewer::class)) {
$this->eventDispatcher->dispatchTyped(new LoadViewer());
}

$this->eventDispatcher->dispatchTyped(new RegisterWidgetEvent($this->dashboardManager));

$userLayout = explode(',', $this->config->getUserValue($this->userId, 'dashboard', 'layout', 'recommendations,spreed,mail,calendar'));
$widgets = array_map(function (IWidget $widget) {
return [
'id' => $widget->getId(),
'title' => $widget->getTitle(),
'iconClass' => $widget->getIconClass(),
'url' => $widget->getUrl()
];
}, $this->dashboardManager->getWidgets());
$this->inititalStateService->provideInitialState('dashboard', 'panels', $widgets);
$this->inititalStateService->provideInitialState('dashboard', 'layout', $userLayout);
$this->inititalStateService->provideInitialState('dashboard', 'firstRun', $this->config->getUserValue($this->userId, 'dashboard', 'firstRun', '1') === '1');
$this->config->setUserValue($this->userId, 'dashboard', 'firstRun', '0');

return new TemplateResponse('dashboard', 'index');
}

/**
* @NoAdminRequired
* @param string $layout
* @return JSONResponse
*/
public function updateLayout(string $layout): JSONResponse {
$this->config->setUserValue($this->userId, 'dashboard', 'layout', $layout);
return new JSONResponse(['layout' => $layout]);
}
}
Loading