From 3624c63e3373cb45ffcc8cfdbb8889765a3b5326 Mon Sep 17 00:00:00 2001 From: Zachary Sloan Date: Thu, 7 Mar 2013 21:56:27 +0000 Subject: Have first 45% of progress bar working Changed "threaded" to True in runserver.py; this fixed issue related to getting progress bar to work --- wqflask/runserver.py | 1 + wqflask/utility/temp_data.py | 1 - .../new/javascript/show_trait_mapping_tools.coffee | 29 ++++++--- .../new/javascript/show_trait_mapping_tools.js | 70 +++++++++++++++++++++- wqflask/wqflask/templates/show_trait.html | 2 +- .../wqflask/templates/show_trait_progress_bar.html | 2 +- 6 files changed, 94 insertions(+), 11 deletions(-) (limited to 'wqflask') 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 @@ {% endfor %} - +
\ No newline at end of file -- cgit v1.2.3