Skip to content
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

Frontend fix to use relative paths #38

Merged
merged 3 commits into from
Jul 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading