Upgrades SPARQL query UI

pull/10/head
Tpt 5 years ago
parent 22540846f0
commit 4beff97894
  1. 2
      server/src/main.rs
  2. 15
      server/templates/query.html

@ -15,6 +15,7 @@ use std::sync::Arc;
const MAX_SPARQL_BODY_SIZE: u64 = 1_048_576; const MAX_SPARQL_BODY_SIZE: u64 = 1_048_576;
const HTML_ROOT_PAGE: &str = include_str!("../templates/query.html"); const HTML_ROOT_PAGE: &str = include_str!("../templates/query.html");
const SERVER: &str = concat!("Rudf/", env!("CARGO_PKG_VERSION"));
pub fn main() { pub fn main() {
let matches = App::new("Rudf SPARQL server") let matches = App::new("Rudf SPARQL server")
@ -54,6 +55,7 @@ where
start_server(addr.to_string(), move |request| { start_server(addr.to_string(), move |request| {
handle_request(request, repository.connection().unwrap(), &addr) handle_request(request, repository.connection().unwrap(), &addr)
.with_unique_header("Server", SERVER)
}) })
} }

@ -3,26 +3,25 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>Rudf server</title> <title>Rudf server</title>
<link href='http://cdn.jsdelivr.net/g/yasqe@2.2(yasqe.min.css),yasr@2.4(yasr.min.css)' rel='stylesheet' type='text/css'/> <link rel="stylesheet" href="//tools-static.wmflabs.org/cdnjs/ajax/libs/yasqe/2.11.22/yasqe.min.css"/>
<link rel="stylesheet" href="//tools-static.wmflabs.org/cdnjs/ajax/libs/yasr/2.12.19/yasr.min.css"/>
</head> </head>
<body> <body>
<div id="yasqe"></div> <div id="yasqe"></div>
<div id="yasr"></div> <div id="yasr"></div>
<script src='http://cdn.jsdelivr.net/yasr/2.4/yasr.bundled.min.js'></script> <script src="//tools-static.wmflabs.org/cdnjs/ajax/libs/yasr/2.12.19/yasr.bundled.min.js"></script>
<script src='http://cdn.jsdelivr.net/yasqe/2.2/yasqe.bundled.min.js'></script> <script src="//tools-static.wmflabs.org/cdnjs/ajax/libs/yasqe/2.11.22/yasqe.bundled.min.js"></script>
<script> <script>
var yasqe = YASQE(document.getElementById("yasqe"), { var yasqe = YASQE(document.getElementById("yasqe"), {
sparql: { sparql: {
showQueryButton: true, showQueryButton: true,
endpoint: '{{endpoint}}' endpoint: "{{endpoint}}"
} }
}); });
var yasr = YASR(document.getElementById("yasr"), { var yasr = YASR(document.getElementById("yasr"), {
//this way, the URLs in the results are prettified using the defined prefixes in the query getUsedPrefixes: yasqe.getPrefixesFromQuery,
getUsedPrefixes: yasqe.getPrefixesFromQuery useGoogleCharts: false
}); });
//link both together
yasqe.options.sparql.callbacks.complete = yasr.setResponse; yasqe.options.sparql.callbacks.complete = yasr.setResponse;
</script> </script>
</body> </body>

Loading…
Cancel
Save