Exemple #1
0
def index(username):
    """
    List all workflows from the master database.
    """
    try:
        dashboard = Dashboard(g.master_db_url)
        args = __get_datatables_args()
        if request.is_xhr:
            count, filtered, workflows, totals = dashboard.get_root_workflow_list(
                **args)

            __update_label_link(workflows)
            __update_timestamp(workflows)

            for workflow in workflows:
                workflow.state = (
                    workflow.state + ' (%s)' % workflow.reason
                ) if workflow.status > 0 and workflow.reason else workflow.state
        else:
            totals = dashboard.get_root_workflow_list(counts_only=True, **args)

    except NoWorkflowsFoundError, e:
        if request.is_xhr:
            return render_template('workflow.xhr.json',
                                   count=e.count,
                                   filtered=e.filtered,
                                   workflows=[],
                                   table_args=args)

        return render_template('workflow.html', counts=(0, 0, 0, 0))
Exemple #2
0
def index(username):
    """
    List all workflows from the master database.
    """
    try:
        dashboard = Dashboard(g.master_db_url)
        args = __get_datatables_args()
        if request.is_xhr:
            count, filtered, workflows, totals = dashboard.get_root_workflow_list(**args)

            __update_label_link(workflows)
            __update_timestamp(workflows)

            for workflow in workflows:
                workflow.state = (
                    (workflow.state + " (%s)" % workflow.reason)
                    if workflow.status > 0 and workflow.reason
                    else workflow.state
                )
        else:
            totals = dashboard.get_root_workflow_list(counts_only=True, **args)

    except NoWorkflowsFoundError, e:
        if request.is_xhr:
            return render_template(
                "workflow.xhr.json", count=e.count, filtered=e.filtered, workflows=[], table_args=args
            )

        return render_template("workflow.html", counts=(0, 0, 0, 0))
Exemple #3
0
def index(username):
    """
    List all workflows from the master database.
    """
    try:
        dashboard = Dashboard(g.master_db_url)
        args = __get_datatables_args()
        if request.is_xhr:
            count, filtered, workflows, totals = dashboard.get_root_workflow_list(
                **args
            )
        else:
            totals = dashboard.get_root_workflow_list(counts_only=True, **args)

    except NoWorkflowsFoundError as e:
        if request.is_xhr:
            workflows = []
            d = {
                "draw": args["sequence"] if args["sequence"] else 0,
                "recordsTotal": e.count if e.count is not None else len(workflows),
                "data": workflows,
            }
            if args["limit"]:
                d["recordsFiltered"] = e.filtered

            return serialize(d)

        return render_template("workflow.html", counts=(0, 0, 0, 0))

    if request.is_xhr:
        d = {
            "draw": args["sequence"] if args["sequence"] else 0,
            "recordsTotal": count if count is not None else len(workflows),
            "data": [w._asdict() for w in workflows],
        }
        if args["limit"]:
            d["recordsFiltered"] = filtered

        return serialize(d)

    return render_template("workflow.html", counts=totals)
Exemple #4
0
def index():
    '''
    List all workflows from the master database.
    '''
    try:
        dashboard = Dashboard(g.master_db_url)
        args = __get_datatables_args()
        count, filtered, workflows, totals = dashboard.get_root_workflow_list(**args)
        __update_label_link(workflows)
        __update_timestamp(workflows)
    except NoWorkflowsFoundError, e:
        if request.is_xhr:
            return render_template('workflow.xhr.json', count=e.count, filtered=e.filtered, workflows=[], table_args=args)

        return render_template('workflow.html', workflows=[], counts=(0, 0, 0, 0))