Skip to content

Add scripts #2399

Closed
Closed
@mtrezza

Description

@mtrezza

New Feature / Enhancement Checklist

Current Limitation

Parse Dashboard allows for low-level data manipulation, but repeated manipulation of multiple fields cannot be done efficiently.

Feature / Enhancement Description

Allow to pre-define scripts that can be executed in Parse Dashboard.

  • Allow to right-click on a row in the data browser to send the full object as argument to a JS function.
  • Offer the script in context menu also for pointers to _User in other classes
  • JS function is declared in a .js file which has the Parse JS SDK available.
  • Show a pop-up message at bottom with request status for success and fail.

Example Use Case

Deleting a user, their installation and all their sessions.

Currently, these involve multiple steps in Parse Dashboard.

  1. Search for user in _User and delete.
  2. Search for installations of user in _Installation and delete.
  3. Search for sessions of user in _Session and delete.

A JS Script using the Parse JS SDK could execute all that with:

  1. Right-click on the row in _User class and in context menu choose "Scripts > Delete Account".

The JS function looks something something like this:

async func deleteAccount(req -> {
  const user = req.object;
  // Search for user in `_User` and delete.
  // Search for installations of user in `_Installation` and delete.
  // Search for sessions of user in `_Session` and delete.

  return `Deleted user with ${installations.length} installations and ${sessions.length} sessions.`;
  // or throw(error); to show an error status message in dashboard
});

The dashboard config file looks something like this:

const dashboard = ParseDashboard({
  scripts: [
      {
         title: 'Delete account', // The title in the context menu
         classes: ['_User'] // The classes for which the script will be available in the context menu
         target: './scripts/scripts.js:deleteAccount' // The JS file that contains the function
      }
  ],
});

Alternatives / Workarounds

Allow to execute Cloud Code functions with input parameters, which requires scripts to be hosted by Parse Server instead of Parse Dashboard.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bounty:$100Bounty applies for fixing this issue (Parse Bounty Program)state:releasedReleased as stable versionstate:released-alphaReleased as alpha versionstate:released-betaReleased as beta versiontype:featureNew feature or improvement of existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions