From 02de2c652d00fb76540fb107a0d3dad54c06bb42 Mon Sep 17 00:00:00 2001 From: Jonas Heinrich Date: Wed, 18 Nov 2020 14:21:33 +0100 Subject: [PATCH] further work on dashboard --- css/dashboard.css | 4 +- lib/Dashboard/RadioWidget.php | 13 +- package-lock.json | 61 +++++++++ package.json | 2 + src/components/Dashboard.vue | 245 ++++++++++++++++++++++++++++++++++ src/components/Table.vue | 9 +- src/dashboard.js | 19 +++ src/main.js | 5 +- webpack.js | 22 +-- 9 files changed, 349 insertions(+), 31 deletions(-) create mode 100644 src/components/Dashboard.vue create mode 100644 src/dashboard.js diff --git a/css/dashboard.css b/css/dashboard.css index 4e0568b..5fbcfce 100644 --- a/css/dashboard.css +++ b/css/dashboard.css @@ -1,7 +1,7 @@ -.icon-mail { +.icon-radio { background-image: url(./../img/radio-trans.svg); } -body.theme--dark .icon-mail { +body.theme--dark .icon-radio { background-image: url(./../img/radio.svg); } diff --git a/lib/Dashboard/RadioWidget.php b/lib/Dashboard/RadioWidget.php index 9c5bca8..d7023f0 100644 --- a/lib/Dashboard/RadioWidget.php +++ b/lib/Dashboard/RadioWidget.php @@ -4,6 +4,8 @@ namespace OCA\Radio\Dashboard; use OCP\Dashboard\IWidget; use OCP\IL10N; +use OCP\IURLGenerator; +use OCP\Util; use OCA\Radio\AppInfo\Application; @@ -22,14 +24,14 @@ class RadioWidget implements IWidget { * @inheritDoc */ public function getId(): string { - return 'radio'; + return Application::APP_ID; } /** * @inheritDoc */ public function getTitle(): string { - return $this->l10n->t('Favorite Radio stations'); + return $this->l10n->t('Radio stations'); } /** @@ -50,14 +52,15 @@ class RadioWidget implements IWidget { * @inheritDoc */ public function getUrl(): ?string { - return \OC::$server->getURLGenerator()->linkToRoute('settings.PersonalSettings.index', ['section' => 'connected-accounts']); + return \OC::$server->getURLGenerator()->linkToRoute('radio.page.index'); + // return $this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkToRoute('radio.page.index')); } /** * @inheritDoc */ public function load(): void { - \OC_Util::addScript(Application::APP_ID, Application::APP_ID . '-dashboard'); - \OC_Util::addStyle(Application::APP_ID, 'dashboard'); + Util::addScript(Application::APP_ID, 'dashboard'); + Util::addStyle(Application::APP_ID, 'dashboard'); } } diff --git a/package-lock.json b/package-lock.json index 42d6616..734af25 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2568,6 +2568,47 @@ "node-gettext": "^3.0.0" } }, + "@nextcloud/moment": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@nextcloud/moment/-/moment-1.1.1.tgz", + "integrity": "sha512-lh7Xn9Ver12pLfE0rpjxE6x/ipscAV+7fw1u+7TJak1QR1T1UDRMZ9dA7z77W8mZH2C3yveTh/VEHZIflKBrng==", + "requires": { + "@nextcloud/l10n": "1.2.0", + "core-js": "3.6.4", + "jed": "^1.1.1", + "moment": "2.24.0", + "node-gettext": "^2.0.0" + }, + "dependencies": { + "@nextcloud/l10n": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@nextcloud/l10n/-/l10n-1.2.0.tgz", + "integrity": "sha512-aPsVAewCYMNe2h0yse3Fj7LofvnvFPimojw24K47ip1+I1gawMIsQL+BYAnN8wzlcbsDTEc7I1FxtOh+8dHHIA==", + "requires": { + "core-js": "^3.6.4", + "node-gettext": "^3.0.0" + }, + "dependencies": { + "node-gettext": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/node-gettext/-/node-gettext-3.0.0.tgz", + "integrity": "sha512-/VRYibXmVoN6tnSAY2JWhNRhWYJ8Cd844jrZU/DwLVoI4vBI6ceYbd8i42sYZ9uOgDH3S7vslIKOWV/ZrT2YBA==", + "requires": { + "lodash.get": "^4.4.2" + } + } + } + }, + "node-gettext": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/node-gettext/-/node-gettext-2.1.0.tgz", + "integrity": "sha512-vsHImHl+Py0vB7M2UXcFEJ5NJ3950gcja45YclBFtYxYeZiqdfQdcu+G9s4L7jpRFSh/J/7VoS3upR4JM1nS+g==", + "requires": { + "lodash.get": "^4.4.2" + } + } + } + }, "@nextcloud/router": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@nextcloud/router/-/router-1.2.0.tgz", @@ -2630,6 +2671,16 @@ } } }, + "@nextcloud/vue-dashboard": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@nextcloud/vue-dashboard/-/vue-dashboard-1.0.1.tgz", + "integrity": "sha512-QKOf0qm4UYobuC3djLYwICSuj29H6xnm24IHetc0AMsrfhwPNN1/CC5IWEl1uKCCvwI0NA02HXCVFLtUErlgyg==", + "requires": { + "@nextcloud/vue": "^2.3.0", + "core-js": "^3.6.4", + "vue": "^2.6.11" + } + }, "@nextcloud/webpack-vue-config": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@nextcloud/webpack-vue-config/-/webpack-vue-config-1.1.0.tgz", @@ -7179,6 +7230,11 @@ "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", "dev": true }, + "jed": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/jed/-/jed-1.1.1.tgz", + "integrity": "sha1-elSbvZ/+FYWwzQoZHiAwVb7ldLQ=" + }, "js-base64": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.6.2.tgz", @@ -7908,6 +7964,11 @@ "minimist": "^1.2.5" } }, + "moment": { + "version": "2.24.0", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.24.0.tgz", + "integrity": "sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg==" + }, "move-concurrently": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz", diff --git a/package.json b/package.json index ef69d8f..971bc88 100644 --- a/package.json +++ b/package.json @@ -33,8 +33,10 @@ "@nextcloud/axios": "^1.4.0", "@nextcloud/dialogs": "^3.0.0", "@nextcloud/l10n": "^1.4.1", + "@nextcloud/moment": "^1.1.1", "@nextcloud/router": "^1.2.0", "@nextcloud/vue": "^2.7.0", + "@nextcloud/vue-dashboard": "^1.0.1", "howler": "^2.2.1", "music-metadata": "^7.4.1", "vue": "^2.6.12", diff --git a/src/components/Dashboard.vue b/src/components/Dashboard.vue new file mode 100644 index 0000000..c6bab86 --- /dev/null +++ b/src/components/Dashboard.vue @@ -0,0 +1,245 @@ + + + + + diff --git a/src/components/Table.vue b/src/components/Table.vue index 1867228..cbba36c 100644 --- a/src/components/Table.vue +++ b/src/components/Table.vue @@ -178,10 +178,15 @@ table { padding-right: 0px; } + td.nameColumn { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + padding-right: 0px; + } + td.nameColumn .innernametext { color: var(--color-main-text); - text-overflow: ellipsis; - overflow: hidden; position: relative; vertical-align: top; user-select: none; diff --git a/src/dashboard.js b/src/dashboard.js new file mode 100644 index 0000000..d1dbab4 --- /dev/null +++ b/src/dashboard.js @@ -0,0 +1,19 @@ +import Vue from 'vue' +import { translate, translatePlural } from '@nextcloud/l10n' +import Dashboard from './components/Dashboard' + +Vue.prototype.t = translate +Vue.prototype.n = translatePlural +Vue.prototype.OC = window.OC +Vue.prototype.OCA = window.OCA + +document.addEventListener('DOMContentLoaded', function() { + + OCA.Dashboard.register('radio', (el, { widget }) => { + const View = Vue.extend(Dashboard) + new View({ + propsData: { title: widget.title }, + }).$mount(el) + }) + +}) diff --git a/src/main.js b/src/main.js index ceca8c7..0eee982 100644 --- a/src/main.js +++ b/src/main.js @@ -27,13 +27,16 @@ import { translate, translatePlural } from '@nextcloud/l10n' import App from './App' +import './dashboard' + import VueBlurHash from 'vue-blurhash' import 'vue-blurhash/dist/vue-blurhash.css' Vue.prototype.t = translate Vue.prototype.n = translatePlural - +Vue.prototype.OC = window.OC +Vue.prototype.OCA = window.OCA Vue.prototype.$apiUrl = 'https://de1.api.radio-browser.info' Vue.use(VueBlurHash) diff --git a/webpack.js b/webpack.js index 8e37c6e..e5daa92 100644 --- a/webpack.js +++ b/webpack.js @@ -1,23 +1,3 @@ -const { merge } = require('webpack-merge') const webpackConfig = require('@nextcloud/webpack-vue-config') -const config = { - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: 'file-loader', - options: { - name: '[name].[ext]?[hash]', - }, - }, - ], - }, -} - -const mergedConfigs = merge(config, webpackConfig) - -// Remove duplicate rules by the `test` key -mergedConfigs.module.rules = mergedConfigs.module.rules.filter((v, i, a) => a.findIndex(t => (t.test.toString() === v.test.toString())) === i) - -module.exports = mergedConfigs +module.exports = webpackConfig