Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
from jadi import component
from aj.plugins.core.api.sidebar import SidebarItemProvider
@component(SidebarItemProvider)
class ItemProvider(SidebarItemProvider):
'''
To add a sidebar item, we create a component implementing SidebarItemProvider
'''
def __init__(self, context):
pass
def provide(self):
return [
{
# attach the item to the 'general' category
'attach': 'category:general',
'name': 'Demo: UI',
'icon': 'question',
'url': '/view/demo2',
'children': []
}
from jadi import component
from aj.plugins.core.api.sidebar import SidebarItemProvider
@component(SidebarItemProvider)
class ItemProvider(SidebarItemProvider):
'''
To add a sidebar item, we create a component implementing SidebarItemProvider
'''
def __init__(self, context):
pass
def provide(self):
return [
{
# attach the item to the 'general' category
'attach': 'category:general',
'name': 'Demo: Bower',
'icon': 'question',
'url': '/view/demo3',
'children': []
}
def search(self, query):
query = query.strip().lower()
results = []
for provider in SidebarItemProvider.all(self.context):
for item in provider.provide():
if 'url' in item:
search_source = '$'.join([item.get('id', ''), item.get('name', '')]).lower()
if query in search_source:
results.append({
'title': item['name'],
'icon': item['icon'],
'url': item['url'],
})
return results
from jadi import component
from aj.auth import PermissionProvider
from aj.plugins.core.api.sidebar import SidebarItemProvider
@component(SidebarItemProvider)
class ItemProvider(SidebarItemProvider):
def __init__(self, context):
self.context = context
def provide(self):
return [
{
'attach': 'category:system',
'id': 'datetime',
'name': _('Date & time'),
'icon': 'clock-o',
'url': '/view/datetime',
'children': [],
}
]
from jadi import component
from aj.plugins.core.api.sidebar import SidebarItemProvider
@component(SidebarItemProvider)
class ItemProvider(SidebarItemProvider):
def __init__(self, context):
self.context = context
def provide(self):
return [
{
'attach': 'category:general',
'id': 'auth_users',
'name': 'Users',
'icon': 'users',
'url': '/view/auth-users',
'children': [],
}
from jadi import component
from aj.plugins.core.api.sidebar import SidebarItemProvider
@component(SidebarItemProvider)
class ItemProvider(SidebarItemProvider):
def __init__(self, context):
pass
def provide(self):
return [
{
'attach': 'category:general',
'name': 'Settings',
'icon': 'cog',
'url': '/view/settings',
'children': [
]
from jadi import component
from aj.plugins.core.api.sidebar import SidebarItemProvider
from aj.auth import PermissionProvider
from .api import ServiceManager
@component(SidebarItemProvider)
class ItemProvider(SidebarItemProvider):
def __init__(self, context):
self.context = context
def provide(self):
children = [{
'attach': 'services',
'name': mgr.name,
'icon': 'cog',
'url': '/view/services/%s' % mgr.id,
'children': [],
} for mgr in ServiceManager.all(self.context)]
return [
{
'attach': 'category:software',
from jadi import component
from aj.plugins.core.api.sidebar import SidebarItemProvider
@component(SidebarItemProvider)
class ItemProvider(SidebarItemProvider):
def __init__(self, context):
pass
def provide(self):
return [
{
'attach': 'category:tools',
'name': 'File Manager',
'icon': 'folder-o',
'url': '/view/filemanager//',
'children': [
]
from jadi import component
from aj.plugins.core.api.sidebar import SidebarItemProvider
@component(SidebarItemProvider)
class ItemProvider(SidebarItemProvider):
def __init__(self, context):
pass
def provide(self):
return [
{
# attach the item to the 'general' category
'attach': 'category:general',
'name': 'Demo: HTTP',
'icon': 'question',
'url': '/view/demo4',
'children': []
}
from jadi import component
from aj.auth import PermissionProvider
from aj.plugins.core.api.sidebar import SidebarItemProvider
@component(SidebarItemProvider)
class ItemProvider(SidebarItemProvider):
def __init__(self, context):
self.context = context
def provide(self):
return [
{
'attach': 'category:system',
'id': 'network',
'name': _('Network'),
'icon': 'plug',
'url': '/view/network',
'children': [],
}
]