Smalyshev has uploaded a new change for review. https://gerrit.wikimedia.org/r/304413
Change subject: [WIP] Polestar support ...................................................................... [WIP] Polestar support TODO: make it not ugly and hacky Change-Id: Ice2cda02f597c6a90dfccf8b1a14e153ae624a5a --- M index.html M style.css M wikibase/queryService/ui/App.js 3 files changed, 33 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/wikidata/query/gui refs/changes/13/304413/1 diff --git a/index.html b/index.html index ba40c7e..f265980 100644 --- a/index.html +++ b/index.html @@ -113,6 +113,9 @@ </button> <span class="query-total"> <span class="label label-default"><span id="total-results"></span> Results in <span id="query-time"></span> ms </span></span> + <button type="button" class="btn btn-default" id="graph-button"> + Graph it! + </button> </div> </div> <ul class="nav navbar-nav navbar-right query-total"> @@ -168,6 +171,9 @@ <div id="query-result">Test result</div> </div> <div class="row"> + <div id="graph-frame"><iframe id="graph-iframe"></iframe></div> + </div> + <div class="row"> <div id="query-error" class="panel-heading">Test error</div> </div> diff --git a/style.css b/style.css index a662df7..da099ec 100644 --- a/style.css +++ b/style.css @@ -18,10 +18,23 @@ display: none; } -#query-error, #query-error-short { +#query-error, #query-error-short, #graph-button { display: none; } +#graph-frame { + display: none; + width: 100%; + height: 800px; +} + +#graph-iframe { + width: 100%; + height: 100%; + border: none; + margin: 0; +} + .error-line { border-bottom: 2px dotted red; } diff --git a/wikibase/queryService/ui/App.js b/wikibase/queryService/ui/App.js index 2ee73f4..3d3f64e 100644 --- a/wikibase/queryService/ui/App.js +++ b/wikibase/queryService/ui/App.js @@ -12,6 +12,8 @@ 'Query deadline is expired.': 'wdqs-action-timeout' }; + var POLESTAR = 'http://localhost:3000/'; + /** * A ui application for the Wikibase query service * @@ -401,6 +403,13 @@ this._initPopovers(); this._initHandlersDownloads(); + + $('#graph-button').click(function() { + $('#query-result').hide(); + window.vguiData = self._sparqlApi.getResultAsJson(); + $('#graph-iframe').attr('src', POLESTAR + "#" + window.vguiData); + $('#graph-frame').show(); + }); }; /** @@ -548,6 +557,9 @@ $( '.query-total' ).hide(); $( '#execute-button' ).prop( 'disabled', true ); $( '#query-error' ).hide(); + $( '#graph-button' ).hide(); + $( '#graph-frame' ).hide(); + $( '#graph-iframe' ).attr('src', ''); this._sparqlApi.query( this._editor.getValue() ).done( $.proxy( this._handleQueryResult, this ) ).fail( function() { @@ -587,6 +599,7 @@ $( '#query-time' ).text( api.getExecutionTime() ); $( '.query-total' ).show(); $( '#execute-button' ).prop( 'disabled', false ); + $( '#graph-button' ).show(); var defaultBrowser = this._createResultBrowsers( api.getResultRawData() ); this._drawResult( defaultBrowser ); -- To view, visit https://gerrit.wikimedia.org/r/304413 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ice2cda02f597c6a90dfccf8b1a14e153ae624a5a Gerrit-PatchSet: 1 Gerrit-Project: wikidata/query/gui Gerrit-Branch: master Gerrit-Owner: Smalyshev <smalys...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits