Page MenuHomePhabricator

Add intermediate object ZObjectGeneric
Closed, ResolvedPublic

Description

A ZObject has type Z1, Z2, Z?, and it's loaded with a ZObject component.
However, if ZObject has its type changed into Z12, it doesn't change into a ZMultilingualString component, but shows its data (ID, keys) in the "generic" way.

Problems of current implementation:

  1. Currently there are two components responsible for checking the types of their children and loading different templates conditionally:
    • ZObjectKey
    • ZList This means that, if something changes in the way these components work, or if we add more custom components, these two files need to be updated and maintained with the changes. The same thing would probably happen with ZReference once we have it working.
  1. A ZObject is currently not responsible for its type and its representation in the Vue component tree, but their parent components are. This means that the component ZObject cannot change its type on its own, but must communicate to its parent so that it re-renders the tree, and if the type turns out to be one that has a specific component (such as Z12), the ZObject component would ultimately disappear.

It would be more comprehensible, and would help simplify the app, to have the following tree:

  • ZObject: a valid ZObject, independently from its type. A ZObject stores its zobject data and alters its information. Also a ZObject renders different component depending on its type. So, for example, if its type is Z12, then it will render:
    • ZMultilingualString, or
    • ZString in case of having a type Z6, or
    • ZList if it's Z10. This list would be oblivious to its elements' types, and would simply be an array of
      • ZObject components, which again will render a different component depending on its type.
  • In the case of not having a special type associated to a particular component (like Z6 or Z12), it would render:
    • ZObjectGeneric that represents a ZObject in a generic way, by showing its ID, its type and:
      • ZObjectKeyList, which is an array of
        • ZObjectKey: Each of these would have a key ID and:
          • ZObject, that can, again, be represented in the DOM in different ways, depending on its type.

Event Timeline

gengh created this task.
gengh updated the task description. (Show Details)

Change 661722 had a related patch set uploaded (by Genoveva Galarza; owner: Genoveva Galarza):
[mediawiki/extensions/WikiLambda@master] [WIP] Vue: Create typeUtils mixin with type-related helpers.

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

Change 661723 had a related patch set uploaded (by Genoveva Galarza; owner: Genoveva Galarza):
[mediawiki/extensions/WikiLambda@master] Vue: Add component ZObjectGeneric and centralize typed components and mutations in ZObject

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

Change 662654 had a related patch set uploaded (by Genoveva Galarza; owner: Genoveva Galarza):
[mediawiki/extensions/WikiLambda@master] Vue: Create typeUtils mixin with type-related helpers.

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

Change 662654 abandoned by Genoveva Galarza:
[mediawiki/extensions/WikiLambda@master] Vue: Create typeUtils mixin with type-related helpers.

Reason:
Pushed it instead of amending.

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

Change 661722 merged by jenkins-bot:
[mediawiki/extensions/WikiLambda@master] Vue: Create typeUtils mixin with type-related helpers.

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

Change 661723 merged by jenkins-bot:
[mediawiki/extensions/WikiLambda@master] Vue: Add component ZObjectGeneric and centralize typed components and mutations in ZObject

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