From aa244108c899207c074b18225442438972230a79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Thu, 20 Aug 2020 15:40:38 +0200 Subject: [PATCH] Fix styling and rename to actual dashboard api MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- lib/AppInfo/Application.php | 8 ++-- .../{DeckPanel.php => DeckWidget.php} | 16 ++++++-- package-lock.json | 17 ++++++++ package.json | 1 + src/components/AttachmentDragAndDrop.vue | 8 ++-- src/components/cards/CardBadges.vue | 8 ---- src/components/cards/badges/DueDate.vue | 4 +- src/components/navigation/AppNavigation.vue | 2 +- src/components/overview/Overview.vue | 40 ++++++++++--------- src/css/dashboard.scss | 1 + src/css/variables.scss | 8 ++-- src/init-dashboard.js | 15 +++---- src/router.js | 2 +- src/views/Dashboard.vue | 22 ++++++---- 14 files changed, 92 insertions(+), 60 deletions(-) rename lib/Dashboard/{DeckPanel.php => DeckWidget.php} (85%) diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 21275e0e2..3bf9f3e6f 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -29,7 +29,7 @@ use OCA\Deck\Capabilities; use OCA\Deck\Collaboration\Resources\ResourceProvider; use OCA\Deck\Collaboration\Resources\ResourceProviderCard; -use OCA\Deck\Dashboard\DeckPanel; +use OCA\Deck\Dashboard\DeckWidget; use OCA\Deck\Db\Acl; use OCA\Deck\Db\AclMapper; use OCA\Deck\Db\AssignedUsersMapper; @@ -44,7 +44,7 @@ use OCP\Collaboration\Resources\IManager; use OCP\Collaboration\Resources\IProviderManager; use OCP\Comments\CommentsEntityEvent; -use OCP\Dashboard\RegisterPanelEvent; +use OCP\Dashboard\RegisterWidgetEvent; use OCP\EventDispatcher\Event; use OCP\EventDispatcher\IEventDispatcher; use OCP\FullTextSearch\IFullTextSearchManager; @@ -92,9 +92,9 @@ public function __construct(array $urlParams = []) { if ($version >= 20) { /** @var IEventDispatcher $dispatcher */ $dispatcher = $container->getServer()->query(IEventDispatcher::class); - $dispatcher->addListener(RegisterPanelEvent::class, function (RegisterPanelEvent $event) use ($container) { + $dispatcher->addListener(RegisterWidgetEvent::class, function (RegisterWidgetEvent $event) use ($container) { \OCP\Util::addScript('myapp', 'dashboard'); - $event->registerPanel(DeckPanel::class); + $event->registerWidget(DeckWidget::class); }); } } diff --git a/lib/Dashboard/DeckPanel.php b/lib/Dashboard/DeckWidget.php similarity index 85% rename from lib/Dashboard/DeckPanel.php rename to lib/Dashboard/DeckWidget.php index 4a2f47d95..3e24d40eb 100644 --- a/lib/Dashboard/DeckPanel.php +++ b/lib/Dashboard/DeckWidget.php @@ -27,9 +27,19 @@ namespace OCA\Deck\Dashboard; -use OCP\Dashboard\IPanel; +use OCP\Dashboard\IWidget; +use OCP\IL10N; -class DeckPanel implements IPanel { +class DeckWidget implements IWidget { + + /** + * @var IL10N + */ + private $l10n; + + public function __construct(IL10N $l10n) { + $this->l10n = $l10n; + } /** * @inheritDoc @@ -42,7 +52,7 @@ public function getId(): string { * @inheritDoc */ public function getTitle(): string { - return 'Deck'; + return $this->l10n->t('Upcoming cards'); } /** diff --git a/package-lock.json b/package-lock.json index 7df8930a1..6fdfd8c72 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3851,6 +3851,23 @@ } } }, + "@nextcloud/vue-dashboard": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/@nextcloud/vue-dashboard/-/vue-dashboard-0.1.6.tgz", + "integrity": "sha512-AgJMFYLuWWKi7U5TE+Zjta02OzS83nMgmgQZOjvP92VV/TwcxMnUo/3eJRaNrAnoRej4x1hjdroQC8PgDbZqzQ==", + "requires": { + "@nextcloud/vue": "^2.3.0", + "core-js": "^3.6.4", + "vue": "^2.6.11" + }, + "dependencies": { + "core-js": { + "version": "3.6.5", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.6.5.tgz", + "integrity": "sha512-vZVEEwZoIsI+vPEuoF9Iqf5H7/M3eeQqWlQnYa8FSKKePuYTf5MWnxb5SDAzCa60b3JBRS5g9b+Dq7b1y/RCrA==" + } + } + }, "@nextcloud/webpack-vue-config": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@nextcloud/webpack-vue-config/-/webpack-vue-config-1.1.0.tgz", diff --git a/package.json b/package.json index c3381d651..47023536e 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,7 @@ "@nextcloud/moment": "^1.1.1", "@nextcloud/router": "^1.1.0", "@nextcloud/vue": "^2.6.0", + "@nextcloud/vue-dashboard": "^0.1.6", "blueimp-md5": "^2.17.0", "dompurify": "^2.0.12", "lodash": "^4.17.20", diff --git a/src/components/AttachmentDragAndDrop.vue b/src/components/AttachmentDragAndDrop.vue index 55e3c5e4e..68ceeb893 100644 --- a/src/components/AttachmentDragAndDrop.vue +++ b/src/components/AttachmentDragAndDrop.vue @@ -69,10 +69,12 @@ import { Modal } from '@nextcloud/vue' import attachmentUpload from '../mixins/attachmentUpload' import { loadState } from '@nextcloud/initial-state' -let maxUploadSizeState = -1 +let maxUploadSizeState try { - loadState('deck', 'maxUploadSize') -} catch (e) {} + maxUploadSizeState = loadState('deck', 'maxUploadSize') +} catch (e) { + maxUploadSizeState = -1 +} export default { name: 'AttachmentDragAndDrop', diff --git a/src/components/cards/CardBadges.vue b/src/components/cards/CardBadges.vue index 28211ee8f..d019bb1e3 100644 --- a/src/components/cards/CardBadges.vue +++ b/src/components/cards/CardBadges.vue @@ -21,11 +21,7 @@ -->