-
Notifications
You must be signed in to change notification settings - Fork 269
/
Copy pathAction.vue
97 lines (96 loc) · 2.01 KB
/
Action.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<!--
- SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
- SPDX-License-Identifier: AGPL-3.0-or-later
-->
<template>
<div class="mail-filter-row">
<div class="mail-filter-column">
<NcSelect :value="action.type"
:required="true"
:label-outside="true"
:options="availableTypes"
@input="updateAction({ type: $event })" />
</div>
<div class="mail-filter-column">
<component :is="componentInstance"
v-if="componentInstance"
:action="action"
:account="account"
@update-action="updateAction" />
</div>
<div class="mail-filter-column">
<NcButton aria-label="Delete action"
type="tertiary-no-background"
@click="deleteAction">
{{ t('mail', 'Delete action') }}
<template #icon>
<DeleteIcon :size="20" />
</template>
</NcButton>
</div>
</div>
</template>
<script>
import ActionFileinto from './ActionFileinto.vue'
import ActionAddflag from './ActionAddflag.vue'
import ActionStop from './ActionStop.vue'
import { NcButton, NcSelect, NcTextField } from '@nextcloud/vue'
import DeleteIcon from 'vue-material-design-icons/Delete.vue'
export default {
name: 'Action',
components: {
NcSelect,
NcTextField,
NcButton,
ActionFileinto,
ActionAddflag,
ActionStop,
DeleteIcon,
},
props: {
action: {
type: Object,
required: true,
},
account: {
type: Object,
required: true,
},
},
data() {
return {
availableTypes: [
'addflag',
'fileinto',
'stop',
],
}
},
computed: {
componentInstance() {
if (this.action.type === 'fileinto') {
return ActionFileinto
} else if (this.action.type === 'addflag') {
return ActionAddflag
} else if (this.action.type === 'stop') {
return ActionStop
}
return null
},
},
methods: {
updateAction(properties) {
this.$emit('update-action', { ...this.action, ...properties })
},
deleteAction() {
this.$emit('delete-action', this.action)
},
},
}
</script>
<style lang="scss" scoped>
.mail-filter-row {
display: flex;
gap: 5px;
}
</style>