From 949e09ccb734b23a09d70f79972aeb7e86bedda4 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Sat, 23 Dec 2023 20:48:10 +0100 Subject: [PATCH] enh(core): Refactor profile page to use vue components Signed-off-by: Ferdinand Thiessen --- core/Controller/ProfilePageController.php | 4 +- core/src/{profile.js => profile.ts} | 22 +- core/src/views/Profile.vue | 482 ++++++++-------------- core/templates/profile.php | 6 +- webpack.modules.js | 2 +- 5 files changed, 190 insertions(+), 326 deletions(-) rename core/src/{profile.js => profile.ts} (81%) diff --git a/core/Controller/ProfilePageController.php b/core/Controller/ProfilePageController.php index 8ea2ad699c1..eb5b0aa4c0a 100644 --- a/core/Controller/ProfilePageController.php +++ b/core/Controller/ProfilePageController.php @@ -29,7 +29,7 @@ namespace OC\Core\Controller; use OC\Profile\ProfileManager; use OCP\AppFramework\Controller; -use OCP\AppFramework\Http\Attribute\IgnoreOpenAPI; +use OCP\AppFramework\Http\Attribute\OpenAPI; use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Services\IInitialState; use OCP\EventDispatcher\IEventDispatcher; @@ -42,7 +42,7 @@ use OCP\Profile\BeforeTemplateRenderedEvent; use OCP\Share\IManager as IShareManager; use OCP\UserStatus\IManager as IUserStatusManager; -#[IgnoreOpenAPI] +#[OpenAPI(scope: OpenAPI::SCOPE_IGNORE)] class ProfilePageController extends Controller { public function __construct( string $appName, diff --git a/core/src/profile.js b/core/src/profile.ts similarity index 81% rename from core/src/profile.js rename to core/src/profile.ts index 79465c6a28d..ee1593e8705 100644 --- a/core/src/profile.js +++ b/core/src/profile.ts @@ -20,17 +20,14 @@ * */ -import Vue from 'vue' import { getRequestToken } from '@nextcloud/auth' -import { translate as t } from '@nextcloud/l10n' -import VTooltip from 'v-tooltip' - -import logger from './logger.js' +import Vue from 'vue' import Profile from './views/Profile.vue' import ProfileSections from './profile/ProfileSections.js' -__webpack_nonce__ = btoa(getRequestToken()) +// @ts-expect-error Script nonce required for webpack loading additional scripts +__webpack_nonce__ = btoa(getRequestToken() ?? '') if (!window.OCA) { window.OCA = {} @@ -41,19 +38,8 @@ if (!window.OCA.Core) { } Object.assign(window.OCA.Core, { ProfileSections: new ProfileSections() }) -Vue.use(VTooltip) - -Vue.mixin({ - props: { - logger, - }, - methods: { - t, - }, -}) - const View = Vue.extend(Profile) window.addEventListener('DOMContentLoaded', () => { - new View().$mount('#vue-profile') + new View().$mount('#content') }) diff --git a/core/src/views/Profile.vue b/core/src/views/Profile.vue index 84859f4a971..b7f593df8d2 100644 --- a/core/src/views/Profile.vue +++ b/core/src/views/Profile.vue @@ -22,197 +22,185 @@ --> - - - diff --git a/core/templates/profile.php b/core/templates/profile.php index 84d6eb0e38f..33cfaeb52c6 100644 --- a/core/templates/profile.php +++ b/core/templates/profile.php @@ -1,5 +1 @@ -
-
+
diff --git a/webpack.modules.js b/webpack.modules.js index 8285271bae5..dc319e39780 100644 --- a/webpack.modules.js +++ b/webpack.modules.js @@ -34,7 +34,7 @@ module.exports = { login: path.join(__dirname, 'core/src', 'login.js'), main: path.join(__dirname, 'core/src', 'main.js'), maintenance: path.join(__dirname, 'core/src', 'maintenance.js'), - profile: path.join(__dirname, 'core/src', 'profile.js'), + profile: path.join(__dirname, 'core/src', 'profile.ts'), recommendedapps: path.join(__dirname, 'core/src', 'recommendedapps.js'), systemtags: path.resolve(__dirname, 'core/src', 'systemtags/merged-systemtags.js'), 'unified-search': path.join(__dirname, 'core/src', 'unified-search.js'),