Comments (4)
Thanks for opening this issue!
- 🎉 We are excited about your ideas for improvement!
from parse-dashboard.
We can't call the cloud function with array of elements it has to be a object meaning our array of selected items must be converted into object. And because of this user should be aware of the cloud function receiving different types of input base on from where it is called i.e. from cell or multi select row. Because accordingly the input will change. If we use this approach.
Here is a snippet that demonstrate that. Now the question is do we want to run the function 1-by-1 on each element or just use single object which in actual is array of all the selected elements. In 1-by-1 approach user don't need to worry about the input type anymore but this will be pure overhead in my opinion.
@mtrezza guide me senpai
async executeSript(script) {
const { selection } = this.props;
try {
const objects = [];
Object.keys(selection).forEach((key) =>
objects.push(
Parse.Object.extend(this.props.currentClass).createWithoutData(key)
)
);
const response = await Parse.Cloud.run(
script.cloudCodeFunction,
{ object: { ...objects.map((object) => object.toPointer()) } },
{ useMasterKey: true }
);
this.props.showNote(
response ||
`Ran script "${script.title}" on "${this.props.currentClass}" object "${object.id}".`
);
this.props.onRefresh();
} catch (e) {
this.props.showNote(e.message, true);
console.log(`Could not run ${script.title}: ${e}`);
}
}
This will output in
info: Ran cloud function deleteAccount for user undefined with:
Input: {"object":{"0":{"__type":"Pointer","className":"_User","objectId":"fM1mhqXeJ9"},"1":{"__type":"Pointer","className":"_User","objectId":"EiBiG6KFdy"}}}
Result: "Hello world!" {"functionName":"deleteAccount","params":{"object":{"0":{"__type":"Pointer","className":"_User","objectId":"fM1mhqXeJ9"},"1":{"__type":"Pointer","className":"_User","objectId":"EiBiG6KFdy"}}}}
As you can see in the output, I have to convert array to object else it won't work. This approach is a bit anti-user. Do you have any suggestion here?
from parse-dashboard.
I think there are two possible scenarios and uses cases for both:
- a) Execute multiple server requests, each with a single object.
- b) Execute a single server requests with all selected rows in the payload.
It's something the developer should be able to decide what they want. Both approaches allow for different features.
For example:
- (a) allows to implement a progress bar in the dashboard, (b) doesn't.
- (b) allows to select 2 rows and "connect" the two records in some way, (a) doesn't.
The developer could choose between (a) and (b) in the script settings.
I would however see (b) as a completely new feature and maybe rather start with (a). Which seems simpler. Not sure about the payload the dashboard currently sends, but if we start supporting sending multiple objects with (b), then maybe we should (breaking) change the payload in a way that it works for both, like:
{
objects: [...]
}
from parse-dashboard.
Related Issues (20)
- The filters dropdown is currently inaccessible via arrow keys. HOT 2
- The file extension is hidden beneath the icon within the file cell in the edit modal HOT 5
- Pass selected field to Cloud Function script HOT 8
- Add confirmation dialog before script execution HOT 7
- Header row not scrolling with data rows in data browser HOT 5
- Improve filer dialog auto-complete usability HOT 4
- Add refresh button to Cloud Config HOT 7
- Add row number to data browser HOT 2
- Allow to restrict script execution to certain object fields HOT 4
- Enable / disable script in context menu based on object field values HOT 1
- Incorrect highlight maker position in class list in data browser HOT 5
- Indicate refresh status on CloudConfig page HOT 4
- Add data aggregation panel HOT 2
- Add relational filter conditions HOT 1
- Published docker image has no matching manifest for linux/arm64/v8 HOT 3
- "At a glance" total user metric always displays "-" HOT 3
- Blank page and "TypeError: e.getUTCDate is not a function" HOT 1
- Add options for default column order HOT 4
- Add descriptive statistics to data browser HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from parse-dashboard.