Page MenuHomePhabricator

When having a ZReference, filter the types of options displayed to the type of the key
Closed, ResolvedPublic

Description

When we represent a ZReference in the built-in component ZReference.vue, we show the ZObjectSelector to allow the user to find and select an object.

However, if this ZReference is the value of a key that is known to accept a given type, the ZObjectSelector should only search/offer/select ZObjects of that given type.

Event Timeline

Jdforrester-WMF renamed this task from When having a ZReference, filter the types of options displayed to the type of they key to When having a ZReference, filter the types of options displayed to the type of the key.Mar 24 2021, 8:14 PM

Is there a good example of this issue that we could work from?

Checking again. @gengh @Jdforrester-WMF @DVrandecic do we have a current example of this? Want to make sure it's still valid.

Still valid, I believe.

For example, say you create a new ZObject in the special page and you choose to create an object of type Z4 (Type). The key Z4K3 is a validator (Z8/Function) and by default it selects literal mode so we can write down the Z8 directly. If we change the mode and we select Reference, we see the ZReference component, which renders a ZObjectSelector. Even though we know that the only type of ZObject that can be selected in here must be a Z8 (because it's the implicit type of Z4K3), the ZObjectSelector allows us to select any kind of ZObject.

The ZObjectSelector has a prop which is type that limits the types of objects that can be requested and selected, and this prop is empty. I believe that in a case like this (where the type of object is known) it could be leveraged.

Screenshot from 2021-08-18 11-25-15.png (491×443 px, 34 KB)

Screenshot from 2021-08-18 11-25-37.png (223×537 px, 17 KB)

Screenshot from 2021-08-18 11-25-55.png (252×537 px, 19 KB)

Change 714777 had a related patch set uploaded (by Lindsay Wardell; author: Lindsay Wardell):

[mediawiki/extensions/WikiLambda@master] Enforce type of references to the expected type for the key

https://gerrit.wikimedia.org/r/714777

Change 714777 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] Enforce type of references to the expected type for the key

https://gerrit.wikimedia.org/r/714777