Page MenuHomePhabricator

When pre-selecting the type of a key-value in the zobject editor, select the type of a type list
Closed, ResolvedPublic

Description

For example: When creating a type, the information of Z4 already knows that Z4K2 is a typed list of Z3, but it still asks us to select the type for each key that we add to the list. This could and should be restricted

Steps to reproduce:

  • Create a new ZObject from the Special:CreateZObject page
  • In Contents, select the type "Type"
  • The key "keys" is preloaded with a ZTypedList component

Observed behavior

  • The ZTypedList but it doesn't have a pre-selected type for the items.
  • When adding an item to the list by clicking the button [+], a new untyped item is added and the user will be asked to select the type.

Expected behavior

  • The ZTypedList should be a ZTypedList of Z3s
  • When adding an item to the list by clicking the button [+], the new item should be of type Z3

Event Timeline

Change 815918 had a related patch set uploaded (by AdesojiThisDot; author: AdesojiThisDot):

[mediawiki/extensions/WikiLambda@master] When pre-selecting the type of a key-value in the zobject editor, select the type of a type list

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

Here are some issues found while testing https://gerrit.wikimedia.org/g/mediawiki/extensions/WikiLambda/+/df4e61bb8419a19d50cc7ff7af4fe01f77af70bc

  1. On viewing a key with type Typed list, the key name and value are now empty. For example in the following image, Z4K2 should show a first item with "value type: Typed list (Key)" or "value type: Typed list --> Key" (not sure what will be the syntax for this). Currently it's empty, even the key label is not showing:

Screenshot from 2022-07-22 17-55-10.png (212×1 px, 16 KB)

  1. On editing an object with a key with type Typed list, the key name and values are also empty. For example, in the following image, the first key has the trash can, but it should contain the label "value type", and then "Typed list" and a ZTypeSelector component with the current type selected.

Screenshot from 2022-07-22 17-58-29.png (346×1 px, 29 KB)

(Followup from previous comment)

  1. In console, multiple errors with description "TypeError: zListItem is undefined"
  1. When creating a list of elements, it's only possible to assign value to the first of those elements. Steps to reproduce:
    • Go to http://localhost:8080/wiki/Special:CreateZObject?view=zobject-editor
    • In Contents select type "Typed list"
    • In the type list type selector, select type "Boolean"
    • Add one element to the list
    • Select true
    • Add another element to the list
    • Select false
    • Observe the ZObject in the JSON textbox: second element doesn't have a value
    • Add a third element to the list
    • Observe the boolean components above: only the first boolean component has a value
    • Observe the ZObject in the JSON textbox: only the first boolean element has a value

Screenshot from 2022-07-22 18-14-35.png (707×1 px, 110 KB)

  • Replicate this same experiment with ZString: the elements are saved properly
  • Replicate this same experiment with ZKeyReference: same thing happens as with Boolean

Screenshot from 2022-07-22 18-11-33.png (863×1 px, 114 KB)

Change 815918 had a related patch set uploaded (by Jforrester; author: AdesojiThisDot):

[mediawiki/extensions/WikiLambda@master] When pre-selecting the type of a key-value in the zobject editor, select the type of a type list

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

Change 815918 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] When pre-selecting the type of a key-value in the zobject editor, select the type of a type list

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