Changeset 804


Ignore:
Timestamp:
10/01/09 13:55:50 (4 years ago)
Author:
cbalan
Message:

Added RightScaleDeployment? wiki macro

Location:
trunk/plugins/rightscaleplugin
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/plugins/rightscaleplugin/setup.py

    r803 r804  
    1616      license="BSD", 
    1717      entry_points={'trac.plugins': [ 
     18            'tracrightscale.wiki = tracrightscale.wiki', 
    1819            'tracrightscale.web_ui = tracrightscale.web_ui' 
    1920            ]}, 
  • trunk/plugins/rightscaleplugin/tracrightscale/api.py

    r803 r804  
    2424        self.auth_cookie = None 
    2525 
    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) 
    2831        request.add_header('X-API-VERSION', self.api_version) 
    2932        self._get_auth_cookie().add_cookie_header(request) 
  • trunk/plugins/rightscaleplugin/tracrightscale/templates/rs_index.html

    r803 r804  
    77    </head> 
    88    <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" />         
    2411    </body> 
    2512</html> 
  • trunk/plugins/rightscaleplugin/tracrightscale/web_ui.py

    r803 r804  
    88from trac.config import Option, IntOption 
    99from trac.web.main import IRequestHandler 
    10 from trac.web.chrome import INavigationContributor, ITemplateProvider 
     10from trac.web.chrome import ITemplateProvider 
    1111from trac.util.html import html 
    1212 
     
    1414 
    1515class RightScaleModule(Component): 
    16     implements(ITemplateProvider, INavigationContributor, IRequestHandler) 
     16    implements(ITemplateProvider, IRequestHandler) 
    1717     
    1818    user = Option('rightscale', 'user', '', 
     
    2525        """RightScale password""") 
    2626     
    27     # INavigationContributor methods 
    28     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  
    3327    # ITemplateProvider 
    3428    def get_templates_dirs(self): 
     
    4337        return re.match('/rightscale',req.path_info) 
    4438    def process_request(self, req): 
    45         self._validate_config() 
    46         data = {} 
    47          
    4839        rs = RightScale(self.user, self.password, self.account_id) 
    4940        deployment = Deployment(self.deployment_id) 
    5041        deployment.load(rs) 
    5142         
    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.