feat: replace our home-grown gantt implementation with ganttastic #2180

Merged
konrad merged 78 commits from feature/ganttastic into main 2022-10-27 16:03:27 +00:00
2 changed files with 14 additions and 4 deletions
Showing only changes of commit 29dcc02217 - Show all commits

View File

@ -53,7 +53,7 @@
</template>
<script setup lang="ts">
import {computed, nextTick, ref} from 'vue'
import {computed, nextTick, ref, watch} from 'vue'
import TaskCollectionService from '@/services/taskCollection'
import {format, parse} from 'date-fns'
import {colorIsDark} from '@/helpers/color/colorIsDark'
@ -85,6 +85,11 @@ const props = defineProps({
type: String,
required: true,
},
showTasksWithoutDates: {
type: Boolean,
required: false,
konrad marked this conversation as resolved Outdated

picky: If you use a default value there is no need to define required

picky: If you use a default value there is no need to define `required`

Done.

Done.
default: false,
},
})
const dateFromDate = computed(() => parse(props.dateFrom, 'yyyy-LL-dd', new Date()))
@ -142,7 +147,7 @@ async function loadTasks() {
filter_comparator: ['greater_equals', 'less_equals'],
filter_value: [props.dateFrom, props.dateTo],
filter_concat: 'and',
filter_include_nulls: true,
filter_include_nulls: props.showTasksWithoutDates,
}
const taskCollectionService = new TaskCollectionService()
@ -168,6 +173,10 @@ async function loadTasks() {
loadTasks()
watch(() => props.dateTo, loadTasks)
konrad marked this conversation as resolved Outdated

This and the three lines below should be combined to one watcher that trigger immediately.

loadTasks should accept these three as params, so that it's clear that these are needed to reload.

Something like:

watchEffect(() => loadTasks({
	dateTo: props.dateTo,
    dateFrom: props.dateFrom,
    showTasksWithoutDates: props.showTasksWithoutDates,
})
This and the three lines below should be combined to one watcher that trigger immediately. `loadTasks` should accept these three as params, so that it's clear that these are needed to reload. Something like: ``` watchEffect(() => loadTasks({ dateTo: props.dateTo, dateFrom: props.dateFrom, showTasksWithoutDates: props.showTasksWithoutDates, }) ```

Done.

Done.
watch(() => props.dateFrom, loadTasks)
watch(() => props.showTasksWithoutDates, loadTasks)
async function updateTask(e) {
const task = tasks.value.get(e.bar.ganttBarConfig.id)
task.startDate = e.bar.startDate

View File

@ -28,7 +28,7 @@
</div>
</div>
</div>
<fancycheckbox class="is-block" v-model="showTaskswithoutDates">
<fancycheckbox class="is-block" v-model="showTasksWithoutDates">
{{ $t('list.gantt.showTasksWithoutDates') }}
</fancycheckbox>
</div>
@ -44,6 +44,7 @@
:date-to="dateTo"
:precision="precision"
:list-id="props.listId"
:show-tasks-without-dates="showTasksWithoutDates"
/>
</card>
@ -71,7 +72,7 @@ const props = defineProps({
},
})
const showTaskswithoutDates = ref(false)
const showTasksWithoutDates = ref(false)
const precision = ref('day')
const now = ref(new Date())
konrad marked this conversation as resolved Outdated

Should this update?

Should this update?

No, doesn't even need to be ref.

No, doesn't even need to be ref.