Skip to content

Commit

Permalink
Merge branch 'alpha' into confirm-dialog-script
Browse files Browse the repository at this point in the history
Signed-off-by: patelmilanun <[email protected]>
  • Loading branch information
patelmilanun authored Jun 28, 2023
2 parents 97ade51 + 359ebdc commit 6733e81
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 7 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
14 changes: 14 additions & 0 deletions changelogs/CHANGELOG_alpha.md
Original file line number Diff line number Diff line change
@@ -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)


Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
28 changes: 23 additions & 5 deletions src/dashboard/Data/Config/Config.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -38,7 +39,7 @@ class Config extends TableView {
}

componentWillMount() {
this.props.config.dispatch(ActionTypes.FETCH);
this.loadData();
}

componentWillReceiveProps(nextProps, nextContext) {
Expand All @@ -47,12 +48,29 @@ class Config extends TableView {
}
}

onRefresh() {
this.loadData();
}

loadData() {
this.props.config.dispatch(ActionTypes.FETCH);
}

renderToolbar() {
return (
<Toolbar
section='Core'
subsection='Config'>
<Button color='white' value='Create a parameter' onClick={this.createParameter.bind(this)} />
<Toolbar section="Core" subsection="Config">
<a
className={browserStyles.toolbarButton}
onClick={this.onRefresh.bind(this)}
>
<Icon name="refresh-solid" width={14} height={14} />
<span>Refresh</span>
</a>
<Button
color="white"
value="Create a parameter"
onClick={this.createParameter.bind(this)}
/>
</Toolbar>
);
}
Expand Down

0 comments on commit 6733e81

Please sign in to comment.