From 57c5bda94f597f3cfce015172ef8f55a520037dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Thu, 9 Jul 2020 17:09:47 +0200 Subject: [PATCH 01/13] Implement a talk dashboard panel 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 | 3 + lib/Dashboard/TalkPanel.php | 70 ++++++++++++++++++++++ src/dashboard.js | 54 +++++++++++++++++ src/views/Dashboard.vue | 115 ++++++++++++++++++++++++++++++++++++ webpack.common.js | 1 + 5 files changed, 243 insertions(+) create mode 100644 lib/Dashboard/TalkPanel.php create mode 100644 src/dashboard.js create mode 100644 src/views/Dashboard.vue diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index d7d3be81a7a..4af5fe309fa 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -35,6 +35,7 @@ use OCA\Talk\Collaboration\Resources\ConversationProvider; use OCA\Talk\Collaboration\Resources\Listener as ResourceListener; use OCA\Talk\Config; +use OCA\Talk\Dashboard\TalkPanel; use OCA\Talk\Events\ChatEvent; use OCA\Talk\Events\RoomEvent; use OCA\Talk\Files\Listener as FilesListener; @@ -95,6 +96,8 @@ public function register(IRegistrationContext $context): void { $context->registerEventListener(\OCP\AppFramework\Http\Events\BeforeTemplateRenderedEvent::class, UnifiedSearchCSSLoader::class); $context->registerSearchProvider(ConversationSearch::class); + + $context->registerDashboardPanel(TalkPanel::class); } public function boot(IBootContext $context): void { diff --git a/lib/Dashboard/TalkPanel.php b/lib/Dashboard/TalkPanel.php new file mode 100644 index 00000000000..081e8770666 --- /dev/null +++ b/lib/Dashboard/TalkPanel.php @@ -0,0 +1,70 @@ + + * + * @author Julius Härtl + * + * @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 . + * + */ + +namespace OCA\Talk\Dashboard; + + +class TalkPanel implements \OCP\Dashboard\IPanel { + + /** + * @inheritDoc + */ + public function getId(): string { + return 'spreed'; + } + + /** + * @inheritDoc + */ + public function getTitle(): string { + return 'Talk'; + } + + /** + * @inheritDoc + */ + public function getOrder(): int { + return 10; + } + + /** + * @inheritDoc + */ + public function getIconClass(): string { + return 'icon-talk'; + } + + /** + * @inheritDoc + */ + public function getUrl(): ?string { + return \OC::$server->getURLGenerator()->getAbsoluteURL('/apps/spreed'); + } + + /** + * @inheritDoc + */ + public function load(): void { + \OC_Util::addScript('spreed', 'dashboard'); + } +} diff --git a/src/dashboard.js b/src/dashboard.js new file mode 100644 index 00000000000..b516f8d26a2 --- /dev/null +++ b/src/dashboard.js @@ -0,0 +1,54 @@ +/* + * @copyright Copyright (c) 2020 Julius Härtl + * + * @author Julius Härtl + * + * @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 . + * + */ + +import Vue from 'vue' +import { generateFilePath } from '@nextcloud/router' +import { getRequestToken } from '@nextcloud/auth' +import { translate, translatePlural } from '@nextcloud/l10n' +import Dashboard from './views/Dashboard' + +// CSP config for webpack dynamic chunk loading +// eslint-disable-next-line +__webpack_nonce__ = btoa(getRequestToken()) + +// Correct the root of the app for chunk loading +// OC.linkTo matches the apps folders +// OC.generateUrl ensure the index.php (or not) +// We do not want the index.php since we're loading files +// eslint-disable-next-line +__webpack_public_path__ = generateFilePath('spreed', '', 'js/') + +Vue.prototype.t = translate +Vue.prototype.n = translatePlural +Vue.prototype.OC = OC +Vue.prototype.OCA = OCA + +document.addEventListener('DOMContentLoaded', function() { + + OCA.Dashboard.register('spreed', (el) => { + const View = Vue.extend(Dashboard) + new View({ + propsData: {}, + }).$mount(el) + }) + +}) diff --git a/src/views/Dashboard.vue b/src/views/Dashboard.vue new file mode 100644 index 00000000000..446ada68554 --- /dev/null +++ b/src/views/Dashboard.vue @@ -0,0 +1,115 @@ + + + + + + + diff --git a/webpack.common.js b/webpack.common.js index 1c7e14db8e8..d86608e0e5e 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -13,6 +13,7 @@ module.exports = { 'talk-public-share-auth-sidebar': path.join(__dirname, 'src', 'mainPublicShareAuthSidebar.js'), 'talk-public-share-sidebar': path.join(__dirname, 'src', 'mainPublicShareSidebar.js'), 'flow': path.join(__dirname, 'src', 'flow.js'), + 'dashboard': path.join(__dirname, 'src', 'dashboard.js'), }, output: { path: path.resolve(__dirname, './js'), From 14f4bc71ba977f4d431f31c8b5e34636efcdb5c2 Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Sat, 11 Jul 2020 11:52:12 +0200 Subject: [PATCH 02/13] Dashboard panel design fixes, adjust in line with Recommendations panel Signed-off-by: Jan-Christoph Borchardt --- src/views/Dashboard.vue | 63 ++++++++++++++++++++++++++++------------- 1 file changed, 44 insertions(+), 19 deletions(-) diff --git a/src/views/Dashboard.vue b/src/views/Dashboard.vue index 446ada68554..6bcbdb97d25 100644 --- a/src/views/Dashboard.vue +++ b/src/views/Dashboard.vue @@ -32,7 +32,7 @@

{{ conversation.displayName }}

{{ conversation.lastMessage.message }}

- +