Ejemplo n.º 1
0
def config_post(request, service_id):
    result = True
    try:
        CIService.edit_ci_service(request, service_id)
    except Exception as ex:
        result = str(ex)
        SimpleLogger.exception(ex)
    return HttpResponse(result)
Ejemplo n.º 2
0
def copy(request, service_id):
    result = True
    try:
        CIService.copy_ci_service(request.user, service_id)
    except Exception as ex:
        result = str(ex)
        SimpleLogger.exception(ex)
    return HttpResponse(result)
Ejemplo n.º 3
0
def replace_config_post(request, service_id):
    result = True
    try:
        CIService.save_replace_config(request, service_id)
    except Exception as ex:
        result = str(ex)
        SimpleLogger.exception(ex)
    return HttpResponse(result)
Ejemplo n.º 4
0
def delete_file(request, file_id):
    result = True
    try:
        CIService.delete_service_file(request, file_id)
    except Exception as ex:
        result = str(ex)
        SimpleLogger.exception(ex)

    return HttpResponse(result)
Ejemplo n.º 5
0
 def get_ci_service_list_controll(self, request, sub_nav_action):
     dm_ci_services = CIService.get_product_ci_services(
         request, sub_nav_action)
     ci_services = self.get_ci_services(request, dm_ci_services)
     pagefileds = {"ci_services": ci_services}
     return self.get_webpart(pagefileds,
                             CIServicePath.service_list_controll)
Ejemplo n.º 6
0
 def get_replace_config(self):
     result = None
     if self.ci_service.AdvanceConfig:
         result = CIService.get_replace_config(
             self.ci_service.AdvanceConfig)
         for file in result.replace_target_map:
             print(file.file_name)
     return result
Ejemplo n.º 7
0
def create(request):
    result = 0
    try:
        ci_service = CIService.create_ci_service(request)
        result = ci_service.id
    except Exception as ex:
        result = str(ex)
        SimpleLogger.exception(ex)

    return HttpResponse(result)
Ejemplo n.º 8
0
def upload_file(request, service_id):
    try:
        message = CIService.file_upload_handler(request, service_id)
        if message == "":
            message = ResCIService.ci_service_upload_file_fail
        else:
            message = ""
    except Exception as ex:
        SimpleLogger.exception(ex)
    return redirect("/ci/service/" + str(service_id) + "/config")
Ejemplo n.º 9
0
 def get_ci_service_config_page(self, request, service_id):
     dm_products = CIService.get_products_include_me(request)
     left_nav_bar = self.get_service_left_bar(request)
     sub_nav_bar = self.get_service_sub_navbar(request, dm_products, 0)
     ci_service_config_webpart = self.ci_service_config_webpart(
         request, service_id)
     page_fileds = {
         "left_nav_bar": left_nav_bar,
         "sub_nav_bar": sub_nav_bar,
         "ci_service_config": ci_service_config_webpart
     }
     return self.get_page(page_fileds, CIServicePath.service_index_path,
                          request)
Ejemplo n.º 10
0
 def get_ci_service_fullpage(self, request, sub_nav_action):
     dm_products = CIService.get_products_include_me(request)
     left_nav_bar = self.get_service_left_bar(request)
     sub_nav_bar = self.get_service_sub_navbar(request, dm_products,
                                               sub_nav_action)
     ci_service_webpart = self.get_ci_service_list_webpart(
         request, sub_nav_action)
     page_fileds = {
         "left_nav_bar": left_nav_bar,
         "sub_nav_bar": sub_nav_bar,
         "ci_service_webpart": ci_service_webpart
     }
     return self.get_page(page_fileds, CIServicePath.service_index_path,
                          request)
Ejemplo n.º 11
0
def download_file(request, file_id):
    try:
        file = FileInfo.objects.get(int(file_id))
        contents = CIService.get_service_file(request, file.FilePath)
        result = HttpResponse(contents,
                              content_type='application/octet-stream')
        display_file_name = str(file.FileName.encode("utf-8")).replace(
            "'", "").replace('b', '')
        result[
            'Content-Disposition'] = 'attachment;filename="' + display_file_name + '"'
    except Exception as ex:
        result = HttpResponse(str(ex))
        SimpleLogger.exception(ex)
    return result