From 640ba67e9a98c8ccf4433d8f42d79e48a567d0a1 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 | 93 ++++++++++++------- package.json | 3 +- 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, 133 insertions(+), 97 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 d951468d5..04d97efd5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4360,6 +4360,22 @@ "resolved": "https://registry.npmjs.org/@nextcloud/browserslist-config/-/browserslist-config-1.0.0.tgz", "integrity": "sha512-f+sKpdLZXkODV+OY39K1M+Spmd4RgxmtEXmNn4Bviv4R7uBFHXuw+JX9ZdfDeOryfHjJ/TRQxQEp0GMpBwZFUw==" }, + "@nextcloud/capabilities": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@nextcloud/capabilities/-/capabilities-1.0.2.tgz", + "integrity": "sha512-HR5vnT2GKTvoQla/WdP+V0/MD1eAGUNWCM0QXVGXQ0TCHb0AORYYMdEQafROsjNSH2kriArFnS/l3YZQrUa9yA==", + "requires": { + "@nextcloud/initial-state": "^1.1.2", + "core-js": "^3.6.4" + }, + "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/dialogs": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/@nextcloud/dialogs/-/dialogs-1.4.0.tgz", @@ -4549,20 +4565,22 @@ } }, "@nextcloud/vue": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@nextcloud/vue/-/vue-2.3.0.tgz", - "integrity": "sha512-6uf7Hu4Obaet7BOs9H/Ng63xAYqks9CL7hsOOHGUzWFYrPPBxgt79iD9OOPpPfJuLQ3Nnuibh942X1QreCBRkw==", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@nextcloud/vue/-/vue-2.5.0.tgz", + "integrity": "sha512-xWUM9TUW1r9MTeK9utEcEwmXb015zbHHC07UcCZeG8i6jXFkPOPgZKQzXiuEgu3dEjiA1k3jRMZOqebiZ5NQdA==", "requires": { "@nextcloud/auth": "^1.2.3", "@nextcloud/axios": "^1.3.2", + "@nextcloud/capabilities": "^1.0.2", "@nextcloud/dialogs": "^1.3.0", "@nextcloud/event-bus": "^1.1.4", "@nextcloud/l10n": "^1.2.3", "@nextcloud/router": "^1.0.2", "core-js": "^3.6.5", "debounce": "1.2.0", - "emoji-mart-vue-fast": "^7.0.2", + "emoji-mart-vue-fast": "^7.0.4", "hammerjs": "^2.0.8", + "linkifyjs": "~2.1.9", "md5": "^2.2.1", "regenerator-runtime": "^0.13.5", "v-click-outside": "^3.0.1", @@ -4571,7 +4589,33 @@ "vue-color": "^2.7.1", "vue-multiselect": "^2.1.6", "vue-visible": "^1.0.2", - "vue2-datepicker": "^3.4.1" + "vue2-datepicker": "^3.6.2" + }, + "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==" + }, + "vue2-datepicker": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/vue2-datepicker/-/vue2-datepicker-3.6.2.tgz", + "integrity": "sha512-J2fCwUmCxIOPUvwQ12e8evFY9cCv6vJmgxRD9fGeUv6JeMMeLwkdpeQZOcqbMf/4mk1cSrY2/9Fr8DaB30LBpA==", + "requires": { + "date-fns": "^2.0.1", + "date-format-parse": "^0.2.5" + } + } + } + }, + "@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": { @@ -4738,16 +4782,6 @@ "@types/istanbul-lib-coverage": "*" } }, - "@types/istanbul-reports": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-1.1.1.tgz", - "integrity": "sha512-UpYjBi8xefVChsCoBpKShdxTllC9pwISirfoZsUa2AAdQg/Jd2KQGtSbw+ya7GPo7x/wAPlH6JBhKhAsXUEZNA==", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "*", - "@types/istanbul-lib-report": "*" - } - }, "@types/jquery": { "version": "2.0.54", "resolved": "https://registry.npmjs.org/@types/jquery/-/jquery-2.0.54.tgz", @@ -6169,24 +6203,6 @@ "babel-types": "^6.24.1" } }, - "babel-preset-current-node-syntax": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-0.1.2.tgz", - "integrity": "sha512-u/8cS+dEiK1SFILbOC8/rUI3ml9lboKuuMvZ/4aQnQmhecQAgPw5ew066C1ObnEAUmlx7dv/s2z52psWEtLNiw==", - "dev": true, - "requires": { - "@babel/plugin-syntax-async-generators": "^7.8.4", - "@babel/plugin-syntax-bigint": "^7.8.3", - "@babel/plugin-syntax-class-properties": "^7.8.3", - "@babel/plugin-syntax-json-strings": "^7.8.3", - "@babel/plugin-syntax-logical-assignment-operators": "^7.8.3", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", - "@babel/plugin-syntax-numeric-separator": "^7.8.3", - "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", - "@babel/plugin-syntax-optional-chaining": "^7.8.3" - } - }, "babel-preset-jest": { "version": "26.3.0", "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-26.3.0.tgz", @@ -8310,9 +8326,9 @@ "dev": true }, "emoji-mart-vue-fast": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/emoji-mart-vue-fast/-/emoji-mart-vue-fast-7.0.3.tgz", - "integrity": "sha512-9BdX1QvWCOKEnmd20wcej7GaB/2/cesgodGJCCQirz1NtW3xctg1pWEYJHbAcjRHSHDzLDC+Y2xj9a2tO8T5hQ==", + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/emoji-mart-vue-fast/-/emoji-mart-vue-fast-7.0.4.tgz", + "integrity": "sha512-VZuyclCe7ZNPhSvt7WT258MscqRBZTB2Is/7vBilCXgpiZqByaA4AhM1xdIIZZik/aA+5BQiZVmbsDK0jk78Eg==", "requires": { "@babel/polyfill": "7.2.5", "@babel/runtime": "7.3.4", @@ -14959,6 +14975,11 @@ "uc.micro": "^1.0.1" } }, + "linkifyjs": { + "version": "2.1.9", + "resolved": "https://registry.npmjs.org/linkifyjs/-/linkifyjs-2.1.9.tgz", + "integrity": "sha512-74ivurkK6WHvHFozVaGtQWV38FzBwSTGNmJolEgFp7QgR2bl6ArUWlvT4GcHKbPe1z3nWYi+VUdDZk16zDOVug==" + }, "load-json-file": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", diff --git a/package.json b/package.json index fe16ac852..28335243b 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,8 @@ "@nextcloud/l10n": "^1.3.0", "@nextcloud/moment": "^1.1.1", "@nextcloud/router": "^1.1.0", - "@nextcloud/vue": "^2.3.0", + "@nextcloud/vue": "^2.5.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 @@ -->