Beispiel #1
0
class UsersTable(Table):
    classes = ['pure-table']
    allow_sort = True
    username = Col('Invite Code')
    role = Col('Created By')
    active = BoolCol('Active')
    created = DatetimeCol('Create Date')
    updated = DatetimeCol('Updated Date')
    delete = ButtonCol('Delete',
                       'delete_user',
                       url_kwargs=dict(id='id'),
                       button_attrs={'class': 'pure-button button-error'})
    disable = ButtonCol('Disable',
                        'disable_user',
                        url_kwargs=dict(id='id'),
                        button_attrs={'class': 'pure-button button-secondary'})
    gen_pass = ButtonCol(
        'New Password',
        'regen_password',
        url_kwargs=dict(id='id'),
        button_attrs={'class': 'pure-button button-secondary'})

    def sort_url(self, col_key, reverse=False):
        if col_key == 'delete' or col_key == 'disable' or col_key == 'gen_pass':
            col_key = 'id'
        if reverse:
            direction = 'desc'
        else:
            direction = 'asc'
        return url_for('invites', sort=col_key, direction=direction)
Beispiel #2
0
class ResultTable(Table):
    classes = ['table', 'table-light', 'table-bordered', 'thead-light']

    id = Col('ID', show=False)
    name = Col('Name')
    created_at = DatetimeCol('Created At',
                             datetime_format="dd/MM-YYYY hh:mm:ss")
    updated_at = DatetimeCol('Updated At',
                             datetime_format="dd/MM-YYYY hh:mm:ss")
    language = Col('Language')
    button_col = ButtonCol('Clone',
                           'repository_page',
                           url_kwargs=dict(id='id'))
class Transactions_Table(Table):
    classes = ['table', 'table-bordered', 'table-striped', 'table-hover']
    id = Col('Id')
    type = Col('Type',
               td_html_attrs={
                   'type': 'button',
                   'src': 'static/img/harddisk.svg'
               })
    asset_name = Col('Asset Name')
    person_name = Col('Person')
    start_time = DatetimeCol('Start Time', datetime_format='dd-MM-yyyy HH:mm')
    end_time = DatetimeCol('End Time', datetime_format='dd-MM-yyyy HH:mm')
    status = Col('Status')
Beispiel #4
0
class JobTable(Table):
    def __init__(self, *args, target, exlude=None, **kwargs):
        super().__init__(*args, **kwargs)
        self.target = target
        self.exclude = exlude

    classes = ['Relation']
    allow_sort = True

    table_name = Col('table name')
    status = Col('Status')
    key = KeyColumn('Key')
    user = Col('User')
    connection_id = Col('Connection ID')
    error_message = Col('Error Message')
    timestamp = DatetimeCol('Timestamp')

    delete = CheckBoxCol('Delete', checked=False)

    def sort_url(self, col_key, reverse=False):
        if reverse:
            direction = 'desc'
        else:
            direction = 'asc'
        if self.exclude is not None and not col_key in self.exclude:
            return url_for(self.target, sort=col_key, direction=direction)
        else:
            return url_for(self.target)
class MeasurementsTable(Table):
    id = Col("Id")
    timestamp = DatetimeCol('Time', datetime_format='dd-MM-YY hh:mm:ss')
    device_name = Col("Device")
    type = Col("Type")
    value = Col("Value")
    unit = Col("Unit")
Beispiel #6
0
class StudyTable(Table):
    def sort_url(self, col_id, reverse=False):
        pass
    edit = LinkCol(
        'edit', 'edit_study', url_kwargs=dict(study_id='STUDYID'),
        anchor_attrs={'class': 'btn btn-icon btn-primary', 'title': 'Edit Study'},
        th_html_attrs={'class': 'mat-icon text-center', 'title': 'Edit Study'}
    )
    details = LinkCol(
        'ballot', 'study_details', url_kwargs=dict(study_id='STUDYID'),
        anchor_attrs={'class': 'btn btn-icon btn-default', 'title': 'Edit Questions'},
        th_html_attrs={'class': 'mat-icon text-center', 'title': 'Edit Questions'}
    )
    add_inv = LinkCol(
        'person_add', 'new_investigator', url_kwargs=dict(study_id='STUDYID'),
        anchor_attrs={'class': 'btn btn-icon btn-accent', 'title': 'Add Investigator'},
        th_html_attrs={'class': 'mat-icon text-center', 'title': 'Add Investigator'}
    )
    STUDYID = Col('Study Id')
    TITLE = Col('Title')
    NETBADGEID = Col('User')
    DATE_MODIFIED = DatetimeCol('Last Update', "medium")
    Q_COMPLETE = BoolCol('Complete?')
    requirements = NestedTableCol('Requirements', RequirementsTable)
    investigators = NestedTableCol('Investigators', InvestigatorsTable)
    delete = LinkCol(
        'delete', 'del_study', url_kwargs=dict(study_id='STUDYID'),
        anchor_attrs={'class': 'btn btn-icon btn-warn', 'title': 'Delete Study'},
        th_html_attrs={'class': 'mat-icon text-center', 'title': 'Delete Study'}
    )
Beispiel #7
0
class S3Objects(Table):
    # To understand LinkCol https://github.com/plumdog/flask_table/blob/master/examples/simple_app.py
    path = LinkCol("Path",
                   endpoint="browse_path",
                   url_kwargs=dict(s3path="path"),
                   attr="path")
    time = DatetimeCol("Time", datetime_format="yyyy.MM.dd HH:mm:ss")
    size = Col("Size")
Beispiel #8
0
class BlockchainTable(Table):
    # Class to format the table
    classes = ['table', 'table-striped']

    from_user = Col('From')
    to_user = Col('To')
    amount = Col('Amount')
    timestamp = DatetimeCol('Timestamp', datetime_format='full')
    nonce = Col('Nonce')
    miner_verify = BoolCol('Transaction Verified')
Beispiel #9
0
class BookResults(Table):
    classes = ['table']
    id = Col('Id', show=False)
    title = Col(_l(u'Title'))
    publisher = Col(_l(u'Publisher'))
    author = Col(_l(u'Author'))
    isbn13 = Col('ISBN 13')
    category = CategoryCol(_l(u'Category'))
    renter_name = Col(_l(u'Renter'))
    rented_time = DatetimeCol(_l(u'Rented time'))
    rent = ButtonCol(_l(u'Rent / Give Back'), '.rent', url_kwargs=dict(id='id'))
Beispiel #10
0
class Statistics(Table):
    settings = get_settings()
    table_id = ['statistics']
    classes = ['statistics']
    pc = Col('Plant Count')
    ec = Col('Environment Count')
    sc = Col('Strain Count')
    ac = Col('Cycle Count')
    rc = Col('Repellent Count')
    nc = Col('Nutrient Count')
    lastlog = DatetimeCol('Last Log')
Beispiel #11
0
class Statistics(Table):
    settings = get_settings()
    table_id = ['statistics']
    classes = ['statistics']
    pc = Col('Customer Count')
    ec = Col('Product Count')
    sc = Col('Strain Count')
    ac = Col('Menu Count')
    rc = Col('Repellent Count')
    nc = Col('Nutrient Count')
    lastlog = DatetimeCol('Last Log')
Beispiel #12
0
class TransactionTable(Table):
    classes = [
        'table', 'table-striped', 'table-bordered', 'table-hover', 'table-sm'
    ]
    thead_classes = ['thead-dark']
    ref_no = Col('#')
    type = Col('Type')
    transaction_date = DatetimeCol('Transaction Date',
                                   datetime_format='yyyy-MM-dd HH:mm')
    property_id = Col('Property')
    sold_price = Col('Sold Price')
    rental_price = Col('Rental Price')
    customer_id = Col('Customer')
    commission = Col('Commission')
class Checkout(Table):
    classes = [
        'table', 'table-striped', 'table-bordered', 'table-condensed',
        'table-hover'
    ]
    id = Col('Id', show=False)
    checkout_timestamp = DatetimeCol('Checkout Time',
                                     datetime_format="YYYY-MM-dd")
    checkout_username = Col('Username')
    checkout_item_name = Col('Item')
    checkout_serial_number = Col('Serial Number')
    checkout_asset_tag = Col('Asset Tag')
    check_in = ButtonCol('Check in',
                         'delete_record',
                         url_kwargs=dict(item='checkout_asset_tag'))
Beispiel #14
0
class OrderTable(Table):
    classes = ['table', 'table-hover',
               'table-condensed', 'table-striped']
    id = LinkCol('ID', 'order_summary',
                 url_kwargs=dict(id='id'), attr_list=['id'])
    user = Col('Created By')
    order_name = Col('Name')
    timestamp = DatetimeCol('Created On')
    archived = BoolCol('Archived')

    def __init__(self, orders, **kwargs):
        items = []
        for order in orders:
            items.append({'id': order.id,
                          'user': order.user.name,
                          'order_name': order.order_name,
                          'timestamp': order.timestamp,
                          'archived': order.archived})
        super().__init__(items, **kwargs)
Beispiel #15
0
class BOMTable(Table):
    classes = ['table', 'table-hover',
               'table-condensed', 'table-striped']
    id = LinkCol('ID', 'bom_summary',
                 url_kwargs=dict(id='id'), attr_list=['id'])
    name = Col('Name')
    version = Col('Version')
    user = Col('Uploaded By')
    part_count = Col('Part Count')
    timestamp = DatetimeCol('Uploaded on')

    def __init__(self, boms, **kwargs):
        items = []
        for bom in boms:
            items.append({'name': bom.name,
                          'version': bom.version,
                          'user': bom.user.name,
                          'id': bom.id,
                          'part_count': len(bom.bomparts),
                          'timestamp': bom.timestamp})
        super().__init__(items, **kwargs)
Beispiel #16
0
class Entries(Table):
    classes = ['table', 'table-striped', 'table-bordered', 'table-condensed']
    id = Col('Id', show=False)
    name = Col('Name')
    date = DatetimeCol('Date')
    text = Col('Text')
Beispiel #17
0
class TweetTable(Table):
    id = Col('id')
    create_date = DatetimeCol('create_date')
    text = Col('text')
    retweet_count = Col('retweet_count')
    favorite_count = Col('favorite_count')
Beispiel #18
0
class ItemTable(Table):
    name = Col('Name')
    dt = DatetimeCol('Datetime')
Beispiel #19
0
class invoice_table(Table):
    account = Col("Account ID")
    account_name = Col("Account Name")
    amount = Col("Amount")
    date_created = DatetimeCol("Date Issued")
    pay = LinkCol("Pay", "pay_invoices", url_kwargs=dict(account='account', amount='amount'))
Beispiel #20
0
 class MyTable(Table):
     datetime = DatetimeCol('DateTime Heading')
Beispiel #21
0
 class MyTable(Table):
     datetime = DatetimeCol('DateTime Heading',
                            datetime_format="YYYY-MM-dd hh:mm")
Beispiel #22
0
from stravalib import client, unithelper
import datetime
from flask_table import create_table, Col, DatetimeCol
tableCls=create_table()\
 .add_column("dist", Col("Dist"))\
 .add_column("date", DatetimeCol("Date"))\
 .add_column("time", DatetimeCol("Time"))\
 .add_column("pace", Col("Avg. Pace"))\
 .add_column("maxPace", Col("Max Pace"))\
 .add_column("el", Col("Elevation"))\
 .add_column("name", Col("Name"))


def minPerMile(meterPerSec):
    secPerMile = 1609.34 / float(meterPerSec)
    return str(datetime.timedelta(seconds=secPerMile))


def runsToTable(runList):
    items = list()
    for act in runList:
        items.append(
            dict(dist=unithelper.miles(act.distance),
                 time=act.moving_time.seconds,
                 date=act.start_date,
                 pace=minPerMile(act.average_speed),
                 maxPace=minPerMile(act.max_speed),
                 el=act.total_elevation_gain,
                 name=act.name))
    return tableCls(items)
class UserTable(Table):
    id = Col('Id')
    name = Col('Name')
    registered_on = DatetimeCol('Registered on',
                                datetime_format='dd-MM-YY hh:mm:ss')
Beispiel #24
0
class FireworksScheduleTable(Table):
    name = Col('Firework')
    channel = Col('Channel')
    run_date = DatetimeCol('Scheduled to Fire', datetime_format='long')