winter icon indicating copy to clipboard operation
winter copied to clipboard

Fix inspector depends functionality.

Open mjauvin opened this issue 3 years ago • 9 comments

This PR corrects the following problems:

object inspector type: properties using depends do not refresh.

objectList inspector type: itemProperties using depends do not work.

mjauvin avatar Sep 25 '22 17:09 mjauvin

@mjauvin could you add a test scenario to the Test plugin that demonstrates this?

bennothommo avatar Sep 30 '22 02:09 bennothommo

@bennothommo I'll try, but I don't garanty anything

mjauvin avatar Sep 30 '22 02:09 mjauvin

@bennothommo I'm frankly not sure how to approach this. The tests would need to create a inspector widget then simulate trigger events on the dropdown fields... any idea?

I could propably instanciate such a widget with cms/formwidgets/Components.php, but how do I programatically interact with it?

mjauvin avatar Sep 30 '22 14:09 mjauvin

@mjauvin I assume you're using this functionality in a component in a plugin? We don't need an automated test case for this at the moment, just a reproduction of what the use case is that triggers the original issue so we can test the before / after of the fix. Can be implemented as a component within the test plugin I'd imagine.

LukeTowers avatar Oct 01 '22 00:10 LukeTowers

yeah, I think this is a better approach.

mjauvin avatar Oct 01 '22 01:10 mjauvin

@LukeTowers @bennothommo this commit (https://github.com/wintercms/wn-test-plugin/pull/10/commits/5e93893721059448ca21900319747e337dfc3e61) adds a component to the Test plugin that can be added to a page/layout to demonstrate the problem.

  • When selecting a value from the Reference Dropdown property, this should update the items in the Object Test dropdown property. Currently, this only works after closing/re-opening the Inspector.

  • Also, If you open the ObjectList Test property and click Add, its dropdown should be populated with values related to the value selected in the Reference Dropdown property. This doesn't happen (even after a close/re-open of the Inspector)

This PR fixes both of the above issues.

mjauvin avatar Oct 01 '22 05:10 mjauvin

I'll have to give this a test in a couple of days - launching that major project I've been working on in the next day or two, so gotta focus on that going smooth :)

bennothommo avatar Oct 02 '22 01:10 bennothommo

I'll have to give this a test in a couple of days - launching that major project I've been working on in the next day or two, so gotta focus on that going smooth :)

Did you get time to test this?

mjauvin avatar Oct 15 '22 12:10 mjauvin

I haven't, no. Thanks for the reminder.

bennothommo avatar Oct 15 '22 13:10 bennothommo

Is that going to be superseded by the inspector widget rewrite ?

mjauvin avatar Mar 28 '23 03:03 mjauvin

Most likely but the Inspector rewrite is a ways off still - if this works, I'm happy to merge it. It's all tested, I assume?

EDIT: I realise I was supposed to test it - d'oh! I'll get to that today.

bennothommo avatar Mar 28 '23 03:03 bennothommo

@bennothommo Yes, it's been tested on my end and there's a procedure/PR to test this with the test plugin above.

mjauvin avatar Mar 28 '23 10:03 mjauvin