From a619a89db8141821a8d3041c0f7c44745187e250 Mon Sep 17 00:00:00 2001 From: kolaente Date: Sun, 30 May 2021 17:34:30 +0200 Subject: [PATCH] Make create commands dependent on the context --- .../quick-actions/quick-actions.vue | 42 +++++++++++-------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/src/components/quick-actions/quick-actions.vue b/src/components/quick-actions/quick-actions.vue index 03f964e58..9e0ec98b2 100644 --- a/src/components/quick-actions/quick-actions.vue +++ b/src/components/quick-actions/quick-actions.vue @@ -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()