@admin_bp.route('/pdns', methods=['GET'])
@login_required
@operator_role_required
def pdns_stats():
    if ((not Setting().get('pdns_api_url')) or (not Setting().get('pdns_api_key')) or (not Setting().get('pdns_version'))):
        return redirect(url_for('admin.setting_pdns'))
    domains = Domain.query.all()
    users = User.query.all()
    server = Server(server_id='localhost')
    configs = server.get_config()
    statistics = server.get_statistic()
    history_number = History.query.count()
    if statistics:
        uptime = list([uptime for uptime in statistics if (uptime['name'] == 'uptime')])[0]['value']
    else:
        uptime = 0
    return render_template('admin_pdns_stats.html', domains=domains, users=users, configs=configs, statistics=statistics, uptime=uptime, history_number=history_number)
@admin_bp.route('/pdns', methods=['GET'])
@login_required
@operator_role_required
def pdns_stats():
    if ((not Setting().get('pdns_api_url')) or (not Setting().get('pdns_api_key')) or (not Setting().get('pdns_version'))):
        return redirect(url_for('admin.setting_pdns'))
    domains = Domain.query.all()
    users = User.query.all()
    server = Server(server_id='localhost')
    configs = server.get_config()
    statistics = server.get_statistic()
    history_number = History.query.count()
    if statistics:
        uptime = list([uptime for uptime in statistics if (uptime['name'] == 'uptime')])[0]['value']
    else:
        uptime = 0
    return render_template('admin_pdns_stats.html', domains=domains, users=users, configs=configs, statistics=statistics, uptime=uptime, history_number=history_number)