Closed
Description
New Feature / Enhancement Checklist
- I am not disclosing a vulnerability.
- I am not just asking a question.
- I have searched through existing issues.
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.
- 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.
A JS Script using the Parse JS SDK could execute all that with:
- 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.