forked from luponzo86/rhapsody-website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
status.php
144 lines (122 loc) · 3.91 KB
/
status.php
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<!DOCTYPE html>
<html lang="en">
<?php
include 'src/php/utils.php';
$scratch_dir = "./workspace";
$arr = check_jobid_and_jobdir($scratch_dir);
$jobid = $arr["jobid"];
$jobdir = $arr["jobdir"];
?>
<head>
<?php readfile("./html/header.html"); ?>
</head>
<body>
<?php
$currentPage = '';
include './html/navbar.php';
?>
<div class="jumbotron">
<div class="container text-center">
<h2>Job #<?php echo $jobid;?></h2>
</div>
</div>
<div class="container bg-3">
<div class="row">
<div class="col-md">
<h4>
status: <b><span style="color:red;" id="status_update"></span></b>
</h4>
<div id="infodiv">
<p><small class="text-muted">
bookmark this page to check your job status later.
If you provided an email address, you'll be notified.
</small></p>
</div>
<div id="errordiv" style="display:none">
<p><small class="text-muted">
please check error message below and
<a href="<?php echo $jobdir;?>" target='_blank'>output folder</a>:
</small></p>
</div>
<div id="resultsdiv" style="display:none">
<p><small class="text-muted">
you will be automatically redirected to the
<a href="results.php?id=<?php echo $jobid;?>">results</a>
page in <span id="counter">4 seconds</span>...
</small></p>
</div>
<div id="logdiv">
<!-- number of 'rows' below must be at least 2 + number of lines in tailShell()
call in src/php/get_status.php:returnStatus() -->
<p><textarea class="form-control" id="log_update" cols="100" rows="9" readonly
style="font-family:monospace; font-size:12px; white-space:pre-wrap">
...
</textarea></p>
</div>
<div id="errordiv-pph2" style="display:none">
<p><small class="text-muted">
error message from PolyPhen-2 (file
<a href="<?php echo $jobdir;?>/pph2-log.txt">pph2-log.txt</a>):
</small></p>
<p><textarea class="form-control" id="pph2log_div" cols="100" rows="9" readonly
style="font-family:monospace; font-size:12px; white-space:pre-wrap">
...
</textarea></p>
</div>
</div>
</div>
</div>
<?php readfile("./html/footer.html"); ?>
<?php readfile("./html/js_src.html"); ?>
<!-- JS code for printing log live -->
<script type="text/javascript">
var jobid = "<?php echo $jobid;?>";
var job_status = "-";
var log_tail = "";
function check_status() {
console.log("job status: " + job_status);
$.get( "src/php/get_status.php?id=" + jobid , function(data, status){
job_status = data.status;
log_tail = data.logTail;
pph2Log = data.pph2Log;
}, "json");
$("#status_update").html(job_status);
$("#log_update").html(log_tail);
if (job_status == "-") {
setTimeout(check_status, 100);
}
else if (job_status == "running...") {
setTimeout(check_status, 300);
}
else if (job_status == "completed") {
$("#infodiv").hide();
$("#resultsdiv").show();
countdown();
}
else {
$("#infodiv").hide();
$("#errordiv").show();
if (pph2Log != "") {
$("#pph2log_div").html(pph2Log);
$("#errordiv-pph2").show();
}
}
}
function countdown() {
var counter = document.getElementById('counter');
var i = parseInt(counter.innerHTML.substring(0, 1)) - 1;
if (i <= 0) {
location.href = 'results.php?id=<?php echo $jobid;?>';
}
else {
if (i>1) {counter.innerHTML = i + " seconds";}
else {counter.innerHTML = i + " second";}
setTimeout(countdown, 1000);
}
}
$(document).ready(function() {
check_status();
})
</script>
</body>
</html>