From 55425f57de2eabb31fdeee193be407c3604d9138 Mon Sep 17 00:00:00 2001 From: Anbarasu Date: Fri, 7 Jun 2024 11:40:54 +0530 Subject: [PATCH] feat: Notifications (#8622) * feat: notifications wip * feat: wip * feat: longpoll and notifications.controller.ts * feat: longpoll and notifications.controller.ts * feat: enable email notifications * fix: notification styles and list * fix: update swagger feat: connect poller to frontend * fix: minor ui corrections * feat: move notifications to ee feat: scroll to commentId fix: polling fail on network error fix: unreadcount not updating fix: add workspace to comment mention event * fix: pubsub for notifications * fix: warning maxListeners * fix: update ui * fix: minor fixes * chore: move pub-sub to redis folder * fix: update ui and schema feat: optimistic comment update and create * fix: row empty during inital load causing row not loading * fix: build * fix: some updated * fix: minor ui corrections * fix: manage local state manually for interactivity * fix: remove prev notifcation data * fix: review comments * fix: code rabbit comments * fix: code rabbit comments * feat: delete notifications * fix: code rabbit comments * fix: row RowMeta manipulation fix: overflow notifications * fix: invalid offset * fix: updated widths * fix: tests * fix: playwright * feat: resolved by comments * feat: update layout * fix: wait 5 seconds before polling start, after polling starts, reload the notifications * fix: bug fixes * fix: disable long polling for playwright * fix: update migration * fix: lint * fix: code rabbit comments * fix: resolve tooltip * feat: resolve ee * fix: build failing * fix: review comments * fix: dependency synx * fix: update notification style --- package.json | 2 +- packages/nc-gui/assets/nc-icons/bell.svg | 6 + .../nc-gui/assets/nc-icons/check-circle.svg | 11 + .../components/dashboard/Sidebar/UserInfo.vue | 222 +-- .../components/dashboard/settings/Modal.vue | 2 - packages/nc-gui/components/dlg/InviteDlg.vue | 6 - .../nc-gui/components/notification/Card.vue | 169 ++- .../nc-gui/components/notification/Item.vue | 28 +- .../notification/Item/ColumnEvent.vue | 17 - .../notification/Item/FilterViewEvent.vue | 17 - .../notification/Item/ProjectEvent.vue | 38 - .../notification/Item/ProjectInvite.vue | 13 +- .../notification/Item/SharedViewEvent.vue | 38 - .../notification/Item/SortViewEvent.vue | 17 - .../notification/Item/TableEvent.vue | 38 - .../notification/Item/ViewEvent.vue | 38 - .../components/notification/Item/Welcome.vue | 21 +- .../components/notification/Item/Wrapper.vue | 119 +- .../nc-gui/components/notification/Menu.vue | 36 +- .../components/project/AccessSettings.vue | 4 +- .../nc-gui/components/project/AllTables.vue | 11 +- packages/nc-gui/components/project/View.vue | 4 - .../nc-gui/components/smartsheet/Toolbar.vue | 4 - .../smartsheet/column/LinkOptions.vue | 5 +- .../smartsheet/expanded-form/Comments.vue | 258 ++-- .../smartsheet/expanded-form/RichComment.vue | 6 +- .../smartsheet/expanded-form/index.vue | 2 +- .../composables/useExpandedFormStore.ts | 121 +- packages/nc-gui/store/notification.ts | 204 ++- packages/nc-gui/utils/datetimeUtils.ts | 3 +- packages/nc-gui/utils/iconUtils.ts | 5 +- packages/nc-mail-templates/.gitignore | 1 + packages/nc-mail-templates/package.json | 23 + packages/nc-mail-templates/src/index.ts | 33 + .../src/templates/Mention.vue | 73 + .../src/templates/Welcome.vue | 68 + .../src/templates/assets/DiscordIcon.ts | 15 + .../src/templates/assets/GithubIcon.ts | 15 + .../src/templates/assets/LinkedIcon.ts | 18 + .../src/templates/assets/TwitterIcon.ts | 15 + .../src/templates/assets/YoutubeIcon.ts | 15 + .../src/templates/assets/index.ts | 15 + .../src/templates/components/Footer.ts | 212 +++ .../src/templates/components/Header.ts | 30 + .../src/templates/components/HtmlWrapper.ts | 56 + .../src/templates/components/index.ts | 9 + packages/nc-mail-templates/tsconfig.json | 29 + packages/nocodb-sdk/src/lib/Api.ts | 146 +- .../src/controllers/comments.controller.ts | 3 +- .../controllers/notifications.controller.ts | 84 +- .../notifications.gateway.spec.ts | 19 - .../notifications/notifications.gateway.ts | 59 - packages/nocodb/src/interface/config.ts | 1 + .../meta/migrations/XcMigrationSourcev2.ts | 4 + .../v2/nc_049_clear_notifications.ts | 14 + packages/nocodb/src/models/Comment.ts | 6 +- packages/nocodb/src/models/Notification.ts | 27 +- .../src/modules/jobs/redis/jobs-redis.ts | 114 +- packages/nocodb/src/modules/noco.module.ts | 4 +- packages/nocodb/src/redis/pubsub-redis.ts | 94 ++ packages/nocodb/src/schema/swagger.json | 324 +---- .../src/services/app-hooks/interfaces.ts | 3 +- .../nocodb/src/services/comments.service.ts | 17 +- .../src/services/notifications.service.ts | 141 -- .../notifications.service.spec.ts | 0 .../notifications/notifications.service.ts | 237 ++++ packages/nocodb/src/utils/circularReplacer.ts | 12 + packages/nocodb/src/utils/index.ts | 1 + packages/nocodb/src/utils/richTextHelper.ts | 10 +- pnpm-lock.yaml | 1216 ++++++++++++++--- pnpm-workspace.yaml | 1 + tests/playwright/setup/index.ts | 6 +- 72 files changed, 3007 insertions(+), 1628 deletions(-) create mode 100644 packages/nc-gui/assets/nc-icons/bell.svg create mode 100644 packages/nc-gui/assets/nc-icons/check-circle.svg delete mode 100644 packages/nc-gui/components/notification/Item/ColumnEvent.vue delete mode 100644 packages/nc-gui/components/notification/Item/FilterViewEvent.vue delete mode 100644 packages/nc-gui/components/notification/Item/ProjectEvent.vue delete mode 100644 packages/nc-gui/components/notification/Item/SharedViewEvent.vue delete mode 100644 packages/nc-gui/components/notification/Item/SortViewEvent.vue delete mode 100644 packages/nc-gui/components/notification/Item/TableEvent.vue delete mode 100644 packages/nc-gui/components/notification/Item/ViewEvent.vue create mode 100644 packages/nc-mail-templates/.gitignore create mode 100644 packages/nc-mail-templates/package.json create mode 100644 packages/nc-mail-templates/src/index.ts create mode 100644 packages/nc-mail-templates/src/templates/Mention.vue create mode 100644 packages/nc-mail-templates/src/templates/Welcome.vue create mode 100644 packages/nc-mail-templates/src/templates/assets/DiscordIcon.ts create mode 100644 packages/nc-mail-templates/src/templates/assets/GithubIcon.ts create mode 100644 packages/nc-mail-templates/src/templates/assets/LinkedIcon.ts create mode 100644 packages/nc-mail-templates/src/templates/assets/TwitterIcon.ts create mode 100644 packages/nc-mail-templates/src/templates/assets/YoutubeIcon.ts create mode 100644 packages/nc-mail-templates/src/templates/assets/index.ts create mode 100644 packages/nc-mail-templates/src/templates/components/Footer.ts create mode 100644 packages/nc-mail-templates/src/templates/components/Header.ts create mode 100644 packages/nc-mail-templates/src/templates/components/HtmlWrapper.ts create mode 100644 packages/nc-mail-templates/src/templates/components/index.ts create mode 100644 packages/nc-mail-templates/tsconfig.json delete mode 100644 packages/nocodb/src/gateways/notifications/notifications.gateway.spec.ts delete mode 100644 packages/nocodb/src/gateways/notifications/notifications.gateway.ts create mode 100644 packages/nocodb/src/meta/migrations/v2/nc_049_clear_notifications.ts create mode 100644 packages/nocodb/src/redis/pubsub-redis.ts delete mode 100644 packages/nocodb/src/services/notifications.service.ts rename packages/nocodb/src/services/{ => notifications}/notifications.service.spec.ts (100%) create mode 100644 packages/nocodb/src/services/notifications/notifications.service.ts create mode 100644 packages/nocodb/src/utils/circularReplacer.ts diff --git a/package.json b/package.json index a0fce7e026..8f55e00b6b 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ ] }, "scripts": { - "bootstrap": "pnpm --filter=nocodb-sdk install && pnpm --filter=nocodb-sdk run build && pnpm --filter=nocodb --filter=nc-gui --filter=playwright install", + "bootstrap": "pnpm --filter=nocodb-sdk install && pnpm --filter=nocodb-sdk run build && pnpm --filter=nocodb --filter=nc-mail-templates --filter=nc-gui --filter=playwright install", "start:frontend": "pnpm --filter=nc-gui run dev", "start:backend": "pnpm --filter=nocodb run start", "lint:staged:playwright": "cd ./tests/playwright; pnpm dlx lint-staged; cd -", diff --git a/packages/nc-gui/assets/nc-icons/bell.svg b/packages/nc-gui/assets/nc-icons/bell.svg new file mode 100644 index 0000000000..de7f88412d --- /dev/null +++ b/packages/nc-gui/assets/nc-icons/bell.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/nc-gui/assets/nc-icons/check-circle.svg b/packages/nc-gui/assets/nc-icons/check-circle.svg new file mode 100644 index 0000000000..f1e9436075 --- /dev/null +++ b/packages/nc-gui/assets/nc-icons/check-circle.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/packages/nc-gui/components/dashboard/Sidebar/UserInfo.vue b/packages/nc-gui/components/dashboard/Sidebar/UserInfo.vue index 12cb350266..1054b38e58 100644 --- a/packages/nc-gui/components/dashboard/Sidebar/UserInfo.vue +++ b/packages/nc-gui/components/dashboard/Sidebar/UserInfo.vue @@ -55,127 +55,139 @@ onMounted(() => {