Changeset 6909 for cows_wps


Ignore:
Timestamp:
29/05/10 08:17:38 (9 years ago)
Author:
astephen
Message:

updated it so it works. Needs finessing, doesn't show percent complete
yet.

Location:
cows_wps/trunk/cows_wps
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cows_wps/trunk/cows_wps/controllers/jobviewer.py

    r6908 r6909  
    5555<div id="view_container" style="background: white; border: 2px outset blue; padding: 5px;"> 
    5656        <div id="view_contents"> 
    57                 <div id="table_view" style="visibility: visible; height: auto;">%s</div>""" % (job_as_table) 
     57                <div id="table_view" style="visibility: visible; height: auto;"><div id="poll_info" class="poller"></div>%s</div>""" % (job_as_table) 
    5858 
    5959        if self.status == "complete": 
     
    6565        elif self.status == "running": 
    6666            jobviewer_url = url_for(controller='jobviewer', status_url = status_url) 
    67  
    6867            base_url = "http://" + request.url[7:].split("/")[0] 
    6968            full_url = base_url + jobviewer_url 
    7069 
    71             resp += """<input type="hidden" id="poll_url" value="%s" />""" % full_url  
    72             resp += """<div id="poll_info">Polling here...</div>""" 
    73             resp += """<script type="text/javascript">pollWPS()</script>""" 
     70            resp += """<input type="hidden" id="poll_url" value="%s" />""" % status_url  
     71            resp += """<input type="hidden" id="jobviewer_url" value="%s" />""" % jobviewer_url 
     72#            resp += """<div id="poll_info">Polling here...</div>""" 
     73            resp += """<script type="text/javascript"> 
     74        function init() { 
     75                pollWPS(); 
     76        } 
     77 
     78</script>""" 
    7479# </form>""" % (submitter_url, urllib.unquote(wps_request_url)) 
    7580 
  • cows_wps/trunk/cows_wps/public/js/ui/jobviewer_utils.js

    r6908 r6909  
    4040function pollWPS() { 
    4141        // Inform that request is being made 
    42         $("#poll_info").append('<span style="color: blue;">contacting the server now...</span>'); 
     42        $("#poll_info").html('Your job is currently running. This page will poll the server for an update.'); 
    4343 
    4444        // Set up AJAX call 
     
    5050        }); 
    5151 
    52         $("#poll_info").append("Sent ajax request."); 
     52        $("#poll_info").append("...Sent ajax request."); 
     53} 
    5354 
    5455 
    55 function parsePollResponse(xml) 
    56 { 
    57     alert("GOT RESPONSE"); 
     56function parsePollResponse(xml) { 
    5857    $(xml).find("ProcessSucceeded").each(function() 
    5958    { 
    60         alert("FOUND IT"); 
    61         $("#poll_info").html("The job has completed! Re-loading page in 3 seconds..."); 
    62         setTimeout("window.location = $('#poll_url').val();", 3000);  
     59        $("#poll_info").html("The job has completed! This page will re-load in 3 seconds."); 
     60        setTimeout("window.location = $('#jobviewer_url').val();", 3000);  
     61        return; 
    6362    }); 
    6463 
    65     $("#poll_info").html("Polling again..."); 
    66     setTimeout("pollWPS();", 10000);  
     64    $(xml).find("ProcessFailed").each(function() 
     65    { 
     66        $("#poll_info").html("THIS JOB HAS FAILED. PLEASE CONTACT THE ADMINISTRATOR."); 
     67        return; 
     68    }); 
     69 
     70// ProcessStarted percentCompleted="$percent" 
     71    var pc; 
     72    $(xml).find("ProcessStarted").each(function() 
     73    { 
     74        pc = $(this).attr("percentComplete");  
     75        $("#poll_info").html("Your job is currently running. The job is " + pc + "% complete."); 
     76    }); 
     77 
     78 
     79    // Assume we found ProcessStarted or ProcessAccepted so keep polling 
     80    $("#poll_info").append("...Polling again in 5 seconds..."); 
     81    setTimeout("pollWPS();", 5000);  
    6782} 
    68  
  • cows_wps/trunk/cows_wps/public/style/wps_ui.css

    r6903 r6909  
    140140} 
    141141 
     142.poller { 
     143        background-color: orange; 
     144        color: blue; 
     145} 
Note: See TracChangeset for help on using the changeset viewer.