TriplyDB / Yasgui

Yet Another Sparql GUI
https://yasgui.triply.cc
MIT License
179 stars 54 forks source link

Decouple YASQE and YASR #166

Closed tfrancart closed 3 years ago

tfrancart commented 3 years ago

With old version of YASGUI I used to decouple YASQE and YASR, for display reasons : YASQE was only half page size, on the right (because I need some space to put something on the left, a query editor), while YASR was full page width. Can I achieve the same behavior with new version of YASGUI ? Thanks

tfrancart commented 3 years ago

And BTW, I also used to use YASR only, without YASQE. I don't find in the documentation if it is still possible and how to do this. Thanks

tfrancart commented 3 years ago

I found out I can write:

      const yasqe = new Yasqe(document.getElementById("yasqe"), {
        requestConfig: { endpoint: $('#endpoint').text() },
        copyEndpointOnNewTab: false  
      });

      const yasr = new Yasr(document.getElementById("yasr"), {});

But then I have trouble linking the 2. In previous version I was:

yasqe.options.sparql.callbacks.complete = yasr.setResponse;

Now I tried yasqe.on("queryResponse", yasr.setResponse); without much success ("Uncaught (in promise) TypeError: Cannot set property 'results' of null")

GerwinBosch commented 3 years ago

Hi,

The individual packages are available with npm as @triply/yasqe and @triply/yasr. Or when using a CDN, replace yasgui with yasr or yasqe in the urls present in the docs.

Yasqe's callback includes itself, try the following snippet

yasqe.on("queryResponse", function(yasqe, response, duration) {
  yasr.setResponse(response, duration);
});
tfrancart commented 3 years ago

Thanks ! that did the trick.