diff --git a/README.md b/README.md index e39438399..14b50243a 100644 --- a/README.md +++ b/README.md @@ -393,6 +393,20 @@ Parse.Cloud.define('deleteAccount', async (req) => { }); ``` +The field which the script was invoked on can be accessed by `selectedField`: + +```js +Parse.Cloud.define('deleteAccount', async (req) => { + if (req.params.selectedField !== 'objectId') { + throw new Parse.Error(Parse.Error.SCRIPT_FAILED, 'Deleting accounts is only available on the objectId field.'); + } + req.params.object.set('deleted', true); + await req.params.object.save(null, {useMasterKey: true}); +}, { + requireMaster: true +}); +``` + ⚠️ Depending on your Parse Server version you may need to set the Parse Server option `encodeParseObjectInCloudFunction` to `true` so that the selected object in the data browser is made available in the Cloud Function as an instance of `Parse.Object`. If the option is not set, is set to `false`, or you are using an older version of Parse Server, the object is made available as a plain JavaScript object and needs to be converted from a JSON object to a `Parse.Object` instance with `req.params.object = Parse.Object.fromJSON(req.params.object);`, before you can call any `Parse.Object` properties and methods on it. For older versions of Parse Server: diff --git a/changelogs/CHANGELOG_alpha.md b/changelogs/CHANGELOG_alpha.md index 21d071462..ef69038ed 100644 --- a/changelogs/CHANGELOG_alpha.md +++ b/changelogs/CHANGELOG_alpha.md @@ -1,3 +1,17 @@ +# [5.2.0-alpha.23](https://github.com/ParsePlatform/parse-dashboard/compare/5.2.0-alpha.22...5.2.0-alpha.23) (2023-06-28) + + +### Features + +* Add parameter `selectedField` to script payload to determine which object field was selected when script was invoked ([#2483](https://github.com/ParsePlatform/parse-dashboard/issues/2483)) ([e98d653](https://github.com/ParsePlatform/parse-dashboard/commit/e98d653b96787720dad5310c5af98869e2ac2923)) + +# [5.2.0-alpha.22](https://github.com/ParsePlatform/parse-dashboard/compare/5.2.0-alpha.21...5.2.0-alpha.22) (2023-06-27) + + +### Features + +* Add refresh button to Cloud Config page ([#2480](https://github.com/ParsePlatform/parse-dashboard/issues/2480)) ([be212b0](https://github.com/ParsePlatform/parse-dashboard/commit/be212b0ad6c777f7c5ee9a74cac0affa63faa1c1)) + # [5.2.0-alpha.21](https://github.com/ParsePlatform/parse-dashboard/compare/5.2.0-alpha.20...5.2.0-alpha.21) (2023-06-24) diff --git a/package-lock.json b/package-lock.json index 7fc1d79da..a1e74f99b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "parse-dashboard", - "version": "5.2.0-alpha.21", + "version": "5.2.0-alpha.23", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 6992d9ace..f8510eadb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "parse-dashboard", - "version": "5.2.0-alpha.21", + "version": "5.2.0-alpha.23", "repository": { "type": "git", "url": "https://github.com/ParsePlatform/parse-dashboard" diff --git a/src/dashboard/Data/Config/Config.react.js b/src/dashboard/Data/Config/Config.react.js index 80f83d08d..2a8cced57 100644 --- a/src/dashboard/Data/Config/Config.react.js +++ b/src/dashboard/Data/Config/Config.react.js @@ -19,6 +19,7 @@ import subscribeTo from 'lib/subscribeTo'; import TableHeader from 'components/Table/TableHeader.react'; import TableView from 'dashboard/TableView.react'; import Toolbar from 'components/Toolbar/Toolbar.react'; +import browserStyles from 'dashboard/Data/Browser/Browser.scss'; @subscribeTo('Config', 'config') class Config extends TableView { @@ -38,7 +39,7 @@ class Config extends TableView { } componentWillMount() { - this.props.config.dispatch(ActionTypes.FETCH); + this.loadData(); } componentWillReceiveProps(nextProps, nextContext) { @@ -47,12 +48,29 @@ class Config extends TableView { } } + onRefresh() { + this.loadData(); + } + + loadData() { + this.props.config.dispatch(ActionTypes.FETCH); + } + renderToolbar() { return ( - -