Esempio n. 1
0
def format(action=None, lister=False):
    columns = (
        'Name',
        'Is system',
        'Input',
        'Description',
        'Tags',
        'Created at',
        'Updated at'
    )

    if action:
        tags = getattr(action, 'tags', None) or []
        input = action.input if not lister else base.cut(action.input)
        desc = (action.description if not lister
                else base.cut(action.description))

        data = (
            action.name,
            action.is_system,
            input,
            desc,
            base.wrap(', '.join(tags)) or '<none>',
            action.created_at,
        )

        if hasattr(action, 'updated_at'):
            data += (action.updated_at,)
        else:
            data += (None,)
    else:
        data = (tuple('<none>' for _ in range(len(columns))),)

    return columns, data
Esempio n. 2
0
def format(workflow=None, lister=False):
    columns = (
        'Name',
        'Tags',
        'Input',
        'Created at',
        'Updated at'
    )

    if workflow:
        tags = getattr(workflow, 'tags', None) or []

        data = (
            workflow.name,
            base.wrap(', '.join(tags)) or '<none>',
            workflow.input if not lister else base.cut(workflow.input),
            workflow.created_at
        )

        if hasattr(workflow, 'updated_at'):
            data += (workflow.updated_at,)
        else:
            data += (None,)
    else:
        data = (tuple('<none>' for _ in range(len(columns))),)

    return columns, data
    def format(workflow=None, lister=False):
        if workflow:
            tags = getattr(workflow, 'tags', None) or []

            data = (
                workflow.id,
                workflow.name,
                workflow.namespace,
                workflow.project_id,
                base.wrap(', '.join(tags)) or '<none>',
                workflow.input if not lister else base.cut(workflow.input),
                workflow.scope,
                workflow.created_at
            )

            if hasattr(workflow, 'updated_at'):
                data += (workflow.updated_at,)
            else:
                data += (None,)
        else:
            data = (tuple('' for _ in range(len(WorkflowFormatter.COLUMNS))),)

        return WorkflowFormatter.headings(), data
Esempio n. 4
0
def format(workbook=None):
    columns = (
        'Name',
        'Tags',
        'Created at',
        'Updated at'
    )

    if workbook:
        data = (
            workbook.name,
            base.wrap(', '.join(workbook.tags or '')) or '<none>',
            workbook.created_at,
        )

        if hasattr(workbook, 'updated_at'):
            data += (workbook.updated_at,)
        else:
            data += (None,)

    else:
        data = (tuple('<none>' for _ in range(len(columns))),)

    return columns, data