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>';
});
}

View File

@@ -7,14 +7,14 @@
</head>
<body>
<h1>Tables</h1>
<a href="./WhoUsesService.html" class="button">Get clients using a service</a>
<a href="./WhoUsesService/WhoUsesService.html" class="button">Get clients using a service</a>
<br>
<a href="./GetSubordinates.html" class="button">Get subordinates of employee</a>
<a href="./GetSubordinates/GetSubordinates.html" class="button">Get subordinates of employee</a>
<br>
<a href="./WhoIsResponsibleForService.html" class="button">Get responsible leader for service</a>
<a href="./WhoIsResponsibleForService/WhoIsResponsibleForService.html" class="button">Get responsible leader for service</a>
<br>
<a href="./WhoMaintainsService.html" class="button">Get employees working on a service</a>
<a href="./WhoMaintainsService/WhoMaintainsService.html" class="button">Get employees working on a service</a>
<br>
<a href="./WhoWorksInMaintainerTeam.html" class="button">Get members of a team</a>
<a href="./WhoWorksInMaintainerTeam/WhoWorksInMaintainerTeam.html" class="button">Get members of a team</a>
</body>
</html>

View File

@@ -62,8 +62,10 @@
<td>Port</td>
<td class="inputcell"><input type="text" id="in_port"></td>
</tr>
<tr>
<td colspan="2"><button onclick="addemployee()">Save</button></td>
</tr>
</table>
<button class="save" onclick="addService()">Save</button>
<div id="addresult"></div>
</body>
</html>