diff --git a/kadmos/interface/interface.py b/kadmos/interface/interface.py index 36288398a1d263184147b850d118cc974f7304a1..4e97867531161d8bd1f0e290b0053518bb69f3a1 100644 --- a/kadmos/interface/interface.py +++ b/kadmos/interface/interface.py @@ -143,26 +143,11 @@ def view(temp_id=None, action=None, error=None, message=None): if action == 'vispack': os.chdir(temp_dir) if not os.path.exists(os.path.join(temp_dir, 'vispack.zip')) or reset: - graph.create_visualization_package(os.path.join(temp_dir, 'vispack'), - MPG=mpg, - compress=True, - order=function_order, - progress_path=os.path.join(temp_dir, 'vispack.progress')) + graph.vispack_create(os.path.join(temp_dir, 'vispack'), + mpg=mpg, + compress=True, + function_order=function_order) return send_file(os.path.join(temp_dir, 'vispack.zip'), as_attachment=True) - if action == 'vispackstatus': - def get_status(): - status = '0' - progress_path = os.path.join(temp_dir, 'vispack.progress') - while status != 'done': - time.sleep(1) - try: - f = open(progress_path, 'r') - status = f.read() - f.close() - except OSError: - pass - yield "data:" + str(status) + "\n\n" - return Response(get_status(), mimetype='text/event-stream') if action == 'delete': try: shutil.rmtree(temp_dir) diff --git a/kadmos/interface/templates/view.html b/kadmos/interface/templates/view.html index c36a7cd190a7184bf8807959434e64a9b3c67af9..c7b036ada01b6644370e65f9b811026447fe2962 100644 --- a/kadmos/interface/templates/view.html +++ b/kadmos/interface/templates/view.html @@ -59,9 +59,6 @@ <a onclick="vispack()" id="vispack"> <div class="panel-body"> <div class="pull-left">Create</div> - <div class="pull-left progress progress-vispack"> - <div class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0;"></div> - </div> <span class="pull-right"> <span class="glyphicon glyphicon-arrow-right" aria-hidden="true"></span></span> <div class="clearfix"></div> @@ -149,17 +146,6 @@ Morris.Bar({ }); </script> <script> -// Streaming logic -function vispackstatus() { - var source = new EventSource("{{ temp_id }}/vispackstatus"); - source.onmessage = function(event) { - if (event.data == 'done') {event.target.close();} - $('.progress-bar').css('width', event.data+'%').attr('aria-valuenow', event.data); - }; - return true; -} -</script> -<script> // Settings logic jQuery(document).ready(function($) { // Clone relevant divs @@ -248,11 +234,8 @@ function vispack() { var vispack_elem = $("#vispack"); vispack_elem.find('.pull-left').not('.progress').html('A dynamic (X)DSM HTML package is currently being created. This might take a while...'); vispack_elem.find('.pull-right').html('<span class="glyphicon glyphicon-refresh spin" aria-hidden="true"></span>'); - $(".progress-vispack").show(); - vispackstatus(); }, success:function(){ - $(".progress-vispack").hide(); var vispack_elem = $("#vispack"); vispack_elem.find('.pull-left').not('.progress').html('A dynamic (X)DSM HTML package was successfully created. Click here to download it.'); vispack_elem.find('.pull-right').html('<span class="glyphicon glyphicon-ok" aria-hidden="true"></span>'); @@ -260,7 +243,6 @@ function vispack() { vispack_elem.removeAttr('onclick'); }, error:function(){ - $(".progress-vispack").hide(); var vispack_elem = $("#vispack"); vispack_elem.find('.pull-left').not('.progress').html('A dynamic (X)DSM HTML package package could not be created created. Click here to try again with detailed error messages it.'); vispack_elem.find('.pull-right').html('<span class="glyphicon glyphicon-remove" aria-hidden="true"></span>');