mirror of
				https://github.com/louislam/uptime-kuma.git
				synced 2025-10-31 11:29:20 +08:00 
			
		
		
		
	| @@ -92,11 +92,9 @@ | |||||||
|  |  | ||||||
| <script lang="ts"> | <script lang="ts"> | ||||||
| import { Modal } from "bootstrap"; | import { Modal } from "bootstrap"; | ||||||
| import { useToast } from "vue-toastification"; |  | ||||||
| import dayjs from "dayjs"; | import dayjs from "dayjs"; | ||||||
| import Datepicker from "@vuepic/vue-datepicker"; | import Datepicker from "@vuepic/vue-datepicker"; | ||||||
| import CopyableInput from "./CopyableInput.vue"; | import CopyableInput from "./CopyableInput.vue"; | ||||||
| const toast = useToast(); |  | ||||||
|  |  | ||||||
| export default { | export default { | ||||||
|     components: { |     components: { | ||||||
| @@ -158,7 +156,7 @@ export default { | |||||||
|                     this.keymodal.show(); |                     this.keymodal.show(); | ||||||
|                     this.clearForm(); |                     this.clearForm(); | ||||||
|                 } else { |                 } else { | ||||||
|                     toast.error(res.msg); |                     this.$root.toastError(res.msg); | ||||||
|                 } |                 } | ||||||
|             }); |             }); | ||||||
|         }, |         }, | ||||||
|   | |||||||
| @@ -62,8 +62,6 @@ | |||||||
| <script lang="ts"> | <script lang="ts"> | ||||||
| import { Modal } from "bootstrap"; | import { Modal } from "bootstrap"; | ||||||
| import Confirm from "./Confirm.vue"; | import Confirm from "./Confirm.vue"; | ||||||
| import { useToast } from "vue-toastification"; |  | ||||||
| const toast = useToast(); |  | ||||||
|  |  | ||||||
| export default { | export default { | ||||||
|     components: { |     components: { | ||||||
| @@ -120,7 +118,7 @@ export default { | |||||||
|                 } |                 } | ||||||
|  |  | ||||||
|                 if (!found) { |                 if (!found) { | ||||||
|                     toast.error("Docker Host not found!"); |                     this.$root.toastError("Docker Host not found!"); | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
|             } else { |             } else { | ||||||
|   | |||||||
| @@ -21,11 +21,8 @@ import { BarController, BarElement, Chart, Filler, LinearScale, LineController, | |||||||
| import "chartjs-adapter-dayjs-4"; | import "chartjs-adapter-dayjs-4"; | ||||||
| import dayjs from "dayjs"; | import dayjs from "dayjs"; | ||||||
| import { Line } from "vue-chartjs"; | import { Line } from "vue-chartjs"; | ||||||
| import { useToast } from "vue-toastification"; |  | ||||||
| import { DOWN, PENDING, MAINTENANCE, log } from "../util.ts"; | import { DOWN, PENDING, MAINTENANCE, log } from "../util.ts"; | ||||||
|  |  | ||||||
| const toast = useToast(); |  | ||||||
|  |  | ||||||
| Chart.register(LineController, BarController, LineElement, PointElement, TimeScale, BarElement, LinearScale, Tooltip, Filler); | Chart.register(LineController, BarController, LineElement, PointElement, TimeScale, BarElement, LinearScale, Tooltip, Filler); | ||||||
|  |  | ||||||
| export default { | export default { | ||||||
| @@ -231,7 +228,7 @@ export default { | |||||||
|  |  | ||||||
|                 this.$root.getMonitorBeats(this.monitorId, newPeriod, (res) => { |                 this.$root.getMonitorBeats(this.monitorId, newPeriod, (res) => { | ||||||
|                     if (!res.ok) { |                     if (!res.ok) { | ||||||
|                         toast.error(res.msg); |                         this.$root.toastError(res.msg); | ||||||
|                     } else { |                     } else { | ||||||
|                         this.heartbeatList = res.data; |                         this.heartbeatList = res.data; | ||||||
|                         this.$root.storage()[`chart-period-${this.monitorId}`] = newPeriod; |                         this.$root.storage()[`chart-period-${this.monitorId}`] = newPeriod; | ||||||
|   | |||||||
| @@ -123,9 +123,7 @@ import Confirm from "./Confirm.vue"; | |||||||
| import Tag from "./Tag.vue"; | import Tag from "./Tag.vue"; | ||||||
| import VueMultiselect from "vue-multiselect"; | import VueMultiselect from "vue-multiselect"; | ||||||
| import { colorOptions } from "../util-frontend"; | import { colorOptions } from "../util-frontend"; | ||||||
| import { useToast } from "vue-toastification"; |  | ||||||
| import { getMonitorRelativeURL } from "../util.ts"; | import { getMonitorRelativeURL } from "../util.ts"; | ||||||
| const toast = useToast(); |  | ||||||
|  |  | ||||||
| export default { | export default { | ||||||
|     components: { |     components: { | ||||||
| @@ -320,7 +318,7 @@ export default { | |||||||
|             for (let addId of this.addingMonitor) { |             for (let addId of this.addingMonitor) { | ||||||
|                 await this.addMonitorTagAsync(this.tag.id, addId, "").then((res) => { |                 await this.addMonitorTagAsync(this.tag.id, addId, "").then((res) => { | ||||||
|                     if (!res.ok) { |                     if (!res.ok) { | ||||||
|                         toast.error(res.msg); |                         this.$root.toastError(res.msg); | ||||||
|                         editResult = false; |                         editResult = false; | ||||||
|                     } |                     } | ||||||
|                 }); |                 }); | ||||||
| @@ -330,7 +328,7 @@ export default { | |||||||
|                 this.monitors.find(monitor => monitor.id === removeId)?.tags.forEach(async (monitorTag) => { |                 this.monitors.find(monitor => monitor.id === removeId)?.tags.forEach(async (monitorTag) => { | ||||||
|                     await this.deleteMonitorTagAsync(this.tag.id, removeId, monitorTag.value).then((res) => { |                     await this.deleteMonitorTagAsync(this.tag.id, removeId, monitorTag.value).then((res) => { | ||||||
|                         if (!res.ok) { |                         if (!res.ok) { | ||||||
|                             toast.error(res.msg); |                             this.$root.toastError(res.msg); | ||||||
|                             editResult = false; |                             editResult = false; | ||||||
|                         } |                         } | ||||||
|                     }); |                     }); | ||||||
|   | |||||||
| @@ -129,10 +129,8 @@ | |||||||
| <script> | <script> | ||||||
| import { Modal } from "bootstrap"; | import { Modal } from "bootstrap"; | ||||||
| import VueMultiselect from "vue-multiselect"; | import VueMultiselect from "vue-multiselect"; | ||||||
| import { useToast } from "vue-toastification"; |  | ||||||
| import { colorOptions } from "../util-frontend"; | import { colorOptions } from "../util-frontend"; | ||||||
| import Tag from "../components/Tag.vue"; | import Tag from "../components/Tag.vue"; | ||||||
| const toast = useToast(); |  | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * @typedef Tag |  * @typedef Tag | ||||||
| @@ -262,7 +260,7 @@ export default { | |||||||
|                 if (res.ok) { |                 if (res.ok) { | ||||||
|                     this.existingTags = res.tags; |                     this.existingTags = res.tags; | ||||||
|                 } else { |                 } else { | ||||||
|                     toast.error(res.msg); |                     this.$root.toastError(res.msg); | ||||||
|                 } |                 } | ||||||
|             }); |             }); | ||||||
|         }, |         }, | ||||||
| @@ -399,7 +397,7 @@ export default { | |||||||
|                     let newTagResult; |                     let newTagResult; | ||||||
|                     await this.addTagAsync(newTag).then((res) => { |                     await this.addTagAsync(newTag).then((res) => { | ||||||
|                         if (!res.ok) { |                         if (!res.ok) { | ||||||
|                             toast.error(res.msg); |                             this.$root.toastError(res.msg); | ||||||
|                             newTagResult = false; |                             newTagResult = false; | ||||||
|                         } |                         } | ||||||
|                         newTagResult = res.tag; |                         newTagResult = res.tag; | ||||||
| @@ -424,7 +422,7 @@ export default { | |||||||
|                 // Assign tag to monitor |                 // Assign tag to monitor | ||||||
|                 await this.addMonitorTagAsync(tagId, monitorId, newTag.value).then((res) => { |                 await this.addMonitorTagAsync(tagId, monitorId, newTag.value).then((res) => { | ||||||
|                     if (!res.ok) { |                     if (!res.ok) { | ||||||
|                         toast.error(res.msg); |                         this.$root.toastError(res.msg); | ||||||
|                         newMonitorTagResult = false; |                         newMonitorTagResult = false; | ||||||
|                     } |                     } | ||||||
|                     newMonitorTagResult = true; |                     newMonitorTagResult = true; | ||||||
| @@ -440,7 +438,7 @@ export default { | |||||||
|                 let deleteMonitorTagResult; |                 let deleteMonitorTagResult; | ||||||
|                 await this.deleteMonitorTagAsync(deleteTag.tag_id, deleteTag.monitor_id, deleteTag.value).then((res) => { |                 await this.deleteMonitorTagAsync(deleteTag.tag_id, deleteTag.monitor_id, deleteTag.value).then((res) => { | ||||||
|                     if (!res.ok) { |                     if (!res.ok) { | ||||||
|                         toast.error(res.msg); |                         this.$root.toastError(res.msg); | ||||||
|                         deleteMonitorTagResult = false; |                         deleteMonitorTagResult = false; | ||||||
|                     } |                     } | ||||||
|                     deleteMonitorTagResult = true; |                     deleteMonitorTagResult = true; | ||||||
|   | |||||||
| @@ -76,8 +76,6 @@ | |||||||
| import { Modal } from "bootstrap"; | import { Modal } from "bootstrap"; | ||||||
| import Confirm from "./Confirm.vue"; | import Confirm from "./Confirm.vue"; | ||||||
| import VueQrcode from "vue-qrcode"; | import VueQrcode from "vue-qrcode"; | ||||||
| import { useToast } from "vue-toastification"; |  | ||||||
| const toast = useToast(); |  | ||||||
|  |  | ||||||
| export default { | export default { | ||||||
|     components: { |     components: { | ||||||
| @@ -138,7 +136,7 @@ export default { | |||||||
|                 if (res.ok) { |                 if (res.ok) { | ||||||
|                     this.uri = res.uri; |                     this.uri = res.uri; | ||||||
|                 } else { |                 } else { | ||||||
|                     toast.error(res.msg); |                     this.$root.toastError(res.msg); | ||||||
|                 } |                 } | ||||||
|             }); |             }); | ||||||
|         }, |         }, | ||||||
| @@ -159,7 +157,7 @@ export default { | |||||||
|                     this.currentPassword = ""; |                     this.currentPassword = ""; | ||||||
|                     this.modal.hide(); |                     this.modal.hide(); | ||||||
|                 } else { |                 } else { | ||||||
|                     toast.error(res.msg); |                     this.$root.toastError(res.msg); | ||||||
|                 } |                 } | ||||||
|             }); |             }); | ||||||
|         }, |         }, | ||||||
| @@ -180,7 +178,7 @@ export default { | |||||||
|                     this.currentPassword = ""; |                     this.currentPassword = ""; | ||||||
|                     this.modal.hide(); |                     this.modal.hide(); | ||||||
|                 } else { |                 } else { | ||||||
|                     toast.error(res.msg); |                     this.$root.toastError(res.msg); | ||||||
|                 } |                 } | ||||||
|             }); |             }); | ||||||
|         }, |         }, | ||||||
| @@ -194,7 +192,7 @@ export default { | |||||||
|                 if (res.ok) { |                 if (res.ok) { | ||||||
|                     this.tokenValid = res.valid; |                     this.tokenValid = res.valid; | ||||||
|                 } else { |                 } else { | ||||||
|                     toast.error(res.msg); |                     this.$root.toastError(res.msg); | ||||||
|                 } |                 } | ||||||
|             }); |             }); | ||||||
|         }, |         }, | ||||||
| @@ -208,7 +206,7 @@ export default { | |||||||
|                 if (res.ok) { |                 if (res.ok) { | ||||||
|                     this.twoFAStatus = res.status; |                     this.twoFAStatus = res.status; | ||||||
|                 } else { |                 } else { | ||||||
|                     toast.error(res.msg); |                     this.$root.toastError(res.msg); | ||||||
|                 } |                 } | ||||||
|             }); |             }); | ||||||
|         }, |         }, | ||||||
|   | |||||||
| @@ -58,8 +58,6 @@ | |||||||
| <script> | <script> | ||||||
| import HiddenInput from "../HiddenInput.vue"; | import HiddenInput from "../HiddenInput.vue"; | ||||||
| import axios from "axios"; | import axios from "axios"; | ||||||
| import { useToast } from "vue-toastification"; |  | ||||||
| const toast = useToast(); |  | ||||||
|  |  | ||||||
| export default { | export default { | ||||||
|     components: { |     components: { | ||||||
| @@ -110,7 +108,7 @@ export default { | |||||||
|                 } |                 } | ||||||
|  |  | ||||||
|             } catch (error) { |             } catch (error) { | ||||||
|                 toast.error(error.message); |                 this.$root.toastError(error.message); | ||||||
|             } |             } | ||||||
|  |  | ||||||
|         }, |         }, | ||||||
|   | |||||||
| @@ -72,8 +72,6 @@ | |||||||
| <script> | <script> | ||||||
| import APIKeyDialog from "../../components/APIKeyDialog.vue"; | import APIKeyDialog from "../../components/APIKeyDialog.vue"; | ||||||
| import Confirm from "../Confirm.vue"; | import Confirm from "../Confirm.vue"; | ||||||
| import { useToast } from "vue-toastification"; |  | ||||||
| const toast = useToast(); |  | ||||||
|  |  | ||||||
| export default { | export default { | ||||||
|     components: { |     components: { | ||||||
| @@ -109,11 +107,7 @@ export default { | |||||||
|          */ |          */ | ||||||
|         deleteKey() { |         deleteKey() { | ||||||
|             this.$root.deleteAPIKey(this.selectedKeyID, (res) => { |             this.$root.deleteAPIKey(this.selectedKeyID, (res) => { | ||||||
|                 if (res.ok) { |                 this.$root.toastRes(res); | ||||||
|                     toast.success(res.msg); |  | ||||||
|                 } else { |  | ||||||
|                     toast.error(res.msg); |  | ||||||
|                 } |  | ||||||
|             }); |             }); | ||||||
|         }, |         }, | ||||||
|  |  | ||||||
|   | |||||||
| @@ -121,9 +121,6 @@ | |||||||
| <script> | <script> | ||||||
| import Confirm from "../../components/Confirm.vue"; | import Confirm from "../../components/Confirm.vue"; | ||||||
| import dayjs from "dayjs"; | import dayjs from "dayjs"; | ||||||
| import { useToast } from "vue-toastification"; |  | ||||||
|  |  | ||||||
| const toast = useToast(); |  | ||||||
|  |  | ||||||
| export default { | export default { | ||||||
|     components: { |     components: { | ||||||
| @@ -200,11 +197,7 @@ export default { | |||||||
|                     (res) => { |                     (res) => { | ||||||
|                         this.processing = false; |                         this.processing = false; | ||||||
|  |  | ||||||
|                         if (res.ok) { |                         this.$root.toastRes(res); | ||||||
|                             toast.success(res.msg); |  | ||||||
|                         } else { |  | ||||||
|                             toast.error(res.msg); |  | ||||||
|                         } |  | ||||||
|                     } |                     } | ||||||
|                 ); |                 ); | ||||||
|             }; |             }; | ||||||
|   | |||||||
| @@ -57,9 +57,6 @@ | |||||||
| <script> | <script> | ||||||
| import Confirm from "../../components/Confirm.vue"; | import Confirm from "../../components/Confirm.vue"; | ||||||
| import { log } from "../../util.ts"; | import { log } from "../../util.ts"; | ||||||
| import { useToast } from "vue-toastification"; |  | ||||||
|  |  | ||||||
| const toast = useToast(); |  | ||||||
|  |  | ||||||
| export default { | export default { | ||||||
|     components: { |     components: { | ||||||
| @@ -118,7 +115,7 @@ export default { | |||||||
|             this.$root.getSocket().emit("shrinkDatabase", (res) => { |             this.$root.getSocket().emit("shrinkDatabase", (res) => { | ||||||
|                 if (res.ok) { |                 if (res.ok) { | ||||||
|                     this.loadDatabaseSize(); |                     this.loadDatabaseSize(); | ||||||
|                     toast.success("Done"); |                     this.$root.toastSuccess("Done"); | ||||||
|                 } else { |                 } else { | ||||||
|                     log.debug("monitorhistory", res); |                     log.debug("monitorhistory", res); | ||||||
|                 } |                 } | ||||||
| @@ -142,7 +139,7 @@ export default { | |||||||
|                 if (res.ok) { |                 if (res.ok) { | ||||||
|                     this.$router.go(); |                     this.$router.go(); | ||||||
|                 } else { |                 } else { | ||||||
|                     toast.error(res.msg); |                     this.$root.toastError(res.msg); | ||||||
|                 } |                 } | ||||||
|             }); |             }); | ||||||
|         }, |         }, | ||||||
|   | |||||||
| @@ -28,11 +28,9 @@ | |||||||
| </template> | </template> | ||||||
|  |  | ||||||
| <script> | <script> | ||||||
| import { useToast } from "vue-toastification"; |  | ||||||
| import TagEditDialog from "../../components/TagEditDialog.vue"; | import TagEditDialog from "../../components/TagEditDialog.vue"; | ||||||
| import Tag from "../Tag.vue"; | import Tag from "../Tag.vue"; | ||||||
| import Confirm from "../Confirm.vue"; | import Confirm from "../Confirm.vue"; | ||||||
| const toast = useToast(); |  | ||||||
|  |  | ||||||
| export default { | export default { | ||||||
|     components: { |     components: { | ||||||
| @@ -86,7 +84,7 @@ export default { | |||||||
|                 if (res.ok) { |                 if (res.ok) { | ||||||
|                     this.tagsList = res.tags; |                     this.tagsList = res.tags; | ||||||
|                 } else { |                 } else { | ||||||
|                     toast.error(res.msg); |                     this.$root.toastError(res.msg); | ||||||
|                 } |                 } | ||||||
|             }); |             }); | ||||||
|         }, |         }, | ||||||
|   | |||||||
| @@ -342,7 +342,7 @@ export default { | |||||||
|          * @returns {void} |          * @returns {void} | ||||||
|          */ |          */ | ||||||
|         toastSuccess(msg) { |         toastSuccess(msg) { | ||||||
|             toast.success(msg); |             toast.success(this.$t(msg)); | ||||||
|         }, |         }, | ||||||
|  |  | ||||||
|         /** |         /** | ||||||
| @@ -351,7 +351,7 @@ export default { | |||||||
|          * @returns {void} |          * @returns {void} | ||||||
|          */ |          */ | ||||||
|         toastError(msg) { |         toastError(msg) { | ||||||
|             toast.error(msg); |             toast.error(this.$t(msg)); | ||||||
|         }, |         }, | ||||||
|  |  | ||||||
|         /** |         /** | ||||||
|   | |||||||
| @@ -66,7 +66,7 @@ export default { | |||||||
|                 } else { |                 } else { | ||||||
|  |  | ||||||
|                     if (res.msg.includes("UNIQUE constraint")) { |                     if (res.msg.includes("UNIQUE constraint")) { | ||||||
|                         this.$root.toastError(this.$t("The slug is already taken. Please choose another slug.")); |                         this.$root.toastError("The slug is already taken. Please choose another slug."); | ||||||
|                     } else { |                     } else { | ||||||
|                         this.$root.toastRes(res); |                         this.$root.toastRes(res); | ||||||
|                     } |                     } | ||||||
|   | |||||||
| @@ -437,7 +437,7 @@ export default { | |||||||
|          */ |          */ | ||||||
|         testNotification() { |         testNotification() { | ||||||
|             this.$root.getSocket().emit("testNotification", this.monitor.id); |             this.$root.getSocket().emit("testNotification", this.monitor.id); | ||||||
|             toast.success("Test notification is requested."); |             this.$root.toastSuccess("Test notification is requested."); | ||||||
|         }, |         }, | ||||||
|  |  | ||||||
|         /** |         /** | ||||||
| @@ -498,11 +498,9 @@ export default { | |||||||
|          */ |          */ | ||||||
|         deleteMonitor() { |         deleteMonitor() { | ||||||
|             this.$root.deleteMonitor(this.monitor.id, (res) => { |             this.$root.deleteMonitor(this.monitor.id, (res) => { | ||||||
|  |                 this.$root.toastRes(res); | ||||||
|                 if (res.ok) { |                 if (res.ok) { | ||||||
|                     toast.success(res.msg); |  | ||||||
|                     this.$router.push("/dashboard"); |                     this.$router.push("/dashboard"); | ||||||
|                 } else { |  | ||||||
|                     toast.error(res.msg); |  | ||||||
|                 } |                 } | ||||||
|             }); |             }); | ||||||
|         }, |         }, | ||||||
|   | |||||||
| @@ -246,14 +246,11 @@ | |||||||
| </template> | </template> | ||||||
|  |  | ||||||
| <script> | <script> | ||||||
| import { useToast } from "vue-toastification"; |  | ||||||
| import VueMultiselect from "vue-multiselect"; | import VueMultiselect from "vue-multiselect"; | ||||||
| import Datepicker from "@vuepic/vue-datepicker"; | import Datepicker from "@vuepic/vue-datepicker"; | ||||||
| import { timezoneList } from "../util-frontend"; | import { timezoneList } from "../util-frontend"; | ||||||
| import cronstrue from "cronstrue/i18n"; | import cronstrue from "cronstrue/i18n"; | ||||||
|  |  | ||||||
| const toast = useToast(); |  | ||||||
|  |  | ||||||
| export default { | export default { | ||||||
|     components: { |     components: { | ||||||
|         VueMultiselect, |         VueMultiselect, | ||||||
| @@ -457,7 +454,7 @@ export default { | |||||||
|                                     this.affectedMonitors.push(this.affectedMonitorsOptions.find(item => item.id === monitor.id)); |                                     this.affectedMonitors.push(this.affectedMonitorsOptions.find(item => item.id === monitor.id)); | ||||||
|                                 }); |                                 }); | ||||||
|                             } else { |                             } else { | ||||||
|                                 toast.error(res.msg); |                                 this.$root.toastError(res.msg); | ||||||
|                             } |                             } | ||||||
|                         }); |                         }); | ||||||
|  |  | ||||||
| @@ -472,11 +469,11 @@ export default { | |||||||
|  |  | ||||||
|                                 this.showOnAllPages = Object.values(res.statusPages).length === this.selectedStatusPagesOptions.length; |                                 this.showOnAllPages = Object.values(res.statusPages).length === this.selectedStatusPagesOptions.length; | ||||||
|                             } else { |                             } else { | ||||||
|                                 toast.error(res.msg); |                                 this.$root.toastError(res.msg); | ||||||
|                             } |                             } | ||||||
|                         }); |                         }); | ||||||
|                     } else { |                     } else { | ||||||
|                         toast.error(res.msg); |                         this.$root.toastError(res.msg); | ||||||
|                     } |                     } | ||||||
|                 }); |                 }); | ||||||
|             } |             } | ||||||
| @@ -490,7 +487,7 @@ export default { | |||||||
|             this.processing = true; |             this.processing = true; | ||||||
|  |  | ||||||
|             if (this.affectedMonitors.length === 0) { |             if (this.affectedMonitors.length === 0) { | ||||||
|                 toast.error(this.$t("atLeastOneMonitor")); |                 this.$root.toastError(this.$t("atLeastOneMonitor")); | ||||||
|                 return this.processing = false; |                 return this.processing = false; | ||||||
|             } |             } | ||||||
|  |  | ||||||
| @@ -499,14 +496,14 @@ export default { | |||||||
|                     if (res.ok) { |                     if (res.ok) { | ||||||
|                         await this.addMonitorMaintenance(res.maintenanceID, async () => { |                         await this.addMonitorMaintenance(res.maintenanceID, async () => { | ||||||
|                             await this.addMaintenanceStatusPage(res.maintenanceID, () => { |                             await this.addMaintenanceStatusPage(res.maintenanceID, () => { | ||||||
|                                 toast.success(res.msg); |                                 this.$root.toastRes(res); | ||||||
|                                 this.processing = false; |                                 this.processing = false; | ||||||
|                                 this.$root.getMaintenanceList(); |                                 this.$root.getMaintenanceList(); | ||||||
|                                 this.$router.push("/maintenance"); |                                 this.$router.push("/maintenance"); | ||||||
|                             }); |                             }); | ||||||
|                         }); |                         }); | ||||||
|                     } else { |                     } else { | ||||||
|                         toast.error(res.msg); |                         this.$root.toastRes(res); | ||||||
|                         this.processing = false; |                         this.processing = false; | ||||||
|                     } |                     } | ||||||
|  |  | ||||||
| @@ -524,7 +521,7 @@ export default { | |||||||
|                         }); |                         }); | ||||||
|                     } else { |                     } else { | ||||||
|                         this.processing = false; |                         this.processing = false; | ||||||
|                         toast.error(res.msg); |                         this.$root.toastError(res.msg); | ||||||
|                     } |                     } | ||||||
|                 }); |                 }); | ||||||
|             } |             } | ||||||
| @@ -539,7 +536,7 @@ export default { | |||||||
|         async addMonitorMaintenance(maintenanceID, callback) { |         async addMonitorMaintenance(maintenanceID, callback) { | ||||||
|             await this.$root.addMonitorMaintenance(maintenanceID, this.affectedMonitors, async (res) => { |             await this.$root.addMonitorMaintenance(maintenanceID, this.affectedMonitors, async (res) => { | ||||||
|                 if (!res.ok) { |                 if (!res.ok) { | ||||||
|                     toast.error(res.msg); |                     this.$root.toastError(res.msg); | ||||||
|                 } else { |                 } else { | ||||||
|                     this.$root.getMonitorList(); |                     this.$root.getMonitorList(); | ||||||
|                 } |                 } | ||||||
| @@ -557,7 +554,7 @@ export default { | |||||||
|         async addMaintenanceStatusPage(maintenanceID, callback) { |         async addMaintenanceStatusPage(maintenanceID, callback) { | ||||||
|             await this.$root.addMaintenanceStatusPage(maintenanceID, (this.showOnAllPages) ? this.selectedStatusPagesOptions : this.selectedStatusPages, async (res) => { |             await this.$root.addMaintenanceStatusPage(maintenanceID, (this.showOnAllPages) ? this.selectedStatusPagesOptions : this.selectedStatusPages, async (res) => { | ||||||
|                 if (!res.ok) { |                 if (!res.ok) { | ||||||
|                     toast.error(res.msg); |                     this.$root.toastError(res.msg); | ||||||
|                 } else { |                 } else { | ||||||
|                     this.$root.getMaintenanceList(); |                     this.$root.getMaintenanceList(); | ||||||
|                 } |                 } | ||||||
|   | |||||||
| @@ -848,7 +848,7 @@ import { genSecret, isDev, MAX_INTERVAL_SECOND, MIN_INTERVAL_SECOND } from "../u | |||||||
| import { hostNameRegexPattern } from "../util-frontend"; | import { hostNameRegexPattern } from "../util-frontend"; | ||||||
| import { sleep } from "../util"; | import { sleep } from "../util"; | ||||||
|  |  | ||||||
| const toast = useToast(); | const toast = useToast; | ||||||
|  |  | ||||||
| const pushTokenLength = 32; | const pushTokenLength = 32; | ||||||
|  |  | ||||||
| @@ -1173,7 +1173,7 @@ message HealthCheckResponse { | |||||||
|                     if (res.ok) { |                     if (res.ok) { | ||||||
|                         this.gameList = res.gameList; |                         this.gameList = res.gameList; | ||||||
|                     } else { |                     } else { | ||||||
|                         toast.error(res.msg); |                         this.$root.toastError(res.msg); | ||||||
|                     } |                     } | ||||||
|                 }); |                 }); | ||||||
|             } |             } | ||||||
| @@ -1318,7 +1318,7 @@ message HealthCheckResponse { | |||||||
|                             this.monitor.timeout = ~~(this.monitor.interval * 8) / 10; |                             this.monitor.timeout = ~~(this.monitor.interval * 8) / 10; | ||||||
|                         } |                         } | ||||||
|                     } else { |                     } else { | ||||||
|                         toast.error(res.msg); |                         this.$root.toastError(res.msg); | ||||||
|                     } |                     } | ||||||
|                 }); |                 }); | ||||||
|             } |             } | ||||||
| @@ -1412,7 +1412,7 @@ message HealthCheckResponse { | |||||||
|                     createdNewParent = true; |                     createdNewParent = true; | ||||||
|                     this.monitor.parent = res.monitorID; |                     this.monitor.parent = res.monitorID; | ||||||
|                 } else { |                 } else { | ||||||
|                     toast.error(res.msg); |                     this.$root.toastError(res.msg); | ||||||
|                     this.processing = false; |                     this.processing = false; | ||||||
|                     return; |                     return; | ||||||
|                 } |                 } | ||||||
| @@ -1428,17 +1428,14 @@ message HealthCheckResponse { | |||||||
|                         if (createdNewParent) { |                         if (createdNewParent) { | ||||||
|                             this.startParentGroupMonitor(); |                             this.startParentGroupMonitor(); | ||||||
|                         } |                         } | ||||||
|  |  | ||||||
|                         toast.success(res.msg); |  | ||||||
|                         this.processing = false; |                         this.processing = false; | ||||||
|                         this.$root.getMonitorList(); |                         this.$root.getMonitorList(); | ||||||
|                         this.$router.push("/dashboard/" + res.monitorID); |                         this.$router.push("/dashboard/" + res.monitorID); | ||||||
|  |  | ||||||
|                     } else { |                     } else { | ||||||
|                         toast.error(res.msg); |  | ||||||
|                         this.processing = false; |                         this.processing = false; | ||||||
|                     } |                     } | ||||||
|  |  | ||||||
|  |                     this.$root.toastRes(res); | ||||||
|                 }); |                 }); | ||||||
|             } else { |             } else { | ||||||
|                 await this.$refs.tagsManager.submit(this.monitor.id); |                 await this.$refs.tagsManager.submit(this.monitor.id); | ||||||
|   | |||||||
| @@ -101,12 +101,8 @@ export default { | |||||||
|          */ |          */ | ||||||
|         deleteMaintenance() { |         deleteMaintenance() { | ||||||
|             this.$root.deleteMaintenance(this.maintenance.id, (res) => { |             this.$root.deleteMaintenance(this.maintenance.id, (res) => { | ||||||
|                 if (res.ok) { |                 this.$root.toastRes(res); | ||||||
|                     toast.success(res.msg); |                 this.$router.push("/maintenance"); | ||||||
|                     this.$router.push("/maintenance"); |  | ||||||
|                 } else { |  | ||||||
|                     toast.error(res.msg); |  | ||||||
|                 } |  | ||||||
|             }); |             }); | ||||||
|         }, |         }, | ||||||
|     }, |     }, | ||||||
|   | |||||||
| @@ -81,8 +81,6 @@ import { getResBaseURL } from "../util-frontend"; | |||||||
| import { getMaintenanceRelativeURL } from "../util.ts"; | import { getMaintenanceRelativeURL } from "../util.ts"; | ||||||
| import Confirm from "../components/Confirm.vue"; | import Confirm from "../components/Confirm.vue"; | ||||||
| import MaintenanceTime from "../components/MaintenanceTime.vue"; | import MaintenanceTime from "../components/MaintenanceTime.vue"; | ||||||
| import { useToast } from "vue-toastification"; |  | ||||||
| const toast = useToast(); |  | ||||||
|  |  | ||||||
| export default { | export default { | ||||||
|     components: { |     components: { | ||||||
| @@ -159,11 +157,9 @@ export default { | |||||||
|          */ |          */ | ||||||
|         deleteMaintenance() { |         deleteMaintenance() { | ||||||
|             this.$root.deleteMaintenance(this.selectedMaintenanceID, (res) => { |             this.$root.deleteMaintenance(this.selectedMaintenanceID, (res) => { | ||||||
|  |                 this.$root.toastRes(res); | ||||||
|                 if (res.ok) { |                 if (res.ok) { | ||||||
|                     toast.success(res.msg); |  | ||||||
|                     this.$router.push("/maintenance"); |                     this.$router.push("/maintenance"); | ||||||
|                 } else { |  | ||||||
|                     toast.error(res.msg); |  | ||||||
|                 } |                 } | ||||||
|             }); |             }); | ||||||
|         }, |         }, | ||||||
|   | |||||||
| @@ -46,9 +46,6 @@ | |||||||
| </template> | </template> | ||||||
|  |  | ||||||
| <script> | <script> | ||||||
| import { useToast } from "vue-toastification"; |  | ||||||
| const toast = useToast(); |  | ||||||
|  |  | ||||||
| export default { | export default { | ||||||
|     data() { |     data() { | ||||||
|         return { |         return { | ||||||
| @@ -79,7 +76,7 @@ export default { | |||||||
|             this.processing = true; |             this.processing = true; | ||||||
|  |  | ||||||
|             if (this.password !== this.repeatPassword) { |             if (this.password !== this.repeatPassword) { | ||||||
|                 toast.error(this.$t("PasswordsDoNotMatch")); |                 this.$root.toastError("PasswordsDoNotMatch"); | ||||||
|                 this.processing = false; |                 this.processing = false; | ||||||
|                 return; |                 return; | ||||||
|             } |             } | ||||||
|   | |||||||
| @@ -179,7 +179,7 @@ export default { | |||||||
|         }, |         }, | ||||||
|  |  | ||||||
|         test() { |         test() { | ||||||
|             toast.error("not implemented"); |             this.$root.toastError("not implemented"); | ||||||
|         } |         } | ||||||
|     }, |     }, | ||||||
| }; | }; | ||||||
|   | |||||||
| @@ -614,7 +614,7 @@ export default { | |||||||
|                         } |                         } | ||||||
|  |  | ||||||
|                     } else { |                     } else { | ||||||
|                         toast.error(res.msg); |                         this.$root.toastError(res.msg); | ||||||
|                     } |                     } | ||||||
|                 }); |                 }); | ||||||
|             } |             } | ||||||
| @@ -869,7 +869,7 @@ export default { | |||||||
|                     this.enableEditMode = false; |                     this.enableEditMode = false; | ||||||
|                     location.href = "/manage-status-page"; |                     location.href = "/manage-status-page"; | ||||||
|                 } else { |                 } else { | ||||||
|                     toast.error(res.msg); |                     this.$root.toastError(res.msg); | ||||||
|                 } |                 } | ||||||
|             }); |             }); | ||||||
|         }, |         }, | ||||||
| @@ -959,7 +959,7 @@ export default { | |||||||
|          */ |          */ | ||||||
|         postIncident() { |         postIncident() { | ||||||
|             if (this.incident.title === "" || this.incident.content === "") { |             if (this.incident.title === "" || this.incident.content === "") { | ||||||
|                 toast.error(this.$t("Please input title and content")); |                 this.$root.toastError("Please input title and content"); | ||||||
|                 return; |                 return; | ||||||
|             } |             } | ||||||
|  |  | ||||||
| @@ -969,7 +969,7 @@ export default { | |||||||
|                     this.enableEditIncidentMode = false; |                     this.enableEditIncidentMode = false; | ||||||
|                     this.incident = res.incident; |                     this.incident = res.incident; | ||||||
|                 } else { |                 } else { | ||||||
|                     toast.error(res.msg); |                     this.$root.toastError(res.msg); | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
|             }); |             }); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user