From 0092d07c6e26a1b97dc62fe7903e7c3456e120a4 Mon Sep 17 00:00:00 2001 From: hay-kot Date: Sat, 8 May 2021 16:47:03 -0800 Subject: [PATCH] complete notification feature --- frontend/src/api/about.js | 15 +- frontend/src/api/users.js | 2 +- .../src/components/UI/Dialogs/BaseDialog.vue | 18 +- frontend/src/components/UI/GlobalSnackbar.vue | 16 ++ frontend/src/locales/messages/en-US.json | 14 ++ .../ToolBox/CategoryTagEditor/BulkAssign.vue | 4 +- .../pages/Admin/ToolBox/EventNotification.vue | 236 ++++++++++++++++++ .../Admin/ToolBox/EventNotification/index.vue | 221 ---------------- mealie/routes/about/events.py | 14 +- mealie/schema/event_notifications.py | 2 + mealie/services/events.py | 19 +- 11 files changed, 318 insertions(+), 243 deletions(-) create mode 100644 frontend/src/pages/Admin/ToolBox/EventNotification.vue delete mode 100644 frontend/src/pages/Admin/ToolBox/EventNotification/index.vue diff --git a/frontend/src/api/about.js b/frontend/src/api/about.js index 211e63169..1cfa13f23 100644 --- a/frontend/src/api/about.js +++ b/frontend/src/api/about.js @@ -1,5 +1,6 @@ import { baseURL } from "./api-utils"; import { apiReq } from "./api-utils"; +import i18n from "@/i18n.js"; const prefix = baseURL + "about"; @@ -47,11 +48,21 @@ export const aboutAPI = { return response.data; }, async testNotificationByID(id) { - const response = await apiReq.post(aboutURLs.testNotifications, { id: id }); + const response = await apiReq.post( + aboutURLs.testNotifications, + { id: id }, + () => i18n.t("events.something-went-wrong"), + () => i18n.t("events.test-message-sent") + ); return response.data; }, async testNotificationByURL(url) { - const response = await apiReq.post(aboutURLs.testNotifications, { test_url: url }); + const response = await apiReq.post( + aboutURLs.testNotifications, + { test_url: url }, + () => i18n.t("events.something-went-wrong"), + () => i18n.t("events.test-message-sent") + ); return response.data; }, // async getAppInfo() { diff --git a/frontend/src/api/users.js b/frontend/src/api/users.js index 1ded3c6e9..68e42c4ae 100644 --- a/frontend/src/api/users.js +++ b/frontend/src/api/users.js @@ -71,7 +71,7 @@ export const userAPI = { }, delete(id) { - return apiReq.delete(usersURLs.userID(id), null, deleteErrorText, function() { + return apiReq.delete(usersURLs.userID(id), null, deleteErrorText, () => { return i18n.t("user.user-deleted"); }); }, diff --git a/frontend/src/components/UI/Dialogs/BaseDialog.vue b/frontend/src/components/UI/Dialogs/BaseDialog.vue index e4a80296e..e83d4d584 100644 --- a/frontend/src/components/UI/Dialogs/BaseDialog.vue +++ b/frontend/src/components/UI/Dialogs/BaseDialog.vue @@ -2,7 +2,7 @@
- + {{ titleIcon }} @@ -11,7 +11,9 @@ - + + + @@ -22,13 +24,15 @@ {{ $t("general.delete") }} - + {{ submitText }} - +
+ +
@@ -59,6 +63,9 @@ export default { submitText: { default: () => i18n.t("general.create"), }, + keepOpen: { + default: false, + }, }, data() { return { @@ -68,7 +75,7 @@ export default { }, computed: { determineClose() { - return this.submitted && !this.loading; + return this.submitted && !this.loading && !this.keepOpen; }, }, watch: { @@ -82,6 +89,7 @@ export default { }, methods: { submitEvent() { + console.log("Submit"); this.$emit("submit"); this.submitted = true; }, diff --git a/frontend/src/components/UI/GlobalSnackbar.vue b/frontend/src/components/UI/GlobalSnackbar.vue index 437d20a46..777c82b2f 100644 --- a/frontend/src/components/UI/GlobalSnackbar.vue +++ b/frontend/src/components/UI/GlobalSnackbar.vue @@ -1,6 +1,10 @@