예제 #1
0
def remove_custom_option(request):
    cm = CustomOptionManager(request)
    try:
        cm.delete()
        return HttpResponse('200')
    except RequestProcessException as e:
        return e.get_response()
예제 #2
0
def add_float_custom_options(request):
    co = CustomOptionManager(request)
    try:
        res = co.update()
        return HttpResponse(res)
    except RequestProcessException as e:
        return e.get_response()
예제 #3
0
def get_hidden_groups(request):
    try:
        cm = CustomOptionManager(request)
        cm.set_get()
        res = cm.get_hidden_group(request.GET.get('t'))
        return HttpResponse(json.dumps(list(res)))
    except RequestProcessException as e:
        return e.get_response()
예제 #4
0
def assign_service_map(request):
    om = CustomOptionManager(request)
    try:
        om.add_service_map()
        return HttpResponse('200')
    except RequestProcessException as e:
        return e.get_response()
    except Exception as e:
        logger.error(e.args)
        return send_error(request, _('system error'))
예제 #5
0
def get_service_map_list(request):
    try:
        x = CustomOptionManager(request)
        res = x.get_service_maps()
        return HttpResponse(json.dumps(list(res)))
    except RequestProcessException as e:
        return e.get_response()
    except Exception as e:
        logger.error(e.message)
        return send_error(request, _('system error'))
예제 #6
0
def view_custom_option(request):
    if not check_ajax(request):
        return render(request,
                      'service/float_service/custom_options/CustomOptionManagement.html',
                      {'has_nav': True, 'service': BasicService.objects.filter(is_deleted=False),
                       'ibs_groups': IBSService.objects.filter(is_deleted=False),
                       'group': CustomOptionGroup.objects.filter(is_deleted=False),
                       'pool': IBSIpPool.objects.filter(is_deleted=False)})
    try:
        cm = CustomOptionManager(request)
        return HttpResponse(cm.get_all())
    except RequestProcessException as e:
        return e.get_response()
예제 #7
0
def get_custom_option_detail(request):
    try:
        co = CustomOptionManager(request).get_single_ext()
        res = {'name': co.name, 'min_value': co.min_value, 'max_value': co.max_value, 'var_name': co.var_name,
               'group': co.group.ext, 'is_custom_value': co.is_custom_value, 'custom_value_min': co.custom_value_min,
               'custom_value_max': co.custom_value_max, 'help_text': co.help_text, 'package': co.package,
               'group_type': co.group_type}
        # if co.:
        if co.pool_id:
            res['pool'] = co.pool.ext
        return HttpResponse(json.dumps(res))
    except RequestProcessException as e:
        return e.get_response()