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

feat(remita-table): Extends classic table plugin with bulk actions and event publishing #32265

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

Conversation

mujibishola
Copy link
Contributor

SUMMARY
This is a custom Table plugin.It provides an interface for users to add, edit, and delete custom actions that can be applied to table headers. Key features include:

  • Action Management:
    Users can add new actions, edit existing ones, or remove them. Each action consists of properties such as a unique key, label, visibility condition, and an optional action URL (if not publishing an event).

  • Dual Editing Modes:
    The component supports two modes for managing actions:

    • A Simple mode that uses form fields (via Ant Design's Form component) for a user-friendly interface.
    • An Advanced mode that allows direct editing of the actions' JSON configuration in a text area.
  • UI Rendering:
    Actions are rendered as cards. Each card displays a header (showing the action key and control buttons for editing or deleting) and a body with additional details (using icons with tooltips to indicate the action properties).

  • Styling Adjustments:
    The card header styling has been adjusted to match the card body’s height by using the same padding, ensuring a consistent look across the UI.

  • Validation:
    The component includes validation rules to ensure that action keys and labels are unique.

  • State Management and Communication:
    It manages its internal state with React hooks, and communicates changes back to the parent component via the onChange callback.

TESTING INSTRUCTIONS

  1. Component Rendering & Initial State:

    • Open a view or sandbox where the Control Panel component is rendered.
    • Verify that if no actions are present initially, an informational alert ("No split table header actions added yet.") is displayed.
    • Ensure the “Add New Action” button is visible.
  2. Adding a New Action (Simple Mode):

    • Click the “Add New Action” button.
    • In the modal that appears, verify that the “Simple” tab is active by default.
    • Fill out the form fields:
      • Key: Enter a unique key (e.g., "action1").
      • Label: Enter a corresponding label (e.g., "Action 1").
      • Bound to Selection: Toggle the checkbox as needed.
      • Visibility Condition: Select one of the provided options (e.g., "Selected" or "All").
      • Publish Event: Test toggling this checkbox. Verify that when unchecked, the “Action URL” field appears and is required; when checked, the “Action URL” field is hidden.
    • Click the “Add Action” button.
    • Confirm that the new action appears as a card on the modal page, and that the card header displays the action key with consistent header and body padding.
  3. Editing an Existing Action:

    • In the modal, click the edit button (pencil icon) on an action card.
    • Verify that the modal pre-populates the form with the selected action’s details.
    • Update one or more fields and click “Save Changes.”
    • Confirm that the action card is updated accordingly with the new information.
  4. Removing an Action:

    • Click the delete button (trash icon) on an action card.
    • Confirm that the action is removed from the list.
    • Verify that the total count of actions decreases.
  5. Advanced Mode (JSON Editing):

    • In the modal, switch to the “Advanced” tab.
    • Verify that the text area is populated with the JSON representation of the actions. If editing a single action, it should show that action’s JSON; otherwise, it should display the full actions array.
    • Make an edit in the JSON (e.g., modify a label) and click “Save JSON.”
    • Switch back to the “Simple” tab and confirm that the changes are reflected in the card view.
  6. Validation Checks:

    • Try to add or edit an action using a key or label that duplicates an existing one.
    • Verify that appropriate validation error messages are displayed (e.g., “Action key must be unique”).
    • Ensure that the form prevents submission until errors are resolved.
  7. UI Consistency & Styling:

    • Inspect the rendered card for each action.
    • Confirm that the card header uses the same padding as the card body (both should have 4px padding), ensuring that the header height matches the body height.
    • Check that all icons and tooltips display correctly with consistent font sizes and spacing.
  8. Modal Behavior:

    • Verify that the modal can be opened and closed properly.
    • Ensure that the form resets when the modal is closed.
    • Confirm that switching between the “Simple” and “Advanced” tabs updates the JSON text accordingly.
  9. Overall Functionality:

    • Confirm that all interactions (adding, editing, removing actions) trigger the onChange callback with the correct JSON string representation of the actions.
    • Test the component in both read-only mode and with editing enabled to ensure the appropriate buttons and inputs are displayed or hidden.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in [SIP-59]([SIP-59] Proposal for Database migration standards #13351))
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • [ x] Introduces new feature or API
  • Removes existing feature or API

mujibishola and others added 17 commits January 8, 2025 19:28
This commit refactors the table chart code by improving formatting, ensuring better compliance with coding conventions, and applying consistent indentation. It also adds type assertions, resolves styling inconsistencies, and simplifies logic for enhanced readability. No functional changes have been made.
Added explicit `width` attributes to table columns for consistent rendering and adjusted styles such as padding and overflow to enhance layout. Included tooltips for row numbers and set `tableLayout` to 'auto' for better flexibility.
Replaced `alert` with a state-driven `Alert` component for better user experience in embedded mode. The message is displayed temporarily for 5 seconds and then cleared. This enhances UX by avoiding intrusive browser alerts while maintaining visibility of the message.
Added a tooltip for row numbers to enhance user experience. Introduced validation to check if actions are an array before rendering, preventing potential runtime errors. Integrated an alert message display for additional feedback.
Copy link

korbit-ai bot commented Feb 14, 2025

Korbit doesn't automatically review large (3000+ lines changed) pull requests such as this one. If you want me to review anyway, use /korbit-review.

@github-actions github-actions bot added i18n Namespace | Anything related to localization plugins dependencies:npm packages labels Feb 14, 2025
@dosubot dosubot bot added the change:frontend Requires changing the frontend label Feb 14, 2025
@rusackas rusackas requested a review from eschutho February 14, 2025 20:28
@hainenber
Copy link
Contributor

I gotta be honest, this PR looks pretty AI-manufactured or at least got helped out by AI big time. Un-reviewable, massive change and list-formatted PR description are one of the early caught symptoms. Please response with what you want to achieve here.

@hainenber hainenber added the hold! On hold label Feb 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
change:frontend Requires changing the frontend dependencies:npm hold! On hold i18n Namespace | Anything related to localization packages plugins size/XXL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants