Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
5d6b158
ci: Remove release-automated-scheduler (#2398)
mtrezza Mar 1, 2023
d9d285b
feat: Data types and pointer classes are sorted alphabetically in dia…
dplewis Mar 5, 2023
60f9a2b
chore(release): 5.1.0-alpha.11 [skip ci]
semantic-release-bot Mar 5, 2023
26bd6fa
fix: Uncaught error when editing Number field in Edit Row dialog (#2401)
dplewis Mar 5, 2023
c32efec
chore(release): 5.1.0-alpha.12 [skip ci]
semantic-release-bot Mar 5, 2023
77fc372
feat: Sort Cloud Code Jobs alphabetically (#2402)
dplewis Mar 7, 2023
447b046
chore(release): 5.1.0-alpha.13 [skip ci]
semantic-release-bot Mar 7, 2023
5917b31
Merge branch 'beta' into build-release
mtrezza May 1, 2023
9be56ec
build: Release beta (#2431)
mtrezza May 1, 2023
5abcbc9
chore(release): 5.2.0-beta.1 [skip ci]
semantic-release-bot May 1, 2023
228d839
feat: Add visual configurator for Parse Dashboard settings (#2406)
dblythy May 21, 2023
52ca7fc
chore(release): 5.2.0-alpha.1 [skip ci]
semantic-release-bot May 21, 2023
a20cb8e
feat: Add links to users and roles in ACL dialog and handle invalid e…
FransGH May 27, 2023
163bd8d
chore(release): 5.2.0-alpha.2 [skip ci]
semantic-release-bot May 27, 2023
6f3dab6
fix: Empty table in data browser when navigating back using the "back…
patelmilanun May 27, 2023
9dc8dab
chore(release): 5.2.0-alpha.3 [skip ci]
semantic-release-bot May 27, 2023
b96b48f
fix: Incorrect date picker position in data browser filter dialog (#2…
AshishBarvaliya May 27, 2023
cd1a46e
chore(release): 5.2.0-alpha.4 [skip ci]
semantic-release-bot May 27, 2023
6c5f19f
fix: Back button in data browser disappears after page refresh (#2421)
gtanchak May 27, 2023
23451e3
chore(release): 5.2.0-alpha.5 [skip ci]
semantic-release-bot May 27, 2023
422ffb2
fix: Text input cursor jumps to first position when writing long text…
AshishBarvaliya May 27, 2023
6040730
chore(release): 5.2.0-alpha.6 [skip ci]
semantic-release-bot May 27, 2023
8190beb
ci: Prevent workflow concurrency (#2438)
mtrezza May 27, 2023
e761f97
fix: File uploading status not updating in data browser (#2422)
patelmilanun May 27, 2023
1b23966
chore(release): 5.2.0-alpha.7 [skip ci]
semantic-release-bot May 27, 2023
e7ace9e
fix: Cannot navigate to nested relation field in data browser (#2420)
AshishBarvaliya May 27, 2023
1fbcee7
chore(release): 5.2.0-alpha.8 [skip ci]
semantic-release-bot May 27, 2023
286269f
fix: Dashboard crashes when adding a row with modal in a class that c…
TravisHeaver May 27, 2023
34b7f83
chore(release): 5.2.0-alpha.9 [skip ci]
semantic-release-bot May 27, 2023
6623369
fix: Option missing for Parse Config parameter to require master key …
dblythy Jun 1, 2023
b1542ab
chore(release): 5.2.0-alpha.10 [skip ci]
semantic-release-bot Jun 1, 2023
667675c
fix: Scroll position is preserved when re-opening the same class in d…
AshishBarvaliya Jun 8, 2023
27cdaf1
chore(release): 5.2.0-alpha.11 [skip ci]
semantic-release-bot Jun 8, 2023
a9ec3a9
feat: Add filter views to save frequently used filters in data browse…
dblythy Jun 9, 2023
31a1cfa
chore(release): 5.2.0-alpha.12 [skip ci]
semantic-release-bot Jun 9, 2023
f56f946
feat: Add export of saved data browser filters via `classPreference` …
dblythy Jun 10, 2023
ca33d08
chore(release): 5.2.0-alpha.13 [skip ci]
semantic-release-bot Jun 10, 2023
32aeea2
fix: Hitting backspace key in data browser crashes dashboard (#2456)
mtrezza Jun 10, 2023
e717fbb
chore(release): 5.2.0-alpha.14 [skip ci]
semantic-release-bot Jun 10, 2023
c781f61
empty commit
mtrezza Jun 8, 2023
9ead20a
build: Release (#2450)
mtrezza Jun 10, 2023
057fc8b
chore(release): 5.2.0-beta.2 [skip ci]
semantic-release-bot Jun 10, 2023
9d553fb
release
mtrezza Sep 15, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,6 @@ jobs:
run: ./scripts/before_script.sh
env:
CI: true
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
73 changes: 0 additions & 73 deletions .github/workflows/release-automated-scheduler.yml

This file was deleted.

31 changes: 28 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -329,13 +329,39 @@ If you have classes with a lot of columns and you filter them often with the sam
{
"name": "email",
"filterSortToTop": true
}
}
]
}
}
]
```

### Persistent Filters

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.

For example:

```json
"apps": [{
"classPreference": {
"_Role": {
"filters": [{
"name": "Filter Name",
"filter": [
{
"field": "objectId",
"constraint": "exists"
}
]
}]
}
}
}]
```

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*.

# Running as Express Middleware

Instead of starting Parse Dashboard with the CLI, you can also run it as an [express](https://github.com/expressjs/express) middleware.
Expand Down Expand Up @@ -452,8 +478,7 @@ With MFA enabled, a user must provide a one-time password that is typically boun

The user requires an authenticator app to generate the one-time password. These apps are provided by many 3rd parties and mostly for free.

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:
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:

```json
{
Expand Down
125 changes: 125 additions & 0 deletions changelogs/CHANGELOG_alpha.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,128 @@
# [5.2.0-alpha.14](https://github.com/ParsePlatform/parse-dashboard/compare/5.2.0-alpha.13...5.2.0-alpha.14) (2023-06-10)


### Bug Fixes

* Hitting backspace key in data browser crashes dashboard ([#2456](https://github.com/ParsePlatform/parse-dashboard/issues/2456)) ([32aeea2](https://github.com/ParsePlatform/parse-dashboard/commit/32aeea244d81404579f55adf25244c11e3a797d1))

# [5.2.0-alpha.13](https://github.com/ParsePlatform/parse-dashboard/compare/5.2.0-alpha.12...5.2.0-alpha.13) (2023-06-10)


### Features

* Add export of saved data browser filters via `classPreference` settings ([#2455](https://github.com/ParsePlatform/parse-dashboard/issues/2455)) ([f56f946](https://github.com/ParsePlatform/parse-dashboard/commit/f56f946023c628c96030e9d2d66284c53decd33e))

# [5.2.0-alpha.12](https://github.com/ParsePlatform/parse-dashboard/compare/5.2.0-alpha.11...5.2.0-alpha.12) (2023-06-09)


### Features

* Add filter views to save frequently used filters in data browser ([#2404](https://github.com/ParsePlatform/parse-dashboard/issues/2404)) ([a9ec3a9](https://github.com/ParsePlatform/parse-dashboard/commit/a9ec3a915ff354304f382c17e8d5311b2c96d7ff))

# [5.2.0-alpha.11](https://github.com/ParsePlatform/parse-dashboard/compare/5.2.0-alpha.10...5.2.0-alpha.11) (2023-06-08)


### Bug Fixes

* Scroll position is preserved when re-opening the same class in data browser via navigation bar ([#2445](https://github.com/ParsePlatform/parse-dashboard/issues/2445)) ([667675c](https://github.com/ParsePlatform/parse-dashboard/commit/667675c031b0483be210a88da3b159f5f815d6fb))

# [5.2.0-alpha.10](https://github.com/ParsePlatform/parse-dashboard/compare/5.2.0-alpha.9...5.2.0-alpha.10) (2023-06-01)


### Bug Fixes

* Option missing for Parse Config parameter to require master key ([#2440](https://github.com/ParsePlatform/parse-dashboard/issues/2440)) ([6623369](https://github.com/ParsePlatform/parse-dashboard/commit/66233698b333422f306dc7024949aef2ea028f34))

# [5.2.0-alpha.9](https://github.com/ParsePlatform/parse-dashboard/compare/5.2.0-alpha.8...5.2.0-alpha.9) (2023-05-27)


### Bug Fixes

* Dashboard crashes when adding a row with modal in a class that contains a pointer to another class that contains an array of pointers ([#2416](https://github.com/ParsePlatform/parse-dashboard/issues/2416)) ([286269f](https://github.com/ParsePlatform/parse-dashboard/commit/286269f3e2c4e1c83b14003ce72caaf1f39b16c1))

# [5.2.0-alpha.8](https://github.com/ParsePlatform/parse-dashboard/compare/5.2.0-alpha.7...5.2.0-alpha.8) (2023-05-27)


### Bug Fixes

* Cannot navigate to nested relation field in data browser ([#2420](https://github.com/ParsePlatform/parse-dashboard/issues/2420)) ([e7ace9e](https://github.com/ParsePlatform/parse-dashboard/commit/e7ace9efa068b92c5cf0e5ccdad169ac7d71e81a))

# [5.2.0-alpha.7](https://github.com/ParsePlatform/parse-dashboard/compare/5.2.0-alpha.6...5.2.0-alpha.7) (2023-05-27)


### Bug Fixes

* File uploading status not updating in data browser ([#2422](https://github.com/ParsePlatform/parse-dashboard/issues/2422)) ([e761f97](https://github.com/ParsePlatform/parse-dashboard/commit/e761f9715a8366466c6620994ce698adbbfc48cd))

# [5.2.0-alpha.6](https://github.com/ParsePlatform/parse-dashboard/compare/5.2.0-alpha.5...5.2.0-alpha.6) (2023-05-27)


### Bug Fixes

* Text input cursor jumps to first position when writing long text ([#2413](https://github.com/ParsePlatform/parse-dashboard/issues/2413)) ([422ffb2](https://github.com/ParsePlatform/parse-dashboard/commit/422ffb2897bb2664eb47b5aaad5094a8b39431bf))

# [5.2.0-alpha.5](https://github.com/ParsePlatform/parse-dashboard/compare/5.2.0-alpha.4...5.2.0-alpha.5) (2023-05-27)


### Bug Fixes

* Back button in data browser disappears after page refresh ([#2421](https://github.com/ParsePlatform/parse-dashboard/issues/2421)) ([6c5f19f](https://github.com/ParsePlatform/parse-dashboard/commit/6c5f19f6ed2cda1f1f0dc59bdaed3ae49f264380))

# [5.2.0-alpha.4](https://github.com/ParsePlatform/parse-dashboard/compare/5.2.0-alpha.3...5.2.0-alpha.4) (2023-05-27)


### Bug Fixes

* Incorrect date picker position in data browser filter dialog ([#2425](https://github.com/ParsePlatform/parse-dashboard/issues/2425)) ([b96b48f](https://github.com/ParsePlatform/parse-dashboard/commit/b96b48fdd5ce452783e0887c36231971a1822173))

# [5.2.0-alpha.3](https://github.com/ParsePlatform/parse-dashboard/compare/5.2.0-alpha.2...5.2.0-alpha.3) (2023-05-27)


### Bug Fixes

* Empty table in data browser when navigating back using the "back” button ([#2423](https://github.com/ParsePlatform/parse-dashboard/issues/2423)) ([6f3dab6](https://github.com/ParsePlatform/parse-dashboard/commit/6f3dab60c257c76345235acfd3e43aafadeb84c8))

# [5.2.0-alpha.2](https://github.com/ParsePlatform/parse-dashboard/compare/5.2.0-alpha.1...5.2.0-alpha.2) (2023-05-27)


### Features

* Add links to users and roles in ACL dialog and handle invalid entries ([#2436](https://github.com/ParsePlatform/parse-dashboard/issues/2436)) ([a20cb8e](https://github.com/ParsePlatform/parse-dashboard/commit/a20cb8e534d3fecd8d337463864b15048772a9a5))

# [5.2.0-alpha.1](https://github.com/ParsePlatform/parse-dashboard/compare/5.1.0...5.2.0-alpha.1) (2023-05-21)


### Bug Fixes

* Uncaught error when editing Number field in Edit Row dialog ([#2401](https://github.com/ParsePlatform/parse-dashboard/issues/2401)) ([26bd6fa](https://github.com/ParsePlatform/parse-dashboard/commit/26bd6fa39be1076621856a9c86dcd1307f8f7fdd))

### Features

* Add visual configurator for Parse Dashboard settings ([#2406](https://github.com/ParsePlatform/parse-dashboard/issues/2406)) ([228d839](https://github.com/ParsePlatform/parse-dashboard/commit/228d83903fd8698da7b96a5b74699f3ff2d5dad4))
* Data types and pointer classes are sorted alphabetically in dialog to add new column ([#2400](https://github.com/ParsePlatform/parse-dashboard/issues/2400)) ([d9d285b](https://github.com/ParsePlatform/parse-dashboard/commit/d9d285b7f90434d3bb138c2c765272498e3f09c3))
* Sort Cloud Code Jobs alphabetically ([#2402](https://github.com/ParsePlatform/parse-dashboard/issues/2402)) ([77fc372](https://github.com/ParsePlatform/parse-dashboard/commit/77fc372bedb9fb4eca728c1bc076e823c5bc3a2c))

# [5.1.0-alpha.13](https://github.com/ParsePlatform/parse-dashboard/compare/5.1.0-alpha.12...5.1.0-alpha.13) (2023-03-07)


### Features

* Sort Cloud Code Jobs alphabetically ([#2402](https://github.com/ParsePlatform/parse-dashboard/issues/2402)) ([77fc372](https://github.com/ParsePlatform/parse-dashboard/commit/77fc372bedb9fb4eca728c1bc076e823c5bc3a2c))

# [5.1.0-alpha.12](https://github.com/ParsePlatform/parse-dashboard/compare/5.1.0-alpha.11...5.1.0-alpha.12) (2023-03-05)


### Bug Fixes

* Uncaught error when editing Number field in Edit Row dialog ([#2401](https://github.com/ParsePlatform/parse-dashboard/issues/2401)) ([26bd6fa](https://github.com/ParsePlatform/parse-dashboard/commit/26bd6fa39be1076621856a9c86dcd1307f8f7fdd))

# [5.1.0-alpha.11](https://github.com/ParsePlatform/parse-dashboard/compare/5.1.0-alpha.10...5.1.0-alpha.11) (2023-03-05)


### Features

* Data types and pointer classes are sorted alphabetically in dialog to add new column ([#2400](https://github.com/ParsePlatform/parse-dashboard/issues/2400)) ([d9d285b](https://github.com/ParsePlatform/parse-dashboard/commit/d9d285b7f90434d3bb138c2c765272498e3f09c3))

# [5.1.0-alpha.10](https://github.com/ParsePlatform/parse-dashboard/compare/5.1.0-alpha.9...5.1.0-alpha.10) (2023-02-13)


Expand Down
35 changes: 35 additions & 0 deletions changelogs/CHANGELOG_beta.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,38 @@
# [5.2.0-beta.2](https://github.com/ParsePlatform/parse-dashboard/compare/5.2.0-beta.1...5.2.0-beta.2) (2023-06-10)


### Bug Fixes

* Back button in data browser disappears after page refresh ([#2421](https://github.com/ParsePlatform/parse-dashboard/issues/2421)) ([6c5f19f](https://github.com/ParsePlatform/parse-dashboard/commit/6c5f19f6ed2cda1f1f0dc59bdaed3ae49f264380))
* Cannot navigate to nested relation field in data browser ([#2420](https://github.com/ParsePlatform/parse-dashboard/issues/2420)) ([e7ace9e](https://github.com/ParsePlatform/parse-dashboard/commit/e7ace9efa068b92c5cf0e5ccdad169ac7d71e81a))
* Dashboard crashes when adding a row with modal in a class that contains a pointer to another class that contains an array of pointers ([#2416](https://github.com/ParsePlatform/parse-dashboard/issues/2416)) ([286269f](https://github.com/ParsePlatform/parse-dashboard/commit/286269f3e2c4e1c83b14003ce72caaf1f39b16c1))
* Empty table in data browser when navigating back using the "back” button ([#2423](https://github.com/ParsePlatform/parse-dashboard/issues/2423)) ([6f3dab6](https://github.com/ParsePlatform/parse-dashboard/commit/6f3dab60c257c76345235acfd3e43aafadeb84c8))
* File uploading status not updating in data browser ([#2422](https://github.com/ParsePlatform/parse-dashboard/issues/2422)) ([e761f97](https://github.com/ParsePlatform/parse-dashboard/commit/e761f9715a8366466c6620994ce698adbbfc48cd))
* Hitting backspace key in data browser crashes dashboard ([#2456](https://github.com/ParsePlatform/parse-dashboard/issues/2456)) ([32aeea2](https://github.com/ParsePlatform/parse-dashboard/commit/32aeea244d81404579f55adf25244c11e3a797d1))
* Incorrect date picker position in data browser filter dialog ([#2425](https://github.com/ParsePlatform/parse-dashboard/issues/2425)) ([b96b48f](https://github.com/ParsePlatform/parse-dashboard/commit/b96b48fdd5ce452783e0887c36231971a1822173))
* Option missing for Parse Config parameter to require master key ([#2440](https://github.com/ParsePlatform/parse-dashboard/issues/2440)) ([6623369](https://github.com/ParsePlatform/parse-dashboard/commit/66233698b333422f306dc7024949aef2ea028f34))
* Scroll position is preserved when re-opening the same class in data browser via navigation bar ([#2445](https://github.com/ParsePlatform/parse-dashboard/issues/2445)) ([667675c](https://github.com/ParsePlatform/parse-dashboard/commit/667675c031b0483be210a88da3b159f5f815d6fb))
* Text input cursor jumps to first position when writing long text ([#2413](https://github.com/ParsePlatform/parse-dashboard/issues/2413)) ([422ffb2](https://github.com/ParsePlatform/parse-dashboard/commit/422ffb2897bb2664eb47b5aaad5094a8b39431bf))

### Features

* Add export of saved data browser filters via `classPreference` settings ([#2455](https://github.com/ParsePlatform/parse-dashboard/issues/2455)) ([f56f946](https://github.com/ParsePlatform/parse-dashboard/commit/f56f946023c628c96030e9d2d66284c53decd33e))
* Add filter views to save frequently used filters in data browser ([#2404](https://github.com/ParsePlatform/parse-dashboard/issues/2404)) ([a9ec3a9](https://github.com/ParsePlatform/parse-dashboard/commit/a9ec3a915ff354304f382c17e8d5311b2c96d7ff))
* Add links to users and roles in ACL dialog and handle invalid entries ([#2436](https://github.com/ParsePlatform/parse-dashboard/issues/2436)) ([a20cb8e](https://github.com/ParsePlatform/parse-dashboard/commit/a20cb8e534d3fecd8d337463864b15048772a9a5))
* Add visual configurator for Parse Dashboard settings ([#2406](https://github.com/ParsePlatform/parse-dashboard/issues/2406)) ([228d839](https://github.com/ParsePlatform/parse-dashboard/commit/228d83903fd8698da7b96a5b74699f3ff2d5dad4))

# [5.2.0-beta.1](https://github.com/ParsePlatform/parse-dashboard/compare/5.1.0...5.2.0-beta.1) (2023-05-01)


### Bug Fixes

* Uncaught error when editing Number field in Edit Row dialog ([#2401](https://github.com/ParsePlatform/parse-dashboard/issues/2401)) ([26bd6fa](https://github.com/ParsePlatform/parse-dashboard/commit/26bd6fa39be1076621856a9c86dcd1307f8f7fdd))

### Features

* Data types and pointer classes are sorted alphabetically in dialog to add new column ([#2400](https://github.com/ParsePlatform/parse-dashboard/issues/2400)) ([d9d285b](https://github.com/ParsePlatform/parse-dashboard/commit/d9d285b7f90434d3bb138c2c765272498e3f09c3))
* Sort Cloud Code Jobs alphabetically ([#2402](https://github.com/ParsePlatform/parse-dashboard/issues/2402)) ([77fc372](https://github.com/ParsePlatform/parse-dashboard/commit/77fc372bedb9fb4eca728c1bc076e823c5bc3a2c))

# [5.1.0-beta.2](https://github.com/ParsePlatform/parse-dashboard/compare/5.1.0-beta.1...5.1.0-beta.2) (2023-03-01)


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.1.0",
"version": "5.2.0-beta.2",
"repository": {
"type": "git",
"url": "https://github.com/ParsePlatform/parse-dashboard"
Expand Down
11 changes: 10 additions & 1 deletion src/components/ACLEditor/ACLEditor.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ import Parse from 'parse';
import PermissionsDialog from 'components/PermissionsDialog/PermissionsDialog.react';
import React from 'react';

function validateEntry(text) {
function validateEntry(text, returnInvalid = true) {

let type = 'unknown';
let entry = text;
let userQuery;
let roleQuery;

Expand All @@ -19,22 +21,26 @@ function validateEntry(text) {
}

if (text.startsWith('user:')) {
type = 'user';
// no need to query roles
roleQuery = {
find: () => Promise.resolve([])
};

let user = text.substring(5);
entry = user;
userQuery = new Parse.Query.or(
new Parse.Query(Parse.User).equalTo('username', user),
new Parse.Query(Parse.User).equalTo('objectId', user)
);
} else if (text.startsWith('role:')) {
type = 'role';
// no need to query users
userQuery = {
find: () => Promise.resolve([])
};
let role = text.substring(5);
entry = role;
roleQuery = new Parse.Query.or(
new Parse.Query(Parse.Role).equalTo('name', role),
new Parse.Query(Parse.Role).equalTo('objectId', role)
Expand All @@ -61,6 +67,9 @@ function validateEntry(text) {
} else if (role.length > 0) {
return { entry: role[0], type: 'role' };
} else {
if(returnInvalid) {
return Promise.resolve({entry, type})
}
return Promise.reject();
}
});
Expand Down
Loading