Make create commands dependent on the context

This commit is contained in:
kolaente 2021-05-30 17:34:30 +02:00
parent 8f94c64e10
commit a619a89db8
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 24 additions and 18 deletions

View File

@ -71,24 +71,6 @@ export default {
data() {
return {
query: '',
availableCmds: [
{
title: 'New task',
action: CMD_NEW_TASK,
},
{
title: 'New list',
action: CMD_NEW_LIST,
},
{
title: 'New namespace',
action: CMD_NEW_NAMESPACE,
},
{
title: 'New Team',
action: CMD_NEW_TEAM,
},
],
selectedCmd: null,
foundTasks: [],
@ -163,6 +145,30 @@ export default {
currentList() {
return Object.keys(this.$store.state[CURRENT_LIST]).length === 0 ? null : this.$store.state[CURRENT_LIST]
},
availableCmds() {
const cmds = []
if (this.currentList !== null) {
cmds.push({
title: 'New task',
action: CMD_NEW_TASK,
})
cmds.push({
title: 'New list',
action: CMD_NEW_LIST,
})
}
cmds.push({
title: 'New namespace',
action: CMD_NEW_NAMESPACE,
})
cmds.push({
title: 'New Team',
action: CMD_NEW_TEAM,
})
return cmds
},
},
created() {
this.taskService = new TaskService()