get deck to build with vue3 with broken functionality

Signed-off-by: grnd-alt <github@belakkaf.net>
This commit is contained in:
grnd-alt
2025-01-27 12:58:29 +01:00
committed by grnd-alt
parent 81e2c4768b
commit 452dc5f230
8 changed files with 6402 additions and 7018 deletions

6
PLACEHOLDER_NPM_I.sh Executable file
View File

@@ -0,0 +1,6 @@
# PLACEHOLDER SCRIPT FOR GETTING DEPENDENCIES vue3 ready
npm remove @vue/vue2-jest vue-template-compiler vue-at vuex-router-sync --force
npm install vue@3 vuex@4.1.0 vue-router@4.5.0 @vue/vue3-jest ../../../../../webpack-vue-config/ ../../../../../nextcloud-dialogs @vue/compat @vue/compiler-sfc
npm ci

13307
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -35,7 +35,7 @@
"@nextcloud/auth": "^2.4.0", "@nextcloud/auth": "^2.4.0",
"@nextcloud/axios": "^2.5.1", "@nextcloud/axios": "^2.5.1",
"@nextcloud/capabilities": "^1.2.0", "@nextcloud/capabilities": "^1.2.0",
"@nextcloud/dialogs": "^6.0.1", "@nextcloud/dialogs": "file:../../../../../nextcloud-dialogs",
"@nextcloud/event-bus": "^3.3.2", "@nextcloud/event-bus": "^3.3.2",
"@nextcloud/files": "^3.10.1", "@nextcloud/files": "^3.10.1",
"@nextcloud/initial-state": "^2.2.0", "@nextcloud/initial-state": "^2.2.0",
@@ -44,6 +44,9 @@
"@nextcloud/notify_push": "^1.3.0", "@nextcloud/notify_push": "^1.3.0",
"@nextcloud/router": "^3.0.1", "@nextcloud/router": "^3.0.1",
"@nextcloud/vue": "^8.25.1", "@nextcloud/vue": "^8.25.1",
"@vue/compat": "^3.5.13",
"@vue/compiler-sfc": "^3.5.13",
"@vue/vue3-jest": "^29.2.6",
"blueimp-md5": "^2.19.0", "blueimp-md5": "^2.19.0",
"chroma-js": "^3.1.2", "chroma-js": "^3.1.2",
"dompurify": "^3.2.5", "dompurify": "^3.2.5",
@@ -54,16 +57,13 @@
"moment": "^2.30.1", "moment": "^2.30.1",
"p-queue": "^8.0.1", "p-queue": "^8.0.1",
"url-search-params-polyfill": "^8.2.5", "url-search-params-polyfill": "^8.2.5",
"vue": "^2.7.15", "vue": "^3.5.13",
"vue-at": "^2.5.1",
"vue-click-outside": "^1.1.0", "vue-click-outside": "^1.1.0",
"vue-easymde": "^2.0.0", "vue-easymde": "^2.0.0",
"vue-infinite-loading": "^2.4.5",
"vue-material-design-icons": "^5.3.1", "vue-material-design-icons": "^5.3.1",
"vue-router": "^3.6.5", "vue-router": "^4.5.0",
"vue-smooth-dnd": "^0.8.1", "vue-smooth-dnd": "^0.8.1",
"vuex": "^3.6.2", "vuex": "^4.1.0"
"vuex-router-sync": "^5.0.0"
}, },
"browserslist": [ "browserslist": [
"extends @nextcloud/browserslist-config" "extends @nextcloud/browserslist-config"
@@ -78,17 +78,15 @@
"@nextcloud/cypress": "^1.0.0-beta.13", "@nextcloud/cypress": "^1.0.0-beta.13",
"@nextcloud/eslint-config": "^8.4.2", "@nextcloud/eslint-config": "^8.4.2",
"@nextcloud/stylelint-config": "^3.0.1", "@nextcloud/stylelint-config": "^3.0.1",
"@nextcloud/webpack-vue-config": "^6.3.0", "@nextcloud/webpack-vue-config": "file:../../../../../webpack-vue-config",
"@relative-ci/agent": "^4.3.1", "@relative-ci/agent": "^4.2.14",
"@vue/test-utils": "^2.4.6", "@vue/test-utils": "^2.4.6",
"@vue/vue2-jest": "^29.2.6",
"cypress": "^13.17.0", "cypress": "^13.17.0",
"eslint-plugin-cypress": "^3.6.0", "eslint-plugin-cypress": "^3.6.0",
"eslint-webpack-plugin": "^5.0.1", "eslint-webpack-plugin": "^5.0.1",
"jest": "^29.7.0", "jest": "^29.7.0",
"jest-serializer-vue": "^3.1.0", "jest-serializer-vue": "^3.1.0",
"stylelint-webpack-plugin": "^5.0.1", "stylelint-webpack-plugin": "^5.0.1"
"vue-template-compiler": "^2.7.16"
}, },
"jest": { "jest": {
"moduleFileExtensions": [ "moduleFileExtensions": [

View File

@@ -2,8 +2,13 @@
- SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors - SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
- SPDX-License-Identifier: AGPL-3.0-or-later - SPDX-License-Identifier: AGPL-3.0-or-later
--> -->
<template> <template>
<div>
THIS HAS AT
</div>
</template>
<!-- <template>
<div class="comment-form"> <div class="comment-form">
<form @submit.prevent="submit"> <form @submit.prevent="submit">
<At ref="at" <At ref="at"
@@ -191,4 +196,4 @@ export default {
.atwho-li--avatar { .atwho-li--avatar {
margin-right: 10px; margin-right: 10px;
} }
</style> </style> -->

View File

@@ -2,7 +2,7 @@
* SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later * SPDX-License-Identifier: AGPL-3.0-or-later
*/ */
import Vue from 'vue' import { createApp } from 'vue'
import App from './App.vue' import App from './App.vue'
import router from './router.js' import router from './router.js'
import store from './store/main.js' import store from './store/main.js'
@@ -20,21 +20,25 @@ document.body.setAttribute('data-snap-ignore', 'true')
sync(store, router) sync(store, router)
Vue.prototype.t = translate const app = createApp(App)
Vue.prototype.n = translatePlural
Vue.directive('click-outside', ClickOutside) app.config.globalProperties.t = translate
app.config.globalProperties.n = translatePlural
Vue.directive('focus', { app.directive('click-outside', ClickOutside)
inserted(el) {
app.directive('focus', {
mounted(el) {
el.focus() el.focus()
}, },
}) })
Vue.config.errorHandler = (err, vm, info) => { app.config.errorHandler = (err, vm, info) => {
if (err.response && err.response.data.message) { if (err.response && err.response.data.message) {
const errorMessage = t('deck', 'Something went wrong') const errorMessage = translate('deck', 'Something went wrong')
showError(`${errorMessage}: ${err.response.data.status} ${err.response.data.message}`) showError(
`${errorMessage}: ${err.response.data.status} ${err.response.data.message}`,
)
} }
console.error(err) console.error(err)
} }
@@ -47,16 +51,14 @@ window.addEventListener('DOMContentLoaded', () => {
window.OCA.Files = {} window.OCA.Files = {}
} }
// register unused client for the sidebar to have access to its parser methods // register unused client for the sidebar to have access to its parser methods
Object.assign(window.OCA.Files, { App: { fileList: { filesClient: OC.Files.getClient() } } }, window.OCA.Files) Object.assign(
window.OCA.Files,
{ App: { fileList: { filesClient: OC.Files.getClient() } } },
window.OCA.Files,
)
}) })
/* eslint-disable-next-line no-new */ app.mixin({
new Vue({
el: '#content',
// eslint-disable-next-line vue/match-component-file-name
name: 'Deck',
router,
store,
data() { data() {
return { return {
time: Date.now(), time: Date.now(),
@@ -75,7 +77,7 @@ new Vue({
this.time = Date.now() this.time = Date.now()
}, 1000) }, 1000)
}, },
beforeDestroy() { beforeUnmount() {
clearInterval(this.interval) clearInterval(this.interval)
}, },
methods: { methods: {
@@ -86,9 +88,12 @@ new Vue({
this.$store.commit('setSearchQuery', '') this.$store.commit('setSearchQuery', '')
}, },
}, },
render: h => h(App),
}) })
app.use(router)
app.use(store)
app.mount('#content')
if (!window.OCA.Deck) { if (!window.OCA.Deck) {
window.OCA.Deck = {} window.OCA.Deck = {}
} }

View File

@@ -3,8 +3,7 @@
* SPDX-License-Identifier: AGPL-3.0-or-later * SPDX-License-Identifier: AGPL-3.0-or-later
*/ */
import Vue from 'vue' import { createRouter, createWebHistory } from 'vue-router'
import Router from 'vue-router'
import { generateUrl, getRootUrl } from '@nextcloud/router' import { generateUrl, getRootUrl } from '@nextcloud/router'
import { BOARD_FILTERS } from './store/main.js' import { BOARD_FILTERS } from './store/main.js'
import Boards from './components/boards/Boards.vue' import Boards from './components/boards/Boards.vue'
@@ -14,7 +13,6 @@ import BoardSidebar from './components/board/BoardSidebar.vue'
import CardSidebar from './components/card/CardSidebar.vue' import CardSidebar from './components/card/CardSidebar.vue'
import Overview from './components/overview/Overview.vue' import Overview from './components/overview/Overview.vue'
Vue.use(Router)
// We apply a dynamic base URL depending on the URL used in the browser // We apply a dynamic base URL depending on the URL used in the browser
const baseUrl = generateUrl('/apps/deck/') const baseUrl = generateUrl('/apps/deck/')
@@ -22,9 +20,8 @@ const webRootWithIndexPHP = getRootUrl() + '/index.php'
const doesURLContainIndexPHP = window.location.pathname.startsWith(webRootWithIndexPHP) const doesURLContainIndexPHP = window.location.pathname.startsWith(webRootWithIndexPHP)
const currentBaseUrl = doesURLContainIndexPHP ? baseUrl : baseUrl.replace('/index.php/', '/') const currentBaseUrl = doesURLContainIndexPHP ? baseUrl : baseUrl.replace('/index.php/', '/')
const router = new Router({ const router = createRouter({
mode: 'history', history: createWebHistory(currentBaseUrl),
base: currentBaseUrl,
linkActiveClass: 'active', linkActiveClass: 'active',
routes: [ routes: [
{ {

View File

@@ -7,7 +7,7 @@ import 'url-search-params-polyfill'
import { loadState } from '@nextcloud/initial-state' import { loadState } from '@nextcloud/initial-state'
import Vue from 'vue' import Vue from 'vue'
import Vuex from 'vuex' import { createStore } from 'vuex'
import axios from '@nextcloud/axios' import axios from '@nextcloud/axios'
import { generateOcsUrl, generateUrl } from '@nextcloud/router' import { generateOcsUrl, generateUrl } from '@nextcloud/router'
import { BoardApi } from '../services/BoardApi.js' import { BoardApi } from '../services/BoardApi.js'
@@ -18,7 +18,6 @@ import comment from './comment.js'
import trashbin from './trashbin.js' import trashbin from './trashbin.js'
import attachment from './attachment.js' import attachment from './attachment.js'
import overview from './overview.js' import overview from './overview.js'
Vue.use(Vuex)
const apiClient = new BoardApi() const apiClient = new BoardApi()
const debug = process.env.NODE_ENV !== 'production' const debug = process.env.NODE_ENV !== 'production'
@@ -29,7 +28,8 @@ export const BOARD_FILTERS = {
SHARED: 'shared', SHARED: 'shared',
} }
export default new Vuex.Store({
const store = createStore({
modules: { modules: {
actions, actions,
stack, stack,
@@ -531,3 +531,5 @@ export default new Vuex.Store({
}, },
}, },
}) })
export default store

View File

@@ -31,6 +31,6 @@ if (isDevServer) {
} }
} }
// Workaround for https://github.com/nextcloud/webpack-vue-config/pull/432 causing problems with nextcloud-vue-collections // Workaround for https://github.com/nextcloud/webpack-vue-config/pull/432 causing problems with nextcloud-vue-collections
webpackConfig.resolve.alias = {} webpackConfig.resolve.alias = { vue: '@vue/compat' }
module.exports = webpackConfig module.exports = webpackConfig