Skip to content

Conversation

dblythy
Copy link
Member

@dblythy dblythy commented Mar 30, 2023

New Pull Request Checklist

Issue Description

Adds a scripts context menu that can call custom cloud code scripts with req.params.object. A small server update will be needed to allow Pointers to be passed.

Closes: #2399

Approach

TODOs before merging

@parse-github-assistant
Copy link

I will reformat the title to use the proper commit message syntax.

@parse-github-assistant parse-github-assistant bot changed the title feat: allow cloud code scripts feat: Allow cloud code scripts Mar 30, 2023
@parse-github-assistant
Copy link

parse-github-assistant bot commented Mar 30, 2023

Thanks for opening this pull request!

  • 🎉 We are excited about your hands-on contribution!

@dblythy
Copy link
Member Author

dblythy commented Mar 30, 2023

mov.mov

@dblythy
Copy link
Member Author

dblythy commented Mar 30, 2023

The Parse Cloud code for this would be:

Parse.Cloud.define('deleteAccount', async (req) => {
  req.params.object.set('deleted', true);
  await req.params.object.save(null, {useMasterKey: true});
}, {
  requireMaster: true
});

With the scripts config:

"scripts": [
  {
    "title": "Delete account",
    "classes": ["_User"],
    "cloudCodeFunction": "deleteAccount"
  }
]

@uffizzi-cloud
Copy link

uffizzi-cloud bot commented Mar 30, 2023

Uffizzi Ephemeral Environment deployment-20722

⌚ Updated Mar 30, 2023, 05:07 UTC

☁️ https://app.uffizzi.com/github.com/parse-community/parse-dashboard/pull/2409

📄 View Application Logs etc.

What is Uffizzi? Learn more

@mtrezza
Copy link
Member

mtrezza commented May 21, 2023

This is just an amazing feature, great work!

@mtrezza mtrezza changed the title feat: Allow cloud code scripts feat: Add custom Cloud Function scripts May 21, 2023
@mtrezza mtrezza changed the title feat: Add custom Cloud Function scripts feat: Add Cloud Function scripts May 21, 2023
@mtrezza mtrezza changed the title feat: Add Cloud Function scripts feat: Add Cloud Function execution on Parse Object via Data Browser May 21, 2023
@mtrezza mtrezza changed the title feat: Add Cloud Function execution on Parse Object via Data Browser feat: Add Cloud Function execution on Parse Object via data browser May 21, 2023
@mtrezza mtrezza changed the title feat: Add Cloud Function execution on Parse Object via data browser feat: Add Cloud Function execution on Parse Object in data browser May 21, 2023
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.

This feature requires a certain version of Parse Server to work properly (parse-community/parse-server#8490). The compatibility table in the README needs to be updated to indicate which version of Parse Server is required for this feature.

dblythy and others added 3 commits May 22, 2023 13:50
Co-authored-by: Manuel <5673677+mtrezza@users.noreply.github.com>
Signed-off-by: Daniel <daniel-blyth@live.com.au>
@dblythy
Copy link
Member Author

dblythy commented May 25, 2023

I have updated the README

@dblythy dblythy requested a review from a team May 25, 2023 04:08
@mtrezza
Copy link
Member

mtrezza commented May 25, 2023

I'm unsure how we should define the compatibility when only 1 feature requires a certain Parse Server version.

  • If we apply it to the whole release then we are forcing people to upgrade their server even though they may not use the feature.
  • If we apply it to the feature only in the README, then a dashboard user may be in doubt which features they can actually use.

I think the best would be if use the Parse Server version (which the dashboard knows) and based on that we hide the feature, or only disable it with a tool tip "Requires Parse Server >=...". Not sure how difficult that is?

@mtrezza mtrezza closed this Jun 8, 2023
@mtrezza mtrezza reopened this Jun 8, 2023
@uffizzi-cloud
Copy link

uffizzi-cloud bot commented Jun 8, 2023

Uffizzi Ephemeral Environment deployment-27982

⌚ Updated Jun 08, 2023, 19:29 UTC

☁️ https://app.uffizzi.com/github.com/parse-community/parse-dashboard/pull/2409

📄 View Application Logs etc.

What is Uffizzi? Learn more

@dplewis
Copy link
Member

dplewis commented Jun 17, 2023

@dblythy Damn Daniel (always wanted to say that) let me check this branch out.

mtrezza

This comment was marked as duplicate.

@mtrezza
Copy link
Member

mtrezza commented Jun 21, 2023

@dblythy we've always been mentioning pointers which cause the issue in Parse Server. I though of it like pointers within a Parse Object, that point to another object. But from the examples in the README it seems that the object itself needs to be transformed from POJO to a Parse.Object instance. Could you clarify this, so we know what changes are necessary in the README for this to get merged.

Also I'd like to clarify this to write up a proper changelog entry and API doc for the temp option for the fix in Parse Server parse-community/parse-server#8646.

@dblythy dblythy requested a review from mtrezza June 23, 2023 01:55
@dblythy
Copy link
Member Author

dblythy commented Jun 23, 2023

But from the examples in the README it seems that the object itself needs to be transformed from POJO to a Parse.Object instance

Yes, that is correct. Cloud code currently has no way to decode a pointer that is sent in a payload, it is always interpreted as a POJO. There is not a current mechanism to do the following:

Parse.Cloud.define("updateObject", async req => {
  req.params.object.increment("count"); // req.params.object with be a POJO so Parse Object prototypes will throw
  await req.params.object.save(null, { useMasterKey: true });
});
const object = await new Parse.Object("Test").save();
await Parse.Cloud.run("updateObject", { object }); // throws Parse Objects not allowed here, so let's use object.toPointer() instead

Therefore, currently it's up to the developer to transform the payload, such as:

Parse.Cloud.define("updateObject", async req => {
  const object = Parse.Object.extend("Test").createWithoutData(req.params.id);
  object.increment("count");
  await object.save(null, { useMasterKey: true });
});
const obj = await new Parse.Object("Test").save();
await Parse.Cloud.run("updateObject", { id: obj.id });

So, as there's no way to implicitly pass Parse Objects to cloud code (hence why we needed a server PR)

@mtrezza
Copy link
Member

mtrezza commented Jun 23, 2023

Got it, changes in parse-community/parse-server#8646 made accordingly. So we can go ahead and merge this.

mtrezza added 2 commits June 23, 2023 16:01
Signed-off-by: Manuel <5673677+mtrezza@users.noreply.github.com>
Signed-off-by: Manuel <5673677+mtrezza@users.noreply.github.com>
Signed-off-by: Manuel <5673677+mtrezza@users.noreply.github.com>
Signed-off-by: Manuel <5673677+mtrezza@users.noreply.github.com>
@mtrezza
Copy link
Member

mtrezza commented Jun 23, 2023

Ready for merge, waiting for CI to pass...

@mtrezza mtrezza merged commit 996ce91 into parse-community:alpha Jun 23, 2023
parseplatformorg pushed a commit that referenced this pull request Jun 23, 2023
# [5.2.0-alpha.19](5.2.0-alpha.18...5.2.0-alpha.19) (2023-06-23)

### Features

* Add Cloud Function execution on Parse Object in data browser ([#2409](#2409)) ([996ce91](996ce91))
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 5.2.0-alpha.19

@parseplatformorg parseplatformorg added the state:released-alpha Released as alpha version label Jun 23, 2023
parseplatformorg pushed a commit that referenced this pull request Sep 15, 2023
# [5.3.0-beta.1](5.2.0...5.3.0-beta.1) (2023-09-15)

### Bug Fixes

* Adding a file when adding a new row in the data browser doesn't show filename ([#2471](#2471)) ([5bbb94e](5bbb94e))
* File extension is hidden in file field when editing object in modal dialog in data browser ([#2472](#2472)) ([8df4e4d](8df4e4d))
* Incorrect highlight maker position in class list in data browser ([#2490](#2490)) ([8c28d24](8c28d24))
* Pasting location coordinates into field of type `GeoPoint` does not work in data browser ([#2464](#2464)) ([a8ce343](a8ce343))
* Selecting a saved filter in data browser also highlights other filters with equal names ([#2466](#2466)) ([35360fe](35360fe))
* Vertical scrollbar in data browser is outside visible area when scrolling horizontally ([#2457](#2457)) ([5acac3f](5acac3f))

### Features

* Add Cloud Function execution on Parse Object in data browser ([#2409](#2409)) ([996ce91](996ce91))
* Add parameter `selectedField` to script payload to determine which object field was selected when script was invoked ([#2483](#2483)) ([e98d653](e98d653))
* Add refresh button to Cloud Config page ([#2480](#2480)) ([be212b0](be212b0))
* Add security checks page ([#2491](#2491)) ([103b9c6](103b9c6))
* Add support for confirmation dialog before script execution in data browser ([#2481](#2481)) ([64d3913](64d3913))
* Add typing with auto-complete to select a filter field in the data browser ([#2463](#2463)) ([257f76b](257f76b))
* Reopen last opened class when navigating to data browser ([#2468](#2468)) ([3d7148e](3d7148e))

### Reverts

* fix: Vertical scrollbar in data browser is outside visible area when scrolling horizontally ([#2457](#2457)) ([#2477](#2477)) ([2f1d84e](2f1d84e))
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 5.3.0-beta.1

@parseplatformorg parseplatformorg added the state:released-beta Released as beta version label Sep 15, 2023
parseplatformorg pushed a commit that referenced this pull request Sep 20, 2023
# [5.3.0-alpha.1](5.2.0...5.3.0-alpha.1) (2023-09-20)

### Bug Fixes

* Adding a file when adding a new row in the data browser doesn't show filename ([#2471](#2471)) ([5bbb94e](5bbb94e))
* File extension is hidden in file field when editing object in modal dialog in data browser ([#2472](#2472)) ([8df4e4d](8df4e4d))
* Incorrect highlight maker position in class list in data browser ([#2490](#2490)) ([8c28d24](8c28d24))
* Pasting location coordinates into field of type `GeoPoint` does not work in data browser ([#2464](#2464)) ([a8ce343](a8ce343))
* Selecting a saved filter in data browser also highlights other filters with equal names ([#2466](#2466)) ([35360fe](35360fe))
* Vertical scrollbar in data browser is outside visible area when scrolling horizontally ([#2457](#2457)) ([5acac3f](5acac3f))

### Features

* Add Cloud Function execution on Parse Object in data browser ([#2409](#2409)) ([996ce91](996ce91))
* Add parameter `selectedField` to script payload to determine which object field was selected when script was invoked ([#2483](#2483)) ([e98d653](e98d653))
* Add refresh button to Cloud Config page ([#2480](#2480)) ([be212b0](be212b0))
* Add security checks page ([#2491](#2491)) ([103b9c6](103b9c6))
* Add support for confirmation dialog before script execution in data browser ([#2481](#2481)) ([64d3913](64d3913))
* Add typing with auto-complete to select a filter field in the data browser ([#2463](#2463)) ([257f76b](257f76b))
* Reopen last opened class when navigating to data browser ([#2468](#2468)) ([3d7148e](3d7148e))

### Reverts

* fix: Vertical scrollbar in data browser is outside visible area when scrolling horizontally ([#2457](#2457)) ([#2477](#2477)) ([2f1d84e](2f1d84e))
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 5.3.0-alpha.1

parseplatformorg pushed a commit that referenced this pull request Nov 16, 2023
# [5.3.0](5.2.0...5.3.0) (2023-11-16)

### Bug Fixes

* Adding a file when adding a new row in the data browser doesn't show filename ([#2471](#2471)) ([5bbb94e](5bbb94e))
* File extension is hidden in file field when editing object in modal dialog in data browser ([#2472](#2472)) ([8df4e4d](8df4e4d))
* Incorrect highlight maker position in class list in data browser ([#2490](#2490)) ([8c28d24](8c28d24))
* Pasting location coordinates into field of type `GeoPoint` does not work in data browser ([#2464](#2464)) ([a8ce343](a8ce343))
* Selecting a saved filter in data browser also highlights other filters with equal names ([#2466](#2466)) ([35360fe](35360fe))
* Vertical scrollbar in data browser is outside visible area when scrolling horizontally ([#2457](#2457)) ([5acac3f](5acac3f))

### Features

* Add Cloud Function execution on Parse Object in data browser ([#2409](#2409)) ([996ce91](996ce91))
* Add parameter `selectedField` to script payload to determine which object field was selected when script was invoked ([#2483](#2483)) ([e98d653](e98d653))
* Add refresh button to Cloud Config page ([#2480](#2480)) ([be212b0](be212b0))
* Add security checks page ([#2491](#2491)) ([103b9c6](103b9c6))
* Add support for confirmation dialog before script execution in data browser ([#2481](#2481)) ([64d3913](64d3913))
* Add typing with auto-complete to select a filter field in the data browser ([#2463](#2463)) ([257f76b](257f76b))
* Reopen last opened class when navigating to data browser ([#2468](#2468)) ([3d7148e](3d7148e))

### Reverts

* fix: Vertical scrollbar in data browser is outside visible area when scrolling horizontally ([#2457](#2457)) ([#2477](#2477)) ([2f1d84e](2f1d84e))
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 5.3.0

@parseplatformorg parseplatformorg added the state:released Released as stable version label Nov 16, 2023
davimacedo pushed a commit to back4app/parse-dashboard that referenced this pull request Apr 4, 2024
* feat: Add refresh indicator to Cloud Config page (parse-community#2505)

* chore(release): 5.3.0-alpha.2 [skip ci]

# [5.3.0-alpha.2](parse-community/parse-dashboard@5.3.0-alpha.1...5.3.0-alpha.2) (2023-10-18)

### Features

* Add refresh indicator to Cloud Config page ([parse-community#2505](parse-community#2505)) ([a10d1f0](parse-community@a10d1f0))

* release

* chore(release): 5.3.0 [skip ci]

# [5.3.0](parse-community/parse-dashboard@5.2.0...5.3.0) (2023-11-16)

### Bug Fixes

* Adding a file when adding a new row in the data browser doesn't show filename ([parse-community#2471](parse-community#2471)) ([5bbb94e](parse-community@5bbb94e))
* File extension is hidden in file field when editing object in modal dialog in data browser ([parse-community#2472](parse-community#2472)) ([8df4e4d](parse-community@8df4e4d))
* Incorrect highlight maker position in class list in data browser ([parse-community#2490](parse-community#2490)) ([8c28d24](parse-community@8c28d24))
* Pasting location coordinates into field of type `GeoPoint` does not work in data browser ([parse-community#2464](parse-community#2464)) ([a8ce343](parse-community@a8ce343))
* Selecting a saved filter in data browser also highlights other filters with equal names ([parse-community#2466](parse-community#2466)) ([35360fe](parse-community@35360fe))
* Vertical scrollbar in data browser is outside visible area when scrolling horizontally ([parse-community#2457](parse-community#2457)) ([5acac3f](parse-community@5acac3f))

### Features

* Add Cloud Function execution on Parse Object in data browser ([parse-community#2409](parse-community#2409)) ([996ce91](parse-community@996ce91))
* Add parameter `selectedField` to script payload to determine which object field was selected when script was invoked ([parse-community#2483](parse-community#2483)) ([e98d653](parse-community@e98d653))
* Add refresh button to Cloud Config page ([parse-community#2480](parse-community#2480)) ([be212b0](parse-community@be212b0))
* Add security checks page ([parse-community#2491](parse-community#2491)) ([103b9c6](parse-community@103b9c6))
* Add support for confirmation dialog before script execution in data browser ([parse-community#2481](parse-community#2481)) ([64d3913](parse-community@64d3913))
* Add typing with auto-complete to select a filter field in the data browser ([parse-community#2463](parse-community#2463)) ([257f76b](parse-community@257f76b))
* Reopen last opened class when navigating to data browser ([parse-community#2468](parse-community#2468)) ([3d7148e](parse-community@3d7148e))

### Reverts

* fix: Vertical scrollbar in data browser is outside visible area when scrolling horizontally ([parse-community#2457](parse-community#2457)) ([parse-community#2477](parse-community#2477)) ([2f1d84e](parse-community@2f1d84e))

* release

* chore(release): 5.4.0-beta.1 [skip ci]

# [5.4.0-beta.1](parse-community/parse-dashboard@5.3.0...5.4.0-beta.1) (2023-11-16)

### Features

* Add refresh indicator to Cloud Config page ([parse-community#2505](parse-community#2505)) ([a10d1f0](parse-community@a10d1f0))

* refactor: Security upgrade js-beautify from 1.14.6 to 1.14.10 (parse-community#2513)

* chore(release): 5.4.0-alpha.1 [skip ci]

# [5.4.0-alpha.1](parse-community/parse-dashboard@5.3.0...5.4.0-alpha.1) (2023-12-02)

### Features

* Add refresh indicator to Cloud Config page ([parse-community#2505](parse-community#2505)) ([a10d1f0](parse-community@a10d1f0))

* feat: Execute script for selected rows (parse-community#2508)

* chore(release): 5.4.0-alpha.2 [skip ci]

# [5.4.0-alpha.2](parse-community/parse-dashboard@5.4.0-alpha.1...5.4.0-alpha.2) (2023-12-16)

### Features

* Execute script for selected rows ([parse-community#2508](parse-community#2508)) ([5d9901e](parse-community@5d9901e))

* fix: Dashboard crashes if Parse Server Cloud Function script returns object (parse-community#2516)

* chore(release): 5.4.0-alpha.3 [skip ci]

# [5.4.0-alpha.3](parse-community/parse-dashboard@5.4.0-alpha.2...5.4.0-alpha.3) (2023-12-16)

### Bug Fixes

* Dashboard crashes if Parse Server Cloud Function script returns object ([parse-community#2516](parse-community#2516)) ([5de08f8](parse-community@5de08f8))

* fix: Data browser redirects to wrong class when changing app (parse-community#2526)

* chore(release): 5.4.0-alpha.4 [skip ci]

# [5.4.0-alpha.4](parse-community/parse-dashboard@5.4.0-alpha.3...5.4.0-alpha.4) (2024-02-15)

### Bug Fixes

* Data browser redirects to wrong class when changing app ([parse-community#2526](parse-community#2526)) ([7713f54](parse-community@7713f54))

* fix: Open pointer in new tab in data browser not working when mount path is not root (parse-community#2527)

* chore(release): 5.4.0-alpha.5 [skip ci]

# [5.4.0-alpha.5](parse-community/parse-dashboard@5.4.0-alpha.4...5.4.0-alpha.5) (2024-02-18)

### Bug Fixes

* Open pointer in new tab in data browser not working when mount path is not root ([parse-community#2527](parse-community#2527)) ([2f4081f](parse-community@2f4081f))

* fix: App metrics for user and installation counts show dash (parse-community#2528)

* chore(release): 5.4.0-alpha.6 [skip ci]

# [5.4.0-alpha.6](parse-community/parse-dashboard@5.4.0-alpha.5...5.4.0-alpha.6) (2024-02-26)

### Bug Fixes

* App metrics for user and installation counts show dash ([parse-community#2528](parse-community#2528)) ([850d7b3](parse-community@850d7b3))

* feat: Add descriptive statistics for number cells in data browser (parse-community#2529)

* chore(release): 5.4.0-alpha.7 [skip ci]

# [5.4.0-alpha.7](parse-community/parse-dashboard@5.4.0-alpha.6...5.4.0-alpha.7) (2024-02-26)

### Features

* Add descriptive statistics for number cells in data browser ([parse-community#2529](parse-community#2529)) ([ead9ec4](parse-community@ead9ec4))

* fix: Config page fails to load (parse-community#2531)

* chore(release): 5.4.0-alpha.8 [skip ci]

# [5.4.0-alpha.8](parse-community/parse-dashboard@5.4.0-alpha.7...5.4.0-alpha.8) (2024-02-29)

### Bug Fixes

* Config page fails to load ([parse-community#2531](parse-community#2531)) ([d721b7c](parse-community@d721b7c))

* feat: Add Node 20 support; remove Node 14, 16 support (parse-community#2532)

* feat: Add Node 20 support; remove Node 14, 16 support (parse-community#2535)

BREAKING CHANGE: Removes support for Node 14 and 16

* chore(release): 6.0.0-alpha.1 [skip ci]

# [6.0.0-alpha.1](parse-community/parse-dashboard@5.4.0-alpha.8...6.0.0-alpha.1) (2024-03-05)

### Features

* Add Node 20 support; remove Node 14, 16 support ([parse-community#2532](parse-community#2532)) ([578a339](parse-community@578a339))
* Add Node 20 support; remove Node 14, 16 support ([parse-community#2535](parse-community#2535)) ([5c90f2d](parse-community@5c90f2d))

### BREAKING CHANGES

* Removes support for Node 14 and 16 ([5c90f2d](5c90f2d))

* refactor: Security upgrade express from 4.18.1 to 4.19.2 (parse-community#2539)

* ci: Fix nginx config for preview environment (parse-community#2542)

* refactor: Upgrade to npm lockfile version 3 (parse-community#2543)

* fix: make cursor pointer for support more icon

* fix: more icon cursor pointer

* fix: remove console from B4aNotification

* feat: add light themed b4aEmptyState

* fix: B4aObjectPicker app crash when class exists not

* fix: cloudcode empty states

* fix: reduce size to remove scrollbar

* fix: remove extra space from REST Console top

* fix: dark themed dropdown arrow

* fix: error modal

* feat: add logRocket

---------

Co-authored-by: patelmilanun <20059797+patelmilanun@users.noreply.github.com>
Co-authored-by: semantic-release-bot <semantic-release-bot@martynus.net>
Co-authored-by: Manuel Trezza <5673677+mtrezza@users.noreply.github.com>
Co-authored-by: Parse Platform <90459499+parseplatformorg@users.noreply.github.com>
Co-authored-by: Ashish Baravaliya <49753983+AshishBarvaliya@users.noreply.github.com>
Co-authored-by: Corey <coreyearleon@icloud.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state:released Released as stable version state:released-alpha Released as alpha version state:released-beta Released as beta version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add scripts
4 participants