Add filters to gantt chart
continuous-integration/drone/push Build is passing Details

This commit is contained in:
kolaente 2020-11-15 16:32:46 +01:00
parent 3b48907514
commit 1d66218d5b
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
2 changed files with 38 additions and 3 deletions

View File

@ -1,5 +1,22 @@
<template>
<div class="gantt-chart box">
<div class="filter-container">
<div class="items">
<button @click="showTaskFilter = !showTaskFilter" class="button">
<span class="icon is-small">
<icon icon="filter"/>
</span>
Filters
</button>
</div>
<transition name="fade">
<filters
@change="loadTasks"
v-if="showTaskFilter"
v-model="params"
/>
</transition>
</div>
<div class="dates">
<template v-for="(y, yk) in days">
<div :key="yk + 'year'" class="months">
@ -149,10 +166,12 @@ import PriorityLabel from './partials/priorityLabel'
import TaskCollectionService from '../../services/taskCollection'
import {mapState} from 'vuex'
import Rights from '../../models/rights.json'
import Filters from '@/components/list/partials/filters'
export default {
name: 'GanttChart',
components: {
Filters,
PriorityLabel,
EditTask,
VueDragResize,
@ -196,6 +215,16 @@ export default {
newTaskFieldActive: false,
priorities: {},
taskCollectionService: TaskCollectionService,
showTaskFilter: false,
params: {
sort_by: ['done', 'id'],
order_by: ['asc', 'desc'],
filter_by: ['done'],
filter_value: ['false'],
filter_comparator: ['equals'],
filter_concat: 'and',
},
}
},
watch: {
@ -245,12 +274,14 @@ export default {
},
parseTasks() {
this.setDates()
this.prepareTasks()
this.loadTasks()
},
prepareTasks() {
loadTasks() {
this.$set(this, 'theTasks', [])
this.$set(this, 'tasksWithoutDates', [])
const getAllTasks = (page = 1) => {
return this.taskCollectionService.getAll({listId: this.listId}, {}, page)
return this.taskCollectionService.getAll({listId: this.listId}, this.params, page)
.then(tasks => {
if (page < this.taskCollectionService.totalPages) {
return getAllTasks(page + 1)

View File

@ -196,6 +196,10 @@ $gantt-vertical-border-color: lighten($grey, 45);
font-size: .68em;
}
}
.filter-container {
margin-top: -133px;
}
}
.gantt-options {