def load_project(): """加载项目""" status, prj, reason = api.project_get_current() if status != api.OK: print(reason) return status, prj, reason = api.project_services_start(prj.id) if status != api.OK: print(reason) return
def project_service_restart(): """重启项目服务""" status, prj, reason = api.project_get_current() if status != api.OK: print(reason) return status, service_status, reason = api.project_service_restart(prj.id) if status != api.OK: print(reason) return dump_service_status(service_status)
def flow_start(ctx, source): """执行流程文件""" status, project, reason = api.project_get_current() if status != api.OK: return if project is None: return if project.id < 0: print("当前还没有激活的项目,无法运行流程!") return status, payload, reason = api.flow_run(project.id, source) if status != api.OK: print(reason) return
def project_with_flow_file(request, prj_id): """获取当前项目的流程执行状态""" status, project, reason = api.project_get_current() if status != api.OK: return HttpResponseNotFound() if prj_id != project.id: return HttpResponseNotFound() status, flow_status, reason = api.flow_get_status_from_cache() if status != api.OK: return HttpResponseNotFound() context = dict() context['project'] = project context['flow_status'] = flow_status return render(request, "14-流程状态/03-流程执行概况.html", context=context)
def show_project_flow_summary(request, prj_id): """显示项目流程运行信息""" context = dict() status, active_prj, reason = api.project_get_current() if status != api.OK: context['reason'] = reason return render(request, '14-流程状态/99-流程信息错误.html', context=context) if active_prj.id != prj_id: context['reason'] = reason return render(request, '14-流程状态/99-流程信息错误.html', context=context) status, flow_status, reason = api.flow_get_status_from_cache() if status != api.OK: context['reason'] = reason return render(request, '14-流程状态/99-流程信息错误.html', context=context) project = Project.objects.get(id=prj_id) context['flow_status'] = flow_status context['project'] = project return render(request, '14-流程状态/03-流程执行概况.html', context=context)