Jonas Kress (WMDE) has uploaded a new change for review. https://gerrit.wikimedia.org/r/282856
Change subject: Fixes treemap IDs and isDrawable ...................................................................... Fixes treemap IDs and isDrawable Change-Id: I54b0c74c76a81d9c706c87a4cecc30b48d1ded8f --- M wikibase/queryService/ui/resultBrowser/AbstractResultBrowser.js M wikibase/queryService/ui/resultBrowser/TableResultBrowser.js M wikibase/queryService/ui/resultBrowser/TreeMapResultBrowser.js 3 files changed, 19 insertions(+), 16 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/wikidata/query/gui refs/changes/56/282856/1 diff --git a/wikibase/queryService/ui/resultBrowser/AbstractResultBrowser.js b/wikibase/queryService/ui/resultBrowser/AbstractResultBrowser.js index aa3b469..314eccd 100644 --- a/wikibase/queryService/ui/resultBrowser/AbstractResultBrowser.js +++ b/wikibase/queryService/ui/resultBrowser/AbstractResultBrowser.js @@ -68,7 +68,7 @@ if( row[key] ){ field = row[key]; } - self.processVisitors( field ); + self.processVisitors( field, key ); cb( field, key, row ); } ); @@ -112,14 +112,14 @@ * @protected * @param data */ - SELF.prototype.processVisitors = function( data ) { + SELF.prototype.processVisitors = function( data, columnKey ) { var self = this, removeVisitors = []; $.each( this._visitors, function ( key, v ) { if( v.visit && typeof v.visit === 'function' ){ - if( v.visit( data ) === false ){ + if( v.visit( data, columnKey ) === false ){ removeVisitors.push( key ); } } diff --git a/wikibase/queryService/ui/resultBrowser/TableResultBrowser.js b/wikibase/queryService/ui/resultBrowser/TableResultBrowser.js index 9f7996d..8c0d567 100644 --- a/wikibase/queryService/ui/resultBrowser/TableResultBrowser.js +++ b/wikibase/queryService/ui/resultBrowser/TableResultBrowser.js @@ -115,11 +115,11 @@ var self = this, showPagination = (this.rows.length > TABLE_PAGE_SIZE); - jQuery.fn.bootstrapTable.columnDefaults.formatter = function( data ){ + jQuery.fn.bootstrapTable.columnDefaults.formatter = function( data, row, index ){ if( !data ){ return ''; } - self.processVisitors( data ); + self.processVisitors( data, this.field ); return self._getFormatter().formatValue( data ).html(); }; diff --git a/wikibase/queryService/ui/resultBrowser/TreeMapResultBrowser.js b/wikibase/queryService/ui/resultBrowser/TreeMapResultBrowser.js index 026e600..8b024f7 100644 --- a/wikibase/queryService/ui/resultBrowser/TreeMapResultBrowser.js +++ b/wikibase/queryService/ui/resultBrowser/TreeMapResultBrowser.js @@ -18,15 +18,16 @@ * @constructor */ function SELF() { + this._labelColumns = {}; } SELF.prototype = new wikibase.queryService.ui.resultBrowser.AbstractChartResultBrowser(); /** - * @property {boolean} + * @property {object} * @private **/ - SELF.prototype._hasLabel = false; + SELF.prototype._labelColumns = null; /** @@ -103,7 +104,7 @@ id = url; } - node = {id:id, name: key, size:size, url:url}; + node = {id:id + Math.random(), name: key, size:size, url:url}; } nodes.push( node ); } ); @@ -426,10 +427,9 @@ */ SELF.prototype.isDrawable = function () { - if( this._hasLabel ){ + if( Object.keys( this._labelColumns ).length > 1 ){ return true; } - return false; }; @@ -438,18 +438,21 @@ * @param data * @return {boolean} false if there is no revisit needed */ - SELF.prototype.visit = function( data ) { - return this._checkColumn( data ); + SELF.prototype.visit = function( data, key ) { + return this._checkColumn( data, key ); }; /** * Check if this value contains an coordinate value. */ - SELF.prototype._checkColumn = function ( value ) { + SELF.prototype._checkColumn = function ( value, key ) { - if( this._getFormatter().isLabel( value ) ){ - this._hasLabel = true; - return false; + if( this._getFormatter().isLabel( value, key ) ){ + this._labelColumns[key] = true; + + if( Object.keys( this._labelColumns ).length > 1 ){ + return false; + } } return true; -- To view, visit https://gerrit.wikimedia.org/r/282856 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I54b0c74c76a81d9c706c87a4cecc30b48d1ded8f Gerrit-PatchSet: 1 Gerrit-Project: wikidata/query/gui Gerrit-Branch: master Gerrit-Owner: Jonas Kress (WMDE) <jonas.kr...@wikimedia.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits