mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-01-02 19:20:54 -05:00
switch on the notification, if it is added in EditMonitor.vue
This commit is contained in:
parent
7a4432de1e
commit
573c7faddd
@ -99,6 +99,8 @@ class Notification {
|
|||||||
if (notification.applyExisting) {
|
if (notification.applyExisting) {
|
||||||
await applyNotificationEveryMonitor(bean.id, userID);
|
await applyNotificationEveryMonitor(bean.id, userID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return bean;
|
||||||
}
|
}
|
||||||
|
|
||||||
static async delete(notificationID, userID) {
|
static async delete(notificationID, userID) {
|
||||||
|
@ -527,12 +527,13 @@ let indexHTML = fs.readFileSync("./dist/index.html").toString();
|
|||||||
try {
|
try {
|
||||||
checkLogin(socket)
|
checkLogin(socket)
|
||||||
|
|
||||||
await Notification.save(notification, notificationID, socket.userID)
|
let notificationBean = await Notification.save(notification, notificationID, socket.userID)
|
||||||
await sendNotificationList(socket)
|
await sendNotificationList(socket)
|
||||||
|
|
||||||
callback({
|
callback({
|
||||||
ok: true,
|
ok: true,
|
||||||
msg: "Saved",
|
msg: "Saved",
|
||||||
|
id: notificationBean.id,
|
||||||
});
|
});
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -454,6 +454,7 @@ export default {
|
|||||||
SMTP,
|
SMTP,
|
||||||
},
|
},
|
||||||
props: {},
|
props: {},
|
||||||
|
emits: ["added"],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
model: null,
|
model: null,
|
||||||
@ -532,7 +533,13 @@ export default {
|
|||||||
this.processing = false;
|
this.processing = false;
|
||||||
|
|
||||||
if (res.ok) {
|
if (res.ok) {
|
||||||
this.modal.hide()
|
this.modal.hide();
|
||||||
|
|
||||||
|
// Emit added event, doesn't emit edit.
|
||||||
|
if (! this.id) {
|
||||||
|
this.$emit("added", res.id);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
<div class="my-3">
|
<div class="my-3">
|
||||||
<label for="type" class="form-label">{{ $t("Monitor Type") }}</label>
|
<label for="type" class="form-label">{{ $t("Monitor Type") }}</label>
|
||||||
<select id="type" v-model="monitor.type" class="form-select" aria-label="Default select example">
|
<select id="type" v-model="monitor.type" class="form-select">
|
||||||
<option value="http">
|
<option value="http">
|
||||||
HTTP(s)
|
HTTP(s)
|
||||||
</option>
|
</option>
|
||||||
@ -190,7 +190,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<NotificationDialog ref="notificationDialog" />
|
<NotificationDialog ref="notificationDialog" @added="addedNotification" />
|
||||||
</div>
|
</div>
|
||||||
</transition>
|
</transition>
|
||||||
</template>
|
</template>
|
||||||
@ -283,7 +283,7 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
init() {
|
init() {
|
||||||
if (this.isAdd) {
|
if (this.isAdd) {
|
||||||
console.log("??????")
|
|
||||||
this.monitor = {
|
this.monitor = {
|
||||||
type: "http",
|
type: "http",
|
||||||
name: "",
|
name: "",
|
||||||
@ -338,6 +338,12 @@ export default {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Added a Notification Event
|
||||||
|
// Enable it if the notification is added in EditMonitor.vue
|
||||||
|
addedNotification(id) {
|
||||||
|
this.monitor.notificationIDList[id] = true;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user