some minor changes

This commit is contained in:
Miskolczi Richárd
2024-05-05 22:22:06 +02:00
parent 4c2cdb5fb9
commit 25728ff18f
4 changed files with 63 additions and 7 deletions

View File

@@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<title>services</title>
<link rel="stylesheet" type="text/css" href="../style.css">
<link rel="stylesheet" type="text/css" href="../../style.css">
<script src="./script.js"></script>
</head>
<body>

View File

@@ -0,0 +1,54 @@
let services = [];
getServices();
async function getServices()
{
await fetch('https://localhost:5001/api/Service')
.then(x => x.json())
.then(y => {
services = y;
console.log(services);
display();
});
}
function display()
{
document.getElementById('resultarea').innerHTML = '';
services.forEach(t => {
document.getElementById('resultarea').innerHTML +=
'<tr><td>'
+ t.id +
'</td><td>'
+ t.name +
'</td><td>'
+ '<button colspan="2" type="button" onclick="runQuery(' + t.id + ')">Run</button>'
+ '</td></tr>';
});
}
async function runQuery(id)
{
let results = []
await fetch('https://localhost:5001/api/WhoUsesService?id=' + id)
.then(x => x.json())
.then(y => {
results = y;
console.log(results);
});
document.getElementById('resultarea').innerHTML = '';
results.forEach(t => {
document.getElementById('resultarea').innerHTML +=
'<h2>Query results</h2>' +
'<table>' +
'<tr>' +
'<td>ID</td>' +
'<td>Client</td>' +
'</tr>';
});
}