[Story] Introduce factory for JS views
Closed, ResolvedPublic

Description

Currently, all views (jquery.wikibase widgets) are immediately constructed wherever needed. This has several implications:

  • They are harder to test because they construct subviews
  • Dependencies have to be passed through all parent views
  • Knowledge about our views being jQuery-based is scattered throughout our code-base

I propose to introduce a ViewFactory along the following rough spec:

ViewFactory = function( valueViewBuilder, entityStore, dataTypeStore, entityChangersFactory, … )
ViewFactory.prototype = {
  getEntityview: function( node, wb.datamodel.Entity value ){
    return $( node ).entityview( {
      value: value,
      viewFactory: this,
      …
    } );
  },
  getStatementview: function( node, wb.datamodel.Statement value ),
  …
}

That could be constructed in wb.ui.entityViewInit.

  • Task: Implement Factory

Introduce factory to the following widgets:

Details

Reference
bz73380
bzimport raised the priority of this task from to Normal.
bzimport set Reference to bz73380.
bzimport added a subscriber: Unknown Object (MLST).
Lydia_Pintscher removed a subscriber: Unknown Object (MLST).
Lydia_Pintscher removed a subscriber: Unknown Object (MLST).Dec 1 2014, 2:34 PM

Currently not needed, so I removed it from sprint.

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 22 2015, 10:17 AM
adrianheine updated the task description. (Show Details)Sep 29 2015, 8:29 PM
Jonas renamed this task from Introduce factory for JS views to [Task] Introduce factory for JS views.Sep 30 2015, 9:43 AM
Jonas updated the task description. (Show Details)
Jonas closed this task as Resolved.Oct 2 2015, 10:46 AM
Jonas moved this task from Review to Done on the Wikidata-Sprint-2015-09-29 board.
adrianheine reopened this task as Open.Oct 4 2015, 9:38 AM

There's much more to be done here.

Change 243496 had a related patch set uploaded (by Jonas Kress (WMDE)):
Use ViewFactory for building statementviews in statementlistview

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

Jonas updated the task description. (Show Details)Oct 4 2015, 7:18 PM
Jonas removed a project: Patch-For-Review.
Jonas removed a subscriber: gerritbot.
Jonas updated the task description. (Show Details)Oct 4 2015, 7:21 PM

Change 243494 had a related patch set uploaded (by Jonas Kress (WMDE)):
Use ViewFactory for constructing statementlistviews in statementgroupview

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

Change 243496 had a related patch set uploaded (by Jonas Kress (WMDE)):
Use ViewFactory for building statementviews in statementlistview

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

This should be implemented at least down to the snakview. Sitelinks and terms are probably not important, since there's not so much passing through going on.

Jonas updated the task description. (Show Details)Oct 7 2015, 12:32 PM
Jonas renamed this task from [Task] Introduce factory for JS views to [Story] Introduce factory for JS views.
Jonas added a subscriber: Jonas.

Could you please update the list of widgets in the description, so the focus of this story is clear.

Jonas updated the task description. (Show Details)Oct 7 2015, 12:39 PM

Change 243494 merged by jenkins-bot:
Use ViewFactory for constructing statementlistviews in statementgroupview

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

Change 243496 merged by jenkins-bot:
Use ViewFactory for building statementviews in statementlistview

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

adrianheine updated the task description. (Show Details)Oct 7 2015, 9:41 PM

I don't like these task lists in descriptions, but I added them anyway. I think creating subtasks would have been a better way, though.

Jonas added a comment.Oct 8 2015, 8:43 AM

I also think that in most cases a separate ticket is the best, but didn't want you to force to do so. Feel free to create them if you like...

adrianheine updated the task description. (Show Details)Oct 15 2015, 7:42 PM

With https://gerrit.wikimedia.org/r/#/c/246769/, I consider this done. There are still more views that could be constructed in the view factory, but there are few if any options passed through these.

Change 247241 had a related patch set uploaded (by Jonas Kress (WMDE)):
Clean up statementview

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

Change 247241 merged by jenkins-bot:
Clean up statementview

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

Jonas updated the task description. (Show Details)Oct 20 2015, 8:51 AM
Jonas closed this task as Resolved.Oct 30 2015, 10:08 AM
Jonas moved this task from Review to Done on the Wikidata-Sprint-2015-10-13 board.