From 6ca11f73e300e451dcacdc3cdaae2a5cdad06022 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Tue, 27 Jan 2026 17:06:23 +0100 Subject: [PATCH] refactor(systemtags): migrate to Vue 3 Signed-off-by: Ferdinand Thiessen --- apps/files/src/services/WebdavClient.ts | 5 +- .../BeforeTemplateRenderedListener.php | 1 + .../LoadAdditionalScriptsListener.php | 1 + apps/systemtags/lib/Settings/Admin.php | 5 +- apps/systemtags/src/admin.ts | 11 +- .../src/components/SystemTagForm.vue | 457 +++++++++-------- .../src/components/SystemTagPicker.vue | 48 +- apps/systemtags/src/components/SystemTags.vue | 462 +++++++++--------- .../components/SystemTagsCreationControl.vue | 126 ++--- .../src/files_actions/bulkSystemTagsAction.ts | 16 +- .../src/files_views/systemtagsView.ts | 2 +- apps/systemtags/src/services/api.ts | 40 +- apps/systemtags/src/services/davClient.ts | 35 +- apps/systemtags/src/services/files.ts | 21 +- apps/systemtags/src/services/systemtags.ts | 20 +- apps/systemtags/src/utils.ts | 37 +- apps/systemtags/src/utils/colorUtils.ts | 1 + .../src/views/SystemTagsSection.vue | 120 +++-- build/frontend-legacy/webpack.modules.cjs | 4 - .../apps/systemtags | 0 build/frontend/vite.config.ts | 4 + package-lock.json | 56 +++ package.json | 1 + 23 files changed, 775 insertions(+), 698 deletions(-) rename build/{frontend-legacy => frontend}/apps/systemtags (100%) diff --git a/apps/files/src/services/WebdavClient.ts b/apps/files/src/services/WebdavClient.ts index 2985fd60131..52cbcfee1fe 100644 --- a/apps/files/src/services/WebdavClient.ts +++ b/apps/files/src/services/WebdavClient.ts @@ -1,8 +1,9 @@ -import type { Node } from '@nextcloud/files' -/** +/*! * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ + +import type { Node } from '@nextcloud/files' import type { FileStat, ResponseDataDetailed } from 'webdav' import { getClient, getDefaultPropfind, getRootPath, resultToNode } from '@nextcloud/files/dav' diff --git a/apps/systemtags/lib/Listeners/BeforeTemplateRenderedListener.php b/apps/systemtags/lib/Listeners/BeforeTemplateRenderedListener.php index 15d06394889..afb85dc6d6b 100644 --- a/apps/systemtags/lib/Listeners/BeforeTemplateRenderedListener.php +++ b/apps/systemtags/lib/Listeners/BeforeTemplateRenderedListener.php @@ -30,6 +30,7 @@ class BeforeTemplateRenderedListener implements IEventListener { return; } Util::addInitScript(Application::APP_ID, 'init'); + Util::addStyle(Application::APP_ID, 'init'); $restrictSystemTagsCreationToAdmin = $this->appConfig->getValueBool(Application::APP_ID, 'restrict_creation_to_admin', false); $this->initialState->provideInitialState('restrictSystemTagsCreationToAdmin', $restrictSystemTagsCreationToAdmin); diff --git a/apps/systemtags/lib/Listeners/LoadAdditionalScriptsListener.php b/apps/systemtags/lib/Listeners/LoadAdditionalScriptsListener.php index 87e50a48075..6ed1adc0834 100644 --- a/apps/systemtags/lib/Listeners/LoadAdditionalScriptsListener.php +++ b/apps/systemtags/lib/Listeners/LoadAdditionalScriptsListener.php @@ -30,6 +30,7 @@ class LoadAdditionalScriptsListener implements IEventListener { return; } Util::addInitScript(Application::APP_ID, 'init'); + Util::addStyle(Application::APP_ID, 'init'); $restrictSystemTagsCreationToAdmin = $this->appConfig->getValueBool(Application::APP_ID, 'restrict_creation_to_admin', false); $this->initialState->provideInitialState('restrictSystemTagsCreationToAdmin', $restrictSystemTagsCreationToAdmin); diff --git a/apps/systemtags/lib/Settings/Admin.php b/apps/systemtags/lib/Settings/Admin.php index 45ea8fc7368..a59c92cc1e6 100644 --- a/apps/systemtags/lib/Settings/Admin.php +++ b/apps/systemtags/lib/Settings/Admin.php @@ -28,8 +28,9 @@ class Admin implements ISettings { $restrictSystemTagsCreationToAdmin = $this->appConfig->getValueBool(Application::APP_ID, 'restrict_creation_to_admin', false); $this->initialStateService->provideInitialState('restrictSystemTagsCreationToAdmin', $restrictSystemTagsCreationToAdmin); - Util::addScript('systemtags', 'admin'); - return new TemplateResponse('systemtags', 'admin', [], ''); + Util::addStyle(Application::APP_ID, 'admin'); + Util::addScript(Application::APP_ID, 'admin'); + return new TemplateResponse(Application::APP_ID, 'admin', [], ''); } /** diff --git a/apps/systemtags/src/admin.ts b/apps/systemtags/src/admin.ts index 004c0df82f1..6a1f07e71a4 100644 --- a/apps/systemtags/src/admin.ts +++ b/apps/systemtags/src/admin.ts @@ -1,13 +1,10 @@ -/** +/*! * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ -import { getCSPNonce } from '@nextcloud/auth' -import Vue from 'vue' +import { createApp } from 'vue' import SystemTagsSection from './views/SystemTagsSection.vue' -__webpack_nonce__ = getCSPNonce() - -const SystemTagsSectionView = Vue.extend(SystemTagsSection) -new SystemTagsSectionView().$mount('#vue-admin-systemtags') +const app = createApp(SystemTagsSection) +app.mount('#vue-admin-systemtags') diff --git a/apps/systemtags/src/components/SystemTagForm.vue b/apps/systemtags/src/components/SystemTagForm.vue index 44a669c7617..24bf5c872bf 100644 --- a/apps/systemtags/src/components/SystemTagForm.vue +++ b/apps/systemtags/src/components/SystemTagForm.vue @@ -3,6 +3,219 @@ - SPDX-License-Identifier: AGPL-3.0-or-later --> + + - -