Ejemplo n.º 1
0
def dbstatus(db_type=None):
    """
    Generates a stats page for each service type
    """
    live_services = Services.get_active()
    results = REGISTERED_SERVICES[db_type]["panel"](live_services.get(db_type))

    template = 'services/detailed_%s.html' % db_type

    return render_template(template, pagetitle='Statusuri db pentru '+str(db_type).upper(), results=results)
Ejemplo n.º 2
0
def get_datatables_results(_filter=None):

    live_services = Services.get_active()

    stats = []
    stats_redis = REGISTERED_SERVICES['redis']["datatable"](live_services.get('redis'))
    stats_mongo = REGISTERED_SERVICES['mongo']["datatable"](live_services.get('mongo'))

    if _filter == 'mongo' and stats_mongo:
        stats = stats_mongo['data']
    elif _filter == 'redis' and stats_redis:
        stats = stats_redis['data']
    else:
        stats.extend(stats_mongo['data'])
        stats.extend(stats_redis['data'])

    output = {}
    output['draw'] = request.form['draw']
    output['data'] = stats
    output['recordsTotal'] = len(stats)
    output['recordsFiltered'] = len(stats)

    return jsonify(output)