Changeset 497:54b441702b25
- Timestamp:
- 10/14/08 16:39:41
(3 months ago)
- Author:
- Brian Warner <warner@allmydata.com>
- branch:
- default
- Message:
web-viewer: add a Reload button, closes #103
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r496 |
r497 |
|
| 1 | 1 | 2008-10-14 Brian Warner <warner@allmydata.com> |
|---|
| | 2 | |
|---|
| | 3 | * foolscap/logging/web.py (Reload): add a 'Reload Logfile' button |
|---|
| | 4 | to the web-viewer's Welcome page. Not automatic, but it means you |
|---|
| | 5 | don't have to get back to the shell and restart the viewer. Works |
|---|
| | 6 | well-enough to say Closes #103. |
|---|
| 2 | 7 | |
|---|
| 3 | 8 | * misc/classify_foolscap.py: plugin to classify some |
|---|
| r393 |
r497 |
|
| 102 | 102 | |
|---|
| 103 | 103 | data += '<h2><a href="all-events">View All Events</a></h2>\n' |
|---|
| | 104 | data += '<form action="reload" method="post">\n' |
|---|
| | 105 | data += ' <input type="submit" value="Reload Logfile" />\n' |
|---|
| | 106 | data += '</form>\n' |
|---|
| 104 | 107 | |
|---|
| 105 | 108 | data += "</body></html>" |
|---|
| … | … | |
| 252 | 255 | level_s, msg) |
|---|
| 253 | 256 | |
|---|
| | 257 | class Reload(resource.Resource): |
|---|
| | 258 | |
|---|
| | 259 | def __init__(self, viewer): |
|---|
| | 260 | self.viewer = viewer |
|---|
| | 261 | resource.Resource.__init__(self) |
|---|
| | 262 | |
|---|
| | 263 | def render_POST(self, req): |
|---|
| | 264 | self.viewer.load_logfiles() |
|---|
| | 265 | req.redirect("welcome") |
|---|
| | 266 | return '' |
|---|
| 254 | 267 | |
|---|
| 255 | 268 | class WebViewer: |
|---|
| … | … | |
| 270 | 283 | welcome = Welcome(self) |
|---|
| 271 | 284 | root.putChild("welcome", welcome) |
|---|
| | 285 | root.putChild("reload", Reload(self)) |
|---|
| 272 | 286 | root.putChild("all-events", EventView(self)) |
|---|
| 273 | 287 | root.putChild("summary", Summary(self)) |
|---|
| … | … | |
| 282 | 296 | if not options["quiet"]: |
|---|
| 283 | 297 | print "scanning.." |
|---|
| 284 | | self.get_logfiles(options) |
|---|
| | 298 | self.logfiles = [options.dumpfile] |
|---|
| | 299 | self.load_logfiles() |
|---|
| 285 | 300 | |
|---|
| 286 | 301 | if not options["quiet"]: |
|---|
| … | … | |
| 290 | 305 | return url # for tests |
|---|
| 291 | 306 | |
|---|
| 292 | | def get_logfiles(self, options): |
|---|
| 293 | | self.logfiles = [options.dumpfile] |
|---|
| | 307 | def load_logfiles(self): |
|---|
| 294 | 308 | #self.summary = {} # keyed by logfile name |
|---|
| 295 | 309 | (self.summaries, self.root_events, self.number_map) = \ |
|---|