parse-dashboard 5.2.0-alpha.2 → 5.2.0-alpha.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -42,6 +42,7 @@ Parse Dashboard is a standalone dashboard for managing your [Parse Server](https
42
42
  - [Other Configuration Options](#other-configuration-options)
43
43
  - [Prevent columns sorting](#prevent-columns-sorting)
44
44
  - [Custom order in the filter popup](#custom-order-in-the-filter-popup)
45
+ - [Scripts](#scripts)
45
46
  - [Running as Express Middleware](#running-as-express-middleware)
46
47
  - [Deploying Parse Dashboard](#deploying-parse-dashboard)
47
48
  - [Preparing for Deployment](#preparing-for-deployment)
@@ -329,13 +330,104 @@ If you have classes with a lot of columns and you filter them often with the sam
329
330
  {
330
331
  "name": "email",
331
332
  "filterSortToTop": true
332
- }
333
+ }
333
334
  ]
334
335
  }
335
336
  }
336
337
  ]
337
338
  ```
338
339
 
340
+ ### Persistent Filters
341
+
342
+ The filters you save in the data browser of Parse Dashboard are only available for the current dashboard user in the current browser session. To make filters permanently available for all dashboard users of an app, you can define filters in the `classPreference` setting.
343
+
344
+ For example:
345
+
346
+ ```json
347
+ "apps": [{
348
+ "classPreference": {
349
+ "_Role": {
350
+ "filters": [{
351
+ "name": "Filter Name",
352
+ "filter": [
353
+ {
354
+ "field": "objectId",
355
+ "constraint": "exists"
356
+ }
357
+ ]
358
+ }]
359
+ }
360
+ }
361
+ }]
362
+ ```
363
+
364
+ You can conveniently create a filter definition without having to write it by hand by first saving a filter in the data browser, then exporting the filter definition under *App Settings > Export Class Preferences*.
365
+
366
+ ### Scripts
367
+
368
+ You can specify scripts to execute Cloud Functions with the `scripts` option:
369
+
370
+
371
+ ```json
372
+ "apps": [
373
+ {
374
+ "scripts": [
375
+ {
376
+ "title": "Delete Account",
377
+ "classes": ["_User"],
378
+ "cloudCodeFunction": "deleteAccount"
379
+ }
380
+ ]
381
+ }
382
+ ]
383
+ ```
384
+
385
+ Next, define the Cloud Function in Parse Server that will be called. The object that has been selected in the data browser will be made available as a request parameter:
386
+
387
+ ```js
388
+ Parse.Cloud.define('deleteAccount', async (req) => {
389
+ req.params.object.set('deleted', true);
390
+ await req.params.object.save(null, {useMasterKey: true});
391
+ }, {
392
+ requireMaster: true
393
+ });
394
+ ```
395
+
396
+ ⚠️ 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.
397
+
398
+ For older versions of Parse Server:
399
+
400
+ <details>
401
+ <summary>Parse Server &gt;=4.4.0 &lt;6.2.0</summary>
402
+
403
+ ```js
404
+ Parse.Cloud.define('deleteAccount', async (req) => {
405
+ req.params.object = Parse.Object.fromJSON(req.params.object);
406
+ req.params.object.set('deleted', true);
407
+ await req.params.object.save(null, {useMasterKey: true});
408
+ }, {
409
+ requireMaster: true
410
+ });
411
+ ```
412
+
413
+ </details>
414
+
415
+ <details>
416
+ <summary>Parse Server &gt;=2.1.4 &lt;4.4.0</summary>
417
+
418
+ ```js
419
+ Parse.Cloud.define('deleteAccount', async (req) => {
420
+ if (!req.master || !req.params.object) {
421
+ throw 'Unauthorized';
422
+ }
423
+ req.params.object = Parse.Object.fromJSON(req.params.object);
424
+ req.params.object.set('deleted', true);
425
+ await req.params.object.save(null, {useMasterKey: true});
426
+ });
427
+ ```
428
+
429
+ </details>
430
+
339
431
  # Running as Express Middleware
340
432
 
341
433
  Instead of starting Parse Dashboard with the CLI, you can also run it as an [express](https://github.com/expressjs/express) middleware.
@@ -452,8 +544,7 @@ With MFA enabled, a user must provide a one-time password that is typically boun
452
544
 
453
545
  The user requires an authenticator app to generate the one-time password. These apps are provided by many 3rd parties and mostly for free.
454
546
 
455
- If you create a new user by running `parse-dashboard --createUser`, you will be asked whether you want to enable MFA for the new user. To enable MFA for an existing user,
456
- run `parse-dashboard --createMFA` to generate a `mfa` secret that you then add to the existing user configuration, for example:
547
+ If you create a new user by running `parse-dashboard --createUser`, you will be asked whether you want to enable MFA for the new user. To enable MFA for an existing user, run `parse-dashboard --createMFA` to generate a `mfa` secret that you then add to the existing user configuration, for example:
457
548
 
458
549
  ```json
459
550
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "parse-dashboard",
3
- "version": "5.2.0-alpha.2",
3
+ "version": "5.2.0-alpha.21",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/ParsePlatform/parse-dashboard"