From 3ab48c4c8cda6bff320fb9b2752eb8707d5db7ac Mon Sep 17 00:00:00 2001 From: Alireza Heidari Date: Tue, 20 Jun 2023 17:22:47 +0200 Subject: [PATCH 01/40] create BroadcastContainer component --- .../Broadcasts/BroadcastContainer.vue | 121 ++++++++++++++++++ .../Broadcasts/BroadcastsOverlay.vue | 117 +---------------- 2 files changed, 125 insertions(+), 113 deletions(-) create mode 100644 client/src/components/Notifications/Broadcasts/BroadcastContainer.vue diff --git a/client/src/components/Notifications/Broadcasts/BroadcastContainer.vue b/client/src/components/Notifications/Broadcasts/BroadcastContainer.vue new file mode 100644 index 000000000000..7fd269e2f888 --- /dev/null +++ b/client/src/components/Notifications/Broadcasts/BroadcastContainer.vue @@ -0,0 +1,121 @@ + + + + + diff --git a/client/src/components/Notifications/Broadcasts/BroadcastsOverlay.vue b/client/src/components/Notifications/Broadcasts/BroadcastsOverlay.vue index e1af53357fb4..f47467442446 100644 --- a/client/src/components/Notifications/Broadcasts/BroadcastsOverlay.vue +++ b/client/src/components/Notifications/Broadcasts/BroadcastsOverlay.vue @@ -1,135 +1,26 @@ - - From a9e4125ff072dc3a315b975982a411139e9d60ab Mon Sep 17 00:00:00 2001 From: Alireza Heidari Date: Tue, 20 Jun 2023 17:23:45 +0200 Subject: [PATCH 02/40] add disabled prop to AsyncButton --- client/src/components/Common/AsyncButton.vue | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client/src/components/Common/AsyncButton.vue b/client/src/components/Common/AsyncButton.vue index f9f2691cd39c..2d6ccd4881e7 100644 --- a/client/src/components/Common/AsyncButton.vue +++ b/client/src/components/Common/AsyncButton.vue @@ -29,6 +29,11 @@ const props = defineProps({ required: false, default: "link", }, + disabled: { + type: Boolean, + required: false, + default: false, + }, }); async function onClick() { @@ -44,7 +49,7 @@ async function onClick() { :title="title" :size="size" :variant="variant" - :disabled="loading" + :disabled="loading || disabled" @click="onClick"> From 533cd8adce85caad288ebb519412a15b7d07365a Mon Sep 17 00:00:00 2001 From: Alireza Heidari Date: Tue, 20 Jun 2023 17:25:11 +0200 Subject: [PATCH 03/40] create broadcasts.services for admin panel --- .../Notifications/broadcasts.services.ts | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 client/src/components/admin/Notifications/broadcasts.services.ts diff --git a/client/src/components/admin/Notifications/broadcasts.services.ts b/client/src/components/admin/Notifications/broadcasts.services.ts new file mode 100644 index 000000000000..a62dbb267363 --- /dev/null +++ b/client/src/components/admin/Notifications/broadcasts.services.ts @@ -0,0 +1,29 @@ +import { type components, fetcher } from "@/schema"; + +type BroadcastNotificationResponse = components["schemas"]["BroadcastNotificationResponse"]; + +const getBroadcast = fetcher.path("/api/notifications/broadcast/{notification_id}").method("get").create(); +export async function loadBroadcast(id: string): Promise { + const { data } = await getBroadcast({ notification_id: id }); + return data; +} + +const getBroadcasts = fetcher.path("/api/notifications/broadcast").method("get").create(); +export async function loadBroadcasts(): Promise { + const { data } = await getBroadcasts({}); + return data; +} + +const postBroadcast = fetcher.path("/api/notifications/broadcast").method("post").create(); +type BroadcastNotificationCreateRequest = components["schemas"]["BroadcastNotificationCreateRequest"]; +export async function createBroadcast(broadcast: BroadcastNotificationCreateRequest) { + const { data } = await postBroadcast(broadcast); + return data; +} + +const putBroadcast = fetcher.path("/api/notifications/broadcast/{notification_id}").method("put").create(); +type NotificationBroadcastUpdateRequest = components["schemas"]["NotificationBroadcastUpdateRequest"]; +export async function updateBroadcast(id: string, broadcast: NotificationBroadcastUpdateRequest) { + const { data } = await putBroadcast({ notification_id: id, ...broadcast }); + return data; +} From 500235ebd38ef3fde5d3eff7b8a3398b97d2c83b Mon Sep 17 00:00:00 2001 From: Alireza Heidari Date: Tue, 20 Jun 2023 17:29:14 +0200 Subject: [PATCH 04/40] create BroadcastForm to create new/edit a broadcast --- .../admin/Notifications/BroadcastForm.vue | 230 ++++++++++++++++++ 1 file changed, 230 insertions(+) create mode 100644 client/src/components/admin/Notifications/BroadcastForm.vue diff --git a/client/src/components/admin/Notifications/BroadcastForm.vue b/client/src/components/admin/Notifications/BroadcastForm.vue new file mode 100644 index 000000000000..dea492ede22f --- /dev/null +++ b/client/src/components/admin/Notifications/BroadcastForm.vue @@ -0,0 +1,230 @@ + + + From c1b33f08b0ae7373fbc1194e844e37b1b12af20c Mon Sep 17 00:00:00 2001 From: Alireza Heidari Date: Tue, 20 Jun 2023 17:30:49 +0200 Subject: [PATCH 05/40] create BroadcastsList that shows all broadcasts with delete and edit actions --- .../admin/Notifications/BroadcastsList.vue | 178 ++++++++++++++++++ 1 file changed, 178 insertions(+) create mode 100644 client/src/components/admin/Notifications/BroadcastsList.vue diff --git a/client/src/components/admin/Notifications/BroadcastsList.vue b/client/src/components/admin/Notifications/BroadcastsList.vue new file mode 100644 index 000000000000..f03f71705e73 --- /dev/null +++ b/client/src/components/admin/Notifications/BroadcastsList.vue @@ -0,0 +1,178 @@ + + + + + From 8ed73dbd2029a9803d07bbcc60cabccc73f3a639 Mon Sep 17 00:00:00 2001 From: Alireza Heidari Date: Tue, 20 Jun 2023 17:34:05 +0200 Subject: [PATCH 06/40] create notifications.services for admin panel --- .../Notifications/notifications.services.ts | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 client/src/components/admin/Notifications/notifications.services.ts diff --git a/client/src/components/admin/Notifications/notifications.services.ts b/client/src/components/admin/Notifications/notifications.services.ts new file mode 100644 index 000000000000..a2170f7479d0 --- /dev/null +++ b/client/src/components/admin/Notifications/notifications.services.ts @@ -0,0 +1,42 @@ +import axios from "axios"; +import { type components, fetcher } from "@/schema"; + +const getNotification = fetcher.path("/api/notifications/{notification_id}").method("get").create(); +type NotificationResponse = components["schemas"]["NotificationResponse"]; +export async function loadNotification(id: string): Promise { + const { data } = await getNotification({ notification_id: id }); + return data; +} + +const postNotification = fetcher.path("/api/notifications").method("post").create(); +type NotificationCreateRequest = components["schemas"]["NotificationCreateRequest"]; +export async function createNotification(notification: NotificationCreateRequest) { + const { data } = await postNotification(notification); + return data; +} + +const putNotification = fetcher.path("/api/notifications/{notification_id}").method("put").create(); +type UserNotificationUpdateRequest = components["schemas"]["UserNotificationUpdateRequest"]; +export async function updateNotification(id: string, notification: UserNotificationUpdateRequest) { + const { data } = await putNotification({ notification_id: id, ...notification }); + return data; +} + +const getRolesReq = fetcher.path("/api/roles").method("get").create(); +type RoleModelResponse = components["schemas"]["RoleModelResponse"]; +export async function getRoles(): Promise { + const { data } = await getRolesReq({}); + return data; +} + +type GroupModel = components["schemas"]["GroupModel"]; +export async function getGroups(): Promise { + const { data } = await axios.get("/api/groups"); + return data; +} + +type UserModel = components["schemas"]["UserModel"]; +export async function getUsers(): Promise { + const { data } = await axios.get("/api/users"); + return data; +} From 9acd44d739449ec6e0225cbb5d4cc09d07b6a039 Mon Sep 17 00:00:00 2001 From: Alireza Heidari Date: Tue, 20 Jun 2023 17:35:02 +0200 Subject: [PATCH 07/40] create NotificationForm to create a notification --- .../admin/Notifications/NotificationForm.vue | 241 ++++++++++++++++++ 1 file changed, 241 insertions(+) create mode 100644 client/src/components/admin/Notifications/NotificationForm.vue diff --git a/client/src/components/admin/Notifications/NotificationForm.vue b/client/src/components/admin/Notifications/NotificationForm.vue new file mode 100644 index 000000000000..5e7f550bc4ed --- /dev/null +++ b/client/src/components/admin/Notifications/NotificationForm.vue @@ -0,0 +1,241 @@ + + + From 54d2e2c97a0d76ca050ebfe4c9b5c4861fc74e9a Mon Sep 17 00:00:00 2001 From: Alireza Heidari Date: Tue, 20 Jun 2023 17:36:03 +0200 Subject: [PATCH 08/40] add admin paths for notifications and broadcasts --- client/src/components/admin/AdminPanel.vue | 5 ++++ client/src/components/admin/Home.vue | 6 ++++ .../src/entry/analysis/routes/admin-routes.js | 28 +++++++++++++++++++ lib/galaxy/webapps/galaxy/buildapp.py | 1 + 4 files changed, 40 insertions(+) diff --git a/client/src/components/admin/AdminPanel.vue b/client/src/components/admin/AdminPanel.vue index 303880658037..3f654e735c0a 100644 --- a/client/src/components/admin/AdminPanel.vue +++ b/client/src/components/admin/AdminPanel.vue @@ -79,6 +79,11 @@ export default { title: "Local Data", route: "/admin/data_manager", }, + { + id: "admin-link-notifications", + title: "Notifications", + route: "/admin/notifications", + }, ], }, { diff --git a/client/src/components/admin/Home.vue b/client/src/components/admin/Home.vue index 459132fd328a..c0a4ced8836e 100644 --- a/client/src/components/admin/Home.vue +++ b/client/src/components/admin/Home.vue @@ -43,6 +43,12 @@ - Manage the reference (and other) data that is stored within Tool Data Tables. See wiki for details. +
  • + + Notifications and Broadcasts + + - Manage the notifications and broadcast messages that are displayed to users. +
  • User Management diff --git a/client/src/entry/analysis/routes/admin-routes.js b/client/src/entry/analysis/routes/admin-routes.js index 76f97e42a8df..43b739dfac41 100644 --- a/client/src/entry/analysis/routes/admin-routes.js +++ b/client/src/entry/analysis/routes/admin-routes.js @@ -5,6 +5,9 @@ import DataManagerJob from "components/admin/DataManager/DataManagerJob"; import DataManagerJobs from "components/admin/DataManager/DataManagerJobs"; import DataManagerTable from "components/admin/DataManager/DataManagerTable"; import DataManagerView from "components/admin/DataManager/DataManagerView"; +import NotificationsManagement from "components/admin/Notifications/NotificationsManagement"; +import BroadcastForm from "components/admin/Notifications/BroadcastForm.vue"; +import NotificationForm from "components/admin/Notifications/NotificationForm.vue"; import DataTables from "components/admin/DataTables"; import DataTypes from "components/admin/DataTypes"; import ToolboxDependencies from "components/admin/Dependencies/Landing"; @@ -94,6 +97,31 @@ export default [ ], }, + // notifications and broadcasts + { + path: "notifications", + component: NotificationsManagement, + }, + + { + path: "notifications/create_new_broadcast", + name: "NewBroadcast", + component: BroadcastForm, + }, + + { + path: "notifications/edit_broadcast/:id", + name: "EditBroadcast", + component: BroadcastForm, + props: true, + }, + + { + path: "notifications/create_new_notification", + name: "NewNotification", + component: NotificationForm, + }, + // grids { path: "forms", diff --git a/lib/galaxy/webapps/galaxy/buildapp.py b/lib/galaxy/webapps/galaxy/buildapp.py index 236da06dd71d..b24bba59ce34 100644 --- a/lib/galaxy/webapps/galaxy/buildapp.py +++ b/lib/galaxy/webapps/galaxy/buildapp.py @@ -194,6 +194,7 @@ def app_pair(global_conf, load_app_kwds=None, wsgi_preflight=True, **kwargs): webapp.add_client_route("/admin/invocations") webapp.add_client_route("/admin/toolbox_dependencies") webapp.add_client_route("/admin/data_manager{path_info:.*}") + webapp.add_client_route("/admin/notifications{path_info:.*}") webapp.add_client_route("/admin/error_stack") webapp.add_client_route("/admin/users") webapp.add_client_route("/admin/users/create") From 865148ce9248d76af66736ee789a00568a697ada Mon Sep 17 00:00:00 2001 From: Alireza Heidari Date: Tue, 20 Jun 2023 17:37:17 +0200 Subject: [PATCH 09/40] create NotificationsManagement component --- .../Notifications/NotificationsManagement.vue | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 client/src/components/admin/Notifications/NotificationsManagement.vue diff --git a/client/src/components/admin/Notifications/NotificationsManagement.vue b/client/src/components/admin/Notifications/NotificationsManagement.vue new file mode 100644 index 000000000000..75d9727dd5a6 --- /dev/null +++ b/client/src/components/admin/Notifications/NotificationsManagement.vue @@ -0,0 +1,36 @@ + + + From b5e9fbbaf753f4a40327cd8b1f4fdcc77187fe92 Mon Sep 17 00:00:00 2001 From: Alireza Heidari Date: Thu, 6 Jul 2023 15:53:33 +1000 Subject: [PATCH 10/40] Update BroadcastContainer props interface and bootstrap components imports --- .../Broadcasts/BroadcastContainer.vue | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/client/src/components/Notifications/Broadcasts/BroadcastContainer.vue b/client/src/components/Notifications/Broadcasts/BroadcastContainer.vue index 7fd269e2f888..f3b16119e23e 100644 --- a/client/src/components/Notifications/Broadcasts/BroadcastContainer.vue +++ b/client/src/components/Notifications/Broadcasts/BroadcastContainer.vue @@ -2,8 +2,7 @@ import { library } from "@fortawesome/fontawesome-svg-core"; import { faInfoCircle, faTimes } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; -import { BButton } from "bootstrap-vue"; -import { PropType } from "vue"; +import { BButton, BCol, BRow } from "bootstrap-vue"; import { useRouter } from "vue-router/composables"; import { useMarkdown } from "@/composables/markdown"; @@ -13,16 +12,12 @@ import Heading from "@/components/Common/Heading.vue"; library.add(faInfoCircle, faTimes); -const props = defineProps({ - broadcast: { - type: Object as PropType, - required: true, - }, - previewMode: { - type: Boolean, - default: false, - }, -}); +interface Props { + previewMode?: boolean; + broadcast: BroadcastNotification; +} + +const props = defineProps(); const router = useRouter(); const broadcastsStore = useBroadcastsStore(); From ed0e48f81f9eabbc1ab75db36d0267d34581f65d Mon Sep 17 00:00:00 2001 From: Alireza Heidari Date: Fri, 7 Jul 2023 11:08:37 +1000 Subject: [PATCH 11/40] rename `createNotification` service method to `sendNotification` --- .../components/admin/Notifications/notifications.services.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/src/components/admin/Notifications/notifications.services.ts b/client/src/components/admin/Notifications/notifications.services.ts index a2170f7479d0..2b1fb6fab2c0 100644 --- a/client/src/components/admin/Notifications/notifications.services.ts +++ b/client/src/components/admin/Notifications/notifications.services.ts @@ -1,4 +1,5 @@ import axios from "axios"; + import { type components, fetcher } from "@/schema"; const getNotification = fetcher.path("/api/notifications/{notification_id}").method("get").create(); @@ -10,7 +11,7 @@ export async function loadNotification(id: string): Promise Date: Fri, 7 Jul 2023 11:09:26 +1000 Subject: [PATCH 12/40] add `previewMode` in MessageNotification --- .../Notifications/Categories/MessageNotification.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/src/components/Notifications/Categories/MessageNotification.vue b/client/src/components/Notifications/Categories/MessageNotification.vue index 8f79f19e57cf..42cdd86322fa 100644 --- a/client/src/components/Notifications/Categories/MessageNotification.vue +++ b/client/src/components/Notifications/Categories/MessageNotification.vue @@ -14,6 +14,7 @@ import NotificationActions from "@/components/Notifications/NotificationActions. library.add(faInbox); interface Props { + previewMode?: boolean; notification: MessageNotification; } @@ -38,7 +39,7 @@ const notificationVariant = computed(() => { {{ notification.content.subject }} - + From 68295f7ddf333ecc8a00a6e9fc1f804abada02b2 Mon Sep 17 00:00:00 2001 From: Alireza Heidari Date: Fri, 7 Jul 2023 11:11:02 +1000 Subject: [PATCH 13/40] fix date-time format conversion in BroadcastForm --- .../admin/Notifications/BroadcastForm.vue | 93 +++++++++++++------ 1 file changed, 63 insertions(+), 30 deletions(-) diff --git a/client/src/components/admin/Notifications/BroadcastForm.vue b/client/src/components/admin/Notifications/BroadcastForm.vue index dea492ede22f..ab2025b5a092 100644 --- a/client/src/components/admin/Notifications/BroadcastForm.vue +++ b/client/src/components/admin/Notifications/BroadcastForm.vue @@ -1,15 +1,21 @@