summaryrefslogtreecommitdiff
path: root/views/batch.haml
diff options
context:
space:
mode:
Diffstat (limited to 'views/batch.haml')
-rw-r--r--views/batch.haml51
1 files changed, 46 insertions, 5 deletions
diff --git a/views/batch.haml b/views/batch.haml
index c5dd2f4..fb317c9 100644
--- a/views/batch.haml
+++ b/views/batch.haml
@@ -1,15 +1,47 @@
:javascript
+ $(document).ready(function(){
+ $('[data-toggle="popover"]').popover();
+ $('.modal').on('hidden.bs.modal', function () {
+ $(this).removeData('bs.modal');
+ });
+ $('.modal').on('show.bs.modal', function(e){
+ var button = $(e.relatedTarget);
+ var modal = $(this);
+ modal.find('.modal-content').load(button.data("remote"));
+ });
+ });
function progress(value,id) {
var percent = Math.round(value);
var bar = document.getElementById("bar_"+id);
+ var est = document.getElementById("est_"+id);
var prog = document.getElementById("progress_"+id);
bar.style.width = value + '%';
if (percent == 100){
prog.style.display = "none";
+ est.style.display = "none";
};
};
+ function remaining(id,tasktime,type) {
+ var est = document.getElementById("est_"+id);
+ var now = new Date().getTime();
+ if ( type == "true" ){
+ var approximate = new Date(tasktime*1000 + #{@compounds_size*1000});
+ } else {
+ var approximate = new Date(tasktime*1000 + #{@compounds_size*100});
+ }
+ var remain = approximate - now;
+ var minutes = Math.floor((remain % (1000 * 60 * 60)) / (1000 * 60));
+ var seconds = Math.floor((remain % (1000 * 60)) / 1000);
+ if ( minutes <= 0 && seconds <= 0 ) {
+ var newtime = "0m " + "00s ";
+ } else {
+ var newtime = minutes + "m " + seconds + "s ";
+ }
+ est.innerHTML = newtime;
+ };
+
var HttpClient = function() {
this.get = function(aUrl, aCallback) {
var anHttpRequest = new XMLHttpRequest();
@@ -58,9 +90,9 @@
$('#data-container_'+id).show();
$('#pager_'+id).show();
$('#pager_'+id).pagination({
- dataSource: '#{to("/prediction/task/?predictions=")}' + task_id + '&model=' + model_id ,
+ dataSource: '#{to("/prediction/task/?predictions=")}' + task_id,
locator: 'prediction',
- totalNumber: #{@compounds.size},
+ totalNumber: '#{@compounds_size}',
pageSize: 1,
showPageNumbers: true,
showGoInput: true,
@@ -106,15 +138,18 @@
%a.btn.btn-outline-info.btn-sm.disabled{:id => "detailsbutton_#{idx}", :data=>{:toggle=>"collapse"}, :href=>"javascript:void(0)", :onclick=>"pagePredictions('#{task}','#{model}','#{idx}')"}
%span.fa.fa-caret-right
Details
- %a.btn.btn-outline-info.btn-sm.disabled{:id => "downbutton_#{idx}", :href=>"#{to("/predict/csv/#{task}/#{model}/#{@filename}")}", :title=>"download"}
+ %a.btn.btn-outline-info.btn-sm.disabled{:id => "downbutton_#{idx}", :href=>"#{to("/predict/batch/download?tid=#{task}")}", :title=>"download"}
%span.fa.fa-download
CSV
%div{:id=>"progress_#{idx}", :style=>"width:100%;height:3px;position:relative;background-color:#ccc;"}
%div{:id=>"bar_#{idx}", :style=>"background-color: #4CAF50;width:10px;height:3px;position:absolute;"}
+ %p{:id=>"est_#{idx}"}
+ waiting ...
- # increase interval timer for large datasets
- - ctimer = ((@compounds.size/1000) == 0 ? 1000 : ((@compounds.size/1000)*1000))
+ - ctimer = ((@compounds_size/1000) == 0 ? 1000 : ((@compounds_size/1000)*1000))
:javascript
var timer = #{ctimer};
+ var tasktime = #{task.generation_time.to_i};
$(document).ready(function(){
// check button class before execute a task
if (#{idx} > 0){
@@ -122,12 +157,18 @@
var button = document.getElementById("detailsbutton_#{idx-1}");
if(!button.classList.contains('disabled')){
renderTask('#{task}','#{model}',#{idx});
+ remaining(#{idx},tasktime);
}
}, timer );
}else{
markers[#{idx}] = setInterval(function(){
renderTask('#{task}','#{model}',#{idx});
+ remaining(#{idx},tasktime,#{m.classification?});
}, timer );
};
});
- #data-container.card.d-none{:id=>idx}
+ #data-container.card.d-none.table-responsive{:id=>idx}
+%div.modal.fade{:id=>"details", :tabindex=>"-1", :role=>"dialog"}
+ %div.modal-dialog.modal-lg{:role=>"document"}
+ %div.modal-content
+