Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add ability to select script field #2488

Open
wants to merge 11 commits into
base: alpha
Choose a base branch
from

Conversation

dblythy
Copy link
Member

@dblythy dblythy commented Jun 29, 2023

New Pull Request Checklist

Issue Description

Currently, scripts show on all fields, and every single value.

Closes: #2487
Closes: #2485

Approach

Adds the following script syntax:

"scripts": [
    {
    "title": "Delete account",
    "classes": [
      {
        "name": "_User",
        "fields": [{ "name": "createdAt", "validator": "value => value > new Date(\"2025\")" }]
      }
    ],
    "cloudCodeFunction": "deleteAccount"
  }
]

If using this syntax, the script will only show on a field defined in fields, and it will be disabled if the validator returns false.

TODOs before merging

  • Add changes to documentation (guides, repository pages, in-code descriptions)

@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: add ability to select script field feat: Add ability to select script field Jun 29, 2023
@parse-github-assistant
Copy link

parse-github-assistant bot commented Jun 29, 2023

Thanks for opening this pull request!

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

@uffizzi-cloud
Copy link

uffizzi-cloud bot commented Jun 29, 2023

Uffizzi Ephemeral Environment deployment-29709

⌚ Updated Jun 29, 2023, 05:42 UTC

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

📄 View Application Logs etc.

What is Uffizzi? Learn more

@dblythy dblythy requested a review from a team June 29, 2023 05:56
@mtrezza
Copy link
Member

mtrezza commented Jun 29, 2023

Wow, impressive PR!

The two referenced issues are not necessarily related. One could enable a script only on fieldA if fieldB has a specific value. Would that be possible?

@dblythy
Copy link
Member Author

dblythy commented Jun 30, 2023

Updated the syntax so the full Parse Object is passed through:

"validator": (row, field) => row.get(field) > new Date("2025")

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.

Could you resolve the conflicts? I've merged the lint and prettier PR.

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.

Could you also add a short example for this new feature to the README?

Signed-off-by: Daniel <daniel-blyth@live.com.au>
@mtrezza
Copy link
Member

mtrezza commented Jul 5, 2023

Btw could you see whether the prettier hook works for you? I've added husky to the repo, but not sure whether the git hook is actually working for existing clones of the repo.

@dblythy
Copy link
Member Author

dblythy commented Jul 18, 2023

Didn't seem to run for me, perhaps my branch is outdated

@mtrezza
Copy link
Member

mtrezza commented Jul 18, 2023

Maybe hooks don't get committed? If I add a hook at least I don't see anything to commit. Anyway, was just a side node.

Parse-Dashboard/parse-dashboard-config.json Outdated Show resolved Hide resolved
src/components/BrowserRow/BrowserRow.react.js Outdated Show resolved Hide resolved
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.

Could you please ament the README to document this feature?

Comment on lines +408 to +415
"classes": [
{
"name": "_User",
"fields": [
{ "name": "createdAt", "validator": "value => value > new Date(\"2025\")" }
]
}
],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that I see this syntax side by side, it seems to be a change in in field value type. The value for key classes is suddenly not Array<String> any more but can also be Array<Object>. If we released the scripts feature only in alpha and/or beta version we could make this breaking change and don't have to support Array<String> anymore to simplify code.

@mtrezza
Copy link
Member

mtrezza commented Aug 27, 2023

@dblythy Could your take a look at the open questions? This seems almost ready to get merged.

@mtrezza mtrezza closed this Feb 29, 2024
@mtrezza mtrezza reopened this Feb 29, 2024
Copy link

uffizzi-cloud bot commented Feb 29, 2024

Uffizzi Ephemeral Environment deployment-47529

⌚ Updated Feb 29, 2024, 13:39 UTC

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

📄 View Application Logs etc.

What is Uffizzi? Learn more

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants