Skip to content

Commit 62c3a60

Browse files
committed
Add switch to enable or disable notifications
Signed-off-by: nscuro <[email protected]>
1 parent 12c67b7 commit 62c3a60

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

src/views/administration/notifications/Alerts.vue

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
import SelectProjectModal from "../../portfolio/projects/SelectProjectModal";
2929
import permissionsMixin from "../../../mixins/permissionsMixin";
3030
import BToggleableDisplayButton from "../../components/BToggleableDisplayButton";
31-
import BValidatedInputGroupFormInput from "../../../forms/BValidatedInputGroupFormInput";
3231
import BInputGroupFormInput from "../../../forms/BInputGroupFormInput";
32+
import { Switch as cSwitch } from '@coreui/vue';
3333
3434
export default {
3535
props: {
@@ -87,6 +87,15 @@
8787
return xssFilters.inHTMLData(common.valueWithDefault(value, ""));
8888
}
8989
},
90+
{
91+
title: this.$t('admin.enabled'),
92+
field: 'enabled',
93+
sortable: false,
94+
align: 'center',
95+
formatter: function (value, row, index) {
96+
return value === true ? '<i class="fa fa-check-square-o" />' : "";
97+
},
98+
},
9099
],
91100
data: [],
92101
options: {
@@ -114,6 +123,10 @@
114123
<b-input-group-form-input id="input-name" :label="$t('message.name')" input-group-size="mb-3"
115124
required="true" type="text" v-model="name" lazy="true"
116125
v-debounce:750ms="updateNotificationRule" :debounce-events="'keyup'" />
126+
<b-form-group>
127+
<c-switch id="notificationEnabled" color="primary" v-model="enabled" label v-bind="labelIcon"/>
128+
{{ $t('admin.enabled') }}
129+
</b-form-group>
117130
<b-form-group id="fieldset-2" :label="this.$t('admin.publisher_class')" label-for="input-2">
118131
<b-form-input id="input-2" v-model="publisherClass" disabled class="form-control disabled" readonly trim />
119132
</b-form-group>
@@ -174,26 +187,35 @@
174187
ActionableListGroupItem,
175188
SelectProjectModal,
176189
BToggleableDisplayButton,
177-
BInputGroupFormInput
190+
BInputGroupFormInput,
191+
cSwitch
178192
},
179193
data() {
180194
return {
181195
alert: row,
182196
uuid: row.uuid,
183197
name: row.name,
198+
enabled: row.enabled,
184199
publisherClass: row.publisher.publisherClass,
185200
notificationLevel: row.notificationLevel,
186201
destination: this.parseDestination(row),
187202
scope: row.scope,
188203
notifyOn: row.notifyOn,
189204
projects: row.projects,
190-
limitToVisible: false
205+
limitToVisible: false,
206+
labelIcon: {
207+
dataOn: '\u2713',
208+
dataOff: '\u2715'
209+
},
191210
}
192211
},
193212
created() {
194213
this.parseDestination(this.alert);
195214
},
196215
watch: {
216+
enabled() {
217+
this.updateNotificationRule();
218+
},
197219
notifyOn() {
198220
this.updateNotificationRule();
199221
}
@@ -220,6 +242,7 @@
220242
this.axios.post(url, {
221243
uuid: this.uuid,
222244
name: this.name,
245+
enabled: this.enabled,
223246
notificationLevel: this.notificationLevel,
224247
publisherConfig: JSON.stringify({ destination: this.destination }),
225248
notifyOn: this.notifyOn

0 commit comments

Comments
 (0)