Alex Hixon's work on Hawkeye. \o/

This commit is contained in:
alexhudson
2007-05-09 13:15:10 +00:00
parent 41402fced8
commit c2dba560b9
28 changed files with 374 additions and 117 deletions
+26 -2
View File
@@ -16,6 +16,7 @@ dist_css_DATA := \
src/www/css/composer.css \
src/www/css/contacts.css \
src/www/css/conversation.css \
src/www/css/hawkeye.css \
src/www/css/interpreter.css \
src/www/css/layout.css \
src/www/css/login.css \
@@ -180,7 +181,21 @@ dist_img_DATA := \
src/www/img/toolbar/16/format-text-italic.png \
src/www/img/toolbar/16/format-text-strikethrough.png \
src/www/img/toolbar/16/format-text-underline.png \
src/www/img/toolbar/16/mail-attachment.png
src/www/img/toolbar/16/mail-attachment.png \
src/www/img/bg.png \
src/www/img/Bongo-logo.png \
src/www/img/cbg.png \
src/www/img/dialog-warning.png \
src/www/img/help-browser.png \
src/www/img/locked.png \
src/www/img/login-pane.png \
src/www/img/network-server.png \
src/www/img/sel.png \
src/www/img/system-installer.png \
src/www/img/system-users.png \
src/www/img/user.png \
src/www/img/user-desktop.png \
src/www/img/welcome-box.png
jsdir = $(htdocsdir)/js
@@ -286,11 +301,12 @@ pkgpythonhawkeyedir = $(pkgpythondir)/hawkeye
pkgpythonhawkeye_PYTHON := \
src/www/bongo/hawkeye/__init__.py \
src/www/bongo/hawkeye/AgentsView.py \
src/www/bongo/hawkeye/AgentView.py \
src/www/bongo/hawkeye/Auth.py \
src/www/bongo/hawkeye/BackupView.py \
src/www/bongo/hawkeye/HawkeyeHandler.py \
src/www/bongo/hawkeye/HawkeyePath.py \
src/www/bongo/hawkeye/SystemView.py \
src/www/bongo/hawkeye/RootView.py \
src/www/bongo/hawkeye/Server.py \
src/www/bongo/hawkeye/ServerView.py \
@@ -311,6 +327,14 @@ dist_hawkeyetplbackup_DATA := \
hawkeyetplserverdir = $(htdocsdir)/hawkeye/server
dist_hawkeyetplserver_DATA := \
src/www/hawkeye/server/index.tpl
hawkeyetplsystemdir = $(htdocsdir)/hawkeye/system
dist_hawkeyetplsystem_DATA := \
src/www/hawkeye/system/index.tpl
hawkeyetplagentsdir = $(htdocsdir)/hawkeye/agents
dist_hawkeyetplagents_DATA := \
src/www/hawkeye/agents/index.tpl
hawkeyetpldir = $(htdocsdir)/hawkeye
dist_hawkeyetpl_DATA := \
-19
View File
@@ -1,19 +0,0 @@
import bongo.dragonfly
import Hawkeye
from HawkeyeHandler import HawkeyeHandler
class AgentsHandler(HawkeyeHandler):
def ParsePath(self, rp):
rp.pathInfo = Hawkeye.SplitQueryArgs(rp.path)
def index_GET(self, req, rp):
vars = {"mdb" : self.GetMdb(req)}
return self.SendTemplate(req, rp, "index.psp", vars)
def edit_GET(self, req, rp):
vars = {"mdb" : self.GetMdb(req)}
return self.SendTemplate(req, rp, "edit.psp", vars)
def edit_POST(self, req, rp):
vars = {"mdb" : self.GetMdb(req)}
return self.SendTemplate(req, rp, "edit.psp", vars)
+2
View File
@@ -13,6 +13,8 @@ class BackupHandler(HawkeyeHandler):
def index_GET(self, req, rp):
today = datetime.date.today()
self.SetVariable("set", today.strftime("%y%m%d"))
self.SetVariable("breadcrumb", "System &#187 Backup and Restore");
self.SetVariable("systab", "selecteditem");
return self.SendTemplate(req, rp, "index.tpl")
def download_GET(self, req, rp):
+4
View File
@@ -6,12 +6,16 @@ from bongo.dragonfly.BongoSession import BongoSession
from bongo.dragonfly.HttpError import HttpError
import RootView
import AgentView
import BackupView
import ServerView
import SystemView
views = {
"root" : RootView.RootHandler(),
"agents" : AgentView.AgentHandler(),
"backup" : BackupView.BackupHandler(),
"system" : SystemView.SystemHandler(),
"server" : ServerView.ServerHandler()
}
+28
View File
@@ -1,4 +1,5 @@
import bongo.dragonfly
import os
import bongo.dragonfly.BongoUtil
from HawkeyeHandler import HawkeyeHandler
import bongo.hawkeye.Auth as Auth
@@ -10,7 +11,34 @@ class RootHandler(HawkeyeHandler):
else:
return True
def memory(self, VmKey):
'''Return process memory usage in bytes.
'''
_scale = {'kB': 1024.0, 'mB': 1024.0*1024.0,
'KB': 1024.0, 'MB': 1024.0*1024.0}
try: # get the /proc/<pid>/status pseudo file
t = open('/proc/meminfo')
v = [v for v in t.readlines() if v.startswith(VmKey)]
t.close()
# convert Vm value to bytes
if len(v) == 1:
t = v[0].split() # e.g. 'VmRSS: 9999 kB'
if len(t) == 3: ## and t[0] == VmKey:
return float(t[1]) * _scale.get(t[2], 0.0)
except:
pass
return 0.0
def index_GET(self, req, rp):
cm = self.memory("MemTotal:")
used = cm - self.memory("MemFree:")
used = used / 1024 / 1024
cm = cm / 1024 / 1024
self.SetVariable("mem", str(round(used, 2)) + "MB / " + str(round(cm, 2)) + "MB")
self.SetVariable("breadcrumb", "Desktop")
self.SetVariable("dsktab", "selecteditem")
return self.SendTemplate(req, rp, "index.tpl")
def test_GET(self, req, rp):
+3
View File
@@ -22,6 +22,9 @@ class ServerHandler(HawkeyeHandler):
else:
self.SetVariable("success", 0)
self.SetVariable("breadcrumb", "Agents &#187 Enable/Disable Agents");
self.SetVariable("agntab", "selecteditem");
return self.SendTemplate(req, rp, "index.tpl")
def index_POST(self, req, rp):
+33
View File
@@ -1,6 +1,39 @@
import os
import bongo.dragonfly
from HawkeyeHandler import HawkeyeHandler
class SummaryHandler(HawkeyeHandler):
_proc_status = '/proc/%d/status' % os.getpid() # Linux only?
_scale = {'kB': 1024.0, 'mB': 1024.0*1024.0,
'KB': 1024.0, 'MB': 1024.0*1024.0}
def _VmB(VmKey):
global _scale
try: # get the /proc/<pid>/status pseudo file
t = open(_proc_status)
v = [v for v in t.readlines() if v.startswith(VmKey)]
t.close()
# convert Vm value to bytes
if len(v) == 1:
t = v[0].split() # e.g. 'VmRSS: 9999 kB'
if len(t) == 3: ## and t[0] == VmKey:
return float(t[1]) * _scale.get(t[2], 0.0)
except:
pass
return 0.0
def memory(since=0.0):
'''Return process memory usage in bytes.
'''
return _VmB('VmSize:') - since
def stacksize(since=0.0):
'''Return process stack size in bytes.
'''
return _VmB('VmStk:') - since
def index_GET(self, req, rp):
self.SetVariable("mem", memory())
self.SetVariable("breadcrumb", "Desktop")
self.SetVariable("dsktab", "selecteditem")
return self.SendTemplate(req, rp, "index.tpl", vars)
+49 -57
View File
@@ -1,74 +1,66 @@
* {
font-family: sans-serif;
}
html, body {
overflow: auto;
margin: 0;
padding: 0;
border: 0;
}
/*
Bongo web administration interface (aka Hawkeye) stylesheet
(c) 2007 Alexander Hixon <hixon.alexander@mediati.org> - see COPYING for details
Last modified: Sunday May 6, 2007
*/
body {
border-top: 2px solid #d4dceb;
background-color: #627aa3; /* #b4c5e1; */
background-color: #eeeeec;
font-size: 12px;
font-family: Verdana, Arial, Helvetica, SunSans-Regular, Sans-Serif;
color:#2e3436;
padding:0px;
margin:0px;
height: 100%; /* Blasted IE! */
}
img#logo {
position: absolute;
top: 40px;
left: 40px;
width: 339px;
height: 59px;
#login {
position:absolute;
height:200px;
width:400px;
margin:-100px 0px 0px -200px;
top: 50%;
left: 50%;
text-align: center;
padding: 0px;
background-image: url('../img/login-pane.png');
background-repeat: no-repeat; /* Make sure this doesn't actually happen. */
overflow: none;
}
ul.navigation {
position: absolute;
top: 110px;
left: 40px;
width: 150px;
background-color: white;
padding: 10px;
border: 1px solid #555;
margin: 0;
form {
padding: 16px;
padding-top: 6.5em;
}
ul.navigation li {
list-style: none;
margin: 0;
text-align: left;
.inputbox {
margin-bottom: 2px;
}
ul.navigation li a {
display: block;
text-decoration: none;
padding: .25em;
color: black;
border-bottom: 1px solid #555;
.submit {
padding-top: 2em;
padding-bottom: 0px;
margin-bottom: 0px;
}
ul.navigation li a:hover {
background-color: #ddd;
input {
color: #555753;
border: 1px solid #2e3436;
}
div#content {
position: absolute;
top: 110px;
right: 20px;
left: 220px;
border: 1px solid #555;
background-color: white;
padding: 10px;
.username {
background-image: url('../img/user.png');
}
div#login {
position: absolute;
top: 200px;
left: 220px;
width: 500px;
height: 250px;
background-color: white;
padding: 20px;
text-align: right;
border: 1px solid #555;
.password {
background-image: url('../img/locked.png');
}
.password, .username {
padding-left: 22px;
min-height: 18px;
background-color: #eeeeec;
background-repeat: no-repeat;
}
+158
View File
@@ -0,0 +1,158 @@
/* body and font definitions */
body {
background: url('/img/bg.png');
background-repeat: repeat-x;
background-color: #fff;
margin-top: 25px;
margin-left: 60px;
margin-right: 60px;
}
html>body {
font-family: luxi sans, trebuchet ms, bitstream vera sans, sans-serif;
}
#userinfo {
padding-top: 20px;
font-size: 80%;
float: right;
}
#logo {
margin-bottom: 60px;
}
p {
/*padding-left: 12px;
padding-right: 12px;*/
font-size: 90%;
color: #2e3436; /* Tango DARK-GREY */
}
#page {
background: url('/img/cbg.png');
background-repeat: repeat-x;
background-color: #eeeeec; /* Tango GREY */
/* float: left;*/
/* width: 100% - 175px;*/
/* margin: 0px;*/
margin-left: 165px; /* Push across width of sidebar, minus 10px, for bg behind round corner */
padding-left: 10px; /* Prints BG for 10px, now flush with sidebar */
padding-top: 6px;
/* z-index: -1;*/
/* padding-right: 8px; */
/* padding-left: 16px;*/
/* margin-left: 280px;*/
min-height: 500px;
}
#content {
padding-left: 12px;
padding-right: 12px;
}
#sidebar {
color: #eeeeec; /* Tango WHITE */
/* background: url('/img/sbg.png');
background-repeat: repeat-x;*/
background-color: #2e3436; /* Tango DARK-GREY */
float: left;
height: 500px;
width: 175px;
text-align: right;
margin-right: 0px;
padding-right: 0px;
-moz-border-radius: 15px;
}
.helpitem {
/* FIXME! */
}
.selecteditem {
background-image: url('/img/sel.png');
width: 175px;
background-repeat: repeat-none;
color: #2e3436;
}
ul.nav,
.nav ul{
/*Remove all spacings from the list items*/
/*float: right;*/
/*display: block; */
margin-right: 0px;
padding-left: 4px;
margin-left: 6px;
/*padding-left: 0px; /* Use this instead of margin? */
padding-right: 0px;
/* cursor: default;*/
list-style-type: none;
}
a.nav,
.nav a{
color: #eeeeec;
text-decoration:none;
}
a.selecteditem,
.selecteditem a,
.selecteditem a:link,
.selecteditem a:visited {
color: #2e3436;
text-decoration:none;
}
li.nav,
.nav li{
display: block;
font-size: 115%; /* Bold maybe? */
min-height: 35px;
/* color: #eeeeec;*/
text-align: left;
padding-left: 15%;
padding-right: 15px;
margin-bottom: 15px;
text-decoration:none;
margin-top: 5px;
width: 95%;
}
img.icon {
margin-right: 6px;
vertical-align:middle;
}
.breadcrumb {
font-size: 75%;
}
ul.nav{
width: 100%;
}
.htable {
border: 2px solid #2e3436;
font-size: 110%;
}
.hrow {
background-color: #2e3436;
color: #eeeeec;
padding-left: 4px;
}
.tlist {
padding-bottom: 3px;
padding-top: 3px;
font-size: 80%;
padding-left: 16px;
}
.floaty {
float: right;
padding-left: 16px;
padding-right: 16px;
display: block;
}
+1 -1
View File
@@ -1,5 +1,5 @@
</div>
</div>
</body>
</html>
+21 -14
View File
@@ -1,22 +1,29 @@
<html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Bongo Web Administration</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<title>Bongo Web Administration - %(breadcrumb)s</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="icon" href="/img/bongo-favicon.ico" type="image/ico">
<link rel="icon" href="/img/bongo-favicon.png" type="image/png">
<style type="text/css" media="screen">
@import url(/css/admin.css);
@import url(/css/hawkeye.css);
</style>
</head>
<body>
<img id="logo" src="/img/login-logo.png" alt="Bongo" />
<ul class="navigation">
<li><a href="%(url|/)s">Home</a></li>
<li><a href="%(url|/)sserver">Server Configuration</a></li>
<li><a href="%(url|/)sbackup">Backup &amp; Restore</a></li>
<li><a href="%(url|/)slogout">Logout</a></li>
</ul>
<div id="userinfo">Logged in as: <i>admin</i> [<a href="%(url|/)slogout">logout</a>]</div>
<div id="logo"><img src="/img/Bongo-logo.png" alt="Bongo" /></div>
<div id="sidebar">
<ul class="nav">
<li tal:attributes="class dsktab"><a href="%(url|/)s"><img src="/img/user-desktop.png" border="0" alt="" class="icon" /> Desktop</a></li>
<li tal:attributes="class usrtab"><img src="/img/system-users.png" alt="" class="icon" /> Users</li>
<li tal:attributes="class agntab"><a href="%(url|/)sagents"><img src="/img/system-installer.png" border="0" alt="" class="icon" /> Agents</a></li>
<li tal:attributes="class systab"><a href="%(url|/)ssystem"><img src="/img/network-server.png" border="0" alt="" class="icon" /> System</a></li>
<li tal:attributes="class hlptab"><img src="/img/help-browser.png" alt="" class="icon" /> Help</li>
</ul>
</div>
<div id="page">
<div id="content">
<div class="breadcrumb"><p>%(breadcrumb)s</p></div>
+34 -2
View File
@@ -1,7 +1,39 @@
%(include|header.tpl)s
<img src="/img/welcome-box.png" class="floaty" alt="Welcome to Bongo" />
<h1>Welcome</h1>
<p>Thank you for choosing Bongo as your calendaring and mail solution.</p>
<p>This screen enables you to briefly overview your system status, and to access commonly and recently used tasks.</p>
<p>Help can be accessed by clicking on the help menu at any time.<br />To get started, either click on one of the menus to the left, or click on one of the common tasks listed below.</p>
<p>This is the admin tool. Under construction, obviously :)</p>
<table class="htable" width="100%%" cellspacing="0" >
<tr style="height: 28px;">
<td class="hrow">System Status</td>
<td style="text-align: center;">Space time continuum stable.</td>
<td class="hrow" width="16"></td>
</tr>
<tr style="height: 28px;">
<td class="hrow">Agent Status</td>
<td style="text-align: center;">Operation normal.</td>
<td class="hrow" width="16"></td>
</tr>
<tr style="height: 28px;">
<td class="hrow">Bongo Updates</td>
<td style="text-align: center;">Critical security update available.</td>
<td class="hrow" width="16"><img src="/img/dialog-warning.png" alt="Warning" /></td>
</tr>
<tr style="height: 28px;">
<td class="hrow">Memory Usage</td>
<td style="text-align: center;">%(mem)s</td>
<td class="hrow" width="16"></td>
</tr>
<tr style="height: 28px;">
<td class="hrow">Load</td>
<td style="text-align: center;">Unknown</td>
<td class="hrow" width="16"></td>
</tr>
</table>
%(include|footer.tpl)s
%(include|footer.tpl)s
+13 -20
View File
@@ -1,28 +1,21 @@
<html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Bongo Web Administration</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Bongo Web Administration &rsaquo; Login</title>
<link rel="icon" href="/img/bongo-favicon.ico" type="image/ico">
<link rel="icon" href="/img/bongo-favicon.png" type="image/png">
<style type="text/css" media="screen">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<style type="text/css" media="screen">
@import url(/css/admin.css);
</style>
</style>
</head>
<body>
<img id="logo" src="/img/login-logo.png" alt="Bongo" />
<body onload="document.forms[0].elements[0].focus();">
<div id="login">
<h1>Login Required</h1>
<form method="post">
<p>User name: <input type="text" name="bongo-username" /></p>
<p>Password: <input type="password" name="bongo-password" /></p>
<input type="submit" value="Login" />
</form>
<form method="post">
<input type="text" name="bongo-username" class="username inputbox" />
<input type="password" name="bongo-password" class="password inputbox"/>
<div class="submit"><input type="submit" value="Log in"></div>
</form>
</div>
</body>
</html>
</html>
+2 -2
View File
@@ -1,6 +1,6 @@
%(include|header.tpl)s
<h1>Server Settings</h1>
<h1>Enable/Disable Agents</h1>
<p tal:condition="message" tal:content="message">No message.</p>
@@ -12,7 +12,7 @@
<div tal:condition="success">
<form method="post">
<input type="hidden" name="command" value="agentstatus" />
<table border="1">
<table class="htable">
<tr>
<th>Enabled?</th>
<th>Agent Name</th>
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 684 B

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 411 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 603 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 612 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 847 B

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 610 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 910 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 762 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB