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

Allow to specify API4 job entity in Edit Job form #27849

Merged
merged 1 commit into from
Oct 17, 2023

Conversation

mattwire
Copy link
Contributor

Overview

This allows you to specify an API4 entity in Edit Job form.

Previously there was some nice complicated javascript to hide the actual fields and give you a dropdown list and a fancy concatenated function name that doesn't mean anything... Removed all that and exposed the API entity and action text fields. I'm sure someone setting up a scheduled job can be trusted to type in those by hand.

Before

image

After

image

Technical Details

With this change you can setup and run an API4 scheduled job by putting "version=4" in the parameters.

Comments

@civibot
Copy link

civibot bot commented Oct 17, 2023

🤖 Thank you for contributing to CiviCRM! ❤️ We will need to test and review this PR. 👷

Introduction for new contributors...
  • If this is your first PR, an admin will greenlight automated testing with the command ok to test or add to whitelist.
  • A series of tests will automatically run. You can see the results at the bottom of this page (if there are any problems, it will include a link to see what went wrong).
  • A demo site will be built where anyone can try out a version of CiviCRM that includes your changes.
  • If this process needs to be repeated, an admin will issue the command test this please to rerun tests and build a new demo site.
  • Before this PR can be merged, it needs to be reviewed. Please keep in mind that reviewers are volunteers, and their response time can vary from a few hours to a few weeks depending on their availability and their knowledge of this particular part of CiviCRM.
  • A great way to speed up this process is to "trade reviews" with someone - find an open PR that you feel able to review, and leave a comment like "I'm reviewing this now, could you please review mine?" (include a link to yours). You don't have to wait for a response to get started (and you don't have to stop at one!) the more you review, the faster this process goes for everyone 😄
  • To ensure that you are credited properly in the final release notes, please add yourself to contributor-key.yml
  • For more information about contributing, see CONTRIBUTING.md.
Quick links for reviewers...

➡️ Online demo of this PR 🔗

@civibot civibot bot added the master label Oct 17, 2023
@colemanw
Copy link
Member

@mattwire in other forms we've made this an Autocomplete widget and that works well, but I guess you need to be able to expose both v3 and v4 entities here?

@mattwire
Copy link
Contributor Author

@mattwire in other forms we've made this an Autocomplete widget and that works well, but I guess you need to be able to expose both v3 and v4 entities here?

Right, I didn't look into any clever ways of doing this and just went for the simplest change that benefits from removing some js from the template. I think that scheduled jobs could do with a bit of work on the schema maybe to include a version field and make the params less ugly (\n separated string!).
I can see us having a nice formbuilder based form to add/edit scheduled job in the future so maybe we could introduce autocompletey magic then.

@colemanw
Copy link
Member

Ok, well that javascript is indeed ugly so this gives us a blanker slate to work with for future improvements. I do note that someone cleverly added validation recently, so for lack of an autocomplete at least we do give a form-error if entity/action/version don't match up.

@colemanw colemanw merged commit 4d6cf91 into civicrm:master Oct 17, 2023
@artfulrobot
Copy link
Contributor

Great, thanks @mattwire

Now we just need to know how to specify parameters like where...!

@mattwire
Copy link
Contributor Author

mattwire commented Dec 7, 2023

@artfulrobot Internally it call civicrm_api4() so should accept the "traditional" notation from the api explorer (you need to specify version=4 as well). Maybe give it a test and document :-) I can't find the example I did at the moment.

@mattwire
Copy link
Contributor Author

mattwire commented Dec 7, 2023

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

Successfully merging this pull request may close these issues.

3 participants