예제 #1
0
파일: views.py 프로젝트: NolanZhao/TTEngine
def compiling_list(request):
    """
    查看编译机状态
    :param request:
    :return:
    """
    if request.method == "GET":
        # 查询编译机
        machine_json = []
        machines = Machine.objects(type=1)
        for machine in machines:
            machine_json_item = {'machine': None, 'record': None}
            # 机器
            machine_json_item['machine'] = convert_machine_to_json(machine)

            # 查询编译机最后一条日志
            compiling_record = CompilingUpdateRecord.objects(machine=machine).order_by('-start_time')
            if len(compiling_record) > 0:
                compiling_record = compiling_record[0]
                machine_json_item['record'] = convert_compiling_record_to_json(compiling_record)
            else:
                compiling_record = None
                machine_json_item['record'] = None
            machine_json.append(machine_json_item)

        machine_json = json.dumps(machine_json)
        return render_to_response("customer/customer_view.html", locals(), context_instance=RequestContext(request))
    else:
        error = '请使用http-get方式请求'
        logger.error(error)
        return render_to_response('item/temp.html', locals(), context_instance=RequestContext(request))
예제 #2
0
파일: views.py 프로젝트: NolanZhao/TTEngine
def compiling_record_del(request):
    response = {"success": False, "error": ""}
    try:
        # 校验参数
        id = request.POST.get("id", None)

        if id is None or str(id).strip() == "":
            response["error"] = "必要参数为空!"
            return HttpResponse(json.dumps(response), mimetype="application/json")

        # 执行删除操作
        record = CompilingUpdateRecord.objects(pk=id)
        if len(record) == 0:
            response["error"] = "未找到该记录!"
            return HttpResponse(json.dumps(response), mimetype="application/json")

        record = record[0]
        record.delete()
        response["success"] = True
        response["error"] = "执行成功!"
        return HttpResponse(json.dumps(response), mimetype="application/json")
    except Exception, e:
        response["error"] = "系统异常![%s]" % str(e)
        logger.error(response["error"] + getTraceBack())
        return HttpResponse(json.dumps(response), mimetype="application/json")
예제 #3
0
def compiling_record_del(request):
    response = {"success": False, "error": ""}
    try:
        # 校验参数
        id = request.POST.get("id", None)

        if id is None or str(id).strip() == "":
            response["error"] = "必要参数为空!"
            return HttpResponse(json.dumps(response),
                                mimetype="application/json")

        # 执行删除操作
        record = CompilingUpdateRecord.objects(pk=id)
        if len(record) == 0:
            response["error"] = "未找到该记录!"
            return HttpResponse(json.dumps(response),
                                mimetype="application/json")

        record = record[0]
        record.delete()
        response["success"] = True
        response["error"] = "执行成功!"
        return HttpResponse(json.dumps(response), mimetype="application/json")
    except Exception, e:
        response["error"] = "系统异常![%s]" % str(e)
        logger.error(response["error"] + getTraceBack())
        return HttpResponse(json.dumps(response), mimetype="application/json")
예제 #4
0
파일: views.py 프로젝트: NolanZhao/TTEngine
def compiling_record_list(request):
    """
    查看编译机日志
    :param request:
    :return:
    """
    if request.method == "GET":
        records = CompilingUpdateRecord.objects().order_by("-start_time")
        return render_to_response("customer/customer_compile_record_list.html", locals(), context_instance=RequestContext(request))
    else:
        error = '请使用http-get方式请求'
        logger.error(error)
        return render_to_response('item/temp.html', locals(), context_instance=RequestContext(request))
예제 #5
0
def compiling_record_list(request):
    """
    查看编译机日志
    :param request:
    :return:
    """
    if request.method == "GET":
        records = CompilingUpdateRecord.objects().order_by("-start_time")
        return render_to_response("customer/customer_compile_record_list.html",
                                  locals(),
                                  context_instance=RequestContext(request))
    else:
        error = '请使用http-get方式请求'
        logger.error(error)
        return render_to_response('item/temp.html',
                                  locals(),
                                  context_instance=RequestContext(request))
예제 #6
0
def compiling_list(request):
    """
    查看编译机状态
    :param request:
    :return:
    """
    if request.method == "GET":
        # 查询编译机
        machine_json = []
        machines = Machine.objects(type=1)
        for machine in machines:
            machine_json_item = {'machine': None, 'record': None}
            # 机器
            machine_json_item['machine'] = convert_machine_to_json(machine)

            # 查询编译机最后一条日志
            compiling_record = CompilingUpdateRecord.objects(
                machine=machine).order_by('-start_time')
            if len(compiling_record) > 0:
                compiling_record = compiling_record[0]
                machine_json_item['record'] = convert_compiling_record_to_json(
                    compiling_record)
            else:
                compiling_record = None
                machine_json_item['record'] = None
            machine_json.append(machine_json_item)

        machine_json = json.dumps(machine_json)
        return render_to_response("customer/customer_view.html",
                                  locals(),
                                  context_instance=RequestContext(request))
    else:
        error = '请使用http-get方式请求'
        logger.error(error)
        return render_to_response('item/temp.html',
                                  locals(),
                                  context_instance=RequestContext(request))