コード例 #1
0
def home(request):
    """
    首页
    """
    hosts = get_host_details()
    scheduler.apply_async(args=(0,), kwargs={
        'host_detail': get_host_details('proxy')
    })
    scheduler.apply_async(args=(1,), kwargs={
        'hosts': [host.keys()[0] for host in hosts],
        'passwords': {host.keys()[0]: host.values()[0] for host in hosts}
    })
    scheduler.apply_async(args=(2,), kwargs={
        'hosts': get_hosts()
    })

    # 指定gateway 1
    scheduler.apply_async(args=(3,), kwargs={
        'host_detail': get_host_details('client1'),
        'proxy': get_host_details('proxy'),
    })
    # 指定gateway 2
    # scheduler.apply_async(args=(3,), kwargs={
    #     'host_detail': get_host_details('proxy'),
    #     'proxy': get_host_details('client1'),
    # })

    scheduler.apply_async(args=(4,), kwargs={
        'hosts': [host.keys()[0] for host in hosts],
        'passwords': {host.keys()[0]: host.values()[0] for host in hosts}
    })
    return render_mako_context(request, '/explore/home.html')
コード例 #2
0
ファイル: accounts.py プロジェクト: imtos/vagrant
 def check_failed(self, request):
     """功能开关检查失败"""
     code = request.GET.get('code', '')
     # 功能开关检查失败的提示页面
     if code == 'func_check':
         res_page = '/account/func_check_failed.html'
     else:
         res_page = '/403.html'
     return render_mako_context(request, res_page)
コード例 #3
0
def dev_guide(request):
    """
    开发指引
    """
    return render_mako_context(request, '/home_application/dev_guide.html')
コード例 #4
0
ファイル: accounts.py プロジェクト: P79N6A/blueking_test_app
 def login_page(self, request):
     """
     告知用户登录态无效, 需要重新登录的引导页
     """
     return render_mako_context(request, self._config.LOGIN_PAGE_TEMPLATE)
コード例 #5
0
ファイル: views.py プロジェクト: fengf96/Blueking-helloworld
def form_validator(request):
    """
    表单验证样例
    """
    return render_mako_context(request, 'kendo_crud/form_validator.part')
コード例 #6
0
def host_status(request):
    """
    联系我们
    """
    return render_mako_context(request, '/home_application/host.html')
コード例 #7
0
ファイル: views.py プロジェクト: winkyi/bkdemo
def helloworld(request):
    return render_mako_context(request, '/home_application/helloworld.html')
コード例 #8
0
ファイル: views.py プロジェクト: Xmandom/twoapp
def dev_guide(request):
    """
    开发指引
    """
    return render_mako_context(request, '/home_application/dev_guide.html')
コード例 #9
0
ファイル: views.py プロジェクト: richrole/test1
def work(request):
    return render_mako_context(request, "/work_application/work_manage.html")
コード例 #10
0
ファイル: views.py プロジェクト: sona201/bk_check_list
def history(request):
    """
    任务中心
    """
    check_init(request.user.username)
    return render_mako_context(request, '/task_center/history.html', {})
コード例 #11
0
def home(request):
    return render_mako_context(request, '/index.html')
コード例 #12
0
def home2(request):
    data = StudentInfo.objects.all()
    return render_mako_context(request, '/home_application/home.html')
コード例 #13
0
ファイル: views.py プロジェクト: sona201/bk_check_list
        parm_data = get_param_data_by_name(business_flag, business_name,
                                           template_name)
    except Exception, e:
        logger.error(u"查看失败,business_name:%s, template_name:%s, %s" %
                     (business_name, template_name, e))
        return render_mako_context(request, '/manager/403.html', {
            'result': True,
            'isNotPass': True,
            'data': u"查看失败,请重试!"
        })
    rec = business.to_dict(record)
    return render_mako_context(
        request, '/task_center/some_template_query.html', {
            'parm_info': parm_data,
            'template_name': template_name,
            'template': rec,
            'flag': flag,
            'audit_flag': audit_flag,
            "active": False,
            'h_flag': h_flag
        })


@check_operate()
def step_delete(request):
    """
    删除指定步骤类别的步骤序号数据
    """
    form = StepDeleteForm(request.POST)
    if not form.is_valid():
        return render_json({'result': False, 'msg': u"参数错误"})
    business_name = form.cleaned_data['business_name']
コード例 #14
0
def home3(request):
    return render_mako_context(request, '/home_application/home3.html')
コード例 #15
0
ファイル: views.py プロジェクト: Xmandom/twoapp
def home(request):
    """
    首页
    """
    return render_mako_context(request, '/home_application/home.html')
コード例 #16
0
ファイル: views.py プロジェクト: Xmandom/twoapp
def contactus(request):
    """
    联系我们
    """
    return render_mako_context(request, '/home_application/contact.html')
コード例 #17
0
ファイル: views.py プロジェクト: Xmandom/twoapp
def error_500(request):
    """
    500提示页
    """
    return render_mako_context(request, '500.html')
コード例 #18
0
def detail(request):
    """
    开发指引
    """
    return render_mako_context(request, '/home_application/detail_1.html')
コード例 #19
0
ファイル: views.py プロジェクト: sona201/bk_check_list
def help_document(request):
    return render_mako_context(request, '/task_center/help.html')
コード例 #20
0
ファイル: views.py プロジェクト: Xmandom/twoapp
        func_info = Function_controller.objects.filter(func_code='func_test')
        if func_info:
            func_info = func_info[0]
        else:
            func_info = Function_controller.objects.create(
                func_code='func_test',
                func_name=u"示例功能",
                enabled=False,
                func_developer='',
            )
        # 获取功能开启状态
        is_enabled = func_info.enabled
    except Exception, e:
        logger.error(u"加载功能推荐页面失败,异常信息:%s" % e)
        is_enabled = False
    return render_mako_context(request, '/home_application/func_check.part',
                               {'is_enabled': is_enabled})


def switch_func(request):
    """
    开启、关闭示例功能
    """
    try:
        status = int(request.POST.get('status', '0'))
        # 更改功能开关的状态
        Function_controller.objects.filter(func_code='func_test').update(enabled=status)
    except Exception, e:
        msg = u"更改功能状态出错,异常信息:%s" % e
        return render_json({'res': False, 'msg': msg})
    return render_json({'res': True, 'msg': u"操作成功"})
コード例 #21
0
def status(request):
    """
    主机状态
    """
    return render_mako_context(request, '/home_application/status.html')
コード例 #22
0
ファイル: views.py プロジェクト: sona201/bk_check_list
def app_manager(request):
    check_init(request.user.username)
    return render_mako_context(request, "/task_center/app.html", {})
コード例 #23
0
def get_all_log(request):
    opt_list = OptLog.objects.order_by('-opt_at')
    return render_mako_context(request, '/home_application/history.html', {'logList': opt_list})
コード例 #24
0
ファイル: views.py プロジェクト: sona201/bk_check_list
def application_type(request):
    check_init(request.user.username)
    return render_mako_context(request, '/task_center/app_type.html')
コード例 #25
0
ファイル: views.py プロジェクト: richrole/test1
def approval(request):
    return render_mako_context(request, '/work_application/approval_list.html')
コード例 #26
0
ファイル: views.py プロジェクト: sona201/bk_check_list
def manage_edit(request):
    """
    模版配置
    """
    check_init(request.user.username)
    return render_mako_context(request, '/task_center/template_edit.html', {})
コード例 #27
0
ファイル: views.py プロジェクト: winkyi/bkdemo
def test1(request):
    return render_mako_context(request, '/home_application/test1.html')
コード例 #28
0
ファイル: views.py プロジェクト: sona201/bk_check_list
def template_create(request):
    """
    新建模版页面
    """
    check_init(request.user.username)
    return render_mako_context(request, '/task_center/new_template.html')
コード例 #29
0
ファイル: views.py プロジェクト: winkyi/bkdemo
def index(request, **kwargs):
    login_user = request.user
    kwargs["login_user"] = login_user
    return render_mako_context(request, '/home_application/index.html', kwargs)
コード例 #30
0
ファイル: views.py プロジェクト: sona201/bk_check_list
def template_download(request):
    """
    导出模板数据到excel
    """
    pk = request.GET.get('pk', '')
    business_name = request.GET.get('business_name', '')
    template_name = request.GET.get('template_name', '')
    flag = request.GET.get('flag', '')
    res_json = {'result': True, 'isNotPass': True, 'data': u""}
    if pk or flag == Flag.EDIT or flag == Flag.TASK or flag == 'False':
        business = BUSINESS_MODEL['template']
        cc_name = business_name
    elif flag == Flag.BUSINESS:
        business = BUSINESS_MODEL['instance']
        cc_name = business_name.split('_')[0]
    else:
        res_json['data'] = u'参数错误'
        return render_mako_context(request, '/manager/403.html', res_json)

    # 获取对应的模版并校验权限
    try:
        if pk:
            template = business.objects.get(id=pk)
            Application.objects.get(cc_name=template.business_name,
                                    operator__username=request.user.username)
        else:
            template = business.objects.get(business_name=business_name,
                                            template_name=template_name)
            Application.objects.get(cc_name=cc_name,
                                    operator__username=request.user.username)
    except ObjectDoesNotExist:
        res_json['data'] = u'您无操作权限,请联系系统管理员'
        return render_mako_context(request, '/manager/403.html', res_json)

    # 表格初始化
    response = HttpResponse(content_type="application/vnd.ms-excel")
    response['Content-Disposition'] = 'attachment; filename="%s_%s.xls"' % (
        template.business_name.encode('utf-8'),
        template.business_type.encode('utf-8'))
    wbk = xlwt.Workbook(encoding='utf-8')
    sheet = wbk.add_sheet('sheet1')
    sheet.col(2).width = 20000
    sheet.col(3).width = 20000

    # 枚举参数初始化
    if flag == Flag.EDIT or flag == Flag.TASK or flag == 'False':
        head_list = HeadList.TEMPLATE
        excel_list = ExcelList.TEMPLATE
        business_step = BUSINESS_STEP_MODEL["template"]
        business_detail = BUSINESS_DETAIL_MODEL['template']
        q = Q()
    else:
        q = ~Q(stat=1)
        head_list = HeadList.INSTANCE
        excel_list = ExcelList.INSTANCE
        business_step = BUSINESS_STEP_MODEL['instance']
        business_detail = BUSINESS_DETAIL_MODEL['instance']
    try:
        for i, data in enumerate(head_list):
            sheet.write(0, i, data)
        row = 1
        algn_center_hv = Alignment()
        algn_center_hv.horz = Alignment.HORZ_CENTER
        algn_center_hv.vert = Alignment.VERT_CENTER
        style_cdata = XFStyle()
        style_cdata.alignment = algn_center_hv

        # 获取步骤详情并填充表格
        steps = business_step.objects.filter(business=template).order_by('id')
        for step in steps:
            details = business_detail.objects.filter(
                q, business_step=step).order_by('step_xh')
            sheet.write_merge(row, row + details.count() - 1, 0, 0, step.name,
                              style_cdata)
            details = business_detail.to_dict(details)
            for detail in details:
                for i, value_key in enumerate(excel_list):
                    sheet.write(row, i + 1, detail[value_key])
                row += 1
        wbk.save(response)
        return response
    except Exception, e:
        logger.error(u'下载模版失败%s' % e)
        res_json['data'] = u'下载模版失败'
        return render_mako_context(request, '/manager/403.html', res_json)
コード例 #31
0
ファイル: views.py プロジェクト: fengf96/Blueking-helloworld
def kendo_home(request):
    """
    grid首页
    """
    return render_mako_context(request, "/kendo_crud/kendo_index.html", {})
コード例 #32
0
ファイル: views.py プロジェクト: nianhuatech/bking-permission
def business_model(request):
    """
    开发指引
    """
    return render_mako_context(request,
                               '/home_application/business_model.html')
コード例 #33
0
def home(request):
    """
    首页
    """
    return render_mako_context(request, '/home_application/home.html')
コード例 #34
0
ファイル: views.py プロジェクト: nianhuatech/bking-permission
def app_relationship_model(request):
    """
    开发指引
    """
    return render_mako_context(
        request, '/home_application/app_relationship_model.html')
コード例 #35
0
def contactus(request):
    """
    联系我们
    """
    return render_mako_context(request, '/home_application/contact.html')
コード例 #36
0
ファイル: views.py プロジェクト: nianhuatech/bking-permission
def host_relational_model(request):
    """
    开发指引
    """
    return render_mako_context(request,
                               '/home_application/host_relational_model.html')
コード例 #37
0
ファイル: views.py プロジェクト: Xmandom/twoapp
def error_404(request):
    """
    404提示页
    """
    return render_mako_context(request, '404.html')
コード例 #38
0
ファイル: views.py プロジェクト: bingle123/TestApp
def index(request):
    """
    首页
    """

    return render_mako_context(request, '/iwork/index.html')