]>
Commit | Line | Data |
---|---|---|
940227cb MT |
1 | #!/usr/bin/python |
2 | ||
3 | import tornado.web | |
4 | ||
372efc19 MT |
5 | import backend |
6 | ||
940227cb MT |
7 | from handlers_base import * |
8 | ||
9 | class StasyBaseHandler(BaseHandler): | |
10 | @property | |
11 | def stasy(self): | |
12 | return backend.Stasy() | |
13 | ||
14 | ||
15 | class StasyIndexHandler(StasyBaseHandler): | |
16 | def get(self): | |
17 | profiles = self.stasy.get_profiles() | |
18 | ||
19 | self.render("stasy-index.html", profiles=profiles) | |
20 | ||
21 | ||
22 | class StasyProfileHandler(StasyBaseHandler): | |
23 | def get(self, profile_id): | |
24 | profile = self.stasy.get_profile(profile_id) | |
25 | if not profile: | |
26 | raise tornado.web.HTTPError(404, "Profile not found: %s" % profile_id) | |
27 | ||
28 | self.render("stasy-profile.html", profile=profile) | |
372efc19 MT |
29 | |
30 | ||
31 | class StasyStatsCPUHandler(StasyBaseHandler): | |
32 | def get(self): | |
33 | return self.render("stasy-stats-cpus.html", | |
34 | cpu_vendors = self.stasy.cpu_map) | |
35 | ||
36 | ||
37 | class StasyStatsVirtualHandler(StasyBaseHandler): | |
38 | def get(self): | |
39 | return self.render("stasy-stats-virtual.html", | |
40 | hypervisor_vendors = self.stasy.hypervisor_map, | |
41 | is_virtual = self.stasy.virtual_map) |