diff options
author | Zachary Sloan | 2013-03-07 21:56:27 +0000 |
---|---|---|
committer | Zachary Sloan | 2013-03-07 21:56:27 +0000 |
commit | 3624c63e3373cb45ffcc8cfdbb8889765a3b5326 (patch) | |
tree | 9d624d5359a8c094152493df1e319dc71778946a | |
parent | 855a586f82fd1774358d8cfde28ce067f1c6c2ae (diff) | |
download | genenetwork2-3624c63e3373cb45ffcc8cfdbb8889765a3b5326.tar.gz |
Have first 45% of progress bar working
Changed "threaded" to True in runserver.py; this fixed issue
related to getting progress bar to work
-rw-r--r-- | wqflask/runserver.py | 1 | ||||
-rw-r--r-- | wqflask/utility/temp_data.py | 1 | ||||
-rw-r--r-- | wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.coffee | 29 | ||||
-rw-r--r-- | wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js | 70 | ||||
-rw-r--r-- | wqflask/wqflask/templates/show_trait.html | 2 | ||||
-rw-r--r-- | wqflask/wqflask/templates/show_trait_progress_bar.html | 2 |
6 files changed, 94 insertions, 11 deletions
diff --git a/wqflask/runserver.py b/wqflask/runserver.py index 2a75faeb..1cf38f8e 100644 --- a/wqflask/runserver.py +++ b/wqflask/runserver.py @@ -29,4 +29,5 @@ logging_tree.printout() app.run(host='0.0.0.0', use_debugger=False, + threaded=True, use_reloader=True) diff --git a/wqflask/utility/temp_data.py b/wqflask/utility/temp_data.py index 192dcc44..0df79e54 100644 --- a/wqflask/utility/temp_data.py +++ b/wqflask/utility/temp_data.py @@ -19,7 +19,6 @@ class TempData(object): return self.redis.hgetall(self.key) - if __name__ == "__main__": redis = Redis() for key in redis.keys(): diff --git a/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.coffee b/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.coffee index 50b97171..35572f67 100644 --- a/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.coffee +++ b/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.coffee @@ -11,14 +11,26 @@ $ -> $("#trait_data_form").attr("action", url); $("#trait_data_form").submit() - get_progress () => + get_progress = -> console.log("temp_uuid:", $("#temp_uuid").val()) - + temp_uuid = $("#temp_uuid").val() + params = { key:temp_uuid } + params_str = $.param(params) + url = "/get_temp_data?" + params_str + console.log("url:", url) + $.ajax( + type: "GET" + url: url + success: (progress_data) => + console.log("in get_progress data:", progress_data) + console.log(progress_data['percent_complete'] + "%") + $('#marker_regression_progress').css("width", progress_data['percent_complete'] + "%") + ) + return false + $("#marker_regression").click(() => $("#progress_bar_container").modal() - - get_progress() - + url = "/marker_regression" form_data = $('#trait_data_form').serialize() console.log("form_data is:", form_data) @@ -27,12 +39,15 @@ $ -> url: url data: form_data success: (data) => + clearInterval(this.my_timer) $('#progress_bar_container').modal('hide') $("body").html(data) ) + console.log("settingInterval") + this.my_timer = setInterval(get_progress, 1000) return false ) - + #$(".submit_special").click(submit_special) composite_mapping_fields = -> @@ -51,4 +66,4 @@ $ -> $("#display_all_lrs").change(-> toggle_enable_disable("#suggestive_lrs") - )
\ No newline at end of file + );
\ No newline at end of file diff --git a/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js b/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js index c8b0aa7b..78459692 100644 --- a/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js +++ b/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js @@ -1,6 +1,74 @@ // Generated by CoffeeScript 1.4.0 (function() { - + $(function() { + var composite_mapping_fields, get_progress, submit_special, toggle_enable_disable, + _this = this; + submit_special = function() { + var url; + console.log("In submit_special"); + console.log("this is:", this); + console.log("$(this) is:", $(this)); + url = $(this).data("url"); + console.log("url is:", url); + $("#trait_data_form").attr("action", url); + return $("#trait_data_form").submit(); + }; + get_progress = function() { + var params, params_str, temp_uuid, url, + _this = this; + console.log("temp_uuid:", $("#temp_uuid").val()); + temp_uuid = $("#temp_uuid").val(); + params = { + key: temp_uuid + }; + params_str = $.param(params); + url = "/get_temp_data?" + params_str; + console.log("url:", url); + $.ajax({ + type: "GET", + url: url, + success: function(progress_data) { + console.log("in get_progress data:", progress_data); + console.log(progress_data['percent_complete'] + "%"); + return $('#marker_regression_progress').css("width", progress_data['percent_complete'] + "%"); + } + }); + return false; + }; + $("#marker_regression").click(function() { + var form_data, url; + $("#progress_bar_container").modal(); + url = "/marker_regression"; + form_data = $('#trait_data_form').serialize(); + console.log("form_data is:", form_data); + $.ajax({ + type: "POST", + url: url, + data: form_data, + success: function(data) { + clearInterval(_this.my_timer); + $('#progress_bar_container').modal('hide'); + return $("body").html(data); + } + }); + console.log("settingInterval"); + _this.my_timer = setInterval(get_progress, 1000); + return false; + }); + composite_mapping_fields = function() { + return $(".composite_fields").toggle(); + }; + $("#use_composite_choice").change(composite_mapping_fields); + toggle_enable_disable = function(elem) { + return $(elem).prop("disabled", !$(elem).prop("disabled")); + }; + $("#choose_closet_control").change(function() { + return toggle_enable_disable("#control_locus"); + }); + return $("#display_all_lrs").change(function() { + return toggle_enable_disable("#suggestive_lrs"); + }); + }); }).call(this); diff --git a/wqflask/wqflask/templates/show_trait.html b/wqflask/wqflask/templates/show_trait.html index 2d569b20..d8f44d53 100644 --- a/wqflask/wqflask/templates/show_trait.html +++ b/wqflask/wqflask/templates/show_trait.html @@ -22,7 +22,7 @@ <input type="hidden" name="{{ key }}" value="{{ hddn[key] }}"> {% endfor %} - <input type="hidden" name="temp_uuid" value="{{ temp_uuid }}"> + <input type="hidden" name="temp_uuid" id="temp_uuid" value="{{ temp_uuid }}"> <div class="container"> <div class="page-header"> diff --git a/wqflask/wqflask/templates/show_trait_progress_bar.html b/wqflask/wqflask/templates/show_trait_progress_bar.html index a7ee2195..2984cc02 100644 --- a/wqflask/wqflask/templates/show_trait_progress_bar.html +++ b/wqflask/wqflask/templates/show_trait_progress_bar.html @@ -4,7 +4,7 @@ </div> <div class="modal-body"> <div class="progress progress-striped active"> - <div class="bar" style="width: 100%;"></div> + <div id="marker_regression_progress" class="bar"></div> </div> </div> </div>
\ No newline at end of file |