From: Quentin Smith Date: Tue, 11 Aug 2009 04:54:08 +0000 (-0400) Subject: Add terminal page X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-web.git/commitdiff_plain/a2089d8328143e3e6836de6623b8b1690edfcfba Add terminal page svn path=/package_branches/invirt-web/ajaxterm-rebased/; revision=2751 --- diff --git a/code/main.py b/code/main.py index dd2b591..0f8ed77 100755 --- a/code/main.py +++ b/code/main.py @@ -37,6 +37,7 @@ from invirt.config import structs as config from invirt.common import InvalidInput, CodeError from view import View, revertStandardError +import ajaxterm static_dir = os.path.join(os.path.dirname(__file__), 'static') @@ -388,6 +389,23 @@ console will suffer artifacts. else: raise InvalidInput('back', back, 'Not a known back page.') + atmulti = ajaxterm.Multiplex() + atsessions = {} + + @cherrypy.expose + @cherrypy.tools.mako(filename="/terminal.mako") + def terminal(self, machine_id): + machine = validation.Validate(cherrypy.request.login, cherrypy.request.state, machine_id=machine_id).machine + + status = controls.statusInfo(machine) + has_vnc = hasVnc(status) + + d = dict(on=status, + has_vnc=has_vnc, + machine=machine, + hostname=cherrypy.request.local.name) + return d + machine = MachineView() diff --git a/code/static/ajaxterm/ajaxterm.css b/code/static/ajaxterm/ajaxterm.css index b9a5f87..5dd6ca5 100644 --- a/code/static/ajaxterm/ajaxterm.css +++ b/code/static/ajaxterm/ajaxterm.css @@ -58,7 +58,6 @@ pre.term span.b5 { background-color: #b0b; } pre.term span.b6 { background-color: #0bb; } pre.term span.b7 { background-color: #bbb; } -body { background-color: #888; } #term { float: left; } diff --git a/code/templates/info.mako b/code/templates/info.mako index 0d1b66b..cd74458 100644 --- a/code/templates/info.mako +++ b/code/templates/info.mako @@ -17,11 +17,11 @@ Info on ${machine.name} <%def name="commands()"> % if on: % if not machine.type.hvm: - Console access: type + Console access: Web Terminal or type ssh ${machine.name}@${config.console.hostname} on Athena. (more info) % elif has_vnc: - Get Console + Get Console or Web Terminal % else: VNC console not enabled; still booting? % endif diff --git a/code/templates/skeleton.mako b/code/templates/skeleton.mako index 37a053d..9414cf2 100644 --- a/code/templates/skeleton.mako +++ b/code/templates/skeleton.mako @@ -61,6 +61,7 @@ You are currently authenticated as an administrator. % if machine:
  • Info
  • Console
  • +
  • Terminal
  • % endif
  • Help
  • diff --git a/code/templates/terminal.mako b/code/templates/terminal.mako new file mode 100644 index 0000000..246c29d --- /dev/null +++ b/code/templates/terminal.mako @@ -0,0 +1,28 @@ +<%page expression_filter="h" /> +<%inherit file="skeleton.mako" /> + +<%def name="title()"> +Terminal for ${machine.name} + + + +% if not on: +

    Your machine appears to be off.

    +% elif has_vnc: +

    Your machine appears to be an HVM; you will need to specially configure a serial console before you can use this terminal.

    +% endif + +<%def name="header_extra()"> +${parent.header_extra()} + + + + + + + +