Ejemplo n.º 1
0
 def environment(self):
     return page(zoom.Component(
         h.h2('Zoom'),
         zoom.html.table([
             ('Version', zoom.__version__ + ' Community Edition'),
             ('Installed Path', zoom.tools.zoompath()),
         ]),
         h.h2('Python'),
         zoom.html.table([
             ('sys.version', sys.version),
             ('sys.path', '<br>'.join(sys.path)),
         ]),
         h.h2('Operating System'),
         zoom.html.table([
             ('Name', os.name),
             ('PATH', '<br>'.join(os.environ.get('PATH').split(':')))
         ]),
         h.h2('Platform'),
         zoom.html.table([('Node', platform.node()),
                          ('System', platform.system()),
                          ('Machine', platform.machine()),
                          ('Archtitecture',
                           ' '.join(platform.architecture()))]),
         h.h2('Variables'),
         zoom.html.table(list(os.environ.items())),
         css="""
                 .content table { width: 100%; }
                 .content table td { vertical-align: top; width: 70%; }
                 .content table td:first-child { width: 25%; }
             """),
                 title='Environment')
Ejemplo n.º 2
0
 def environment(self):
     return page(zoom.Component(
         h.h2('Python'),
         zoom.html.table([
             ('Version', sys.version),
             ('PYTHONPATH', '<br>'.join(sys.path)),
             ('PATH', '<br>'.join(os.environ.get('PATH').split(':')))
         ]),
         h.h2('Operating System'),
         zoom.html.table([
             ('Name', os.name), ('PYTHONPATH', '<br>'.join(sys.path)),
             ('PATH', '<br>'.join(os.environ.get('PATH').split(':')))
         ]),
         h.h2('Platform'),
         zoom.html.table([('Node', platform.node()),
                          ('System', platform.system()),
                          ('Machine', platform.machine()),
                          ('Archtitecture',
                           ' '.join(platform.architecture()))]),
         h.h2('Variables'),
         zoom.html.table(list(os.environ.items())),
         css="""
                 .content table { width: 100%; }
                 .content table td { vertical-align: top; }
             """),
                 title='Environment')
Ejemplo n.º 3
0
    def index(self):
        engine = zoom.system.site.config.get('database', 'engine')
        if engine == 'mysql':

            db = zoom.system.site.db

            sections = [
                ('Settings', [
                    ('Connection', str(zoom.tools.websafe(zoom.system.site.db))),
                    ('Isolation Level', get_isolation_level(zoom.system.site.db))
                ]),
                ('Process List', zoom.system.site.db('show processlist')),
                ('Status', zoom.system.site.db('show status')),
            ]

            if db('show slave hosts'):
                sections.extend([
                    ('Replication Hosts', db('show slave hosts')),
                    ('Replication Status', db('show slave status'))
                ])

            content = zoom.Component(
                *((h.h2(title), h.table(code)) for title, code in sections),
                css="""
                .content table { width: 100%; }
                .content table td {width: 50%; }
                """
            )


        else:
            content = 'not available for {} database engine'.format(engine)
        return zoom.page(content, title='Database')
Ejemplo n.º 4
0
def view():

    hr = '<hr>\n'

    content = zoom.Component(
        'zoom.components.HeaderBar',
        c.HeaderBar(left=h.h2('HeaderBar Left'), right='HeaderBar right'),
        hr,
        'zoom.components.spinner',
        h.div(c.spinner(),
              classed="clearfix",
              style="margin: 40px auto; width: 0;"),
        hr,
        'zoom.components.dropzone',
        c.dropzone('/sample/components'),
        hr,
    )

    return zoom.page(content, title='Components')
Ejemplo n.º 5
0
def view():

    hr = '<hr>\n'

    data = [('String', 'Integer', 'Decimal'),
            ('One', 1, decimal.Decimal(1234)),
            ('Two', 2, decimal.Decimal(2345))]

    content = zoom.Component(
        'zoom.browse',
        zoom.browse(data, title='Sample Header',
                    footer='sample footer'), hr, 'zoom.components.HeaderBar',
        c.HeaderBar(left=h.h2('HeaderBar Left'),
                    right='HeaderBar right'), hr, 'zoom.components.spinner',
        h.div(c.spinner(),
              classed="clearfix",
              style="margin: 40px auto; width: 0;"), hr,
        'zoom.components.dropzone', c.dropzone('/sample/components'), hr,
        use_common_package('not updated yet'))

    return zoom.page(content, title='Components')
Ejemplo n.º 6
0
    def configuration(self):
        """Return the configuration page"""
        get = zoom.system.site.config.get
        site = zoom.system.site
        request = zoom.system.request
        app = zoom.system.request.app
        system_apps = get('apps', 'system',
                          ','.join(zoom.apps.DEFAULT_SYSTEM_APPS))
        main_apps = get('apps', 'main', ','.join(zoom.apps.DEFAULT_MAIN_APPS))

        items = zoom.packages.get_registered_packages()
        packages = ((key, '<br>'.join(
            '{resources}'.format(resources='<br>'.join(resources))
            for resource_type, resources in sorted(
                parts.items(),
                key=lambda a: ['requires', 'styles', 'libs'].index(a[0]))))
                    for key, parts in sorted(items.items()))

        return page(zoom.Component(
            h.h2('Site'),
            zoom.html.table([(k, getattr(site, k)) for k in (
                'name',
                'path',
                'owner_name',
                'owner_email',
                'owner_url',
                'admin_email',
                'csrf_validation',
            )]),
            h.h2('Users'),
            zoom.html.table([(k, getattr(site, k)) for k in (
                'guest',
                'administrators_group',
                'developers_group',
            )]),
            h.h2('Apps'),
            zoom.html.table([(k, getattr(site, k)) for k in (
                'index_app_name',
                'home_app_name',
                'login_app_name',
                'auth_app_name',
                'locate_app_name',
            )] + [
                ('app.path', app.path),
                ('apps_paths', '<br>'.join(site.apps_paths)),
                ('main_apps', main_apps),
                ('system_apps', system_apps),
            ]),
            h.h2('Theme'),
            zoom.html.table([
                ('name', site.theme),
                ('path', site.theme_path),
                ('comments', site.theme_comments),
            ]),
            h.h2('Sessions'),
            zoom.html.table([(k, getattr(site, k))
                             for k in ('secure_cookies', )]),
            h.h2('Monitoring'),
            zoom.html.table([
                ('logging', site.logging),
                ('profiling', site.profiling),
                ('app_database', site.monitor_app_database),
                ('system_database', site.monitor_system_database),
            ]),
            h.h2('Errors'),
            zoom.html.table([
                ('users', get('errors', 'users', False)),
            ]),
            h.h2('Packages'),
            zoom.html.table(packages, ),
            css="""
                    .content table { width: 100%; }
                    .content table td { vertical-align: top; width: 70%; }
                    .content table td:first-child { width: 25%; }
                """),
                    title='Environment')
Ejemplo n.º 7
0
def view():

    layout = WidgetsLayout()

    card = Card()

    cards = Cards().format(cards=zoom.Component(
        card.format('basic card'),
        card.format('card with title', title='Title'),
        card.format('Card with footer', footer='Footer'),
        card.format('Card with title and footer',
                    title='Title',
                    footer='Footer'),
    ), )

    metric = MetricWidget()
    metrics = zoom.Component(
        h.h2('Metrics'),
        zoom.html.div(
            layout.format(
                card(metric(title='Queries', value=100, hint='numeric value')),
                card(metric(title='Items', value='1,123', hint='string')),
                card(metric(title='Revenue', value='$1,323',
                            hint='formatted')),
                card(
                    metric(title='Date',
                           value=zoom.tools.today(),
                           hint='other types')),
            ),
            classed='metrics-layout',
        ),
        css='.metrics-layout .widgets-layout { min-height: auto; }')

    progress_widgets = (card(ProgressWidget().format(
        10 + n * 20,
        title='Metric %s' % n,
        hint='Metric %s hint' % n if n in [1, 3] else '',
    )) for n in range(4))
    progress = zoom.Component(
        h.h2('Progress'),
        layout.format(*progress_widgets),
    )

    charts = [
        Chart(
            title='Pipeline',
            format='${:,.2f}',
        ),
        Chart(
            title='Inventory',
            classed='bg-gradient-info',
            smooth=False,
        ),
        Chart(
            title='Expenses',
            classed='bg-gradient-warning',
            data=[100, 200, 700, 400],
            labels=['January', 'February', 'March', 'April'],
            type='bar',
        ),
        Chart(
            title='Errors',
            classed='bg-gradient-danger',
            fill_color='#fff',
        ),
    ]
    chart_widget = ChartWidget()
    chart_widgets = (card(chart_widget.format(chart)) for chart in charts)
    charts_section = zoom.Component(h.h2('Charts'),
                                    layout.format(*chart_widgets))

    return zoom.page(cards, metrics, progress, charts_section, title='Widgets')