-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Josh H
committed
Sep 8, 2018
1 parent
4ca94fc
commit 0bbd193
Showing
4 changed files
with
228 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
click==6.7 | ||
Flask==1.0.2 | ||
itsdangerous==0.24 | ||
Jinja2==2.10 | ||
MarkupSafe==1.0 | ||
pkg-resources==0.0.0 | ||
Werkzeug==0.14.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>21M.387 Lab Queue</title> | ||
|
||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> | ||
<link type="text/css" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-rc.2/css/materialize.min.css" media="screen,projection"> | ||
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> | ||
</head> | ||
|
||
<body> | ||
<nav> | ||
<div class="nav-wrapper blue"> | ||
<a href="#" class="brand-logo center">21M.387</a> | ||
</div> | ||
</nav> | ||
|
||
<div class="container"> | ||
<div class="row"> | ||
<div class="col s12 m6 section center-align" style="margin-bottom: 20px"> | ||
<h5>Help Queue</h5> | ||
|
||
<table class="centered queue-table"> | ||
<thead> | ||
<tr> | ||
<th>Name</th> | ||
<th>Kerberos</th> | ||
<th></th> | ||
</tr> | ||
</thead> | ||
|
||
<tbody id="help-queue-table"> | ||
</tbody> | ||
</table> | ||
|
||
</div> | ||
|
||
<div class="col s12 m6 section center-align"> | ||
<h5>Checkoff Queue</h5> | ||
|
||
<table class="centered queue-table"> | ||
<thead> | ||
<tr> | ||
<th>Name</th> | ||
<th>Kerberos</th> | ||
<th></th> | ||
</tr> | ||
</thead> | ||
|
||
<tbody id="checkoff-queue-table"> | ||
</tbody> | ||
</table> | ||
|
||
</div> | ||
</div> | ||
</div> | ||
|
||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-rc.2/js/materialize.min.js"></script> | ||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> | ||
<script type="text/javascript" src="scripts.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
$(document).ready(function() { | ||
var site_base_url = 'http://localhost:5000'; | ||
var refresh_interval = 2000; | ||
|
||
// button handler for help queue | ||
$("#help-queue-table").on('click', '.btn-floating', function () { | ||
var fn = $(this).parent().parent().data("first_name"); | ||
var ln = $(this).parent().parent().data("last_name"); | ||
var k = $(this).parent().parent().data("kerberos"); | ||
console.log($(this).parent().parent()); | ||
|
||
$.ajax({ | ||
type: "POST", | ||
url: site_base_url + "/queue/help", | ||
data: 'first_name='+fn+'&last_name='+ln+'&kerberos='+k+'&remove=true' | ||
}).then(function(data) { | ||
console.log(data); | ||
}); | ||
|
||
$(this).parent().parent().remove() | ||
}); | ||
|
||
// button handler for checkoff queue | ||
$("#checkoff-queue-table").on('click', '.btn-floating', function () { | ||
var fn = $(this).parent().parent().data("first_name"); | ||
var ln = $(this).parent().parent().data("last_name"); | ||
var k = $(this).parent().parent().data("kerberos"); | ||
console.log($(this).parent().parent()); | ||
|
||
$.ajax({ | ||
type: "POST", | ||
url: site_base_url + "/queue/checkoff", | ||
data: 'first_name='+fn+'&last_name='+ln+'&kerberos='+k+'&remove=true' | ||
}).then(function(data) { | ||
console.log(data); | ||
}); | ||
|
||
$(this).parent().parent().remove() | ||
}); | ||
|
||
|
||
// refresh the lab queue every `refresh_interval` seconds | ||
setInterval(function() { | ||
|
||
$.ajax({ | ||
type: "GET", | ||
url: site_base_url + "/queue/help" | ||
}).then(function(data) { | ||
$('#help-queue-table').empty() | ||
if (data.message.length > 0) {console.log(data.message)}; | ||
$.each(data.help_queue, function(i, item) { | ||
pulse = ''; | ||
if (i == 0) { | ||
pulse = 'pulse' | ||
}; | ||
|
||
$('#help-queue-table').append( | ||
$('<tr>').append( | ||
$('<td>').text(item[0] + " " + item[1][0]), | ||
$('<td>').text(item[2]), | ||
$('<td>').append( | ||
$('<a>').addClass("btn-floating btn-small waves-effect waves-light red "+pulse).append( | ||
$('<i>').addClass("material-icons").text('remove') | ||
) | ||
) | ||
).data('first_name', item[0]).data('last_name', item[1]).data('kerberos', item[2]) | ||
); | ||
}); | ||
}); | ||
|
||
$.ajax({ | ||
type: "GET", | ||
url: site_base_url + "/queue/checkoff" | ||
}).then(function(data) { | ||
$('#checkoff-queue-table').empty() | ||
if (data.message.length > 0) {console.log(data.message)}; | ||
$.each(data.checkoff_queue, function(i, item) { | ||
pulse = ''; | ||
if (i == 0) { | ||
pulse = 'pulse' | ||
}; | ||
|
||
$('#checkoff-queue-table').append( | ||
$('<tr>').append( | ||
$('<td>').text(item[0] + " " + item[1][0]), | ||
$('<td>').text(item[2]), | ||
$('<td>').append( | ||
$('<a>').addClass("btn-floating btn-small waves-effect waves-light red "+pulse).append( | ||
$('<i>').addClass("material-icons").text('remove') | ||
) | ||
) | ||
).data('first_name', item[0]).data('last_name', item[1]).data('kerberos', item[2]) | ||
); | ||
}); | ||
}); | ||
|
||
}, refresh_interval); | ||
|
||
}); |