Ejemplo n.º 1
0
 def get(self, **kwargs):
     data = self.get_pro_info_res(kwargs["pro_id"])
     applies = data["pro_info_res"].data.pro_resource_applies
     svc = ProjectService(self)
     pro_list_res = svc.get_project_list()
     logger.info(pro_list_res)
     # svc = ProUserService(self, {"pro_id": kwargs["pro_id"]})
     # pro_users_res = svc.get_list()
     # pro_user_res = svc.get_info()
     # svc = ApplyPublish(self, {"pro_id": kwargs["pro_id"]})
     # pro_publish_res = svc.get_publish()
     # svc = ApplyLoadBalance(self, {"pro_id": kwargs["pro_id"]})
     # pro_loadbalance_res = svc.get_loadbalance()
     # svc = ApplyBackups(self, {"pro_id": kwargs["pro_id"]})
     # backups_res = svc.get_backups()
     data.update(
         pro_list_res=pro_list_res,
         pro_id=kwargs["pro_id"]
         # pro_users_res=pro_users_res,
         # pro_user_res=pro_user_res,
         # pro_publish_res=pro_publish_res,
         # pro_loadbalance_res=pro_loadbalance_res,
         # backups_res=backups_res,
     )
     if len(applies) > 0:
         last_apply = applies[-1]
         if not last_apply.start_date:
             self.add_message(u"尚未设置云资源启用时间!", level="warning")
         return self.render_to_string("admin/guide/step3.html", **data)
     else:
         return self.render_to_string("admin/guide/step1.html", **data)
Ejemplo n.º 2
0
 def get(self):
     svc = ProjectService(self)
     pro_list_res = svc.get_project_list()
     if pro_list_res.return_code < 0:
         raise SystemError(pro_list_res.return_code, pro_list_res.return_message)
     logger.info(pro_list_res)
     data = dict(pro_list_res=pro_list_res)
     return self.render_to_string("admin/event/add.html", **data)
Ejemplo n.º 3
0
 def get(self):
     svc = ProjectService(self)
     pro_list_res = svc.get_project_list()
     if pro_list_res.return_code < 0:
         raise SystemError(pro_list_res.return_code,
                           pro_list_res.return_message)
     logger.info(pro_list_res)
     data = dict(pro_list_res=pro_list_res)
     return self.render_to_string("admin/event/add.html", **data)
Ejemplo n.º 4
0
 def get(self):
     env_svc = EnvService(self)
     env_list_res = env_svc.get_list()
     svc = ProjectService(self)
     result = svc.get_project_list()
     if result.return_code < 0:
         raise SystemError(result.return_code, result.return_message)
     logger.info(result)
     return self.render_to_string("admin/guide/index.html", result=result, pro_resource_apply_status_types=pro_resource_apply_status_types, env_list_res=env_list_res)
Ejemplo n.º 5
0
 def get(self):
     svc = ProjectService(self)
     pro_list_res = svc.get_project_list()
     logger.info(pro_list_res)
     svc = ProResourceApplyService(self)
     pro_resource_applies_res = svc.get_list()
     pro_resource_apply_list = pro_resource_applies_res.data
     logger.info(pro_resource_apply_list)
     data = dict(pro_list_res=pro_list_res,
                 page=self.getPage(pro_resource_apply_list))
     return self.render_to_string("admin/apply/resource/index.html", **data)
Ejemplo n.º 6
0
 def get(self):
     svc = ProjectService(self)
     pro_list_res = svc.get_project_list()
     logger.info(pro_list_res)
     svc = ProResourceApplyService(self)
     pro_resource_applies_res = svc.get_list()
     pro_resource_apply_list = pro_resource_applies_res.data
     logger.info(pro_resource_apply_list)
     data = dict(
         pro_list_res = pro_list_res,
         page = self.getPage(pro_resource_apply_list)
     )
     return self.render_to_string("admin/apply/resource/index.html", **data)
Ejemplo n.º 7
0
 def get_pro_info_res(self, pro_id):
     kw = {"pro_id": pro_id}
     svc = ProjectService(self, kw)
     pro_info_res = svc.get_project()
     pro_list_res = svc.get_project_list()
     if isinstance(pro_info_res, Exception):
         raise pro_info_res
     data = {
         "pro_info_res": pro_info_res,
         "pro_list_res": pro_list_res,
         "STATUS_RESOURCE": STATUS_RESOURCE,
         "Pro_Resource_Apply": Pro_Resource_Apply
     }
     return data
Ejemplo n.º 8
0
 def get_pro_data(self, **kw):
     # kw = {"pro_id": pro_id}
     svc = ProjectService(self, kw)
     if "pro_id" in kw:
         pro_info_res = svc.get_project()
         if isinstance(pro_info_res, Exception):
             raise pro_info_res
     pro_list_res = svc.get_project_list()
     data = {
         "pro_list_res": pro_list_res,
         "Pro_Resource_Apply": Pro_Resource_Apply
     }
     if "pro_id" in kw:
         data.update({"pro_info_res": pro_info_res})
     return data
Ejemplo n.º 9
0
 def post(self):
     env_svc = EnvService(self)
     env_list_res = env_svc.get_list()
     svc = ProjectService(self)
     result = svc.create_project()
     logger.info(result)
     if result.return_code == 0:
         logger.info("return_code:%s" % result.return_code)
         self.add_message(u"项目[%s]添加成功" % result.data.name, level="success", post_action=True)
         data = self.get_pro_info_res(result.data.id)
         return self.render_to_string("admin/guide/step1.html", **data)
     else:
         logger.info("return_code:%s" % result.return_code)
         post_result = result
         proj_result = svc.get_project_list()
         self.add_message(post_result.return_message, level='warning')
         return self.render_to_string("admin/guide/index.html", result=proj_result, post_result=post_result, env_list_res=env_list_res)