Changeset 11098
- Timestamp:
- 04/13/12 10:48:59 (13 months ago)
- Location:
- ossiedev/branches/jsnyder/trunk/tools/cornetApps
- Files:
-
- 1 removed
- 5 modified
-
DomainMan/views.py (modified) (8 diffs)
-
cornetApps.db (modified) (previous)
-
templates/DomainMan/cornet_login.html (deleted)
-
templates/DomainMan/nodes.html (modified) (1 diff)
-
templates/WebDash/running.html (modified) (1 diff)
-
urls.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
ossiedev/branches/jsnyder/trunk/tools/cornetApps/DomainMan/views.py
r11096 r11098 12 12 13 13 """ 14 Testing login 15 """ 16 def cornet_login(request): 17 user = request.user 18 return render_to_response('DomainMan/cornet_login.html', locals(), context_instance=RequestContext(request)) 19 14 Checks if running locally or on the web by testing which Django settings are used 15 """ 16 def isOnWeb(): 17 if environ['DJANGO_SETTINGS_MODULE'] == 'cornetApps.settingsWeb': 18 return 1 19 if environ['DJANGO_SETTINGS_MODULE'] == 'cornetApps.settings': 20 return 0 21 20 22 """ 21 23 Connects to a server through a given ip, port and associated username and password … … 31 33 return client 32 34 35 """ 36 Connects to a node given its floor and number 37 Returns the SSHClient connected to the server 38 """ 39 def connectViaNode(floor, num, user, password): 40 floor = int(floor) 41 num = int(num) 42 node = Node(floor, num) 43 ip = node.ip 44 port = node.port 45 client = SSHClient() 46 client.set_missing_host_key_policy(AutoAddPolicy()) 47 try: 48 client.connect(ip, int(port), user, password) 49 except: 50 raise Http404(u'Incorrect username and password combination') 51 return client 52 33 53 ''' 34 54 Tests if nodebooter is running. … … 51 71 return 0 52 72 53 ''' 54 Starts nodeBooter at a given ip and port 73 """ 74 Views the available nodeBooters to start 75 """ 76 def selectNodeboter(request, floor, num, user, password): 77 client = connectViaNode(floor, num, user, password) 78 79 client.close 80 return 81 82 ''' 83 Starts default nodeBooter at a given ip and port 55 84 @param ip: The ip address of the server for the nodes 56 85 @param port: The port, typically 22 … … 68 97 client.exec_command('cd /sdr ; nodeBooter -D -d dev/nodes/default_GPP_node/DeviceManager.dcd.xml') 69 98 runningNodebooter = nodeBooter_running(client) 99 client.close 70 100 return render_to_response('DomainMan/runningNodebooter.html', locals(), context_instance=RequestContext(request)) 71 101 … … 93 123 ip = node.ip 94 124 port = node.port 95 client = connect(ip, port, user, password) 125 client = connect(ip, port, user, password) 96 126 stdin, stdout, stderr = client.exec_command('killall nodeBooter && killall GPP') 97 127 runningNodebooter = nodeBooter_running(client) 128 client.close 98 129 return render_to_response('DomainMan/runningNodebooter.html', locals(), context_instance=RequestContext(request)) 99 130 … … 114 145 stdin, stdout, stderr = client.exec_command('cd /sdr; nodeBooter -D -d dev/nodes/default_GPP_node/DeviceManager.dcd.xml') 115 146 runningNodebooter = nodeBooter_running(client) 147 client.close 116 148 return render_to_response('DomainMan/console.html', locals(), context_instance=RequestContext(request)) 117 149 118 """ 119 Views the available nodeBooters to start 120 """ 121 def selectNodeboter(): 122 return 150 123 151 124 152 """ … … 137 165 client = connect(ip, port, user, password) 138 166 runningNodebooter = nodeBooter_running(client) 167 client.close 139 168 else: 140 169 message = 'Missing ssh connection parameters' … … 159 188 ip = node.ip 160 189 port = node.port 190 if isOnWeb(): 191 address = str(ip) + ":" + str(port) 192 else: 193 address = str(ip) 161 194 #index2(request, ip) 162 195 return render_to_response("DomainMan/nodes.html", locals(), context_instance=RequestContext(request)) -
ossiedev/branches/jsnyder/trunk/tools/cornetApps/templates/DomainMan/nodes.html
r11096 r11098 4 4 <a href='javascript:loadHrefToDiv("#node_space", "{{MEDIA_URL}}/connect/{{floor}}/{{num}}");'>Check Nodebooter</a> 5 5 --> 6 <a href= 'javascript:openWindow("{{MEDIA_URL}}/connect/{{floor}}/{{num}}");'>Check Nodebooter</a>6 <a href="#" onclick='javascript:window.open("{{MEDIA_URL}}/connect/{{floor}}/{{num}}", "","width=400,height=300,location=0");'>Check Nodebooter</a> 7 7 </div> 8 <a href='javascript:loadHrefToDiv("#workspace", "{{MEDIA_URL}}/WebDash/index2/{{ip}} ");'>View Waveforms</a>8 <a href='javascript:loadHrefToDiv("#workspace", "{{MEDIA_URL}}/WebDash/index2/{{ip}}:{{port}}");'>View Waveforms</a> -
ossiedev/branches/jsnyder/trunk/tools/cornetApps/templates/WebDash/running.html
r10914 r11098 4 4 {% for instance in instancesList %} 5 5 <tr> 6 < !--<td> <a href='/~webdemo/django/WebDash/{{ instance.getName }}/display/'>{{ instance.getName }}</a> </td>-->7 <td>< a href='#' onclick='javascript:display("{{instance.getName}}");'>{{instance.getName}}</a></td>8 <!--<td> <button onClick="window.location='/WebDash/{{ instance.getName }}/uninstall/'">Uninstall </button></td>-->9 <td><button onClick='javascript:uninstall("{{ instance.getName }}");'>Uninstall</button></td> 6 <td><a href="#" title="Display Waveform Properties" onClick='javascript:loadHrefToDiv("#workspace","{{MEDIA_URL}}/WebDash/display/{{instance.getName}}/");'>{{instance.getName}}</a></td> 7 <td><button onClick='javascript:loadHrefToDiv("#apps","{{MEDIA_URL}}/WebDash/uninstall/{{instance.getName}}/");'>Uninstall</button></td> 8 <!--<td><a href='#' onclick='javascript:display("{{instance.getName}}");'>{{instance.getName}}</a></td> 9 <td><button onClick='javascript:uninstall("{{ instance.getName }}");'>Uninstall</button></td>--> 10 10 </tr> 11 11 {% endfor %} -
ossiedev/branches/jsnyder/trunk/tools/cornetApps/urls.py
r11093 r11098 13 13 url(r'^WebDash/$', 'WebDash.views.index', name='index'), 14 14 url(r'^WebDash/waveforms/$', 'WebDash.views.waveforms'), 15 url(r'^WebDash/ (?P<instance>.*)/display/$', 'WebDash.views.display', name='display'),15 url(r'^WebDash/display/(?P<instance>.*)/$', 'WebDash.views.display', name='display'), 16 16 url(r'^WebDash/configure/$', 'WebDash.views.configure', name='configure'), 17 17 url(r'^WebDash/updateControls/$', 'WebDash.views.updateControls', name='updateControls'),