Add creating a new task cmd
This commit is contained in:
parent
1cebe3ca8b
commit
8f94c64e10
|
@ -86,7 +86,7 @@ export default {
|
||||||
this.$route.name === 'user.settings' ||
|
this.$route.name === 'user.settings' ||
|
||||||
this.$route.name === 'namespaces.index'
|
this.$route.name === 'namespaces.index'
|
||||||
) {
|
) {
|
||||||
this.$store.commit(CURRENT_LIST, {})
|
this.$store.commit(CURRENT_LIST, null)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
renewTokenOnFocus() {
|
renewTokenOnFocus() {
|
||||||
|
|
|
@ -50,9 +50,12 @@ import ListService from '@/services/list'
|
||||||
import NamespaceService from '@/services/namespace'
|
import NamespaceService from '@/services/namespace'
|
||||||
import TeamService from '@/services/team'
|
import TeamService from '@/services/team'
|
||||||
|
|
||||||
|
import TaskModel from '@/models/task'
|
||||||
import NamespaceModel from '@/models/namespace'
|
import NamespaceModel from '@/models/namespace'
|
||||||
import TeamModel from '@/models/team'
|
import TeamModel from '@/models/team'
|
||||||
|
|
||||||
|
import {CURRENT_LIST} from '@/store/mutation-types'
|
||||||
|
|
||||||
const TYPE_LIST = 'list'
|
const TYPE_LIST = 'list'
|
||||||
const TYPE_TASK = 'task'
|
const TYPE_TASK = 'task'
|
||||||
const TYPE_CMD = 'cmd'
|
const TYPE_CMD = 'cmd'
|
||||||
|
@ -157,6 +160,9 @@ export default {
|
||||||
|
|
||||||
return 'Type a command or search...'
|
return 'Type a command or search...'
|
||||||
},
|
},
|
||||||
|
currentList() {
|
||||||
|
return Object.keys(this.$store.state[CURRENT_LIST]).length === 0 ? null : this.$store.state[CURRENT_LIST]
|
||||||
|
},
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.taskService = new TaskService()
|
this.taskService = new TaskService()
|
||||||
|
@ -229,6 +235,22 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
newTask() {
|
newTask() {
|
||||||
|
if (this.currentList === null) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const newTask = new TaskModel({
|
||||||
|
title: this.query,
|
||||||
|
listId: this.currentList.id,
|
||||||
|
})
|
||||||
|
this.taskService.create(newTask)
|
||||||
|
.then(r => {
|
||||||
|
this.success({message: 'The task was successfully created.'}, this)
|
||||||
|
this.$router.push({name: 'task.detail', params: {id: r.id}})
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
this.error(e, this)
|
||||||
|
})
|
||||||
},
|
},
|
||||||
newList() {
|
newList() {
|
||||||
},
|
},
|
||||||
|
|
|
@ -61,6 +61,12 @@ export const store = new Vuex.Store({
|
||||||
},
|
},
|
||||||
[CURRENT_LIST](state, currentList) {
|
[CURRENT_LIST](state, currentList) {
|
||||||
|
|
||||||
|
if (currentList === null) {
|
||||||
|
state.currentList = {}
|
||||||
|
state.background = null
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
setTitle(currentList.title)
|
setTitle(currentList.title)
|
||||||
|
|
||||||
// Not sure if this is the right way to do it but hey, it works
|
// Not sure if this is the right way to do it but hey, it works
|
||||||
|
|
|
@ -429,6 +429,7 @@ import heading from '@/components/tasks/partials/heading'
|
||||||
import Datepicker from '@/components/input/datepicker'
|
import Datepicker from '@/components/input/datepicker'
|
||||||
import {playPop} from '@/helpers/playPop'
|
import {playPop} from '@/helpers/playPop'
|
||||||
import TaskSubscription from '@/components/misc/subscription'
|
import TaskSubscription from '@/components/misc/subscription'
|
||||||
|
import {CURRENT_LIST} from '@/store/mutation-types'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'TaskDetailView',
|
name: 'TaskDetailView',
|
||||||
|
@ -520,7 +521,9 @@ export default {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.$store.getters['namespaces/getListAndNamespaceById'](this.task.listId)
|
const list = this.$store.getters['namespaces/getListAndNamespaceById'](this.task.listId)
|
||||||
|
this.$store.commit(CURRENT_LIST, list)
|
||||||
|
return list
|
||||||
},
|
},
|
||||||
canWrite() {
|
canWrite() {
|
||||||
return this.task && this.task.maxRight && this.task.maxRight > rights.READ
|
return this.task && this.task.maxRight && this.task.maxRight > rights.READ
|
||||||
|
|
Reference in New Issue