Skip to content

feat: Add new options deleteOptions, exportOptions to manage delete and export permissions #2850

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

Closed

Conversation

ImperadorSid
Copy link

@ImperadorSid ImperadorSid commented Jun 7, 2025

Changes

  • Added new property deleteOptions for toggling delete operations on data browser toolbar;
    • Added new property exportOptions for toggling export operations on data browser toolbar.

Summary by CodeRabbit

  • New Features

    • Added granular controls to enable or disable delete and export actions (such as deleting classes, columns, selected rows, or exporting schema and data) in the dashboard menus based on configuration settings.
  • Refactor

    • Improved the dashboard toolbar to dynamically show or hide delete and export options according to new configuration flags for a more tailored user experience.

Copy link

parse-github-assistant bot commented Jun 7, 2025

🚀 Thanks for opening this pull request!

Copy link

coderabbitai bot commented Jun 7, 2025

📝 Walkthrough

Walkthrough

The changes introduce new configuration options for granular control over delete and export functionalities in the Parse Dashboard. These options are added to the dashboard config, passed through the ParseApp class, and conditionally control the rendering and enabling of related actions in the DataBrowser and BrowserToolbar React components.

Changes

File(s) Change Summary
Parse-Dashboard/parse-dashboard-config.json Added deleteOptions and exportOptions objects to each app config, enabling fine-grained control of delete/export dashboard features.
src/lib/ParseApp.js Extended ParseApp constructor to accept and store deleteOptions and exportOptions with sensible defaults.
src/dashboard/Data/Browser/DataBrowser.react.js Updated to extract and pass deleteOptions/exportOptions from app config to the toolbar, enabling/disabling features accordingly.
src/dashboard/Data/Browser/BrowserToolbar.react.js Added boolean props for delete/export controls; conditionally renders and enables menu items based on these new flags.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant DashboardConfig
    participant ParseApp
    participant DataBrowser
    participant BrowserToolbar

    User->>DashboardConfig: Loads dashboard config (with delete/export options)
    DashboardConfig->>ParseApp: Instantiates ParseApp with options
    ParseApp->>DataBrowser: Passes deleteOptions/exportOptions via props
    DataBrowser->>BrowserToolbar: Passes enabled/disabled flags for features
    BrowserToolbar->>User: Renders menu items based on flags
    User->>BrowserToolbar: Attempts action (e.g., delete/export)
    BrowserToolbar-->>User: Allows or disables action per configuration
Loading

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

npm error code ERR_SSL_WRONG_VERSION_NUMBER
npm error errno ERR_SSL_WRONG_VERSION_NUMBER
npm error request to https://10.0.0.28:4873/npm/-/npm-10.9.2.tgz failed, reason: C00C45F5EA7F0000:error:0A00010B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:354:
npm error
npm error A complete log of this run can be found in: /.npm/_logs/2025-06-07T16_33_56_609Z-debug-0.log


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ef5171f and 319e341.

📒 Files selected for processing (4)
  • Parse-Dashboard/parse-dashboard-config.json (1 hunks)
  • src/dashboard/Data/Browser/BrowserToolbar.react.js (5 hunks)
  • src/dashboard/Data/Browser/DataBrowser.react.js (2 hunks)
  • src/lib/ParseApp.js (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/dashboard/Data/Browser/BrowserToolbar.react.js (1)
src/components/BrowserMenu/BrowserMenu.react.js (1)
  • BrowserMenu (15-81)
🔇 Additional comments (10)
src/lib/ParseApp.js (2)

47-48: LGTM! Clean parameter addition for new options.

The new deleteOptions and exportOptions parameters are properly added to the constructor signature, maintaining consistency with the existing parameter structure.


79-89: Excellent default value implementation.

The default objects are well-structured and maintain backward compatibility by enabling all features when the options are not explicitly configured. The property names clearly indicate their purpose and align with the configuration structure.

Parse-Dashboard/parse-dashboard-config.json (1)

11-21: Well-structured configuration options.

The configuration properly defines both deleteOptions and exportOptions with granular boolean flags. The default values of true ensure backward compatibility while providing the flexibility to disable specific operations when needed.

src/dashboard/Data/Browser/DataBrowser.react.js (2)

625-625: Correct extraction of new configuration options.

The destructuring properly extracts the new deleteOptions and exportOptions alongside existing properties, maintaining clean code organization.


693-707: Excellent conditional logic implementation.

The prop assignments correctly combine the new configuration flags with existing server capability checks and schema edit prevention. This ensures that operations are only enabled when both the configuration allows it AND the server supports it AND schema edits are not prevented.

The logic properly handles all the conditional requirements:

  • Delete operations respect both configuration and preventSchemaEdits
  • Export operations combine configuration with server feature availability
  • All conditions are properly ANDed together
src/dashboard/Data/Browser/BrowserToolbar.react.js (5)

62-68: Well-defined props for granular control.

The new boolean props provide clear, granular control over delete and export operations. The naming is consistent and self-explanatory.


92-92: Smart approach to Export menu visibility.

The hasSomeExportEnabled variable efficiently determines whether to show the Export menu at all, avoiding an empty menu when all export options are disabled.


175-184: Proper conditional rendering for delete operations.

The delete selected rows menu item is correctly wrapped with conditional rendering, ensuring it only appears when the feature is enabled. The separator is also conditionally rendered to maintain proper menu structure.


186-200: Correct integration with existing manipulation flags.

The delete operations properly combine the new granular flags (enableDeleteColumns, enableDeleteClass) with existing manipulation flags (enableColumnManipulation, enableClassManipulation), ensuring all conditions are met before enabling the operations.


359-383: Excellent Export menu implementation.

The Export menu and its items are properly controlled by the new flags:

  • The entire menu is conditionally rendered based on hasSomeExportEnabled
  • Individual menu items are disabled based on their respective enable flags
  • The logic maintains consistency with the existing disabled state patterns

The implementation provides clear user feedback by disabling unavailable options rather than hiding them completely.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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>, please review it.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration 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.

@parseplatformorg
Copy link
Contributor

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

@mtrezza mtrezza mentioned this pull request Jun 8, 2025
3 tasks
@mtrezza mtrezza added the type:feature New feature or improvement of existing feature label Jun 8, 2025
@parse-github-assistant parse-github-assistant bot removed the type:feature New feature or improvement of existing feature label Jun 8, 2025
@mtrezza mtrezza changed the title Disable export option feat: Add new options deleteOptions, exportOptions to manage delete and export permissions Jun 8, 2025
Copy link
Member

@mtrezza mtrezza left a comment

Choose a reason for hiding this comment

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

It seems to me that it makes more sense to make this class specific, not as general options, similar to the syntax of columnPreference:

"apps": [
  {
    "deletePreference": {
        "_User": [
          {
            "enableDeleteClass": true,
            "enableDeleteColumns": true,
            "enableDeleteSelectedRows": true,
            "enableDeleteAllRows": true,
          },
        ]
      }
    "exportPreference": {
        "_User": [
          {
             "enableExportSchema": true,
            "enableExportSelectedRows": true,
            "enableExportAllRows": true,
          },
        ]
      }
    },
]

The class name could be parsed as RegEx, to allow for easy class config; to apply to all classes, you'd simply use .* as classname.

And it may make more sense to combine these:

"apps": [
  {
    "classPreference": {
        "_User": [
          {
            "enableDeleteClass": true,
            "enableDeleteColumns": true,
            "enableDeleteSelectedRows": true,
            "enableDeleteAllRows": true,
            "enableExportSchema": true,
            "enableExportSelectedRows": true,
            "enableExportAllRows": true,
          },
        ]
      }
    },
]

TODO:

  •  Add new options to the README options table
  • Add new section in README that explains the options

Comment on lines +11 to +21
"deleteOptions": {
"class": true,
"columns": true,
"selectedRows": true,
"allData": true
},
"exportOptions": {
"schema": true,
"selectedRows": true,
"allData": true
}
Copy link
Member

Choose a reason for hiding this comment

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

The names should be less ambiguous and follow the syntax of existing options:

Suggested change
"deleteOptions": {
"class": true,
"columns": true,
"selectedRows": true,
"allData": true
},
"exportOptions": {
"schema": true,
"selectedRows": true,
"allData": true
}
"deletePreference": {
"enableDeleteClass": true,
"enableDeleteColumns": true,
"enableDeleteSelectedRows": true,
"enableDeleteAllRows": true,
},
"exportPreference": {
"enableExportSchema": true,
"enableExportSelectedRows": true,
"enableExportAllRows": true,
}

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.

3 participants