Skip to content
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

Added new columns in alerts table #2334

Merged
merged 6 commits into from
May 1, 2024
Merged

Added new columns in alerts table #2334

merged 6 commits into from
May 1, 2024

Conversation

tomer-shvadron
Copy link
Collaborator

@tomer-shvadron tomer-shvadron commented May 1, 2024

User description

Description

  • Small UI changes
  • Added 2 new columns to the Alerts Table - Subject Type and Subject ID

Type

enhancement


Description

  • Extended the subject schema in alerts to include additional fields like id, correlationId, and type.
  • Added new columns Subject Type and Subject ID to the Alerts Table with appropriate rendering logic.
  • Updated CSS for better alignment and text handling in Alerts Table.
  • Enhanced data structure in alert controller to include new subject fields.
  • Updated type definitions to align with new data structure changes.

Changes walkthrough

Relevant files
Enhancement
TextWithNAFallback.tsx
Add Display Name to TextWithNAFallback Component                 

apps/backoffice-v2/src/common/components/atoms/TextWithNAFallback/TextWithNAFallback.tsx

  • Added a display name for the TextWithNAFallback component.
+1/-0     
fetchers.ts
Extend Subject Schema in Alerts List                                         

apps/backoffice-v2/src/domains/alerts/fetchers.ts

  • Extended the subject schema to include id, correlationId, and type
    with specific enum values.
  • +6/-1     
    AlertsTable.tsx
    UI Adjustments in Alerts Table                                                     

    apps/backoffice-v2/src/pages/TransactionMonitoringAlerts/components/AlertsTable/AlertsTable.tsx

  • Adjusted CSS classes for table headers and button elements to improve
    UI consistency.
  • +2/-2     
    columns.tsx
    Add New Columns to Alerts Table                                                   

    apps/backoffice-v2/src/pages/TransactionMonitoringAlerts/components/AlertsTable/columns.tsx

  • Added new columns for Subject Type and Subject ID with respective
    rendering logic.
  • Utilized useEllipsesWithTitle hook for Subject ID to manage text
    overflow.
  • +36/-1   
    alert.controller.external.ts
    Enhance Subject Data Structure in Alert Controller             

    services/workflows-service/src/alert/alert.controller.external.ts

  • Included type and correlationId in the subject data structure for
    business and counterparty.
  • +4/-0     
    types.ts
    Update Type Definitions for Alert Response                             

    services/workflows-service/src/alert/types.ts

  • Updated type definitions to include correlationId for business and end
    user.
  • +3/-3     
    Configuration changes
    data-migrations
    Update Data Migration Commit Reference                                     

    services/workflows-service/prisma/data-migrations

    • Updated subproject commit reference for data migrations.
    +1/-1     

    PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    Summary by CodeRabbit

    • Refactor
      • Simplified error handling logic by refactoring the fromClassValidator method in the ValidationError class.
    • Bug Fixes
      • Replaced IsDate import with IsDateString in the transaction-create.dto.ts file to address date validation issues.
    • Chores
      • Removed unnecessary imports for ReviewStatus and TransactionRecordStatus in the transaction.controller.external.intg.test.ts file.
    • Documentation
      • No changes.
    • New Features
      • Added an export statement for the InlineRule type in the types.ts file within the workflows-service.
    • Style
      • No changes.
    • Tests
      • No changes.
    • Revert
      • No changes.

    Copy link

    changeset-bot bot commented May 1, 2024

    ⚠️ No Changeset found

    Latest commit: 53ccf83

    Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

    This PR includes no changesets

    When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

    Click here to learn what changesets are, and how to add one.

    Click here if you're a maintainer who wants to add a changeset to this PR

    Copy link
    Contributor

    coderabbitai bot commented May 1, 2024

    Walkthrough

    The recent updates focus on refining various aspects of the workflows-service codebase. Changes include adjustments in imports, validator usage, error handling logic, and variable declarations across different files. These modifications aim to streamline functionality, improve code organization, and enhance error handling within the system.

    Changes

    Files Change Summary
    .../alert/alert.service.intg.test.ts Removed import of TExecutionDetails.
    .../alert/dtos/create-alert-definition.dto.ts
    .../transaction/dtos/transaction-create.dto.ts
    Updated validator imports (IsEnum -> IsDateString).
    .../common/filters/HttpExceptions.filter.ts Removed import of HttpException.
    .../customer/customer.service.ts Removed Project import.
    .../data-analytics/types.ts Added export type InlineRule.
    .../errors.ts Refactored fromClassValidator in ValidationError.
    .../test/helpers/nest-app-helper.ts Removed import of CustomerService.
    .../transaction/transaction.controller.external.intg.test.ts Removed imports for ReviewStatus and TransactionRecordStatus.
    .../transaction/transaction.mapper.ts Added variable declaration and object assignment.
    .../webhooks/webhooks.service.ts Added logging statement.

    🐇✨
    Code changes dance in the digital breeze,
    Imports shift, errors put at ease.
    Validators update, variables declare,
    Each file tells a story, a coder's care.
    In the labyrinth of code, a rabbit roams,
    Guiding changes through digital tomes! 🌟🐾


    Recent Review Details

    Configuration used: CodeRabbit UI
    Review profile: CHILL

    Commits Files that changed from the base of the PR and between 1a48cc9 and 53ccf83.
    Files selected for processing (1)
    • services/workflows-service/src/errors.ts (3 hunks)
    Files skipped from review as they are similar to previous changes (1)
    • services/workflows-service/src/errors.ts

    Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

    Share
    Tips

    Chat

    There are 3 ways to chat with CodeRabbit:

    • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
      • I pushed a fix in commit <commit_id>.
      • Generate unit testing code for this file.
      • Open a follow-up GitHub issue for this discussion.
    • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
      • @coderabbitai generate unit testing code for this file.
      • @coderabbitai modularize this function.
    • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
      • @coderabbitai generate interesting stats about this repository and render them as a table.
      • @coderabbitai show all the console.log statements in this repository.
      • @coderabbitai read src/utils.ts and generate unit testing code.
      • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

    Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

    CodeRabbit Commands (invoked as PR comments)

    • @coderabbitai pause to pause the reviews on a PR.
    • @coderabbitai resume to resume the paused reviews.
    • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
    • @coderabbitai resolve resolve all the CodeRabbit review comments.
    • @coderabbitai help to get help.

    Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

    CodeRabbit Configration File (.coderabbit.yaml)

    • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
    • Please see the configuration documentation for more information.
    • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

    Documentation and Community

    • Visit our Documentation for detailed information on how to use CodeRabbit.
    • Join our Discord Community to get help, request features, and share feedback.
    • Follow us on X/Twitter for updates and announcements.

    @tomer-shvadron tomer-shvadron changed the title feat: added new columns in alerts table Added new columns in alerts table May 1, 2024
    @github-actions github-actions bot added the enhancement New feature or request label May 1, 2024
    Copy link
    Contributor

    github-actions bot commented May 1, 2024

    PR Description updated to latest commit (09c87cd)

    Copy link
    Contributor

    github-actions bot commented May 1, 2024

    PR Review

    ⏱️ Estimated effort to review [1-5]

    3, because the PR involves multiple files across different layers (UI, backend schema, and data migrations) with both frontend and backend changes. Understanding the context and ensuring the changes are consistent across layers requires a moderate level of effort.

    🧪 Relevant tests

    No

    🔍 Possible issues

    Possible Bug: The use of useEllipsesWithTitle hook inside a non-component function in columns.tsx might cause issues since hooks are generally used within React components or custom hooks.

    🔒 Security concerns

    No

    Code feedback:
    relevant fileapps/backoffice-v2/src/pages/TransactionMonitoringAlerts/components/AlertsTable/columns.tsx
    suggestion      

    Consider refactoring the use of useEllipsesWithTitle hook to ensure it's used within a component or a custom hook context. This change is important to comply with React's rules of hooks and avoid potential runtime errors. [important]

    relevant lineconst { ref, styles } = useEllipsesWithTitle();

    relevant fileapps/backoffice-v2/src/pages/TransactionMonitoringAlerts/components/AlertsTable/AlertsTable.tsx
    suggestion      

    Ensure consistent padding in the AlertsTable headers. The change from px-3 to px-3 text-left might cause alignment issues with other headers. Consider reviewing and adjusting all headers to maintain consistency. [medium]

    relevant lineclassName="flex h-9 flex-row items-center gap-x-2 px-3 text-left text-[#A3A3A3]"


    ✨ Review tool usage guide:

    Overview:
    The review tool scans the PR code changes, and generates a PR review which includes several types of feedbacks, such as possible PR issues, security threats and relevant test in the PR. More feedbacks can be added by configuring the tool.

    The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on any PR.

    • When commenting, to edit configurations related to the review tool (pr_reviewer section), use the following template:
    /review --pr_reviewer.some_config1=... --pr_reviewer.some_config2=...
    
    [pr_reviewer]
    some_config1=...
    some_config2=...
    

    See the review usage page for a comprehensive guide on using this tool.

    Copy link
    Contributor

    github-actions bot commented May 1, 2024

    PR Code Suggestions

    CategorySuggestions                                                                                                                                                       
    Enhancement
    Add a default value for the type field to ensure robustness.

    Consider adding a fallback or default value for the type field in the subject object to
    handle cases where the type might not be provided or recognized. This can prevent
    potential runtime errors or unexpected behavior in the UI.

    apps/backoffice-v2/src/domains/alerts/fetchers.ts [83]

    -type: z.enum(['business', 'counterparty']),
    +type: z.enum(['business', 'counterparty']).default('business'),
     
    Possible issue
    Review and adjust the padding in the table header to maintain layout consistency.

    The added padding in the className might cause layout shifts or alignment issues in the
    table headers. Consider reviewing the design requirements and testing across different
    screen sizes to ensure consistency.

    apps/backoffice-v2/src/pages/TransactionMonitoringAlerts/components/AlertsTable/AlertsTable.tsx [32]

    -className={`sticky top-0 z-10 h-[34px] bg-white p-1 text-[14px] font-bold text-[#787981]`}
    +className={`sticky top-0 z-10 h-[34px] bg-white p-0 text-[14px] font-bold text-[#787981]`}
     
    Bug
    Refactor the code to comply with React's rules of hooks.

    The use of eslint-disable-next-line for hooks rules in a non-hooks function context is
    risky. Refactor this to either move the hook outside of the cell function or redesign the
    component structure to comply with React's rules of hooks.

    apps/backoffice-v2/src/pages/TransactionMonitoringAlerts/components/AlertsTable/columns.tsx [101]

    -// eslint-disable-next-line react-hooks/rules-of-hooks -- ESLint doesn't like `cell` not being `Cell`.
    +// Properly use hooks at the top level of your React function component.
     
    Performance
    Ensure database optimization for the new correlationId fields.

    Ensure that the newly added correlationId fields are properly indexed in the database to
    optimize query performance, especially if they are frequently accessed or searched upon.

    services/workflows-service/src/alert/types.ts [26-27]

    -business: Pick<Business, 'id' | 'companyName' | 'correlationId'>;
    -endUser: Pick<EndUser, 'id' | 'firstName' | 'lastName' | 'correlationId'>;
    +// Ensure database indexes are set for 'correlationId' in both 'Business' and 'EndUser'.
     
    Maintainability
    Improve responsiveness by using CSS classes or media queries instead of fixed widths.

    The inline style max-w-[12ch] and max-w-[40ch] might not be responsive across devices.
    Consider using CSS classes or media queries to handle different screen sizes more
    gracefully.

    apps/backoffice-v2/src/pages/TransactionMonitoringAlerts/components/AlertsTable/columns.tsx [94-146]

    -className={`max-w-[12ch]`}
    +className={`max-w-full md:max-w-[12ch]`}
     

    ✨ Improve tool usage guide:

    Overview:
    The improve tool scans the PR code changes, and automatically generates suggestions for improving the PR code. The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on a PR.

    • When commenting, to edit configurations related to the improve tool (pr_code_suggestions section), use the following template:
    /improve --pr_code_suggestions.some_config1=... --pr_code_suggestions.some_config2=...
    
    [pr_code_suggestions]
    some_config1=...
    some_config2=...
    

    See the improve usage page for a comprehensive guide on using this tool.

    @tomer-shvadron tomer-shvadron merged commit 3e7d2f8 into dev May 1, 2024
    8 of 9 checks passed
    @tomer-shvadron tomer-shvadron deleted the bal-1950 branch May 1, 2024 13:44
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    None yet

    2 participants