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 optional restriction of script execution to certain object fields and values #2488

Merged
merged 12 commits into from
Jun 27, 2024

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?

@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?

README.md Show resolved Hide resolved
@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

@mtrezza mtrezza closed this Jun 27, 2024
@mtrezza mtrezza reopened this Jun 27, 2024
@mtrezza mtrezza changed the title feat: Add ability to select script field feat: Add optional restriction of script execution to certain object fields and values Jun 27, 2024
@mtrezza mtrezza merged commit 8feac9b into parse-community:alpha Jun 27, 2024
16 checks passed
parseplatformorg pushed a commit that referenced this pull request Jun 27, 2024
# [6.0.0-alpha.8](6.0.0-alpha.7...6.0.0-alpha.8) (2024-06-27)

### Features

* Add optional restriction of script execution to certain object fields and values ([#2488](#2488)) ([8feac9b](8feac9b))
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 6.0.0-alpha.8

@parseplatformorg parseplatformorg added the state:released-alpha Released as alpha version label Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state:released-alpha Released as alpha version
Projects
None yet
3 participants