Skip to content

ease wdqs-frontend configuration #814

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
etlel opened this issue Jan 9, 2025 · 4 comments
Open

ease wdqs-frontend configuration #814

etlel opened this issue Jan 9, 2025 · 4 comments

Comments

@etlel
Copy link

etlel commented Jan 9, 2025

It was a little bit challenging to make the simple operation of changing the logo of wqds-frontend.

I finally succeded by adding that code to docker-compose.yml:

 volumes:
      - ./config/logo.svg:/usr/share/nginx/html/logo.svg

For the name beside it, I added an environment variable BRAND_TITLE after finding about that in Github. Why not just preset it in docker-compose.yml, as everyone is going to want to change that ?

I'm still looking for a way to add my custom prefixes in the textarea.

Overall, it would be helpful to make configuration more accessible, for instance by moving custom-config.json along with LocalSettings.php outside of the container along with LocalSettings.php.

Copy link

welcome bot commented Jan 9, 2025

Hi! 👋

Thank you so much for opening your first issue with us! 🎉 We are thrilled to have you here and really appreciate you taking the time to contribute.

Your input is valuable in making our project better for everyone. If you have any questions, do not hesitate to ask. We're here to help and support you along the way!

Here are a few links to get you started:

Looking forward to collaborating with you. We will get back to you on this issue within the next 14 days. 😊

Happy contributing! 🚀

@lucamauri
Copy link

It was a little bit challenging to make the simple operation of changing the logo of wqds-frontend.

Hello @etlel I am playing around with this myself and I think I can provide some help to you.
To customise the WDQS front-end I ended up using this solution.
First of all I created a file config/wdqs-frontend-custom-config.json, then replace the standard one with a configuration in the docker-compose.yml file:

volumes:
      - ./config/wdqs-frontend-custom-config.json:/templates/custom-config.json

The JSON file contains several configuration, here's an example:

{
  "api": {
    "sparql": {
      "uri": "/proxy/wdqs/bigdata/namespace/wdq/sparql"
    },
    "wikibase": {
      "uri": "https://your.wikibase.org/w/api.php"
    },
    "examples": {
      "server": "https://your.wikibase.org/",
      "apiPath": "w/api.php",
      "pageTitle": "Help:SPARQL Examples",
      "pagePathElement": "wiki/"
    },
    "urlShortener": "tinyurl",
    "query-builder": {
      "server": "https://gerrit.wikimedia.org/g/wikidata/query-builder"
    }
  },
  "brand": {
    "title": "Your Wikibase Query Service",
    "logo": "https://your.wikibase.org/w/resources/assets/YourLogo.svg",
    "favicon": "https://your.wikibase.org/w/resources/assets/favicon.ico",
    "copyrightUrl": "https://your.wikibase.org/wiki/YourWikibase:License",
    "index": "./index.html"
  },
  "prefixes": {
    "wd": "https://your.wikibase.org/entity/",
    "wdt": "https://your.wikibase.org/prop/direct/",
    "pq": "https://your.wikibase.org/prop/qualifier/"
  },
  "defaultPrefixes": {
    "wd": "https://your.wikibase.org/entity/",
    "wdt": "https://your.wikibase.org/prop/direct/"
  }
}

All the parameters in the above file can be replaced by variables to be set via the YML file and loaded from the .env.

Regarding the example page, please see this ticket on Phabricator.

I'm still looking for a way to add my custom prefixes in the textarea.

Despite having configured them in the file above, I am unable to make them work, I am still looking for a solution.

Hope this helps.

@etlel
Copy link
Author

etlel commented Feb 1, 2025

@lucamauri Thank you.
For the prefixes, i ended loading them into the textarea by URL.

I entered into the wdqs-frontend Docker container and I pushed CSS:
$ echo ".navbar-default li.dropdown, :has(> .shortUrlTrigger) { display: none; }" >> css/style.min.572d05cf32fff3e9d333.css

This is far from ideal but what else can I do, there are near-zero customization and Wikidata links everywhere.

Even to set custom examples, the JS is parsing mw headings rendered by MW 1.43 and the dockerized version is 1.42... A bit messy.

@lucamauri
Copy link

I entered into the wdqs-frontend Docker container and I pushed CSS: $ echo ".navbar-default li.dropdown, :has(> .shortUrlTrigger) { display: none; }" >> css/style.min.572d05cf32fff3e9d333.css

Thanks for the hint, I will also try this on my instance.

In regards to the other questions you originally had, was my response helpful and can we close this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants