Changeset 804
- Timestamp:
- 10/01/09 13:55:50 (4 years ago)
- Location:
- trunk/plugins/rightscaleplugin
- Files:
-
- 2 added
- 4 edited
-
setup.py (modified) (1 diff)
-
tracrightscale/api.py (modified) (1 diff)
-
tracrightscale/templates/rs_deployment.html (added)
-
tracrightscale/templates/rs_index.html (modified) (1 diff)
-
tracrightscale/web_ui.py (modified) (4 diffs)
-
tracrightscale/wiki.py (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/plugins/rightscaleplugin/setup.py
r803 r804 16 16 license="BSD", 17 17 entry_points={'trac.plugins': [ 18 'tracrightscale.wiki = tracrightscale.wiki', 18 19 'tracrightscale.web_ui = tracrightscale.web_ui' 19 20 ]}, -
trunk/plugins/rightscaleplugin/tracrightscale/api.py
r803 r804 24 24 self.auth_cookie = None 25 25 26 def service(self, service_url, acct_id = None): 27 request = ClientCookie.Request('/'.join([self.base_url, 'acct', str(acct_id is None and self.acct_id or acct_id), service_url])) 26 def service(self, service_url, acct_id = None, absolute_url = False): 27 url = service_url 28 if not absolute_url: 29 url = '/'.join([self.base_url, 'acct', str(acct_id is None and self.acct_id or acct_id), service_url]) 30 request = ClientCookie.Request(url) 28 31 request.add_header('X-API-VERSION', self.api_version) 29 32 self._get_auth_cookie().add_cookie_header(request) -
trunk/plugins/rightscaleplugin/tracrightscale/templates/rs_index.html
r803 r804 7 7 </head> 8 8 <body> 9 <div id="content" class="wiki"> 10 <h1>RightScale deployment : <a href="${rs.deployment.href}">${rs.deployment.nickname}</a></h1> 11 <table class="listing" style="width:100%"> 12 <thead> 13 <tr><th>Server</th><th>State</th><th>Type</th></tr> 14 </thead> 15 <tbody> 16 <tr py:for="server in rs.deployment.servers.values()"> 17 <td><a href="${server.href}">${server.nickname}</a></td> 18 <td>${server.state}</td> 19 <td>${server['server-type']}</td> 20 </tr> 21 </tbody> 22 </table> 23 </div> 9 <h1>RightScale deployment : <a href="${rs.deployment.href}">${rs.deployment.nickname}</a></h1> 10 <xi:include href="rs_deployment.html" /> 24 11 </body> 25 12 </html> -
trunk/plugins/rightscaleplugin/tracrightscale/web_ui.py
r803 r804 8 8 from trac.config import Option, IntOption 9 9 from trac.web.main import IRequestHandler 10 from trac.web.chrome import I NavigationContributor, ITemplateProvider10 from trac.web.chrome import ITemplateProvider 11 11 from trac.util.html import html 12 12 … … 14 14 15 15 class RightScaleModule(Component): 16 implements(ITemplateProvider, I NavigationContributor, IRequestHandler)16 implements(ITemplateProvider, IRequestHandler) 17 17 18 18 user = Option('rightscale', 'user', '', … … 25 25 """RightScale password""") 26 26 27 # INavigationContributor methods28 def get_active_navigation_item(self, req):29 return 'rightscale'30 def get_navigation_items(self, req):31 yield 'mainnav', 'rightscale', html.A('Right Scale', href=req.href('rightscale'))32 33 27 # ITemplateProvider 34 28 def get_templates_dirs(self): … … 43 37 return re.match('/rightscale',req.path_info) 44 38 def process_request(self, req): 45 self._validate_config()46 data = {}47 48 39 rs = RightScale(self.user, self.password, self.account_id) 49 40 deployment = Deployment(self.deployment_id) 50 41 deployment.load(rs) 51 42 52 data['deployment'] = deployment 53 54 return 'rs_index.html', {'rs': data}, None 55 56 def _validate_config(self): 57 for option in [self.user, self.password, self.account_id, self.deployment_id]: 58 if option is None: 59 raise Exception("RightScale configuration not valid") 60 return True 61 62 43 return 'rs_index.html', {'rs': dict(deployment = deployment)}, None
Note: See TracChangeset
for help on using the changeset viewer.
