diff --git a/dashboard/src/models/NotificationsModel.js b/dashboard/src/models/NotificationsModel.js index e33480e31..47b8c573e 100644 --- a/dashboard/src/models/NotificationsModel.js +++ b/dashboard/src/models/NotificationsModel.js @@ -9,7 +9,7 @@ function create() { async list(acknowledged = null) { const query = { access_token: accessToken, - per_page: 1000 + per_page: 10000 }; if (acknowledged !== null) query.acknowledged = !!acknowledged; diff --git a/dashboard/src/views/NotificationsView.vue b/dashboard/src/views/NotificationsView.vue index 9698c4e01..2b0eca78f 100644 --- a/dashboard/src/views/NotificationsView.vue +++ b/dashboard/src/views/NotificationsView.vue @@ -13,7 +13,7 @@ const busy = ref(true); const notifications = ref([]); const notificationsAllBusy = ref(false); const refreshNotifications = inject('refreshNotifications'); -const showAll = ref(true); +const showAll = ref(false); async function refresh() { const [error, result] = await notificationsModel.list(showAll.value ? null : false); @@ -31,8 +31,17 @@ async function onMarkNotificationRead(notification) { const [error] = await notificationsModel.update(notification.id, true); if (error) return console.error(error); - await refresh(); + notification.busy = false; + notification.acknowledged = true; refreshNotifications(); + + if (!showAll.value) { + setTimeout(() => { + const idx = notifications.value.findIndex(n => n.id === notification.id); + if (idx === -1) return; + notifications.value.splice(idx, 1); + }, 500); + } } async function onMarkNotificationUnread(notification) { @@ -40,7 +49,8 @@ async function onMarkNotificationUnread(notification) { const [error] = await notificationsModel.update(notification.id, false); if (error) return console.error(error); - await refresh(); + notification.busy = false; + notification.acknowledged = false; refreshNotifications(); }