Changeset 10816

Show
Ignore:
Timestamp:
08/05/11 14:33:13 (22 months ago)
Author:
edent
Message:

Add install/uninstall function and lists active waveforms

Location:
ossiedev/trunk/tools/cornetApps
Files:
8 modified

Legend:

Unmodified
Added
Removed
  • ossiedev/trunk/tools/cornetApps/HtmlPages/static/frames.js

    r10814 r10816  
    44    $(this).css('background-color', '#3e1'); 
    55  }); 
     6}); 
     7 
     8$(function closePage(){ 
     9  window.onbeforeunload=function(){ 
     10    return 'Please remember to uninstall ALL WAVEFORMS and scripts before leaving.';} 
    611}); 
    712 
     
    2126}); 
    2227 
    23 $(function closePage(){ 
    24   window.onbeforeunload=function(){ 
    25     return 'Please remember to uninstall ALL WAVEFORMS and scripts before leaving.';} 
     28$("#left_bottom").ready(function(){ 
     29        $("#apps").load("/running/"); 
    2630}); 
    2731 
     
    3640var tabsIdRightTop = '#right_top .tabs'; 
    3741 
    38 $("#right-top").ready(function(){ 
     42$("#right_top").ready(function(){ 
    3943     // Preload tab on page load 
    4044     if($(tabsIdRightTop + ' LI.current  A').length > 0){ 
     
    5357tabsIdRightBot = "#right_bottom .tabs" 
    5458 
    55 $("#right-bottom").ready(function(){ 
     59$("#right_bottom").ready(function(){ 
    5660     // Preload tab on page load 
    5761     if($(tabsIdRightBot + 'LI.current  A').length > 0){ 
     
    7781} 
    7882 
     83function install(waveform){ 
     84        $("#apps").load("/install/"+waveform); 
     85} 
     86 
     87function uninstall(waveform){ 
     88        $("#apps").load("/uninstall/"+waveform); 
     89} 
  • ossiedev/trunk/tools/cornetApps/HtmlPages/views.py

    r10814 r10816  
    6464        return render_to_response("HtmlPages/nodes.html", locals(), context_instance=RequestContext(request)) 
    6565 
    66 def waveforms(request): 
    67         ctrlr = Controller(False) 
    68         ctrlr.createWidgetContainer() 
    69         ctrlr.CORBAutils.init_CORBA(False) 
    70         ctrlr.buildModel() 
    71  
    72         availableList = ctrlr.model.getSystemWaveforms() 
    73  
    74         return render_to_response("HtmlPages/waveforms.html", locals(), context_instance=RequestContext(request)) 
    75  
    7666def register_page(request): 
    7767        if request.method == 'POST': 
     
    8878        variables = RequestContext(request, {'form':form}) 
    8979        return render_to_response('registration/register.html', variables)       
     80         
     81def buildWebDash(): 
     82        ctrlr = Controller(False) 
     83        ctrlr.createWidgetContainer() 
     84        ctrlr.CORBAutils.init_CORBA(False) 
     85        ctrlr.buildModel() 
     86        return ctrlr 
     87 
     88def waveforms(request): 
     89        ctrlr = buildWebDash() 
     90        availableList = ctrlr.model.getSystemWaveforms() 
     91        return render_to_response("HtmlPages/waveforms.html", locals(), context_instance=RequestContext(request)) 
     92 
     93def running_page(request): 
     94        ctrlr = buildWebDash() 
     95 
     96        availableList = ctrlr.model.getSystemWaveforms() 
     97        instancesList = []       
     98        instances = [] 
     99        for waveform in availableList: 
     100                instances = ctrlr.model.getInstanceWaveforms(waveform.getName()) 
     101                if instances: 
     102                        for instance in instances: 
     103                                instancesList.append(instance) 
     104         
     105        return render_to_response('HtmlPages/running.html', {'instancesList' : instancesList}) 
     106 
     107def install(request, waveform_to_install): 
     108        ctrlr = buildWebDash() 
     109        instance = ctrlr.installWaveform(waveform_to_install, True) 
     110        return running_page(request) 
     111         
     112def uninstall(request, instance_to_uninstall): 
     113        ctrlr = buildWebDash() 
     114        uninstall = ctrlr.uninstallWaveform(instance_to_uninstall) 
     115        return running_page(request) 
  • ossiedev/trunk/tools/cornetApps/templates/HtmlPages/ossie.html

    r10814 r10816  
    1515  <div id="left_bottom"> 
    1616   <p>Active Applications</p> 
     17   <div id="apps"></div> 
    1718  </div><!--end #left_bottom--> 
    1819 </div><!--end #column_left--> 
  • ossiedev/trunk/tools/cornetApps/templates/HtmlPages/running.html

    r10815 r10816  
    11{% if instancesList %} 
    2 <h1>Running Instances</h1> 
     2<!--<h1>Running Instances</h1>--> 
    33<table> 
    44        {% for instance in instancesList %} 
    55                <tr> 
    66                <td>    <a href='/WebDash/{{ instance.getName }}/display/'>{{ instance.getName }}</a>&nbsp;</td> 
    7                 <td>    <button onClick="window.location='/WebDash/{{ instance.getName }}/uninstall/'">Uninstall </button></td>                                  
     7                <!--<td>        <button onClick="window.location='/WebDash/{{ instance.getName }}/uninstall/'">Uninstall </button></td>--> 
     8                <td><button onClick="javascript:uninstall('{{ instance.getName }}');">Uninstall</button></td> 
    89                </tr> 
    910        {% endfor %} 
    1011</table> 
    1112{% else %} 
    12         <p>No waveforms currently running.<p> 
     13        <p>No running waveforms.<p> 
    1314{% endif %} 
  • ossiedev/trunk/tools/cornetApps/templates/HtmlPages/waveforms.html

    r10814 r10816  
    55  <tr> 
    66        <td>    {{ wave.getName }} &nbsp; </td> 
    7     <td>    <button onClick="window.location='/WebDash/{{ wave.getName }}/install/'">Install</button> </td> 
     7    <!--<td>    <button onClick="window.location='/WebDash/{{ wave.getName }}/install/'">Install</button> </td>--> 
     8    <td>    <button onClick="javascript:install('{{ wave.getName }}');">Install</button> </td> 
    89    {% endfor %} 
    910  </tr> 
    1011 </table> 
    1112{% else %} 
    12         <p>No waveforms currently running.</p> 
     13        <p>No available waveforms. Check if nodebooter is running.</p> 
    1314{% endif %} 
  • ossiedev/trunk/tools/cornetApps/urls.py

    r10786 r10816  
    2525        url(r'^waveforms/$', 'HtmlPages.views.waveforms'), 
    2626        url(r'^register/$', 'HtmlPages.views.register_page'), 
     27    url(r'^install/(?P<waveform_to_install>.*)/$', 'HtmlPages.views.install'), 
     28    url(r'^uninstall/(?P<instance_to_uninstall>.*)/', 'HtmlPages.views.uninstall'), 
     29    url(r'^running/$', 'HtmlPages.views.running_page'), 
    2730 
    2831    # url(r'^cornetApps/', include('cornetApps.foo.urls')),