Skip to content

feat(ui): Add notification system for rss feeds #7397

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

sumit-tft
Copy link
Collaborator

Context

This PR introduces a notification system to the Prowler UI
It adds a bell icon in the top-right corner, fetching alerts from an external RSS feed.
A red dot appears on the bell when new notifications arrive.

Description

  • Created feeds-server.tsx (Server Component) for initial data fetch.
  • Created feeds-client.tsx (Client Component) to handle UI updates.
  • Created feeds.ts (Action) to fetch the feeds
  • The notification system loads only on cloud domains (e.g., cloud.prowler.com).
  • Added styling for the notification bell and dropdown in the ui or dashboard directory.
  • Ensured that UI updates are smooth and efficient.
  • Used rss-parser library to parse rss feeds

Steps

  1. Checkout feature/add-notification-system branch.
  2. Run the docker containers
  3. Make sure the new npm package rss-parser installed
  4. Open http://localhost:3000 in your browser
  5. Verify that the notification bell is in the top-right corner
  6. Check if notifications appear when fetching from the RSS feed(currently showing with mock data)

Note: To use it in development mode please ensure that NEXT_PUBLIC_IS_CLOUD_ENV should be set as true

@sumit-tft sumit-tft requested a review from a team as a code owner March 31, 2025 04:02
Copy link
Member

@paabloLC paabloLC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left some comments, @sumit-tft. Please take a look when you have a moment. Thank you

import Parser from "rss-parser";

// TODO: Need to use the actual feed url
const RSS_FEED_URL = "https://prowler.com/blog/rss";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @sumit-tft , can we add this URL in our .env file please? thank you

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

variant="outline"
className={cn("relative", "rounded-full", "bg-transparent", "p-2")}
>
<Icon size={18} />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @sumit-tft , can we make sure the size matches the rest of the items?

image

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Updated, please let me know if any changes are required :)

# Conflicts:
#	ui/components/icons/Icons.tsx
@sumit-tft sumit-tft requested a review from a team as a code owner April 11, 2025 07:45
@jfagoagas
Copy link
Member

Hey @sumit-tft, I was reviewing the functionality of the RSS feed and I noticed the following:

  • We should not show the bell's red dot if no RSS feed configured or if there is nothing new
    Screenshot 2025-05-13 at 08 25 53
  • If RSS_FEED_URL is empty or not set the UI logs are showing the following. Could you please review it? I think we should not do anything in that case.
Error fetching RSS feed: AggregateError [ECONNREFUSED]: 
    at internalConnectMultiple (node:net:1139:18)
    at afterConnectMultiple (node:net:1712:7)
    at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
  code: 'ECONNREFUSED',
  [errors]: [
    Error: connect ECONNREFUSED ::1:80
        at createConnectionError (node:net:1675:14)
        at afterConnectMultiple (node:net:1705:16)
        at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
      errno: -61,
      code: 'ECONNREFUSED',
      syscall: 'connect',
      address: '::1',
      port: 80
    },
    Error: connect ECONNREFUSED 127.0.0.1:80
        at createConnectionError (node:net:1675:14)
        at afterConnectMultiple (node:net:1705:16)
        at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
      errno: -61,
      code: 'ECONNREFUSED',
      syscall: 'connect',
      address: '127.0.0.1',
      port: 80
    }
  ]
}
  • When the RSS feed has something new I think we should remove Comments on: Blog and just show the blog post title, what do you think?
    Screenshot 2025-05-13 at 08 28 05

@sumit-tft
Copy link
Collaborator Author

Hello, Thank you for reviewing this PR, I discussed with Pablo and made the changes

  • Updated the color of the dot and also added a condition if we don't have any feeds than the dot will not appear(this is a temporary solution as of, we have to show it dynamically when data changes)
  • Thank you for catching this error :) I added a condition to avoid calling of an endpoint if not set
  • For the third point, I need some more data in the feed URL to determine how we get the result, currently we are getting one channel only, if data changes for that channel than it will update on feed also

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants