示例#1
0
文件: task.py 项目: pfinal/leafops
def task():
    models = Task.query.order_by(Task.id.desc()).all()
    return jsonify({
        "status":
        True,
        'data': [to_dict(m, append_columns=['project_name']) for m in models]
    })
示例#2
0
def project():
    return_data = []

    models = Project.query.order_by(Project.id.desc()).all()

    return jsonify({
        'status':
        True,
        'data': [to_dict(m, append_columns=['machine_names']) for m in models]
    })
示例#3
0
文件: machine.py 项目: pfinal/leafops
def machine():
    query = Machine.query.order_by(Machine.id.desc())

    print(request.args.get('name'))

    if request.args.get('name') != None and request.args.get('name') != '':
        query = query.filter('name like :name').params(
            name=request.args.get('name') + "%")

    models = query.all()

    return jsonify({
        "status":
        True,
        "data": [to_dict(m, append_columns=['cpu', 'mem']) for m in models]
    })
示例#4
0
文件: user.py 项目: pfinal/leafops
def user_profile():
    one = User.query.get(g.user_id)

    return jsonify({'status': True, 'data': to_dict(one, ['id', 'username', 'created_at'])})
示例#5
0
文件: user.py 项目: pfinal/leafops
def user():
    users = User.query.order_by(User.id.desc()).all()

    return jsonify({'status': True, 'data': [to_dict(obj, ['id', 'username', 'created_at']) for obj in users]})