Skip to content

Commit

Permalink
[TaskType] avoid loading error if empty search
Browse files Browse the repository at this point in the history
  • Loading branch information
NicoPennec committed Sep 29, 2023
1 parent c185d2d commit 746076f
Showing 1 changed file with 22 additions and 34 deletions.
56 changes: 22 additions & 34 deletions src/components/pages/TaskType.vue
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ const filters = {
}
export default {
name: 'task-type-page',
name: 'task-type',
mixins: [formatListMixin, searchMixin],
components: {
ButtonSimple,
Expand Down Expand Up @@ -586,9 +586,8 @@ export default {
locale() {
if (this.user.locale === 'fr_FR') {
return fr
} else {
return en
}
return en
},
productionStartDate() {
Expand Down Expand Up @@ -641,12 +640,10 @@ export default {
`${episodeName} / ` +
`${this.currentTaskType.name}`
)
} else {
return `${this.currentProduction.name} / ${this.currentTaskType.name}`
}
} else {
return 'Loading...'
return `${this.currentProduction.name} / ${this.currentTaskType.name}`
}
return 'Loading...'
},
// Paths
Expand Down Expand Up @@ -765,11 +762,8 @@ export default {
this.resetTasks()
this.focusSearchField({ preventScroll: true })
let searchQuery = this.$route.query.search
if (searchQuery.length === 0) {
searchQuery =
!searchQuery && this.searchField
? this.searchField.getValue()
: ''
if (!searchQuery && this.searchField) {
searchQuery = this.searchField.getValue()
}
if (searchQuery) this.onSearchChange(searchQuery)
setTimeout(() => {
Expand All @@ -784,7 +778,6 @@ export default {
this.dueDateFilter = this.$route.query.duedate || 'all'
this.estimationFilter = this.$route.query.late || 'all'
this.priorityFilter = this.$route.query.priority || '-1'
this.onSearchChange(this.$route.query.search)
})
.catch(err => {
console.error(err)
Expand All @@ -797,11 +790,8 @@ export default {
this.resetTaskTypeDates()
this.loading.entities = false
let searchQuery = this.$route.query.search
if (!searchQuery || searchQuery.length === 0) {
searchQuery =
!searchQuery && this.searchField
? this.searchField.getValue()
: ''
if (!searchQuery && this.searchField) {
searchQuery = this.searchField.getValue()
}
if (searchQuery) this.onSearchChange(searchQuery)
if (this.isActiveTab('schedule')) {
Expand Down Expand Up @@ -831,18 +821,17 @@ export default {
Promise.resolve(this.currentScheduleItem)
}
})
} else {
return this.loadScheduleItems(this.currentProduction).then(items => {
if (!items) {
Promise.resolve([])
} else {
this.currentScheduleItem = items.find(item => {
return item.task_type_id === this.currentTaskType.id
})
Promise.resolve(this.currentScheduleItem)
}
})
}
return this.loadScheduleItems(this.currentProduction).then(items => {
if (!items) {
Promise.resolve([])
} else {
this.currentScheduleItem = items.find(item => {
return item.task_type_id === this.currentTaskType.id
})
Promise.resolve(this.currentScheduleItem)
}
})
},
// Tabs
Expand Down Expand Up @@ -1212,8 +1201,8 @@ export default {
return {
...task,
name: task.entity_name,
startDate: startDate,
endDate: endDate,
startDate,
endDate,
expanded: false,
loading: false,
man_days: estimation,
Expand All @@ -1225,7 +1214,7 @@ export default {
}
})
Object.assign(personElement, {
children: children,
children,
startDate: minStartDate,
endDate: maxEndDate,
man_days: manDays
Expand All @@ -1243,9 +1232,8 @@ export default {
!this.taskStatusMap.get(task.task_status_id).is_done &&
endDate.isBefore(moment())
return isLate ? '#FF3860' : '#999'
} else {
return null
}
return null
},
saveTaskScheduleItem(item) {
Expand Down

0 comments on commit 746076f

Please sign in to comment.