77 <NcSettingsSection
88 :name =" t('notifications', 'Notifications defaults')"
99 :description =" t('notifications', 'Configure the default notification settings')" >
10- <p >
11- <label for =" notify_setting_batchtime " class =" notification-frequency__label" >
10+ <div class = " notification-frequency__wrapper " >
11+ <label for =" notification_reminder_batchtime " class =" notification-frequency__label" >
1212 {{ t('notifications', 'Send email reminders about unhandled notifications after:') }}
1313 </label >
14- <select
15- id =" notify_setting_batchtime "
16- v-model =" config.setting_batchtime "
14+ <NcSelect
15+ id =" notification_reminder_batchtime "
16+ v-model =" currentBatchTime "
1717 class =" notification-frequency__select"
18- @change =" updateSettings()" >
19- <option v-for =" option in batchtime_options" :key =" option.value" :value =" option.value" >
20- {{ option.text }}
21- </option >
22- </select >
23- </p >
18+ :clearable =" false"
19+ label-outside
20+ :options =" BATCHTIME_OPTIONS"
21+ @update:model-value =" updateSettings" />
22+ </div >
2423
2524 <NcCheckboxRadioSwitch
2625 v-model =" config.sound_notification"
3736
3837<script >
3938import axios from ' @nextcloud/axios'
39+ import { computed , reactive } from ' vue'
4040import { showError , showSuccess } from ' @nextcloud/dialogs'
4141import { loadState } from ' @nextcloud/initial-state'
4242import { t } from ' @nextcloud/l10n'
4343import { generateOcsUrl } from ' @nextcloud/router'
4444import NcCheckboxRadioSwitch from ' @nextcloud/vue/components/NcCheckboxRadioSwitch'
4545import NcSettingsSection from ' @nextcloud/vue/components/NcSettingsSection'
46+ import NcSelect from " @nextcloud/vue/components/NcSelect" ;
4647
4748const EmailFrequency = {
4849 EMAIL_SEND_OFF : 0 ,
@@ -52,24 +53,38 @@ const EmailFrequency = {
5253 EMAIL_SEND_WEEKLY : 4 ,
5354}
5455
56+ const BATCHTIME_OPTIONS = [
57+ { label: t (' notifications' , ' Never' ), value: EmailFrequency .EMAIL_SEND_OFF },
58+ { label: t (' notifications' , ' 1 hour' ), value: EmailFrequency .EMAIL_SEND_HOURLY },
59+ { label: t (' notifications' , ' 3 hours' ), value: EmailFrequency .EMAIL_SEND_3HOURLY },
60+ { label: t (' notifications' , ' 1 day' ), value: EmailFrequency .EMAIL_SEND_DAILY },
61+ { label: t (' notifications' , ' 1 week' ), value: EmailFrequency .EMAIL_SEND_WEEKLY },
62+ ]
63+
5564export default {
5665 name: ' AdminSettings' ,
5766 components: {
67+ NcSelect,
5868 NcCheckboxRadioSwitch,
5969 NcSettingsSection,
6070 },
6171
62- data () {
63- return {
64- batchtime_options: [
65- { text: t (' notifications' , ' Never' ), value: EmailFrequency .EMAIL_SEND_OFF },
66- { text: t (' notifications' , ' 1 hour' ), value: EmailFrequency .EMAIL_SEND_HOURLY },
67- { text: t (' notifications' , ' 3 hours' ), value: EmailFrequency .EMAIL_SEND_3HOURLY },
68- { text: t (' notifications' , ' 1 day' ), value: EmailFrequency .EMAIL_SEND_DAILY },
69- { text: t (' notifications' , ' 1 week' ), value: EmailFrequency .EMAIL_SEND_WEEKLY },
70- ],
72+ setup () {
73+ const config = reactive (loadState (' notifications' , ' config' , {}))
7174
72- config: loadState (' notifications' , ' config' ),
75+ const currentBatchTime = computed ({
76+ get () {
77+ return BATCHTIME_OPTIONS .find (({ value }) => value === config .setting_batchtime )
78+ },
79+ set ({ value }) {
80+ config .setting_batchtime = value
81+ },
82+ })
83+
84+ return {
85+ BATCHTIME_OPTIONS ,
86+ config,
87+ currentBatchTime,
7388 }
7489 },
7590
@@ -93,3 +108,16 @@ export default {
93108}
94109
95110 </script >
111+
112+ <style lang="scss" scoped>
113+ .notification-frequency__wrapper {
114+ display : flex ;
115+ flex-direction : column ;
116+ gap : var (--default-grid-baseline );
117+
118+ .notification-frequency__select {
119+ margin-inline-start : calc (2 * var (--default-grid-baseline ));
120+ width : fit-content ;
121+ }
122+ }
123+ </style >
0 commit comments