-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfixstucknotes.html
More file actions
76 lines (65 loc) · 2.87 KB
/
Copy pathfixstucknotes.html
File metadata and controls
76 lines (65 loc) · 2.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<!doctype html>
<html lang="en">
<head>
<title>Fix Stuck Notes</title>
<meta http-equiv="Content-Type" content="text/html charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="utf-8">
<style>
span.tick { color: green; font-size: 130%; }
span.cross { color: red; font-size: 130%; }
</style>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-KyZXEAg3QhqLMpG8r+8fhAXLRk2vvoC2f3B09zVXn8CA5QIVfZOJ3BCsw2P0p/We" crossorigin="anonymous">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
</head>
<body>
<div class="container">
<div class="stuck collapse"></div>
<div class="error text-center collapse"></div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
<script>
const ranges = ['Low', 'Mid', 'High', 'All'];
const buttons = ['info', 'secondary', 'primary', 'warning'];
function fixStuckNotes(port, range) {
$.get({
url: '--APIGATEWAYENDPOINT--'+'/resetStuckNote?port='+port+'&range='+range
}).then(function(data) {
$('.tick-'+port+'-'+range.toLowerCase()).show();
setTimeout(() => { $('.tick-'+port+'-'+range.toLowerCase()).hide(); }, 2000);
}).fail(function(data) {
console.log(data);
$('.cross-'+port+'-'+range.toLowerCase()).show();
setTimeout(() => { $('.cross-'+port+'-'+range.toLowerCase()).hide(); }, 2000);
});
}
function getTransmitPorts() {
$.get({
url: '--APIGATEWAYENDPOINT--'+'/getTransmitPorts'
}).then(function(data) {
var table = '<table class="table table-striped table-borderless table-sm w-auto mx-auto mt-2">';
table += '<tr><th>Transmit Port</th><th class="text-center" colspan="4">Range</th></tr>';
for (portNumber of data) {
table += '<tr><th class="text-center" width="20%">'+portNumber+'</th>';
for (index in ranges) {
table += '<td width="20%">';
table += '<button type="button" class="btn btn-'+buttons[index]+'" onclick="fixStuckNotes('+portNumber+',\''+ranges[index]+'\')">'+ranges[index]+'</button>';
table += ' <span class="tick tick-'+portNumber+'-'+ranges[index].toLowerCase()+' collapse">✓</span>';
table += ' <span class="cross cross-'+portNumber+'-'+ranges[index].toLowerCase()+' collapse">❌</span>';
table += '</td>';
}
table += '</tr>';
}
table += '</table>';
$('.stuck').html(table);
$('.stuck').show();
}).fail(function(data) {
$('.error').append('<h3>Whoopsie</h3>');
$('.error').append('<div>'+data.responseText+'</div>');
$('.error').show();
});
}
$(document).ready(getTransmitPorts);
</script>
</body>
</html>