summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/notifications/components/notification_email_listbox_input.vue
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-01-18 19:00:14 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2023-01-18 19:00:14 +0000
commit05f0ebba3a2c8ddf39e436f412dc2ab5bf1353b2 (patch)
tree11d0f2a6ec31c7793c184106cedc2ded3d9a2cc5 /app/assets/javascripts/notifications/components/notification_email_listbox_input.vue
parentec73467c23693d0db63a797d10194da9e72a74af (diff)
downloadgitlab-ce-05f0ebba3a2c8ddf39e436f412dc2ab5bf1353b2.tar.gz
Add latest changes from gitlab-org/gitlab@15-8-stable-eev15.8.0-rc42
Diffstat (limited to 'app/assets/javascripts/notifications/components/notification_email_listbox_input.vue')
-rw-r--r--app/assets/javascripts/notifications/components/notification_email_listbox_input.vue46
1 files changed, 46 insertions, 0 deletions
diff --git a/app/assets/javascripts/notifications/components/notification_email_listbox_input.vue b/app/assets/javascripts/notifications/components/notification_email_listbox_input.vue
new file mode 100644
index 00000000000..5d5524deb0d
--- /dev/null
+++ b/app/assets/javascripts/notifications/components/notification_email_listbox_input.vue
@@ -0,0 +1,46 @@
+<script>
+import ListboxInput from '~/vue_shared/components/listbox_input/listbox_input.vue';
+
+export default {
+ components: {
+ ListboxInput,
+ },
+ inject: ['label', 'name', 'emails', 'emptyValueText', 'value', 'disabled'],
+ data() {
+ return {
+ selected: this.value,
+ };
+ },
+ computed: {
+ options() {
+ return [
+ {
+ value: '',
+ text: this.emptyValueText,
+ },
+ ...this.emails.map((email) => ({
+ text: email,
+ value: email,
+ })),
+ ];
+ },
+ },
+ methods: {
+ async onSelect() {
+ await this.$nextTick();
+ this.$el.closest('form').submit();
+ },
+ },
+};
+</script>
+
+<template>
+ <listbox-input
+ v-model="selected"
+ :label="label"
+ :name="name"
+ :items="options"
+ :disabled="disabled"
+ @select="onSelect"
+ />
+</template>