Skip to content

Add UI SQS message send/list/delete features #1140

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 2 commits into
base: master
Choose a base branch
from

Conversation

tuliocll
Copy link

Hello guys, I want to contribute with these features that help me a lot with this awesome software!

I created three new features that make working with SQS messages much easier:

  • Send Messages: Modal to create and send new messages
  • List Messages: View queue messages with expandable details
  • Delete Messages: Remove individual messages
image

- Centralize message fetching to prevent component remounting
- Implement message deletion with SQS API integration
- Add HTML entity decoding for message display
- Include comprehensive tests and performance optimizations
- Update component architecture for
@tuliocll tuliocll changed the title Add SQS message send/list/delete features Add UI SQS message send/list/delete features Jul 25, 2025
Copy link

@afternoon2 afternoon2 left a comment

Choose a reason for hiding this comment

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

Hey 👋🏻 Thanks for the PR. I've got some notes here from the frontend dev's side. 🙂

…tions

- Replaced `notistack` with a custom Snackbar context for better control over notifications.
- Simplified the QueueMessagesList component by removing unnecessary useMemo hooks and directly using utility functions for formatting and truncating text.
- Updated QueueRow and QueueRowDetails components to streamline props and improve readability.
- Enhanced error handling in message deletion and fetching functions with a centralized error message utility.
- Added unit tests for new Snackbar context and refactored QueueService tests to align with the new structure.
- Introduced utility functions for decoding HTML entities, formatting dates, and truncating text.
- Cleaned up unused dependencies and ensured consistent code style across components.
@tuliocll
Copy link
Author

tuliocll commented Aug 5, 2025

Thanks for the review — sorry for the many changes!
I’ve applied all the changes. Let me know if anything else needs adjusting.

}

const {row} = props
function ExpandableArrowButton({ isExpanded }: { isExpanded: boolean }) {

Choose a reason for hiding this comment

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

Hm... I don't think this needs to be declared in a function. isExpanded can be accessed directly from the state. Also, this is used only once here, so you could simply keep the returned jsx straight in the TableCell below

<TableCell>
  <IconButton
    aria-label="open-details"
    size="small"
    onClick={() => setIsExpanded((prevState) => !prevState)}
  >
    {isExpanded ? <KeyboardArrowRight /> : <KeyboardArrowDown />}
  </IconButton>
</TableCell>


const RowDetails: React.FC<{ props: { isExpanded: boolean, queueName: string } }> = ({props}) => {
const RowDetails: React.FC<{

Choose a reason for hiding this comment

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

would be nice to extract the props type 🙂

value: number;
}

function TabPanel(props: TabPanelProps) {

Choose a reason for hiding this comment

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

Could you extract this component (together with the props type) outside of the RowDetails? Otherwise, it gets re-declared on every RowDetails render.

const mockUpdateMessageExpandedState = jest.fn();
const mockOnRefreshMessages = jest.fn();

const renderWithSnackbarProvider = (component: React.ReactElement) => {

Choose a reason for hiding this comment

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

I see this helper declared 3 times. Could it be extracted to a tests/utils.ts so it's reused?

})
})
}
export default function useRefreshedQueueStatistics(): {

Choose a reason for hiding this comment

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

Can we extract the return type?

QueueMessagesData[]
>([]);

const updateQueue = useCallback(

Choose a reason for hiding this comment

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

no need to use useCallback if its dependency array stays empty

[updateQueue]
);

const updateMessageExpandedState = useCallback(

Choose a reason for hiding this comment

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

Same here, no need for useCallback


await fetchQueueMessages(queueName);
} catch (error) {
console.error("Erro ao deletar mensagem:", error);

Choose a reason for hiding this comment

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

Can we use English? 😅

@@ -0,0 +1,5 @@
export default function decodeHtmlEntities(text: string) {

Choose a reason for hiding this comment

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

Could we have all these utilities tested? 🙏🏻

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

Successfully merging this pull request may close these issues.

2 participants