Exemplo n.º 1
0
 def show_tag(x):
     if x.is_default: #If we are the default, we can't change to not default
         return x.tag
     elif user and user.is_admin():
         return make_edit_link(x.tag,x.id)
     else:  #no perms to edit
         return x.tag
Exemplo n.º 2
0
    def index(self):
        labcontrollers = session.query(LabController)

        labcontrollers_grid = LabControllerDataGrid(fields=[
                                  ('FQDN', lambda x: make_edit_link(x.fqdn,x.id)),
                                  ('Disabled', lambda x: x.disabled),
                                  ('Removed', lambda x: x.removed),
                                  (' ', lambda x: self.make_lc_remove_link(x)),
                              ])
        return dict(title="Lab Controllers", 
                    grid = labcontrollers_grid,
                    search_bar = None,
                    object_count = labcontrollers.count(),
                    list = labcontrollers)
Exemplo n.º 3
0
    def index(self):
        labcontrollers = session.query(LabController)

        labcontrollers_grid = LabControllerDataGrid(fields=[
            ('FQDN', lambda x: make_edit_link(x.fqdn, x.id)),
            ('Disabled', lambda x: x.disabled),
            ('Removed', lambda x: x.removed),
            (' ', lambda x: self.make_lc_remove_link(x)),
        ],
                                                    add_action='./new')
        return dict(title="Lab Controllers",
                    grid=labcontrollers_grid,
                    search_bar=None,
                    list=labcontrollers)
Exemplo n.º 4
0
 def index(self,*args,**kw):
     keytypes = session.query(Key) 
     list_by_letters = set([elem.key_name[0].capitalize() for elem in keytypes])
     results = self.process_search(**kw)
     if results:
         keytypes = results.order_by(Key.key_name)
     keytypes_grid = myPaginateDataGrid(fields=[
                               ('Key', lambda x: make_edit_link(x.key_name, x.id)),
                               ('Numeric', lambda x: x.numeric),
                               (' ', lambda x: make_remove_link(x.id)),
                           ],
                           add_action='./new')
     return dict(title="Key Types", 
                 grid = keytypes_grid, 
                 search_widget = self.search_widget_form,
                 alpha_nav_bar = AlphaNavBar(list_by_letters,self.search_name),
                 list = keytypes)
Exemplo n.º 5
0
    def index(self,*args,**kw):
        powertypes = session.query(PowerType)
        list_by_letters = set([elem.name[0].capitalize() for elem in powertypes if elem.name])
        results = self.process_search(**kw)
        if results:
            powertypes = results
        can_edit = identity.current.user and identity.current.user.is_admin()
        powertypes_grid = myPaginateDataGrid(fields=[
                                  ('Power Type', lambda x: make_edit_link(x.name, x.id) if can_edit else x.name),
                                  (' ', lambda x: make_remove_link(x.id) if can_edit else None ),
                              ],
                              add_action='./new' if can_edit else None)
        

        return dict(title="Power Types", 
                    grid = powertypes_grid,
                    search_widget = self.search_widget_form,
                    alpha_nav_bar = AlphaNavBar(list_by_letters,'power'),
                    list = powertypes)
Exemplo n.º 6
0
 def index(self, *args, **kw):
     configitems = session.query(ConfigItem)
     list_by_letters = set([elem.name[0].capitalize() for elem in configitems])
     results = self.process_search(**kw)
     if results:
         configitems = results
     configitems_grid = myPaginateDataGrid(fields=[
                               ('Setting', lambda x: make_edit_link(x.name, x.id)),
                               ('Description', lambda x: x.description),
                               ('Current Value', lambda x: x.current_value()),
                               ('Next Value', lambda x: x.next_value() and u'"%s" from %s' % (x.next_value().value, x.next_value().valid_from)),
                               (' ', lambda x: (x.readonly or x.current_value() is None) and " " or
                                     make_link(url='remove?id=%s' % x.id,
                                         elem_class='btn', text='Clear current value')),
                           ])
     return dict(title="Configuration",
                 grid = configitems_grid,
                 alpha_nav_bar = AlphaNavBar(list_by_letters, self.search_name),
                 search_widget = self.search_widget_form,
                 list = configitems)
Exemplo n.º 7
0
    def index(self, *args, **kw):
        users = session.query(User)
        list_by_letters = set(
            [elem.user_name[0].capitalize() for elem in users])
        result = self.process_search(**kw)
        if result:
            users = result

        users_grid = myPaginateDataGrid(fields=[
            ('Login', lambda x: make_edit_link(x.user_name, x.user_id)),
            ('Display Name', lambda x: x.display_name),
            ('Disabled', lambda x: x.disabled),
            ('', lambda x: self.make_remove_link(x)),
        ],
                                        add_action='./new')
        return dict(title="Users",
                    grid=users_grid,
                    alpha_nav_bar=AlphaNavBar(list_by_letters, 'user'),
                    search_widget=self.search_widget_form,
                    list=users)
Exemplo n.º 8
0
 def index(self, *args, **kw):
     configitems = session.query(ConfigItem)
     list_by_letters = set([elem.name[0].capitalize() for elem in configitems])
     results = self.process_search(**kw)
     if results:
         configitems = results
     configitems_grid = myPaginateDataGrid(fields=[
                               ('Setting', lambda x: make_edit_link(x.name, x.id)),
                               ('Description', lambda x: x.description),
                               ('Current Value', lambda x: x.current_value()),
                               ('Next Value', lambda x: x.next_value() and u'"%s" from %s' % (x.next_value().value, x.next_value().valid_from)),
                               (' ', lambda x: (x.readonly or x.current_value() is None) and " " or
                                     make_link(url='remove?id=%s' % x.id,
                                         elem_class='btn', text='Clear current value')),
                           ])
     return dict(title="Configuration",
                 grid = configitems_grid,
                 alpha_nav_bar = AlphaNavBar(list_by_letters, self.search_name),
                 search_widget = self.search_widget_form,
                 list = configitems)
Exemplo n.º 9
0
Arquivo: user.py Projeto: omps/beaker
 def index(self,*args,**kw): 
     users = session.query(User) 
     list_by_letters = set([elem.user_name[0].capitalize() for elem in users]) 
     result = self.process_search(**kw)
     if result:
         users = result
     
    
     users_grid = myPaginateDataGrid(fields=[
                               ('Login', lambda x: make_edit_link(x.user_name,
                                                                  x.user_id)),
                               ('Display Name', lambda x: x.display_name),
                               ('Disabled', lambda x: x.disabled),
                               ('', lambda x: self.make_remove_link(x)),
                           ],
                           add_action='./new')
     return dict(title="Users",
                 grid = users_grid,
                 alpha_nav_bar = AlphaNavBar(list_by_letters,'user'),
                 search_widget = self.search_widget_form,
                 list = users)
Exemplo n.º 10
0
    def index(self, *args, **kw):
        powertypes = session.query(PowerType)
        list_by_letters = set(
            [elem.name[0].capitalize() for elem in powertypes if elem.name])
        results = self.process_search(**kw)
        if results:
            powertypes = results
        can_edit = identity.current.user and identity.current.user.is_admin()
        powertypes_grid = myPaginateDataGrid(
            fields=[
                ('Power Type', lambda x: make_edit_link(x.name, x.id)
                 if can_edit else x.name),
                (' ', lambda x: make_remove_link(x.id) if can_edit else None),
            ],
            add_action='./new' if can_edit else None)

        return dict(title="Power Types",
                    grid=powertypes_grid,
                    search_widget=self.search_widget_form,
                    alpha_nav_bar=AlphaNavBar(list_by_letters, 'power'),
                    list=powertypes)
Exemplo n.º 11
0
 def index(self, *args, **kw):
     keytypes = session.query(Key)
     list_by_letters = set([elem.key_name[0].capitalize() for elem in keytypes])
     results = self.process_search(**kw)
     if results:
         keytypes = results.order_by(Key.key_name)
     can_edit = identity.current.user and identity.current.user.is_admin()
     keytypes_grid = myPaginateDataGrid(
         fields=[
             ("Key", lambda x: make_edit_link(x.key_name, x.id) if can_edit else x.key_name),
             ("Numeric", lambda x: x.numeric),
             (" ", lambda x: make_remove_link(x.id) if can_edit else None),
         ],
         add_action="./new" if can_edit else None,
     )
     return dict(
         title="Key Types",
         grid=keytypes_grid,
         search_widget=self.search_widget_form,
         alpha_nav_bar=AlphaNavBar(list_by_letters, self.search_name),
         list=keytypes,
     )