Commit 8de28a69 authored by Stefan Dähling's avatar Stefan Dähling
Browse files

fetch list of mas

parent a237ea6b
Pipeline #302167 passed with stages
in 54 seconds
......@@ -19,7 +19,7 @@
</ul>
<p>MAS</p>
<hr>
<ul>
<ul id="maslist">
<li><a href="#" class="masbutton" id="sidemas0">MAS0</a></li>
<li><a href="#" class="masbutton" id="sidemas1">MAS1</a></li>
</ul>
......
......@@ -4,14 +4,15 @@ $(document).ready(function(){
$("#sideplatform").click(sideplatform);
$(".masbutton").click(sidemas);
updateSidebar();
});
function sideoverview(){
$(".modules").hide();
$("#headertitle").text("Overview");
fetch('/api/ams/mas').then(response => response.json()).then(data => console.log(data));
updateSidebar();
// fetch('/api/ams/mas').then(response => response.json()).then(data => console.log(data));
}
function sideplatform(){
......@@ -22,4 +23,18 @@ function sideplatform(){
function sidemas(){
$(".modules").show();
$("#headertitle").text(this.id);
}
function updateSidebar(){
fetch('/api/ams/mas')
.then(response => response.json())
// .then(data => JSON.parse(data))
.then(mas => {
$("#maslist").empty()
for (let i of mas) {
console.log(i);
$("#maslist").append("<li><a href=\"#\" class=\"masbutton\" id=\"sidemas"+i.id.toString()+"\">MAS"+i.id.toString()+"</a></li>")
}
$(".masbutton").click(sidemas);
})
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment