From 5b70f8d5d777c3b05e49c1a3519ed3661cce39f5 Mon Sep 17 00:00:00 2001 From: kolaente Date: Fri, 6 Aug 2021 19:25:17 +0200 Subject: [PATCH] Fix showing import tasks cta when tasks are loading --- src/store/modules/tasks.js | 20 +++++++++++++++++++- src/styles/components/tasks.scss | 4 ---- src/styles/theme/loading.scss | 2 -- src/views/Home.vue | 24 +++++++++++++----------- src/views/tasks/ShowTasks.vue | 21 +++++++++------------ 5 files changed, 41 insertions(+), 30 deletions(-) diff --git a/src/store/modules/tasks.js b/src/store/modules/tasks.js index 2b6d5a25..3fd2e8d4 100644 --- a/src/store/modules/tasks.js +++ b/src/store/modules/tasks.js @@ -3,12 +3,30 @@ import TaskAssigneeService from '../../services/taskAssignee' import TaskAssigneeModel from '../../models/taskAssignee' import LabelTaskModel from '../../models/labelTask' import LabelTaskService from '../../services/labelTask' -import {setLoading} from '@/store/helper' +import {HAS_TASKS} from '../mutation-types' +import {setLoading} from '../helper' export default { namespaced: true, state: () => ({}), actions: { + loadTasks(ctx, params) { + const cancel = setLoading(ctx, 'tasks') + const taskService = new TaskService() + + return taskService.getAll({}, params) + .then(r => { + ctx.commit(HAS_TASKS, r.length > 0) + return r + }) + .catch(e => { + return Promise.reject(e) + }) + .finally(() => { + cancel() + }) + + }, update(ctx, task) { const cancel = setLoading(ctx, 'tasks') diff --git a/src/styles/components/tasks.scss b/src/styles/components/tasks.scss index afb07630..ceae69cd 100644 --- a/src/styles/components/tasks.scss +++ b/src/styles/components/tasks.scss @@ -287,10 +287,6 @@ .user img { margin: 0; } - - .spinner.is-loading:after { - margin-left: calc(40% - 1rem); - } } .defer-task { diff --git a/src/styles/theme/loading.scss b/src/styles/theme/loading.scss index ca2dea43..49c7310d 100644 --- a/src/styles/theme/loading.scss +++ b/src/styles/theme/loading.scss @@ -25,9 +25,7 @@ width: 2rem; height: 2rem; margin-left: calc(50% - 1rem); - position: absolute; margin-top: 1rem; - z-index: 999; border-width: 0.25rem; } } diff --git a/src/views/Home.vue b/src/views/Home.vue index cc65d838..25d874aa 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -8,16 +8,17 @@ @taskAdded="updateTaskList" class="is-max-width-desktop" /> -