Changeset 10817

Show
Ignore:
Timestamp:
08/05/11 15:32:41 (23 months ago)
Author:
edent
Message:

edit Jason's WebDash? app to use for the Django/JQuery interface

Location:
ossiedev/trunk/tools/cornetApps
Files:
6 added
10 modified

Legend:

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

    r10816 r10817  
    2121      $("#waveform").click(function(){ 
    2222          //$("#workspace").load($("#console a").attr("href")); 
    23           $("#workspace").load("/waveforms/"); 
     23          $("#workspace").load("/WebDash/waveforms/"); 
    2424     }); 
    2525    }); 
     
    2727 
    2828$("#left_bottom").ready(function(){ 
    29         $("#apps").load("/running/"); 
    30 }); 
    31  
    32 $(function ajax(){ 
    33 //load console in workspace 
    34   $('#console').click(function(){ 
    35     $('#workspace').load('/grid/'); 
    36   }); 
     29        $("#apps").load("/WebDash/running/"); 
    3730}); 
    3831 
     
    8275 
    8376function install(waveform){ 
    84         $("#apps").load("/install/"+waveform); 
     77        $("#apps").load("/WebDash/install/"+waveform); 
    8578} 
    8679 
    8780function uninstall(waveform){ 
    88         $("#apps").load("/uninstall/"+waveform); 
     81        $("#apps").load("/WebDash/uninstall/"+waveform); 
    8982} 
  • ossiedev/trunk/tools/cornetApps/HtmlPages/views.py

    r10816 r10817  
    7878        variables = RequestContext(request, {'form':form}) 
    7979        return render_to_response('registration/register.html', variables)       
    80          
    81 def buildWebDash(): 
    82         ctrlr = Controller(False) 
    83         ctrlr.createWidgetContainer() 
    84         ctrlr.CORBAutils.init_CORBA(False) 
    85         ctrlr.buildModel() 
    86         return ctrlr 
    87  
    88 def waveforms(request): 
    89         ctrlr = buildWebDash() 
    90         availableList = ctrlr.model.getSystemWaveforms() 
    91         return render_to_response("HtmlPages/waveforms.html", locals(), context_instance=RequestContext(request)) 
    92  
    93 def 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  
    107 def install(request, waveform_to_install): 
    108         ctrlr = buildWebDash() 
    109         instance = ctrlr.installWaveform(waveform_to_install, True) 
    110         return running_page(request) 
    111          
    112 def uninstall(request, instance_to_uninstall): 
    113         ctrlr = buildWebDash() 
    114         uninstall = ctrlr.uninstallWaveform(instance_to_uninstall) 
    115         return running_page(request) 
  • ossiedev/trunk/tools/cornetApps/WebDash/views.py

    r10771 r10817  
    99import wavedash.src.WaveformModel 
    1010 
    11 def index(request):      
     11def buildController(): 
    1212        ctrlr = Controller(False) 
    1313        ctrlr.createWidgetContainer() 
    1414        ctrlr.CORBAutils.init_CORBA(False) 
    1515        ctrlr.buildModel() 
     16        return ctrlr 
     17 
     18def waveforms(request): 
     19        ctrlr = buildController() 
     20        availableList = ctrlr.model.getSystemWaveforms() 
     21        return render_to_response("WebDash/waveforms.html", locals(), context_instance=RequestContext(request)) 
     22         
     23def index(request):      
     24        ctrlr = buildController() 
    1625 
    1726        availableList = ctrlr.model.getSystemWaveforms() 
     
    2837                                                          {'availableList' : availableList, 'instancesList' : instancesList}) 
    2938 
     39def running_page(request): 
     40        ctrlr = buildController() 
    3041 
    31 def install(request, waveform): 
    32         ctrlr = Controller(False) 
    33         ctrlr.createWidgetContainer() 
    34         ctrlr.CORBAutils.init_CORBA(False) 
    35         ctrlr.buildModel() 
     42        availableList = ctrlr.model.getSystemWaveforms() 
     43        instancesList = []       
     44        instances = [] 
     45        for waveform in availableList: 
     46                instances = ctrlr.model.getInstanceWaveforms(waveform.getName()) 
     47                if instances: 
     48                        for instance in instances: 
     49                                instancesList.append(instance) 
     50         
     51        return render_to_response('WebDash/running.html', {'instancesList' : instancesList}) 
    3652 
    37         instance = ctrlr.installWaveform(waveform, True) 
     53def install(request, waveform_to_install): 
     54        ctrlr = buildController() 
     55 
     56        instance = ctrlr.installWaveform(waveform_to_install, True) 
    3857        if instance:     
    3958                message = 'Install Successful' 
     
    4160                message = 'Install Unsuccessful' 
    4261 
    43         link = '/WebDash/' 
    44         return render_to_response('WebDash/message.html',  
    45                                                           {'message' : message, 'link' : link}) 
     62        #link = '/WebDash/' 
     63        #return render_to_response('WebDash/message.html', {'message' : message, 'link' : link}) 
     64        return running_page(request) 
    4665 
    4766 
    4867def display(request, instance): 
    49         ctrlr = Controller(False) 
    50         ctrlr.createWidgetContainer() 
    51         ctrlr.CORBAutils.init_CORBA(False) 
    52         ctrlr.buildModel() 
     68        ctrlr = buildController() 
     69         
    5370        instance = ctrlr.model.getWaveform(instance, wavedash.src.WaveformModel.INSTANCE_WAVEFORM) 
    54  
    5571 
    5672        return render_to_response('WebDash/display.html',  
    5773                                                          {'instance' : instance}, context_instance=RequestContext(request))     
    5874 
    59 def uninstall(request, instance): 
    60         ctrlr = Controller(False) 
    61         ctrlr.createWidgetContainer() 
    62         ctrlr.CORBAutils.init_CORBA(False) 
    63         ctrlr.buildModel() 
     75def uninstall(request, instance_to_uninstall): 
     76        ctrlr = buildController() 
    6477 
    65         uninstall = ctrlr.uninstallWaveform(instance) 
     78        uninstall = ctrlr.uninstallWaveform(instance_to_uninstall) 
    6679        if uninstall: 
    6780                message = 'Uninstall Successful' 
     
    6982                message = 'Uninstall Not Successful' 
    7083 
    71         link = '/WebDash/' 
    72         return render_to_response('WebDash/message.html',  
    73                                                           {'message' : message, 'link' : link}) 
     84        #link = '/WebDash/' 
     85        #return render_to_response('WebDash/message.html', {'message' : message, 'link' : link}) 
     86        return running_page(request) 
    7487 
    7588def configure(request): 
    76         ctrlr = Controller(False) 
    77         ctrlr.createWidgetContainer() 
    78         ctrlr.CORBAutils.init_CORBA(False) 
    79         ctrlr.buildModel() 
     89        ctrlr = buildController() 
    8090        if request.method == 'POST': 
    8191                waveName = request.POST['waveform'] 
     
    113123                                                                {'message' : message, 'link' : link}, context_instance=RequestContext(request)) 
    114124         
    115          
    116          
    117          
  • ossiedev/trunk/tools/cornetApps/static/frames.css

    r10787 r10817  
    9999} 
    100100  
    101 #tabs-container { 
     101.tabs-container { 
    102102        padding: 5px 0px; 
    103103        position: relative; 
    104104} 
    105105 
     106.loading { 
     107        position: relative; 
     108        background: url('loading.gif') no-repeat; 
     109        margin-left: auto; 
     110        margin-right: auto; 
     111        display: block; 
     112} 
    106113.navigation{ 
    107114        position: relative; 
  • ossiedev/trunk/tools/cornetApps/static/frames.js

    r10814 r10817  
    33    $(this).parent().children().css('background-color', 'white'); 
    44    $(this).css('background-color', '#3e1'); 
    5   }); 
    6 }); 
    7  
    8 $(function loadNodeMenu(){ 
    9   $('#load').click(function(){ 
    10     $('#directory').load('/nodeMenu/', function(){ 
    11     //slide menu 
    12       $('#menu ul').hide(); 
    13       $('#menu li a').click(function(){ 
    14         $(this).next().slideToggle('fast'); 
    15       }); 
    16     }); 
    175  }); 
    186}); 
     
    2311}); 
    2412 
     13$("#menu").ready(function(){ 
     14        $('#directory').load('/nodeMenu/', function(){ 
     15    //slide menu 
     16      $('#menu ul').hide(); 
     17      $('#menu li a').click(function(){ 
     18        $(this).next().slideToggle('fast'); 
     19      }); 
     20    //load workspace 
     21      $("#waveform").click(function(){ 
     22          //$("#workspace").load($("#console a").attr("href")); 
     23          $("#workspace").load("/waveforms/"); 
     24     }); 
     25    }); 
     26}); 
     27 
     28$("#left_bottom").ready(function(){ 
     29        $("#apps").load("/running/"); 
     30}); 
     31 
    2532$(function ajax(){ 
    2633//load console in workspace 
    2734  $('#console').click(function(){ 
    28     $('#workspace').load('/WebDash/'); 
     35    $('#workspace').load('/grid/'); 
    2936  }); 
    3037}); 
    3138 
    32 var viewContainer = "#view"; 
    33 var tabsId = '.tabs'; 
    34 $("#right-top").ready(function(){ 
     39var viewContainerRightTop = "#view"; 
     40var tabsIdRightTop = '#right_top .tabs'; 
     41 
     42$("#right_top").ready(function(){ 
    3543     // Preload tab on page load 
    36      if($(tabsId + 'LI.current  A').length > 0){ 
    37           loadTab($(tabsId + ' LI.current A'), "#view"); 
     44     if($(tabsIdRightTop + ' LI.current  A').length > 0){ 
     45          loadTab($(tabsIdRightTop + ' LI.current A'), viewContainerRightTop); 
    3846     } 
    39      $(tabsId + ' A').click(function(){ 
     47     $(tabsIdRightTop + ' A').click(function(){ 
    4048          if($(this).parent().hasClass('current')){ return false; } 
    41           $(tabsId + ' LI.current').removeClass('current'); 
     49          $(tabsIdRightTop + ' LI.current').removeClass('current'); 
    4250          $(this).parent().addClass('current'); 
    43           loadTab($(this), "#view"); 
     51          loadTab($(this), viewContainerRightTop); 
    4452          return false; 
    4553     }); 
    4654}); 
     55 
     56viewContainerRightBot = "#workspace"; 
     57tabsIdRightBot = "#right_bottom .tabs" 
     58 
     59$("#right_bottom").ready(function(){ 
     60     // Preload tab on page load 
     61     if($(tabsIdRightBot + 'LI.current  A').length > 0){ 
     62          loadTab($(tabsIdRightBot + ' LI.current A'), viewContainerRightBot); 
     63     } 
     64     $(tabsIdRightBot + ' A').click(function(){ 
     65          if($(this).parent().hasClass('current')){ return false; } 
     66          $(tabsIdRightBot + ' LI.current').removeClass('current'); 
     67          $(this).parent().addClass('current'); 
     68          loadTab($(this), viewContainerRightBot); 
     69          return false; 
     70     }); 
     71}); 
     72 
    4773function loadTab(tabObj, container){ 
    4874     if(!tabObj || !tabObj.length){ return; } 
     
    5581} 
    5682 
     83function install(waveform){ 
     84        $("#apps").load("/install/"+waveform); 
     85} 
     86 
     87function uninstall(waveform){ 
     88        $("#apps").load("/uninstall/"+waveform); 
     89} 
  • ossiedev/trunk/tools/cornetApps/templates/HtmlPages/running.html

    r10816 r10817  
    1111</table> 
    1212{% else %} 
    13         <p>No running waveforms.<p> 
     13        <p>No waveforms are currently running.  If they should be, check if node booter is running.<p> 
    1414{% endif %} 
  • ossiedev/trunk/tools/cornetApps/templates/HtmlPages/waveforms.html

    r10816 r10817  
    55  <tr> 
    66        <td>    {{ wave.getName }} &nbsp; </td> 
    7     <!--<td>    <button onClick="window.location='/WebDash/{{ wave.getName }}/install/'">Install</button> </td>--> 
    87    <td>    <button onClick="javascript:install('{{ wave.getName }}');">Install</button> </td> 
    98    {% endfor %} 
  • ossiedev/trunk/tools/cornetApps/templates/WebDash/index.html

    r10774 r10817  
    1010        <tr> 
    1111        <td>    {{ wave.getName }} &nbsp; </td> 
    12     <td>    <button onClick="window.location='/WebDash/{{ wave.getName }}/install/'">Install</button> </td> 
     12    <td>    <button onClick="window.location='/WebDash/install/{{ wave.getName }}/'">Install</button> </td> 
    1313    {% endfor %} 
    1414    </tr> 
     
    2121                <tr> 
    2222                <td>    <a href='/WebDash/{{ instance.getName }}/display/'>{{ instance.getName }}</a>&nbsp;</td> 
    23                 <td>    <button onClick="window.location='/WebDash/{{ instance.getName }}/uninstall/'">Uninstall </button></td>                                  
     23                <td>    <button onClick="window.location='/WebDash/uninstall/{{ instance.getName }}/'">Uninstall </button></td>                                  
    2424                </tr> 
    2525        {% endfor %} 
  • ossiedev/trunk/tools/cornetApps/urls.py

    r10816 r10817  
    99    # Examples: 
    1010    url(r'^WebDash/$', 'WebDash.views.index', name='index'), 
    11         url(r'^WebDash/(?P<waveform>.*)/install/$', 'WebDash.views.install', name='install'), 
    12         url(r'^WebDash/(?P<instance>.*)/display/$', 'WebDash.views.display', name='display'), 
    13         url(r'^WebDash/(?P<instance>.*)/uninstall/$', 'WebDash.views.uninstall', name='uninstall'), 
     11        url(r'^WebDash/waveforms/$', 'WebDash.views.waveforms'), 
     12    url(r'^WebDash/(?P<instance>.*)/display/$', 'WebDash.views.display', name='display'), 
    1413        url(r'^WebDash/configure/$', 'WebDash.views.configure', name='configure'),       
    15         url(r'^$', 'HtmlPages.views.main_page'), 
     14        url(r'^WebDash/running/$', 'WebDash.views.running_page'), 
     15    url(r'^WebDash/install/(?P<waveform_to_install>.*)/', 'WebDash.views.install'), 
     16    url(r'^WebDash/uninstall/(?P<instance_to_uninstall>.*)/', 'WebDash.views.uninstall'), 
     17    url(r'^$', 'HtmlPages.views.main_page'), 
    1618        url(r'^ossie/$', 'HtmlPages.views.ossie_view'), 
    1719        url(r'^login/$', 'django.contrib.auth.views.login'), 
     
    2325        url(r'^map/(\d*)/$', 'HtmlPages.views.map_view'), 
    2426        url(r'^grid/$', 'HtmlPages.views.grid_view'), 
    25         url(r'^waveforms/$', 'HtmlPages.views.waveforms'), 
    2627        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'), 
    3028 
    3129    # url(r'^cornetApps/', include('cornetApps.foo.urls')),