feat: use new async component definition

- fix see: https://v3.vuejs.org/guide/migration/async-components.html
- put async editor in separate component
This commit is contained in:
Dominik Pschenitschni 2021-08-23 21:18:29 +02:00
parent 51a740f53c
commit 421ff9a188
No known key found for this signature in database
GPG key ID: B257AC0149F43A77
10 changed files with 38 additions and 74 deletions

View file

@ -0,0 +1,12 @@
import { defineAsyncComponent } from 'vue'
import ErrorComponent from '@/components/misc/error.vue'
import LoadingComponent from '@/components/misc/loading.vue'
const Editor = () => import('@/components/input/editor.vue')
export default defineAsyncComponent({
loader: Editor,
loadingComponent: LoadingComponent,
errorComponent: ErrorComponent,
timeout: 60000,
})

View file

@ -69,6 +69,8 @@
</template>
<script>
import AsyncEditor from '@/components/input/AsyncEditor'
import ListService from '../../services/list'
import TaskService from '../../services/task'
import TaskModel from '../../models/task'
@ -76,8 +78,6 @@ import priorities from '../../models/constants/priorities'
import EditLabels from './partials/editLabels'
import Reminders from './partials/reminders'
import ColorPicker from '../input/colorPicker'
import LoadingComponent from '../misc/loading'
import ErrorComponent from '../misc/error'
export default {
name: 'edit-task',
@ -99,12 +99,7 @@ export default {
ColorPicker,
Reminders,
EditLabels,
editor: () => ({
component: import('../../components/input/editor'),
loading: LoadingComponent,
error: ErrorComponent,
timeout: 60000,
}),
editor: AsyncEditor,
},
props: {
task: {

View file

@ -152,22 +152,17 @@
</template>
<script>
import AsyncEditor from '@/components/input/AsyncEditor'
import TaskCommentService from '../../../services/taskComment'
import TaskCommentModel from '../../../models/taskComment'
import LoadingComponent from '../../misc/loading'
import ErrorComponent from '../../misc/error'
import {uploadFile} from '@/helpers/attachments'
import {mapState} from 'vuex'
export default {
name: 'comments',
components: {
editor: () => ({
component: import('../../input/editor'),
loading: LoadingComponent,
error: ErrorComponent,
timeout: 60000,
}),
editor: AsyncEditor,
},
props: {
taskId: {

View file

@ -30,8 +30,7 @@
</template>
<script>
import LoadingComponent from '@/components/misc/loading.vue'
import ErrorComponent from '@/components/misc/error.vue'
import AsyncEditor from '@/components/input/AsyncEditor'
import {LOADING} from '@/store/mutation-types'
import {mapState} from 'vuex'
@ -39,12 +38,7 @@ import {mapState} from 'vuex'
export default {
name: 'description',
components: {
editor: () => ({
component: import('@/components/input/editor.vue'),
loading: LoadingComponent,
error: ErrorComponent,
timeout: 60000,
}),
editor: AsyncEditor,
},
data() {
return {

View file

@ -60,8 +60,8 @@
</template>
<script>
import LoadingComponent from '@/components/misc/loading.vue'
import ErrorComponent from '@/components/misc/error.vue'
import AsyncEditor from '@/components/input/AsyncEditor'
import Filters from '@/components/list/partials/filters.vue'
import SavedFilterService from '@/services/savedFilter'
import SavedFilterModel from '@/models/savedFilter'
@ -86,12 +86,7 @@ export default {
},
components: {
Filters,
editor: () => ({
component: import('../../components/input/editor'),
loading: LoadingComponent,
error: ErrorComponent,
timeout: 60000,
}),
editor: AsyncEditor,
},
created() {
this.editorActive = false

View file

@ -52,8 +52,8 @@
</template>
<script>
import ErrorComponent from '@/components/misc/error.vue'
import LoadingComponent from '@/components/misc/loading.vue'
import AsyncEditor from '@/components/input/AsyncEditor'
import CreateEdit from '@/components/misc/create-edit.vue'
import SavedFilterModel from '@/models/savedFilter'
@ -84,12 +84,7 @@ export default {
components: {
CreateEdit,
Filters,
editor: () => ({
component: import('@/components/input/editor.vue'),
loading: LoadingComponent,
error: ErrorComponent,
timeout: 60000,
}),
editor: AsyncEditor,
},
watch: {
// call again the method if the route changes

View file

@ -100,21 +100,16 @@
import {mapState} from 'vuex'
import LabelModel from '../../models/label'
import ColorPicker from '../../components/input/colorPicker'
import LoadingComponent from '../../components/misc/loading'
import ErrorComponent from '../../components/misc/error'
import {LOADING, LOADING_MODULE} from '@/store/mutation-types'
import AsyncEditor from '@/components/input/AsyncEditor'
import ColorPicker from '@/components/input/colorPicker'
export default {
name: 'ListLabels',
components: {
ColorPicker,
editor: () => ({
component: import('../../components/input/editor'),
loading: LoadingComponent,
error: ErrorComponent,
timeout: 60000,
}),
editor: AsyncEditor,
},
data() {
return {

View file

@ -66,11 +66,11 @@
</template>
<script>
import AsyncEditor from '@/components/input/AsyncEditor'
import ListModel from '@/models/list'
import ListService from '@/services/list'
import ColorPicker from '@/components/input/colorPicker.vue'
import LoadingComponent from '@/components/misc/loading.vue'
import ErrorComponent from '@/components/misc/error.vue'
import ListDuplicateService from '@/services/listDuplicateService'
import {CURRENT_LIST} from '@/store/mutation-types'
import CreateEdit from '@/components/misc/create-edit.vue'
@ -87,12 +87,7 @@ export default {
components: {
CreateEdit,
ColorPicker,
editor: () => ({
component: import('@/components/input/editor.vue'),
loading: LoadingComponent,
error: ErrorComponent,
timeout: 60000,
}),
editor: AsyncEditor,
},
watch: {
'$route.params.listId': {

View file

@ -57,12 +57,12 @@
</template>
<script>
import AsyncEditor from '@/components/input/AsyncEditor'
import NamespaceService from '@/services/namespace'
import NamespaceModel from '@/models/namespace'
import Fancycheckbox from '@/components/input/fancycheckbox.vue'
import ColorPicker from '@/components/input/colorPicker.vue'
import LoadingComponent from '@/components/misc/loading.vue'
import ErrorComponent from '@/components/misc/error.vue'
import CreateEdit from '@/components/misc/create-edit.vue'
export default {
@ -79,12 +79,7 @@ export default {
CreateEdit,
ColorPicker,
Fancycheckbox,
editor: () => ({
component: import('@/components/input/editor.vue'),
loading: LoadingComponent,
error: ErrorComponent,
timeout: 60000,
}),
editor: AsyncEditor,
},
beforeMount() {
this.namespace.id = this.$route.params.id

View file

@ -161,6 +161,7 @@
</template>
<script>
import AsyncEditor from '@/components/input/AsyncEditor'
import {mapState} from 'vuex'
import TeamService from '../../services/team'
@ -171,9 +172,6 @@ import UserModel from '../../models/user'
import UserService from '../../services/user'
import Rights from '../../models/constants/rights.json'
import LoadingComponent from '../../components/misc/loading'
import ErrorComponent from '../../components/misc/error'
import Multiselect from '@/components/input/multiselect.vue'
export default {
@ -199,12 +197,7 @@ export default {
},
components: {
Multiselect,
editor: () => ({
component: import('../../components/input/editor'),
loading: LoadingComponent,
error: ErrorComponent,
timeout: 60000,
}),
editor: AsyncEditor,
},
watch: {
// call again the method if the route changes