Note
Issues for this repository are tracked on Phabricator - (Click here to open a new one)
This repository is a fork of https://gitlab.wikimedia.org/repos/wmde/wikidata-query-gui with modifications specific to Wikibase Cloud applied on top.
The long-term vision is that we upstream these modifications in a configurable way so that we don't have to maintain our own fork.
- The
upstream
branch only contains the changes from upstream/main and is synced manually - The
develop
branch contains all the Wikibase Cloud specific modifications - New PRs containing additional Wikibase Cloud specific modifications that can't easily be upstreamed are opened against the
develop
branch
- Update the
upstream
branch with the latest changes from upstreamgit switch upstream
git pull upstream main
git push origin upstream
- Rebase the
develop
branch on top of the upstream changesgit switch develop
git rebase upstream
- Resolve any conflicts
- Test that everything works as expected
- Update the CHANGELOG
- Push the changes with
git push --force-with-lease origin develop
- Have the
develop
branch reviewed- Add a comment to the Phabricator task with a link that compares the
develop
andupstream
branches and move the task to review - Reviewer leaves any review comments on the Phabricator task
- Once happy with the change reviewer leaves an approval message on the Phabricator task
- Add a comment to the Phabricator task with a link that compares the
- Tag the tip of the
develop
branch:git tag <version-tag>
git push origin <version-tag>
Note
Below is the README from upstream
This repository contains the GUI for the Wikidata Query Service.
Please see more details about the service in the User Manual.
Clone git repo, go into created folder and then pull all dependencies via npm package manager.
$ git clone https://gerrit.wikimedia.org/r/wikidata/query/gui
$ cd gui
$ npm install
Alternatively, use npm install
.
npm install wikidata-query-gui
Per default the Wikibase Query Service GUI is configured to be used as a local development test instance. It can be customized by creating a custom-config.json
in the repository's root dir. This file can be used to override any of the default settings obtained from default-config.json
.
The banner message may be configured per site deployment. In order display a banner, add its banner key to the configuration:
{
// ...
"bannerName": "query-builder",
// ...
}
Empty values, falsy values and undefined banner keys will result in the banner not showing.
Run eslint, JSHint, JSCS and QUnit tests.
$ npm test
Autofix eslint errors
$ npm run grunt eslint -- --fix
It is recommended to use Fresh to run the browser tests.
$ npm run browser_test
Running browser tests headlessly inside a container can make debugging difficult. You can record videos of the browser running the tests by executing the following commands inside the fresh container:
export DISPLAY=:94
/usr/bin/Xvfb "$DISPLAY" -screen 0 1280x1024x24 -ac -nolisten tcp &
npm run browser_test
Start a test server for local debugging. Do not use it in production.
$ npm start
Create a build with bundled and minified files.
$ npm run build
Build image locally:
DOCKER_BUILDKIT=1 docker build --target production -f .pipeline/blubber.yaml .
Run image:
docker run -p 8080:8080 <image name>
Visit http://127.0.0.1:8080/
To create a new image version merge your change into the main branch.
This triggers the publish-image pipeline. Image is available at docker-registry.wikimedia.org/repos/wmde/wikidata-query-gui:<timestamp>
After the code changes have been merged and new container image version has been published to Wikimedia registry, change the version tag in the Helm chart used for deployments by making and approving the change in helmfile.d/services/wikidata-query-gui/values.yaml
in WMF's deployment-charts.
Once the new deployment chart has been created, change the deployment chart version in use on the deployment server following instructions on https://wikitech.wikimedia.org/wiki/Kubernetes/Deployments. A bit more detailed deployment instructions for another service, that could be used for reference, can be found at https://wikitech.wikimedia.org/wiki/Miscweb#Deploy\_to\_Kubernetes/wikikube.
Usage metrics are only emitted when hosted on query.wikidata.org. They are sent to https://wikidata.org/beacon/stats and https://wikidata.org/beacon/statsv .
A CodeMirror based SPARQL editor with code completion (ctrl+space) and tooltips (hover).
var editor = new wikibase.queryService.ui.editor.Editor();
editor.fromTextArea( $( '.editor' )[0] );
See examples/editor.html
.
A dialog that allows browsing of SPARQL examples.
new wikibase.queryService.ui.dialog.QueryExampleDialog( $element, querySamplesApi, callback, previewUrl );
See examples/dialog.html
.
var api = new wikibase.queryService.api.Sparql();
api.query( query ).done( function() {
var json = JSON.parse( api.getResultAsJson() );
} );
See examples/sparql.html
.
JSFiddle.net
Views that allow rendering SPARQL results (see documentation).
var api = new wikibase.queryService.api.Sparql();
api.query( query ).done(function() {
var result = new wikibase.queryService.ui.resultBrowser.CoordinateResultBrowser();
result.setResult( api.getResultRawData() );
result.draw( element );
} );
See examples/result.html
.
JSFiddle.net
Unfortunately there are no releases and the provided code and interfaces are not considered to be stable. Also the dist/ folder contains a build that may not reflect the current code on master branch.