Skip to content

Commit

Permalink
Merge pull request #38 from geoadmin/FrontendFix
Browse files Browse the repository at this point in the history
Frontend fix to use relative paths
  • Loading branch information
ltbam authored Jul 8, 2024
2 parents 5068965 + cc8d6fb commit 86bba15
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions static/index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<!DOCTYPE html>
<html lang="de">
<!-- https://leafletjs.com/examples/quick-start/ -->
<!-- 05.07.2024 bao -->
<head>
<style>

Expand Down Expand Up @@ -55,8 +56,8 @@

</style>

<title>KARP GUI</title>
<h1>KARP - KADAS Routing Packager</h1>
<title id="titleid"></title>
<h1 id="h1id"></h1>

<link rel="shortcut icon" type="image/x-icon" href="docs/images/favicon.ico" />

Expand All @@ -79,7 +80,7 @@ <h1>KARP - KADAS Routing Packager</h1>
<div id="leftpane" style="width: 49%; float:left;">
<div id="map" style="height: 470px; border: 1px solid #ccc "></div>
<br>
<form method="POST" id="submitForm" action="https://l0t2511a.lt.admin.ch/api/v1/jobs/">
<form method="POST" id="submitForm" action="javascript:postjobsurl;">

<label for="name" width="300" >Export name:</label>
<input type="text" id="name" name="name" placeholder="Enter export name" required><br>
Expand All @@ -100,6 +101,16 @@ <h1>KARP - KADAS Routing Packager</h1>
</form>

<script>
// Variables for host infos
var hostlocation = window.location.origin;
var hostname = window.location.hostname;
var postjobsurl = "";

document.getElementById("titleid").innerHTML = "KARP GUI ".concat(hostname);
document.getElementById("h1id").innerHTML = "KARP - KADAS Routing Packager ".concat(hostname);

postjobsurl = hostlocation.concat("/api/v1/jobs/");

// Variables for extent
var sw = 0.0;
var ne = 0.0;
Expand Down Expand Up @@ -181,7 +192,7 @@ <h1>KARP - KADAS Routing Packager</h1>

// prepare POST Call for ajax
$.ajax({
url: "https://l0t2511a.lt.admin.ch/api/v1/jobs/",
url: postjobsurl,
type: "POST",
headers: {
"Authorization": "Basic YWRtaW5AZXhhbXBsZS5vcmc6YWRtaW4=",
Expand Down Expand Up @@ -228,7 +239,7 @@ <h1>KARP - KADAS Routing Packager</h1>
formElement.addEventListener("submit", handler);

</script>
<p style="color: gray; font-size:8pt">v.1.0</p>
<p style="color: gray; font-size:8pt">v.1.1</p>
</div>

<div id="middlepane" style="width: 2%; float:left; ">
Expand All @@ -245,7 +256,7 @@ <h1>KARP - KADAS Routing Packager</h1>
<script>

function jobresult() {
$.getJSON("https://l0t2511a.lt.admin.ch/api/v1/jobs/", function (gr) {
$.getJSON(postjobsurl, function (gr) {
if (gr) {
//console.log(gr)
var jsonData = gr
Expand Down Expand Up @@ -381,7 +392,7 @@ <h1>KARP - KADAS Routing Packager</h1>
function delJob(jid) {
//console.log("del Job: "+jid);
$.ajax({
url: "https://l0t2511a.lt.admin.ch/api/v1/jobs/" + jid,
url: postjobsurl + jid,
type: 'DELETE',
headers: {
"Authorization": "Basic YWRtaW5AZXhhbXBsZS5vcmc6YWRtaW4=",
Expand Down

0 comments on commit 86bba15

Please sign in to comment.