-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
/
Copy pathConfigurationTab.vue
50 lines (45 loc) · 979 Bytes
/
ConfigurationTab.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<template>
<div class="configuration-tab">
<PromptsList
:prompts="visiblePrompts"
@answer="answerPrompt"
/>
</div>
</template>
<script>
import Prompts from '@/mixins/Prompts'
import CONFIGURATION from '@/graphql/configuration/configuration.gql'
export default {
mixins: [
Prompts({
field: 'tab',
query: CONFIGURATION,
variables () {
return {
id: this.configuration.id
}
},
updateQuery (data, prompts) {
const result = {}
for (const prompt of prompts) {
const list = result[prompt.tabId] || (result[prompt.tabId] = [])
list.push(prompt)
}
for (const tabId in result) {
data.configuration.tabs.find(t => t.id === tabId).prompts = result[tabId]
}
}
})
],
props: {
configuration: {
type: Object,
required: true
},
tab: {
type: Object,
required: true
}
}
}
</script>