How to use the aj.plugins.core.api.sidebar.SidebarItemProvider function in aj

To help you get started, we’ve selected a few aj examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ajenti / demo-plugins / demo_2_ui / main.py View on Github external
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': []
            }
github ajenti / demo-plugins / demo_3_bower / main.py View on Github external
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': []
            }
github ajenti / ajenti / plugins / core / api / navbox.py View on Github external
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
github ajenti / ajenti / plugins / datetime / main.py View on Github external
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': [],
            }
        ]
github ajenti / ajenti / plugins / auth_users / main.py View on Github external
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': [],
            }
github ajenti / ajenti / plugins / settings / main.py View on Github external
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': [
                ]
github ajenti / ajenti / plugins / services / main.py View on Github external
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',
github ajenti / ajenti / plugins / filemanager / main.py View on Github external
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': [
                ]
github ajenti / demo-plugins / demo_4_http / main.py View on Github external
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': []
            }
github ajenti / ajenti / plugins / network / main.py View on Github external
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': [],
            }
        ]