Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration to Vue 3 #3311

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.js → .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module.exports = {
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
'object-curly-spacing': ['error', 'always'],
'prefer-template': 'error',
'vue/no-v-model-argument': 'off',
'vue/no-unused-properties': ['error', {
groups: ['props', 'data', 'computed', 'methods'],
deepData: true,
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
.vscode/
build/
css/*.map
css/
js/*
nbproject/
node_modules/
Expand Down
File renamed without changes.
6,958 changes: 2,491 additions & 4,467 deletions package-lock.json

Large diffs are not rendered by default.

25 changes: 11 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "polls",
"description": "Polls app for nextcloud",
"version": "6.1.0-rc3",
"version": "7.0.0-alpha0",
"authors": [
{
"name": "Vinzenz Rosenkranz",
Expand All @@ -26,9 +26,9 @@
"private": true,
"main": "src/js/main.js",
"scripts": {
"dev": "webpack --mode=development",
"watch": "webpack --mode=development --progress --watch",
"build": "webpack --mode=production --progress",
"dev": "vite build --mode development",
"watch": "vite build --mode development --watch",
"build": "vite build --mode production",
"lint": "eslint --ext .js,.vue src",
"lint:fix": "eslint --ext .js,.vue src --fix",
"stylelint": "stylelint src/**/*{.scss,.vue,.css}",
Expand All @@ -38,14 +38,13 @@
"dependencies": {
"@nextcloud/auth": "^2.2.1",
"@nextcloud/axios": "^2.4.0",
"@nextcloud/dialogs": "^5.1.1",
"@nextcloud/dialogs": "4.1.0",
"@nextcloud/event-bus": "^3.1.0",
"@nextcloud/initial-state": "^2.1.0",
"@nextcloud/l10n": "^2.2.0",
"@nextcloud/moment": "^1.3.1",
"@nextcloud/router": "^3.0.0",
"@nextcloud/vue": "^8.6.2",
"core-js": "^3.35.1",
"@nextcloud/vue": "9.0.0-alpha.1",
"dompurify": "^3.0.8",
"file-saver": "^2.0.5",
"linkify-string": "^4.1.3",
Expand All @@ -54,12 +53,11 @@
"marked-gfm-heading-id": "^3.1.3",
"qrcode": "^1.5.3",
"v-click-outside": "^3.2.0",
"vue": "^2.7.15",
"vue": "^3.4.15",
"vue-material-design-icons": "^5.3.0",
"vue-router": "^3.6.5",
"vue-router": "^4.2.5",
"vuedraggable": "^2.24.3",
"vuex": "^3.6.2",
"vuex-router-sync": "^5.0.0",
"vuex": "^4.1.0",
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.0/xlsx-0.20.0.tgz"
},
"browserslist": [
Expand All @@ -72,13 +70,12 @@
"devDependencies": {
"@nextcloud/babel-config": "^1.0.0",
"@nextcloud/browserslist-config": "^3.0.0",
"@nextcloud/eslint-config": "^8.3.0",
"@nextcloud/eslint-config": "github:nextcloud-libraries/eslint-config#vue3",
"@nextcloud/stylelint-config": "^2.4.0",
"@nextcloud/webpack-vue-config": "^6.0.1",
"@nextcloud/vite-config": "github:nextcloud-libraries/nextcloud-vite-config#vue3",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"prettier": "^3.2.5",
"vue-template-compiler": "^2.7.16",
"xml2js": "^0.6.2"
}
}
4 changes: 2 additions & 2 deletions src/js/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import { getCurrentUser } from '@nextcloud/auth'
import { NcContent } from '@nextcloud/vue'
import { subscribe, unsubscribe } from '@nextcloud/event-bus'
import { mapState, mapActions } from 'vuex'
import '@nextcloud/dialogs/style.css'
// import '@nextcloud/dialogs/style.css'
import './assets/scss/colors.scss'
import './assets/scss/hacks.scss'
import './assets/scss/print.scss'
Expand Down Expand Up @@ -117,7 +117,7 @@ export default {

},

beforeDestroy() {
beforeUnmount() {
this.cancelToken.cancel()
unsubscribe('polls:poll:load')
unsubscribe('polls:transitions:on')
Expand Down
33 changes: 12 additions & 21 deletions src/js/adminSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,37 +21,28 @@
*
*/

import Vue from 'vue'
import Vuex, { Store } from 'vuex'
import { createApp } from 'vue'
import { createStore } from 'vuex'
import appSettings from './store/modules/appSettings.js'
import { translate, translatePlural } from '@nextcloud/l10n'

import AdminSettingsPage from './views/AdminSettingsPage.vue'

// /* eslint-disable-next-line camelcase, no-undef */
// __webpack_nonce__ = btoa(getRequestToken())
// /* eslint-disable-next-line camelcase, no-undef */
// __webpack_public_path__ = generateFilePath('polls', '', 'js/')
// Vue.config.debug = import.meta.env.MODE === 'development'
// Vue.config.devtools = import.meta.env.MODE === 'development'

Vue.prototype.t = translate
Vue.prototype.n = translatePlural

Vue.config.debug = process.env.NODE_ENV !== 'production'
Vue.config.devTools = process.env.NODE_ENV !== 'production'
// eslint-disable-next-line vue/match-component-file-name

Vue.use(Vuex)

const store = new Store({
const store = createStore({
modules: {
appSettings,
},
strict: process.env.NODE_ENV !== 'production',
})

/* eslint-disable-next-line no-new */
new Vue({
el: '#content_polls',
store,
render: (h) => h(AdminSettingsPage),
})
const PollsAdminSettings = createApp(AdminSettingsPage)
.use(store)

PollsAdminSettings.config.globalProperties.t = translate
PollsAdminSettings.config.globalProperties.n = translatePlural

AdminSettingsPage.mount('#admin_settings')
2 changes: 2 additions & 0 deletions src/js/components/Actions/modules/ActionDelete.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ export default {
},
},

emits: ['delete', 'restore'],

data() {
return {
deleteInterval: null,
Expand Down
2 changes: 1 addition & 1 deletion src/js/components/Actions/modules/ActionRegister.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
@click="clickAction()">
{{ caption }}
</NcButton>
<NcModal :show.sync="showRegistration"
<NcModal v-model:show="showRegistration"
:size="registerModalSize"
:can-close="true"
@close="closeRegisterModal()">
Expand Down
4 changes: 3 additions & 1 deletion src/js/components/Actions/modules/ActionSendConfirmed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
{{ sendButtonCaption }}
</NcButton>

<NcModal :show.sync="showModal"
<NcModal v-model:show="showModal"
:name="t('polls', 'Result of sent confirmation mails')"
size="small">
<div class="modal-confirmation-result">
Expand Down Expand Up @@ -71,6 +71,8 @@ export default {
NcModal,
},

emits: ['success', 'error'],

data() {
return {
showModal: false,
Expand Down
1 change: 1 addition & 0 deletions src/js/components/AppIcons/modules/MaybeIcon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,6 @@ export default {
default: 24,
},
},
emits: ['click'],
}
</script>
1 change: 1 addition & 0 deletions src/js/components/AppIcons/modules/PollsAppIcon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,6 @@ export default {
default: 24,
},
},
emits: ['click'],
}
</script>
1 change: 1 addition & 0 deletions src/js/components/AppIcons/modules/Spinner.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export default {
default: 24,
},
},
emits: ['click'],
}
</script>

Expand Down
2 changes: 1 addition & 1 deletion src/js/components/Base/modules/BadgeDiv.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
-
-->

<template lang="html">
<template>
<Component :is="tag" class="badge">
<div>
<slot name="icon" />
Expand Down
2 changes: 1 addition & 1 deletion src/js/components/Base/modules/ConfigBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
-
-->

<template lang="html">
<template>
<div class="config-box">
<div class="config-box__header">
<slot name="icon" />
Expand Down
2 changes: 1 addition & 1 deletion src/js/components/Base/modules/FlexSpacer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
-
-->

<template lang="html">
<template>
<Component :is="tag" class="spacer">
<slot />
</Component>
Expand Down
2 changes: 1 addition & 1 deletion src/js/components/Base/modules/HeaderBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
-
-->

<template lang="html">
<template>
<div class="header_bar">
<div class="header_bar_top">
<div class="bar_top_left">
Expand Down
4 changes: 3 additions & 1 deletion src/js/components/Base/modules/InputDiv.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
-
-->

<template lang="html">
<template>
<div :class="['input-div', { numeric: useNumModifiers }]">
<label v-if="label">
{{ label }}
Expand Down Expand Up @@ -135,6 +135,8 @@ export default {
},
},

emits: ['input', 'change', 'submit'],

computed: {
computedSignalingClass() {
if (this.signalingClass === 'valid') return 'success'
Expand Down
5 changes: 3 additions & 2 deletions src/js/components/Base/modules/RadioGroupDiv.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
-
-->

<template lang="html">
<template>
<div class="radio-group-div">
<NcCheckboxRadioSwitch v-for="(option, index) in options"
:key="option.value"
:checked.sync="selectedValue"
v-model:checked="selectedValue"
:value="option.value"
:name="id + '_' + index"
type="radio"
Expand Down Expand Up @@ -61,6 +61,7 @@ export default {
},
},

emits: ['input'],
computed: {
selectedValue: {
get() {
Expand Down
2 changes: 1 addition & 1 deletion src/js/components/Cards/VoteInfoCards.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
-
-->

<template lang="html">
<template>
<div class="info-section">
<CardUnpublishedPoll v-if="showUnpublishedPollCard" />
<CardAddProposals v-if="showAddProposalsCard" />
Expand Down
2 changes: 1 addition & 1 deletion src/js/components/Cards/modules/CardAddProposals.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
-
-->

<template lang="html">
<template>
<CardDiv :type="cardType">
{{ t('polls', 'You are asked to propose more options. ') }}
<p v-if="proposalsExpirySet && !proposalsExpired">
Expand Down
2 changes: 1 addition & 1 deletion src/js/components/Cards/modules/CardAnonymousPollHint.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
-
-->

<template lang="html">
<template>
<CardDiv :type="cardType">
{{ t('polls', 'Although participant\'s names are hidden, this is not a real anonymous poll because they are not hidden from the owner.') }}
{{ t('polls', 'Additionally the owner can remove the anonymous flag at any time, which will reveal the participant\'s names.') }}
Expand Down
2 changes: 1 addition & 1 deletion src/js/components/Cards/modules/CardClosedPoll.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
-
-->

<template lang="html">
<template>
<CardDiv :type="cardType">
{{ t('polls', 'This poll is closed.') }}
<span v-if="!allowEdit">
Expand Down
2 changes: 1 addition & 1 deletion src/js/components/Cards/modules/CardHiddenParticipants.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
-
-->

<template lang="html">
<template>
<CardDiv :type="cardType">
{{ t('polls', 'Due to possible performance issues {countHiddenParticipants} voters are hidden.', { countHiddenParticipants }) }}
{{ t('polls', 'You can reveal them, but you may expect an unwanted long loading time.') }}
Expand Down
2 changes: 1 addition & 1 deletion src/js/components/Cards/modules/CardLimitedVotes.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
-
-->

<template lang="html">
<template>
<CardDiv :heading="t('polls', 'Limited votes.')"
:type="cardType">
<ul>
Expand Down
2 changes: 1 addition & 1 deletion src/js/components/Cards/modules/CardLockedShare.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
-
-->

<template lang="html">
<template>
<CardDiv :type="cardType">
{{ cardText }}
<template #button>
Expand Down
2 changes: 1 addition & 1 deletion src/js/components/Cards/modules/CardRegister.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
-
-->

<template lang="html">
<template>
<CardDiv :type="cardType">
{{ registrationInvitationText }}
<template #button>
Expand Down
4 changes: 3 additions & 1 deletion src/js/components/Cards/modules/CardSendConfirmations.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
-
-->

<template lang="html">
<template>
<CardDiv :type="cardType">
{{ confirmationSendMessage }}
<template #button>
Expand All @@ -41,6 +41,8 @@ export default {
ActionSendConfirmed: () => import('../../Actions/modules/ActionSendConfirmed.vue'),
},

emits: ['send-confirmation-success', 'send-confirmation-error'],

data() {
return {
cardType: 'info',
Expand Down
2 changes: 1 addition & 1 deletion src/js/components/Cards/modules/CardUnpublishedPoll.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
-
-->

<template lang="html">
<template>
<CardDiv :type="cardType">
{{ t('polls', 'This poll is unpublished.') }}
<span v-if="hasVotes">{{ t('polls', 'Existing participants will still have access.') }} </span>
Expand Down
2 changes: 1 addition & 1 deletion src/js/components/Combo/ComboTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
-
-->

<template lang="html">
<template>
<div :class="['combo-table', viewMode]">
<div class="user-column">
<div class="spacer" />
Expand Down
Loading
Loading