Thiemo Mättig (WMDE) has uploaded a new change for review.

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

Change subject: Pass repoApiUrl option to ValueView experts
......................................................................

Pass repoApiUrl option to ValueView experts

This requires https://github.com/wmde/ValueView/pull/182 to be
merged and released.

Change-Id: I3bbc6244a6189d0d2a20322e1280291c4199d796
---
M composer.json
M repo/resources/wikibase.ui.entityViewInit.js
M view/resources/wikibase/view/ViewFactory.js
M view/resources/wikibase/wikibase.ValueViewBuilder.js
4 files changed, 29 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/48/233948/1

diff --git a/composer.json b/composer.json
index 0dd0c67..7f77d7e 100644
--- a/composer.json
+++ b/composer.json
@@ -33,7 +33,7 @@
                "data-values/data-types": "~0.5.0",
                "data-values/serialization": "~1.0",
                "data-values/javascript": "~0.6.0|~0.7.0",
-               "data-values/value-view": "~0.15.1",
+               "data-values/value-view": "~0.15.2",
 
                "wikibase/data-model": "~4.0",
                "wikibase/data-model-javascript": "^1.0.2",
diff --git a/repo/resources/wikibase.ui.entityViewInit.js 
b/repo/resources/wikibase.ui.entityViewInit.js
index baed7ed..be9a524 100644
--- a/repo/resources/wikibase.ui.entityViewInit.js
+++ b/repo/resources/wikibase.ui.entityViewInit.js
@@ -140,9 +140,10 @@
         * @throws {Error} if no widget to render the entity exists.
         */
        function createEntityView( entity, $entityview ) {
-               var repoConfig = mw.config.get( 'wbRepo' );
-               var mwApi = wb.api.getLocationAgnosticMwApi( repoConfig.url + 
repoConfig.scriptPath + '/api.php' );
-               var repoApi = new wb.api.RepoApi( mwApi ),
+               var repoConfig = mw.config.get( 'wbRepo' ),
+                       repoApiUrl = repoConfig.url + repoConfig.scriptPath + 
'/api.php',
+                       mwApi = wb.api.getLocationAgnosticMwApi( repoApiUrl ),
+                       repoApi = new wb.api.RepoApi( mwApi ),
                        userLanguages = getUserLanguages(),
                        entityStore = buildEntityStore( repoApi, 
userLanguages[0] ),
                        revisionStore = new wb.RevisionStore( mw.config.get( 
'wgCurRevisionId' ) ),
@@ -165,7 +166,8 @@
                                        }
                                },
                                getParserStore( repoApi ),
-                               userLanguages
+                               userLanguages,
+                               repoApiUrl
                        );
 
                var entityView = viewFactory.getEntityView( entity, $entityview 
);
diff --git a/view/resources/wikibase/view/ViewFactory.js 
b/view/resources/wikibase/view/ViewFactory.js
index 248d512..991fbe9 100644
--- a/view/resources/wikibase/view/ViewFactory.js
+++ b/view/resources/wikibase/view/ViewFactory.js
@@ -34,6 +34,7 @@
         * @param {string[]} userLanguages An array of language codes, the 
first being the UI language
         *        Required for showing the user interface in the correct 
language and for showing terms
         *        in all languages requested by the user.
+        * @param {string|null} [repoApiUrl=null]
         */
        var SELF = MODULE.ViewFactory = function ViewFactory(
                contentLanguages,
@@ -44,7 +45,8 @@
                formatterStore,
                messageProvider,
                parserStore,
-               userLanguages
+               userLanguages,
+               repoApiUrl
        ) {
                this._contentLanguages = contentLanguages;
                this._dataTypeStore = dataTypeStore;
@@ -56,6 +58,7 @@
                this._parserStore = parserStore;
                // Maybe make userLanguages an argument to getEntityView 
instead of to the constructor
                this._userLanguages = userLanguages;
+               this._repoApiUrl = repoApiUrl || null;
        };
 
        /**
@@ -113,6 +116,12 @@
        SELF.prototype._userLanguages = null;
 
        /**
+        * @property {string|null}
+        * @private
+        **/
+       SELF.prototype._repoApiUrl = null;
+
+       /**
         * Construct a suitable view for the given entity on the given DOM 
element
         *
         * @param {wikibase.datamodel.Entity} entity
@@ -146,7 +155,8 @@
                        this._parserStore,
                        this._userLanguages && this._userLanguages[0],
                        this._messageProvider,
-                       this._contentLanguages
+                       this._contentLanguages,
+                       this._repoApiUrl
                );
        };
 
diff --git a/view/resources/wikibase/wikibase.ValueViewBuilder.js 
b/view/resources/wikibase/wikibase.ValueViewBuilder.js
index b777d42..7119a0b 100644
--- a/view/resources/wikibase/wikibase.ValueViewBuilder.js
+++ b/view/resources/wikibase/wikibase.ValueViewBuilder.js
@@ -14,9 +14,16 @@
         * @param {string} language
         * @param {util.MessageProvider} messageProvider
         * @param {util.ContentLanguages} contentLanguages
+        * @param {string|null} [repoApiUrl=null]
         */
        var SELF = wb.ValueViewBuilder = function WbValueViewBuilder(
-               expertStore, formatterStore, parserStore, language, 
messageProvider, contentLanguages
+               expertStore,
+               formatterStore,
+               parserStore,
+               language,
+               messageProvider,
+               contentLanguages,
+               repoApiUrl
        ) {
                this._baseOptions = {
                        expertStore: expertStore,
@@ -24,7 +31,8 @@
                        parserStore: parserStore,
                        language: language,
                        messageProvider: messageProvider,
-                       contentLanguages: contentLanguages
+                       contentLanguages: contentLanguages,
+                       repoApiUrl: repoApiUrl || null
                };
        };
 

-- 
To view, visit https://gerrit.wikimedia.org/r/233948
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3bbc6244a6189d0d2a20322e1280291c4199d796
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to