From 9750e0309500259e9a56e267ce87984fb5bb5e53 Mon Sep 17 00:00:00 2001 From: gebele Date: Mon, 26 Nov 2018 15:29:26 +0000 Subject: clean out; better response codes; prepare for batch --- views/batch.haml | 238 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 131 insertions(+), 107 deletions(-) (limited to 'views/batch.haml') diff --git a/views/batch.haml b/views/batch.haml index 0e7efc7..c5dd2f4 100644 --- a/views/batch.haml +++ b/views/batch.haml @@ -1,109 +1,133 @@ -%div.well - %a.btn.btn-warning{:href => to('/predict')} - %span.glyphicon.glyphicon-menu-left{:aria=>{:hidden=>"true"}} +:javascript + + function progress(value,id) { + var percent = Math.round(value); + var bar = document.getElementById("bar_"+id); + var prog = document.getElementById("progress_"+id); + bar.style.width = value + '%'; + if (percent == 100){ + prog.style.display = "none"; + }; + }; + + var HttpClient = function() { + this.get = function(aUrl, aCallback) { + var anHttpRequest = new XMLHttpRequest(); + anHttpRequest.onreadystatechange = function() { + if (anHttpRequest.readyState == 4 && anHttpRequest.status == 200) + aCallback(anHttpRequest.responseText); + } + anHttpRequest.open( "GET", aUrl, true ); + anHttpRequest.send( null ); + } + }; + + var markers = []; + + function renderTask(task_id,model_id,id) { + var uri = "#{to("/prediction/task/?turi=")}" + task_id; + var aClient = new HttpClient(); + aClient.get(uri, function(res) { + var response = JSON.parse(res); + progress(response['percent'],id); + if (response['percent'] == 100){ + window.clearInterval(markers[id]); + $("a#downbutton_"+id).removeClass("disabled"); + $("a#detailsbutton_"+id).removeClass("disabled"); + $("a#downbutton_"+id).removeClass("btn-outline-info"); + $("a#detailsbutton_"+id).removeClass("btn-outline-info"); + $("a#downbutton_"+id).addClass("btn-info"); + $("a#detailsbutton_"+id).addClass("btn-info"); + }; + }); + }; + function simpleTemplating(data) { + var html = ''; + return html; + }; + function pagePredictions(task_id,model_id,id){ + button = document.getElementById("detailsbutton_"+id); + span = button.childNodes[1]; + if (span.className == "fa fa-caret-right"){ + span.className = "fa fa-caret-down"; + $('#data-container_'+id).removeClass("d-none"); + $('#data-container_'+id).show(); + $('#pager_'+id).show(); + $('#pager_'+id).pagination({ + dataSource: '#{to("/prediction/task/?predictions=")}' + task_id + '&model=' + model_id , + locator: 'prediction', + totalNumber: #{@compounds.size}, + pageSize: 1, + showPageNumbers: true, + showGoInput: true, + formatGoInput: 'go to <%= input %>', + formatAjaxError: function(jqXHR, textStatus, errorThrown) { + $('#data-container_'+id).html(errorThrown); + }, + /*ajax: { + beforeSend: function() { + $('#data-container_'+id).html('Loading content ...'); + } + },*/ + callback: function(data, pagination) { + var html = simpleTemplating(data); + $('#data-container_'+id).html(html); + //$('#data-container_'+id).css("min-height", $(window).height() + "px" ); + } + }); + } else if (span.className = "fa fa-caret-down"){ + span.className = "fa fa-caret-right"; + $('#data-container_'+id).hide(); + $('#pager_'+id).hide(); + }; + }; +%div.card + %a.btn.btn-warning{:href => to("/predict?tpid=#{@pid}")} + %span.fa.fa-caret-left{:aria=>{:hidden=>"true"}} New Prediction - %a.btn.btn-success{:id => "downbutton", :href=>"#{to("/predict/#{@tmppath}/#{@filename}")}", :title=>"download"} - %span.glyphicon.glyphicon-download-alt - Download CSV +%div.card.bg-light + %div.card-body + %h3.card-title="Batch prediction results for: #{@filename}" - / show file name - %topline - %div.row - %div.col-md-4 - %h3 Batch Prediction Results: - %div.col-md-8 - %h3= @filename - - / displays all prediction result in one table - %div.table-responsive - %table.table.table-bordered{:id=>"batch", :style=>"background-color:white;"} - %tbody - - if @warnings - - @warnings.each do |warning| - %tr - %td - %b Warning - %td - = warning.sub(/\b(tmp\/)\b/,"") - - @view.each do |compound, array| - %tr - %td{:style=>"vertical-align:top;"} - %p= compound.svg - %p= compound.smiles - - array.each do |model,prediction| - %td{:style=>"vertical-align:top;white-space:nowrap;"} - - model.model.class.to_s.match("Classification") ? type = "Classification" : type = "Regression" - - unit = model.unit - - %b{:class => "title"} - = "#{model.endpoint.gsub('_', ' ')} (#{model.species})" - - / check for prediction - - if prediction[:value] - %p - / show model type (classification|regression) - %b Type: - = type - %p - / check for database hit - - if prediction[:info] =~ /\b(identical)\b/i - - / show message about dbhit and measurements - %p - %b Compound is part of the training dataset - %p - %b Measured activity: - %br - - if prediction[:measurements].is_a?(Array) - = (type == "Regression") ? prediction[:measurements].collect{|value| "#{value.delog10.signif(3)} (#{unit})
#{compound.mmol_to_mg(value.delog10).signif(3)} #{unit =~ /mmol\/L/ ? "(mg/L)" : "(mg/kg_bw/day)"}"}.join("
") : prediction[:measurements].join(", ") - - else - = (type == "Regression") ? "#{prediction[:measurements].delog10.signif(3)} (#{unit})
#{compound.mmol_to_mg(prediction[:measurements].delog10).signif(3)} #{(unit =~ /\b(mmol\/L)\b/) ? "(mg/L)" : "(mg/kg_bw/day)"}" : prediction[:measurements] - - - / show prediction - %p - %b Prediction: - %br - = (type == "Regression") ? "#{prediction[:value].delog10.signif(3)} (#{unit})
#{compound.mmol_to_mg(prediction[:value].delog10).signif(3)} #{(unit =~ /\b(mmol\/L)\b/) ? "(mg/L)" : "(mg/kg_bw/day)"}" : prediction[:value] - - / show prediction interval or probability - %p - - if type == "Regression" - %b 95% Prediction interval: - - interval = (prediction[:prediction_interval].nil? ? nil : prediction[:prediction_interval]) - %br - = interval.nil? ? "" : "#{interval[1].delog10.signif(3)} - #{interval[0].delog10.signif(3)} (#{unit})" - %br - = "#{compound.mmol_to_mg(interval[1].delog10).signif(3)} - #{compound.mmol_to_mg(interval[0].delog10).signif(3)} #{(unit =~ /\b(mmol\/L)\b/) ? "(mg/L)" : "(mg/kg_bw/day)"}" if !prediction[:prediction_interval].nil? - - else - %b Probability: - - unless prediction[:probabilities].nil? - - probabilities = "" - - prediction[:probabilities].each{|k,v| probabilities += "#{k}: #{v.signif(3)}
"} - %br - = probabilities - / show warnings - %p - - if !prediction[:info].blank? - %b Info: - %br - %p=prediction[:info].sub(/\'.*\'/,"").sub(/,/, ",
") - - if !prediction[:warnings].blank? - %b Warnings: - - prediction[:warnings].uniq.each do |warning| - %br - %p=warning.sub(/substances/, "substances
").sub(/prediction\:/, "prediction\:
") - - / no prediction - - else - %br - - if !prediction[:info].blank? - %b Info: - %br - %p=prediction[:info].sub(/\'.*\'/,"").sub(/,/, ",
") - - if !prediction[:warnings].blank? - %b Warnings: - - prediction[:warnings].uniq.each do |warning| - %br - %p=warning.sub(/substances/, "substances
").sub(/prediction\:/, "prediction\:
") - %tr + - @models.each_with_index do |model,idx| + - m = Model::Validation.find model + - task = @tasks[idx].id + #result.caret.bg-light{:id=>idx} + %div.card-body + %div.row + %div.col-6 + %h5.card-title="#{m.endpoint} (#{m.species})" + #pager{:id=>idx} + %div.col-6 + %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"} + %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;"} + - # increase interval timer for large datasets + - ctimer = ((@compounds.size/1000) == 0 ? 1000 : ((@compounds.size/1000)*1000)) + :javascript + var timer = #{ctimer}; + $(document).ready(function(){ + // check button class before execute a task + if (#{idx} > 0){ + markers[#{idx}] = setInterval(function(){ + var button = document.getElementById("detailsbutton_#{idx-1}"); + if(!button.classList.contains('disabled')){ + renderTask('#{task}','#{model}',#{idx}); + } + }, timer ); + }else{ + markers[#{idx}] = setInterval(function(){ + renderTask('#{task}','#{model}',#{idx}); + }, timer ); + }; + }); + #data-container.card.d-none{:id=>idx} -- cgit v1.2.3 From 5a3be4190688bc8240327930b3e953b09ecc9d9e Mon Sep 17 00:00:00 2001 From: gebele Date: Tue, 28 May 2019 14:25:52 +0000 Subject: before clean up --- views/batch.haml | 51 ++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 46 insertions(+), 5 deletions(-) (limited to 'views/batch.haml') 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 + -- cgit v1.2.3 From 2d4782c4e8df908efa0973ee842593ead58d5980 Mon Sep 17 00:00:00 2001 From: gebele Date: Thu, 27 Jun 2019 08:37:33 +0000 Subject: use prediction to csv;edit info text --- views/batch.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'views/batch.haml') diff --git a/views/batch.haml b/views/batch.haml index fb317c9..d8e6862 100644 --- a/views/batch.haml +++ b/views/batch.haml @@ -128,7 +128,7 @@ - @models.each_with_index do |model,idx| - m = Model::Validation.find model - task = @tasks[idx].id - #result.caret.bg-light{:id=>idx} + #result.card.bg-light{:id=>idx} %div.card-body %div.row %div.col-6 -- cgit v1.2.3 From 86a45822c29cef7fb84871416427f96782e4ecf5 Mon Sep 17 00:00:00 2001 From: gebele Date: Fri, 5 Jul 2019 08:26:18 +0000 Subject: reorder validation statistics --- views/batch.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'views/batch.haml') diff --git a/views/batch.haml b/views/batch.haml index d8e6862..334d22e 100644 --- a/views/batch.haml +++ b/views/batch.haml @@ -118,7 +118,7 @@ }; }; %div.card - %a.btn.btn-warning{:href => to("/predict?tpid=#{@pid}")} + %a.btn.btn-outline-info{:href => to("/predict?tpid=#{@pid}")} %span.fa.fa-caret-left{:aria=>{:hidden=>"true"}} New Prediction %div.card.bg-light -- cgit v1.2.3 From 60aa817bdb08e4bcb769f4bee2834c23de9cd346 Mon Sep 17 00:00:00 2001 From: gebele Date: Wed, 10 Jul 2019 09:03:23 +0000 Subject: adjust approx task time --- views/batch.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'views/batch.haml') diff --git a/views/batch.haml b/views/batch.haml index 334d22e..6ac2a1b 100644 --- a/views/batch.haml +++ b/views/batch.haml @@ -27,9 +27,9 @@ var est = document.getElementById("est_"+id); var now = new Date().getTime(); if ( type == "true" ){ - var approximate = new Date(tasktime*1000 + #{@compounds_size*1000}); + var approximate = new Date(tasktime*1000 + #{@compounds_size*100}*(id+1)); } else { - var approximate = new Date(tasktime*1000 + #{@compounds_size*100}); + var approximate = new Date(tasktime*1000 + #{@compounds_size*1000}*(id+1)); } var remain = approximate - now; var minutes = Math.floor((remain % (1000 * 60 * 60)) / (1000 * 60)); -- cgit v1.2.3 From bcc618026db1ee7a030391853b55bbf6116ab89a Mon Sep 17 00:00:00 2001 From: gebele Date: Wed, 10 Jul 2019 09:57:07 +0000 Subject: moved batch js functions to lazar-gui.js --- views/batch.haml | 131 +++---------------------------------------------------- 1 file changed, 7 insertions(+), 124 deletions(-) (limited to 'views/batch.haml') diff --git a/views/batch.haml b/views/batch.haml index 6ac2a1b..c454ac7 100644 --- a/views/batch.haml +++ b/views/batch.haml @@ -1,122 +1,3 @@ -: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*100}*(id+1)); - } else { - var approximate = new Date(tasktime*1000 + #{@compounds_size*1000}*(id+1)); - } - 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(); - anHttpRequest.onreadystatechange = function() { - if (anHttpRequest.readyState == 4 && anHttpRequest.status == 200) - aCallback(anHttpRequest.responseText); - } - anHttpRequest.open( "GET", aUrl, true ); - anHttpRequest.send( null ); - } - }; - - var markers = []; - - function renderTask(task_id,model_id,id) { - var uri = "#{to("/prediction/task/?turi=")}" + task_id; - var aClient = new HttpClient(); - aClient.get(uri, function(res) { - var response = JSON.parse(res); - progress(response['percent'],id); - if (response['percent'] == 100){ - window.clearInterval(markers[id]); - $("a#downbutton_"+id).removeClass("disabled"); - $("a#detailsbutton_"+id).removeClass("disabled"); - $("a#downbutton_"+id).removeClass("btn-outline-info"); - $("a#detailsbutton_"+id).removeClass("btn-outline-info"); - $("a#downbutton_"+id).addClass("btn-info"); - $("a#detailsbutton_"+id).addClass("btn-info"); - }; - }); - }; - function simpleTemplating(data) { - var html = '
    '; - $.each(data, function(index, item){ - html += '
  • '+ item +'
  • '+'
    '; - }); - html += '
'; - return html; - }; - function pagePredictions(task_id,model_id,id){ - button = document.getElementById("detailsbutton_"+id); - span = button.childNodes[1]; - if (span.className == "fa fa-caret-right"){ - span.className = "fa fa-caret-down"; - $('#data-container_'+id).removeClass("d-none"); - $('#data-container_'+id).show(); - $('#pager_'+id).show(); - $('#pager_'+id).pagination({ - dataSource: '#{to("/prediction/task/?predictions=")}' + task_id, - locator: 'prediction', - totalNumber: '#{@compounds_size}', - pageSize: 1, - showPageNumbers: true, - showGoInput: true, - formatGoInput: 'go to <%= input %>', - formatAjaxError: function(jqXHR, textStatus, errorThrown) { - $('#data-container_'+id).html(errorThrown); - }, - /*ajax: { - beforeSend: function() { - $('#data-container_'+id).html('Loading content ...'); - } - },*/ - callback: function(data, pagination) { - var html = simpleTemplating(data); - $('#data-container_'+id).html(html); - //$('#data-container_'+id).css("min-height", $(window).height() + "px" ); - } - }); - } else if (span.className = "fa fa-caret-down"){ - span.className = "fa fa-caret-right"; - $('#data-container_'+id).hide(); - $('#pager_'+id).hide(); - }; - }; %div.card %a.btn.btn-outline-info{:href => to("/predict?tpid=#{@pid}")} %span.fa.fa-caret-left{:aria=>{:hidden=>"true"}} @@ -135,7 +16,7 @@ %h5.card-title="#{m.endpoint} (#{m.species})" #pager{:id=>idx} %div.col-6 - %a.btn.btn-outline-info.btn-sm.disabled{:id => "detailsbutton_#{idx}", :data=>{:toggle=>"collapse"}, :href=>"javascript:void(0)", :onclick=>"pagePredictions('#{task}','#{model}','#{idx}')"} + %a.btn.btn-outline-info.btn-sm.disabled{:id => "detailsbutton_#{idx}", :data=>{:toggle=>"collapse"}, :href=>"javascript:void(0)", :onclick=>"pagePredictions('#{to("/prediction/task/?predictions=#{task}")}','#{model}','#{idx}','#{@compounds_size}')"} %span.fa.fa-caret-right Details %a.btn.btn-outline-info.btn-sm.disabled{:id => "downbutton_#{idx}", :href=>"#{to("/predict/batch/download?tid=#{task}")}", :title=>"download"} @@ -150,20 +31,22 @@ :javascript var timer = #{ctimer}; var tasktime = #{task.generation_time.to_i}; + var compoundsSize = #{@compounds_size}; + var task_uri = "#{to("/prediction/task/?turi=#{task}")}"; $(document).ready(function(){ // check button class before execute a task if (#{idx} > 0){ markers[#{idx}] = setInterval(function(){ var button = document.getElementById("detailsbutton_#{idx-1}"); if(!button.classList.contains('disabled')){ - renderTask('#{task}','#{model}',#{idx}); - remaining(#{idx},tasktime); + renderTask(task_uri,'#{model}',#{idx}); + remaining(#{idx},tasktime,#{m.classification?},compoundsSize); } }, timer ); }else{ markers[#{idx}] = setInterval(function(){ - renderTask('#{task}','#{model}',#{idx}); - remaining(#{idx},tasktime,#{m.classification?}); + renderTask(task_uri,'#{model}',#{idx}); + remaining(#{idx},tasktime,#{m.classification?},compoundsSize); }, timer ); }; }); -- cgit v1.2.3 From 5490f6214f3a22216f7980c7d46f6d9fe10a4924 Mon Sep 17 00:00:00 2001 From: gebele Date: Thu, 11 Jul 2019 15:59:13 +0000 Subject: simplify js code;reorder js code; --- views/batch.haml | 53 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 22 deletions(-) (limited to 'views/batch.haml') diff --git a/views/batch.haml b/views/batch.haml index c454ac7..3f54772 100644 --- a/views/batch.haml +++ b/views/batch.haml @@ -6,9 +6,20 @@ %div.card-body %h3.card-title="Batch prediction results for: #{@filename}" + // prepare variable values for javascript + // increase timer interval for large datasets + - ctimer = ((@compounds_size/1000) == 0 ? 1000 : ((@compounds_size/1000)*1000)) + - approx = {} + - sum_approx = 0 + // process batch predictions - @models.each_with_index do |model,idx| - m = Model::Validation.find model - task = @tasks[idx].id + - tasktime = task.generation_time.to_i + // assume single compound prediction time: classification=0.1s,regression=0.5s + - task_approx = m.classification? ? (tasktime*1000 + @compounds_size*100) : (tasktime*1000 + @compounds_size*500) + - approx[idx] = task_approx + sum_approx + - sum_approx += (m.classification? ? @compounds_size*100 : @compounds_size*1000) #result.card.bg-light{:id=>idx} %div.card-body %div.row @@ -26,31 +37,29 @@ %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)) :javascript - var timer = #{ctimer}; - var tasktime = #{task.generation_time.to_i}; - var compoundsSize = #{@compounds_size}; - var task_uri = "#{to("/prediction/task/?turi=#{task}")}"; - $(document).ready(function(){ - // check button class before execute a task - if (#{idx} > 0){ - markers[#{idx}] = setInterval(function(){ - var button = document.getElementById("detailsbutton_#{idx-1}"); - if(!button.classList.contains('disabled')){ - renderTask(task_uri,'#{model}',#{idx}); - remaining(#{idx},tasktime,#{m.classification?},compoundsSize); - } - }, timer ); - }else{ - markers[#{idx}] = setInterval(function(){ - renderTask(task_uri,'#{model}',#{idx}); - remaining(#{idx},tasktime,#{m.classification?},compoundsSize); - }, timer ); - }; + $(document).ready(function() { + taskProgress('#{idx}','#{ctimer}','#{approx[idx]}','#{to("/prediction/task/?turi=#{task}")}'); }); #data-container.card.d-none.table-responsive{:id=>idx} + :javascript + taskProgress = function(idx,timer,approximate,task_uri){ + // wait until previous task is completed + if (idx > 0){ + markers[idx] = setInterval(function(){ + var button = document.getElementById("detailsbutton_"+(idx-1)); + if(!button.classList.contains('disabled')){ + renderTask(task_uri,idx); + remaining(idx,approximate); + } + }, timer ); + }else{ + markers[idx] = setInterval(function(){ + renderTask(task_uri,idx); + remaining(idx,approximate); + }, timer ); + }; + }; %div.modal.fade{:id=>"details", :tabindex=>"-1", :role=>"dialog"} %div.modal-dialog.modal-lg{:role=>"document"} %div.modal-content -- cgit v1.2.3 From 592fa64120e2712c46dd020fbda0c128c69467b7 Mon Sep 17 00:00:00 2001 From: gebele Date: Fri, 12 Jul 2019 10:50:51 +0000 Subject: kill task pid if page is reloaded --- views/batch.haml | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'views/batch.haml') diff --git a/views/batch.haml b/views/batch.haml index 3f54772..45997bf 100644 --- a/views/batch.haml +++ b/views/batch.haml @@ -1,3 +1,12 @@ +:javascript + // kill task pid if page is reloaded, `false` makes the request synchronous + window.addEventListener('unload', ktpid, false); + function ktpid() { + var client = new XMLHttpRequest(); + client.open("GET", "#{to("/prediction/task?ktpid=#{@pid}")}", false); + client.setRequestHeader("Content-Type", "application/json"); + client.send(null); + }; %div.card %a.btn.btn-outline-info{:href => to("/predict?tpid=#{@pid}")} %span.fa.fa-caret-left{:aria=>{:hidden=>"true"}} -- cgit v1.2.3 From a446fb2ecc8e7ab5f179d910a1f332c469dee35e Mon Sep 17 00:00:00 2001 From: gebele Date: Fri, 12 Jul 2019 11:51:32 +0000 Subject: assume approx prediction time --- views/batch.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'views/batch.haml') diff --git a/views/batch.haml b/views/batch.haml index 45997bf..4f82312 100644 --- a/views/batch.haml +++ b/views/batch.haml @@ -28,7 +28,7 @@ // assume single compound prediction time: classification=0.1s,regression=0.5s - task_approx = m.classification? ? (tasktime*1000 + @compounds_size*100) : (tasktime*1000 + @compounds_size*500) - approx[idx] = task_approx + sum_approx - - sum_approx += (m.classification? ? @compounds_size*100 : @compounds_size*1000) + - sum_approx += (m.classification? ? @compounds_size*100 : @compounds_size*500) #result.card.bg-light{:id=>idx} %div.card-body %div.row -- cgit v1.2.3 From 0908895b1ebc9d85a96b0d848dc357ba25e0e763 Mon Sep 17 00:00:00 2001 From: gebele Date: Fri, 12 Jul 2019 12:07:51 +0000 Subject: use wait animation instead approx prediction time --- views/batch.haml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'views/batch.haml') diff --git a/views/batch.haml b/views/batch.haml index 4f82312..f161125 100644 --- a/views/batch.haml +++ b/views/batch.haml @@ -42,10 +42,11 @@ %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=>"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 ... + %img.h2{:src=>"/images/wait30trans.gif", :id=>"circle_#{idx}", :class=>"circle", :alt=>"wait", :style=>"display:none;"} :javascript $(document).ready(function() { taskProgress('#{idx}','#{ctimer}','#{approx[idx]}','#{to("/prediction/task/?turi=#{task}")}'); @@ -59,13 +60,17 @@ var button = document.getElementById("detailsbutton_"+(idx-1)); if(!button.classList.contains('disabled')){ renderTask(task_uri,idx); - remaining(idx,approximate); + //remaining(idx,approximate); + $("#est_"+idx).hide(); + $("#circle_"+idx).show(); } }, timer ); }else{ markers[idx] = setInterval(function(){ renderTask(task_uri,idx); - remaining(idx,approximate); + //remaining(idx,approximate); + $("#est_"+idx).hide(); + $("#circle_"+idx).show(); }, timer ); }; }; -- cgit v1.2.3 From 807b87cf18b42c055e62c91e31b05a728a7fdd42 Mon Sep 17 00:00:00 2001 From: gebele Date: Mon, 29 Jul 2019 14:53:44 +0000 Subject: optimize batch table size; mute task progress js functions --- views/batch.haml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'views/batch.haml') diff --git a/views/batch.haml b/views/batch.haml index f161125..efb9b71 100644 --- a/views/batch.haml +++ b/views/batch.haml @@ -18,17 +18,17 @@ // prepare variable values for javascript // increase timer interval for large datasets - ctimer = ((@compounds_size/1000) == 0 ? 1000 : ((@compounds_size/1000)*1000)) - - approx = {} - - sum_approx = 0 + //- approx = {} + //- sum_approx = 0 // process batch predictions - @models.each_with_index do |model,idx| - m = Model::Validation.find model - task = @tasks[idx].id - - tasktime = task.generation_time.to_i + //- tasktime = task.generation_time.to_i // assume single compound prediction time: classification=0.1s,regression=0.5s - - task_approx = m.classification? ? (tasktime*1000 + @compounds_size*100) : (tasktime*1000 + @compounds_size*500) - - approx[idx] = task_approx + sum_approx - - sum_approx += (m.classification? ? @compounds_size*100 : @compounds_size*500) + //- task_approx = m.classification? ? (tasktime*1000 + @compounds_size*100) : (tasktime*1000 + @compounds_size*500) + //- approx[idx] = task_approx + sum_approx + //- sum_approx += (m.classification? ? @compounds_size*100 : @compounds_size*500) #result.card.bg-light{:id=>idx} %div.card-body %div.row @@ -49,11 +49,11 @@ %img.h2{:src=>"/images/wait30trans.gif", :id=>"circle_#{idx}", :class=>"circle", :alt=>"wait", :style=>"display:none;"} :javascript $(document).ready(function() { - taskProgress('#{idx}','#{ctimer}','#{approx[idx]}','#{to("/prediction/task/?turi=#{task}")}'); + taskProgress('#{idx}','#{ctimer}','#{to("/prediction/task/?turi=#{task}")}'); }); #data-container.card.d-none.table-responsive{:id=>idx} :javascript - taskProgress = function(idx,timer,approximate,task_uri){ + taskProgress = function(idx,timer,task_uri){ // wait until previous task is completed if (idx > 0){ markers[idx] = setInterval(function(){ -- cgit v1.2.3 From 1ffdd765fe4b4d9d80626070dea652fe467a2fa5 Mon Sep 17 00:00:00 2001 From: gebele Date: Thu, 1 Aug 2019 16:48:14 +0000 Subject: introduce task for upload and parse to dataset --- views/batch.haml | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) (limited to 'views/batch.haml') diff --git a/views/batch.haml b/views/batch.haml index efb9b71..2e48ec0 100644 --- a/views/batch.haml +++ b/views/batch.haml @@ -11,24 +11,26 @@ %a.btn.btn-outline-info{:href => to("/predict?tpid=#{@pid}")} %span.fa.fa-caret-left{:aria=>{:hidden=>"true"}} New Prediction +%div.card.bg-light{:id=>"uploadDataset"} + %div.card-body + %h3.card-title="Processing file #{@filename} to dataset." + %img.h2{:src=>"/images/wait30trans.gif", :id=>"circle_upload", :class=>"circle", :alt=>"processing"} + :javascript + uploadInterval = setInterval(function(){ + uploadDataset('#{to("/prediction/task/?turi=#{@upid}")}'); + }, 1000 ); + %div.card.bg-light %div.card-body %h3.card-title="Batch prediction results for: #{@filename}" // prepare variable values for javascript // increase timer interval for large datasets - - ctimer = ((@compounds_size/1000) == 0 ? 1000 : ((@compounds_size/1000)*1000)) - //- approx = {} - //- sum_approx = 0 + - ctimer = 1000#((@compounds_size/1000) == 0 ? 1000 : ((@compounds_size/1000)*1000)) // process batch predictions - @models.each_with_index do |model,idx| - m = Model::Validation.find model - task = @tasks[idx].id - //- tasktime = task.generation_time.to_i - // assume single compound prediction time: classification=0.1s,regression=0.5s - //- task_approx = m.classification? ? (tasktime*1000 + @compounds_size*100) : (tasktime*1000 + @compounds_size*500) - //- approx[idx] = task_approx + sum_approx - //- sum_approx += (m.classification? ? @compounds_size*100 : @compounds_size*500) #result.card.bg-light{:id=>idx} %div.card-body %div.row @@ -36,14 +38,12 @@ %h5.card-title="#{m.endpoint} (#{m.species})" #pager{:id=>idx} %div.col-6 - %a.btn.btn-outline-info.btn-sm.disabled{:id => "detailsbutton_#{idx}", :data=>{:toggle=>"collapse"}, :href=>"javascript:void(0)", :onclick=>"pagePredictions('#{to("/prediction/task/?predictions=#{task}")}','#{model}','#{idx}','#{@compounds_size}')"} + %a.btn.btn-outline-info.btn-sm.disabled{:id => "detailsbutton_#{idx}", :data=>{:toggle=>"collapse"}, :href=>"javascript:void(0)", :onclick=>"pagePredictions('#{to("/prediction/task/?predictions=#{task}")}','#{model}','#{idx}','#{to("/prediction/task/?turi=#{task}")}')"} %span.fa.fa-caret-right Details %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 ... %img.h2{:src=>"/images/wait30trans.gif", :id=>"circle_#{idx}", :class=>"circle", :alt=>"wait", :style=>"display:none;"} @@ -60,7 +60,6 @@ var button = document.getElementById("detailsbutton_"+(idx-1)); if(!button.classList.contains('disabled')){ renderTask(task_uri,idx); - //remaining(idx,approximate); $("#est_"+idx).hide(); $("#circle_"+idx).show(); } @@ -68,9 +67,14 @@ }else{ markers[idx] = setInterval(function(){ renderTask(task_uri,idx); - //remaining(idx,approximate); - $("#est_"+idx).hide(); - $("#circle_"+idx).show(); + // check that dataset parsing is completed + if (document.getElementById("uploadDataset")){ + $("#est_"+idx).show(); + $("#circle_"+idx).hide(); + } else { + $("#est_"+idx).hide(); + $("#circle_"+idx).show(); + } }, timer ); }; }; -- cgit v1.2.3 From b349cb51c4e46e1ae1bb309e9c589f1cff89e5af Mon Sep 17 00:00:00 2001 From: gebele Date: Fri, 2 Aug 2019 10:57:06 +0000 Subject: optimize upload task with wait for dataset id --- views/batch.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'views/batch.haml') diff --git a/views/batch.haml b/views/batch.haml index 2e48ec0..ed69819 100644 --- a/views/batch.haml +++ b/views/batch.haml @@ -26,7 +26,7 @@ // prepare variable values for javascript // increase timer interval for large datasets - - ctimer = 1000#((@compounds_size/1000) == 0 ? 1000 : ((@compounds_size/1000)*1000)) + - ctimer = 2000#((@compounds_size/1000) == 0 ? 1000 : ((@compounds_size/1000)*1000)) // process batch predictions - @models.each_with_index do |model,idx| - m = Model::Validation.find model -- cgit v1.2.3 From 1546e77e9b2796f20215caa23f06822c96be27ee Mon Sep 17 00:00:00 2001 From: gebele Date: Mon, 5 Aug 2019 09:48:54 +0000 Subject: ensure xhr requests are https to avoid mixed content issue in browsers --- views/batch.haml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'views/batch.haml') diff --git a/views/batch.haml b/views/batch.haml index ed69819..b03d1c7 100644 --- a/views/batch.haml +++ b/views/batch.haml @@ -3,12 +3,12 @@ window.addEventListener('unload', ktpid, false); function ktpid() { var client = new XMLHttpRequest(); - client.open("GET", "#{to("/prediction/task?ktpid=#{@pid}")}", false); + client.open("GET", '//#{ENV['VIRTUAL_HOST']}/prediction/task?ktpid=#{@pid}', false); client.setRequestHeader("Content-Type", "application/json"); client.send(null); }; %div.card - %a.btn.btn-outline-info{:href => to("/predict?tpid=#{@pid}")} + %a.btn.btn-outline-info{:href => "//#{ENV['VIRTUAL_HOST']}/predict?tpid=#{@pid}"} %span.fa.fa-caret-left{:aria=>{:hidden=>"true"}} New Prediction %div.card.bg-light{:id=>"uploadDataset"} @@ -17,7 +17,7 @@ %img.h2{:src=>"/images/wait30trans.gif", :id=>"circle_upload", :class=>"circle", :alt=>"processing"} :javascript uploadInterval = setInterval(function(){ - uploadDataset('#{to("/prediction/task/?turi=#{@upid}")}'); + uploadDataset('//#{ENV['VIRTUAL_HOST']}/prediction/task/?turi=#{@upid}'); }, 1000 ); %div.card.bg-light @@ -38,10 +38,10 @@ %h5.card-title="#{m.endpoint} (#{m.species})" #pager{:id=>idx} %div.col-6 - %a.btn.btn-outline-info.btn-sm.disabled{:id => "detailsbutton_#{idx}", :data=>{:toggle=>"collapse"}, :href=>"javascript:void(0)", :onclick=>"pagePredictions('#{to("/prediction/task/?predictions=#{task}")}','#{model}','#{idx}','#{to("/prediction/task/?turi=#{task}")}')"} + %a.btn.btn-outline-info.btn-sm.disabled{:id => "detailsbutton_#{idx}", :data=>{:toggle=>"collapse"}, :href=>"javascript:void(0)", :onclick=>"pagePredictions('//#{ENV['VIRTUAL_HOST']}/prediction/task/?predictions=#{task}','#{model}','#{idx}','//#{ENV['VIRTUAL_HOST']}/prediction/task/?turi=#{task}')"} %span.fa.fa-caret-right Details - %a.btn.btn-outline-info.btn-sm.disabled{:id => "downbutton_#{idx}", :href=>"#{to("/predict/batch/download?tid=#{task}")}", :title=>"download"} + %a.btn.btn-outline-info.btn-sm.disabled{:id => "downbutton_#{idx}", :href=>"//#{ENV['VIRTUAL_HOST']}/predict/batch/download?tid=#{task}", :title=>"download"} %span.fa.fa-download CSV %p{:id=>"est_#{idx}"} @@ -49,7 +49,7 @@ %img.h2{:src=>"/images/wait30trans.gif", :id=>"circle_#{idx}", :class=>"circle", :alt=>"wait", :style=>"display:none;"} :javascript $(document).ready(function() { - taskProgress('#{idx}','#{ctimer}','#{to("/prediction/task/?turi=#{task}")}'); + taskProgress('#{idx}','#{ctimer}','//#{ENV['VIRTUAL_HOST']}/prediction/task/?turi=#{task}'); }); #data-container.card.d-none.table-responsive{:id=>idx} :javascript -- cgit v1.2.3 From 185a6df5e09dc89a50f23858e9cb221aacca9327 Mon Sep 17 00:00:00 2001 From: gebele Date: Tue, 6 Aug 2019 09:39:09 +0000 Subject: start render task after file processing is finished --- views/batch.haml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'views/batch.haml') diff --git a/views/batch.haml b/views/batch.haml index b03d1c7..e0fc573 100644 --- a/views/batch.haml +++ b/views/batch.haml @@ -26,7 +26,7 @@ // prepare variable values for javascript // increase timer interval for large datasets - - ctimer = 2000#((@compounds_size/1000) == 0 ? 1000 : ((@compounds_size/1000)*1000)) + - ctimer = 10000#((@compounds_size/1000) == 0 ? 1000 : ((@compounds_size/1000)*1000)) // process batch predictions - @models.each_with_index do |model,idx| - m = Model::Validation.find model @@ -66,14 +66,16 @@ }, timer ); }else{ markers[idx] = setInterval(function(){ - renderTask(task_uri,idx); // check that dataset parsing is completed if (document.getElementById("uploadDataset")){ $("#est_"+idx).show(); $("#circle_"+idx).hide(); } else { - $("#est_"+idx).hide(); - $("#circle_"+idx).show(); + renderTask(task_uri,idx); + if ( $("#est_"+idx).is(":visible") ){ + $("#est_"+idx).hide(); + $("#circle_"+idx).show(); + } } }, timer ); }; -- cgit v1.2.3 From 498ad82d2cc8582d3139bf69a0fe333d6b425668 Mon Sep 17 00:00:00 2001 From: gebele Date: Thu, 8 Aug 2019 12:44:29 +0000 Subject: ensure dataset parser errors not hidden in a task; check upload by first header; remove_task_data, tasks, prediction dataset, training dataset; js code refinement --- views/batch.haml | 44 ++++---------------------------------------- 1 file changed, 4 insertions(+), 40 deletions(-) (limited to 'views/batch.haml') diff --git a/views/batch.haml b/views/batch.haml index e0fc573..4e1df05 100644 --- a/views/batch.haml +++ b/views/batch.haml @@ -11,22 +11,13 @@ %a.btn.btn-outline-info{:href => "//#{ENV['VIRTUAL_HOST']}/predict?tpid=#{@pid}"} %span.fa.fa-caret-left{:aria=>{:hidden=>"true"}} New Prediction -%div.card.bg-light{:id=>"uploadDataset"} - %div.card-body - %h3.card-title="Processing file #{@filename} to dataset." - %img.h2{:src=>"/images/wait30trans.gif", :id=>"circle_upload", :class=>"circle", :alt=>"processing"} - :javascript - uploadInterval = setInterval(function(){ - uploadDataset('//#{ENV['VIRTUAL_HOST']}/prediction/task/?turi=#{@upid}'); - }, 1000 ); - %div.card.bg-light %div.card-body - %h3.card-title="Batch prediction results for: #{@filename}" + %h3.card-title="Batch prediction results for: #{@filename}" // prepare variable values for javascript // increase timer interval for large datasets - - ctimer = 10000#((@compounds_size/1000) == 0 ? 1000 : ((@compounds_size/1000)*1000)) + - timer = 10000#((@compounds_size/1000) == 0 ? 1000 : ((@compounds_size/1000)*1000)) // process batch predictions - @models.each_with_index do |model,idx| - m = Model::Validation.find model @@ -38,7 +29,7 @@ %h5.card-title="#{m.endpoint} (#{m.species})" #pager{:id=>idx} %div.col-6 - %a.btn.btn-outline-info.btn-sm.disabled{:id => "detailsbutton_#{idx}", :data=>{:toggle=>"collapse"}, :href=>"javascript:void(0)", :onclick=>"pagePredictions('//#{ENV['VIRTUAL_HOST']}/prediction/task/?predictions=#{task}','#{model}','#{idx}','//#{ENV['VIRTUAL_HOST']}/prediction/task/?turi=#{task}')"} + %a.btn.btn-outline-info.btn-sm.disabled{:id => "detailsbutton_#{idx}", :data=>{:toggle=>"collapse"}, :href=>"javascript:void(0)", :onclick=>"pagePredictions('//#{ENV['VIRTUAL_HOST']}/prediction/task/?predictions=#{task}','#{model}','#{idx}','#{@compounds_size}')"} %span.fa.fa-caret-right Details %a.btn.btn-outline-info.btn-sm.disabled{:id => "downbutton_#{idx}", :href=>"//#{ENV['VIRTUAL_HOST']}/predict/batch/download?tid=#{task}", :title=>"download"} @@ -49,37 +40,10 @@ %img.h2{:src=>"/images/wait30trans.gif", :id=>"circle_#{idx}", :class=>"circle", :alt=>"wait", :style=>"display:none;"} :javascript $(document).ready(function() { - taskProgress('#{idx}','#{ctimer}','//#{ENV['VIRTUAL_HOST']}/prediction/task/?turi=#{task}'); + taskProgress('#{idx}','#{timer}','//#{ENV['VIRTUAL_HOST']}/prediction/task/?turi=#{task}'); }); #data-container.card.d-none.table-responsive{:id=>idx} :javascript - taskProgress = function(idx,timer,task_uri){ - // wait until previous task is completed - if (idx > 0){ - markers[idx] = setInterval(function(){ - var button = document.getElementById("detailsbutton_"+(idx-1)); - if(!button.classList.contains('disabled')){ - renderTask(task_uri,idx); - $("#est_"+idx).hide(); - $("#circle_"+idx).show(); - } - }, timer ); - }else{ - markers[idx] = setInterval(function(){ - // check that dataset parsing is completed - if (document.getElementById("uploadDataset")){ - $("#est_"+idx).show(); - $("#circle_"+idx).hide(); - } else { - renderTask(task_uri,idx); - if ( $("#est_"+idx).is(":visible") ){ - $("#est_"+idx).hide(); - $("#circle_"+idx).show(); - } - } - }, timer ); - }; - }; %div.modal.fade{:id=>"details", :tabindex=>"-1", :role=>"dialog"} %div.modal-dialog.modal-lg{:role=>"document"} %div.modal-content -- cgit v1.2.3 From 270bddf5081671cd1905d6cce6eb3659159f573a Mon Sep 17 00:00:00 2001 From: gebele Date: Fri, 16 Aug 2019 09:49:53 +0000 Subject: change hostname method --- views/batch.haml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'views/batch.haml') diff --git a/views/batch.haml b/views/batch.haml index 4e1df05..6bc2354 100644 --- a/views/batch.haml +++ b/views/batch.haml @@ -3,12 +3,12 @@ window.addEventListener('unload', ktpid, false); function ktpid() { var client = new XMLHttpRequest(); - client.open("GET", '//#{ENV['VIRTUAL_HOST']}/prediction/task?ktpid=#{@pid}', false); + client.open("GET", '//#{$host_with_port}/prediction/task?ktpid=#{@pid}', false); client.setRequestHeader("Content-Type", "application/json"); client.send(null); }; %div.card - %a.btn.btn-outline-info{:href => "//#{ENV['VIRTUAL_HOST']}/predict?tpid=#{@pid}"} + %a.btn.btn-outline-info{:href => "//#{$host_with_port}/predict?tpid=#{@pid}"} %span.fa.fa-caret-left{:aria=>{:hidden=>"true"}} New Prediction %div.card.bg-light @@ -29,10 +29,10 @@ %h5.card-title="#{m.endpoint} (#{m.species})" #pager{:id=>idx} %div.col-6 - %a.btn.btn-outline-info.btn-sm.disabled{:id => "detailsbutton_#{idx}", :data=>{:toggle=>"collapse"}, :href=>"javascript:void(0)", :onclick=>"pagePredictions('//#{ENV['VIRTUAL_HOST']}/prediction/task/?predictions=#{task}','#{model}','#{idx}','#{@compounds_size}')"} + %a.btn.btn-outline-info.btn-sm.disabled{:id => "detailsbutton_#{idx}", :data=>{:toggle=>"collapse"}, :href=>"javascript:void(0)", :onclick=>"pagePredictions('//#{$host_with_port}/prediction/task/?predictions=#{task}','#{model}','#{idx}','#{@compounds_size}')"} %span.fa.fa-caret-right Details - %a.btn.btn-outline-info.btn-sm.disabled{:id => "downbutton_#{idx}", :href=>"//#{ENV['VIRTUAL_HOST']}/predict/batch/download?tid=#{task}", :title=>"download"} + %a.btn.btn-outline-info.btn-sm.disabled{:id => "downbutton_#{idx}", :href=>"//#{$host_with_port}/predict/batch/download?tid=#{task}", :title=>"download"} %span.fa.fa-download CSV %p{:id=>"est_#{idx}"} @@ -40,7 +40,7 @@ %img.h2{:src=>"/images/wait30trans.gif", :id=>"circle_#{idx}", :class=>"circle", :alt=>"wait", :style=>"display:none;"} :javascript $(document).ready(function() { - taskProgress('#{idx}','#{timer}','//#{ENV['VIRTUAL_HOST']}/prediction/task/?turi=#{task}'); + taskProgress('#{idx}','#{timer}','//#{$host_with_port}/prediction/task/?turi=#{task}'); }); #data-container.card.d-none.table-responsive{:id=>idx} :javascript -- cgit v1.2.3