Пример #1
0
def map_detail(request):
    """
    App detail view
    """
    header_title, path1, path2 = u'应用详细信息', u'应用管理', u'应用详情'
    app_id = request.GET.get('id', '')
    app = get_object(App, id=app_id)
    perm_info = get_group_asset_perm(app)
    log = Log.objects.filter(host=app.name)
    if perm_info:
        user_perm = []
        for perm, value in perm_info.items():
            if perm == 'user':
                for user, role_dic in value.items():
                    user_perm.append([user, role_dic.get('role', '')])
            elif perm == 'user_group' or perm == 'rule':
                user_group_perm = value
    print perm_info

    app_record = AppRecord.objects.filter(app=app).order_by('-alert_time')

    return my_render('upapp/map_detail.html', locals(), request)
Пример #2
0
def map_detail(request):
    """
    App detail view
    """
    header_title, path1, path2 = u'应用详细信息', u'应用管理', u'应用详情'
    app_id = request.GET.get('id', '')
    app = get_object(App, id=app_id)
    perm_info = get_group_asset_perm(app)
    log = Log.objects.filter(host=app.name)
    if perm_info:
        user_perm = []
        for perm, value in perm_info.items():
            if perm == 'user':
                for user, role_dic in value.items():
                    user_perm.append([user, role_dic.get('role', '')])
            elif perm == 'user_group' or perm == 'rule':
                user_group_perm = value
    print perm_info

    app_record = AppRecord.objects.filter(app=app).order_by('-alert_time')

    return my_render('upapp/map_detail.html', locals(), request)
Пример #3
0
def rule_detail(request):
    """
    rule detail view
    """
    header_title, path1, path2 = u'规则详细信息', u'灰度管理', u'规则详情'
    rule_id = request.GET.get('id', '')
    rule = get_object(Rule, id=rule_id)
    perm_info = get_group_asset_perm(rule)
    log = Log.objects.filter(host=rule.name)
    if perm_info:
        user_perm = []
        for perm, value in perm_info.items():
            if perm == 'user':
                for user, role_dic in value.items():
                    user_perm.append([user, role_dic.get('role', '')])
            elif perm == 'user_group' or perm == 'role':
                user_group_perm = value
    print perm_info

    rule_record = RuleRecord.objects.filter(rule=rule).order_by('-alert_time')

    return my_render('upgray/rule_detail.html', locals(), request)
Пример #4
0
def etcd_detail(request):
    """
    Etcd detail view
    """
    header_title, path1, path2 = u'参数详细信息', u'参数管理', u'参数详情'
    etcd_id = request.GET.get('id', '')
    etcd = get_object(Etcd, id=etcd_id)
    perm_info = get_group_asset_perm(etcd)
    log = Log.objects.filter(host=etcd.name)
    if perm_info:
        user_perm = []
        for perm, value in perm_info.items():
            if perm == 'user':
                for user, role_dic in value.items():
                    user_perm.append([user, role_dic.get('role', '')])
            elif perm == 'user_group' or perm == 'role':
                user_group_perm = value
    print perm_info

    etcd_record = EtcdRecord.objects.filter(etcd=etcd).order_by('-alert_time')

    return my_render('upetcd/etcd_detail.html', locals(), request)
Пример #5
0
def asset_detail(request):
    """
    Asset detail view
    """
    header_title, path1, path2 = u'主机详细信息', u'资产管理', u'主机详情'
    asset_id = request.GET.get('id', '')
    asset = get_object(Asset, id=asset_id)
    perm_info = get_group_asset_perm(asset)
    log = Log.objects.filter(host=asset.hostname)
    if perm_info:
        user_perm = []
        for perm, value in perm_info.items():
            if perm == 'user':
                for user, role_dic in value.items():
                    user_perm.append([user, role_dic.get('role', '')])
            elif perm == 'user_group' or perm == 'rule':
                user_group_perm = value
    print perm_info

    asset_record = AssetRecord.objects.filter(asset=asset).order_by('-alert_time')

    return my_render('upasset/asset_detail.html', locals(), request)
Пример #6
0
def etcd_detail(request):
    """
    Etcd detail view
    """
    header_title, path1, path2 = u'参数详细信息', u'参数管理', u'参数详情'
    etcd_id = request.GET.get('id', '')
    etcd = get_object(Etcd, id=etcd_id)
    perm_info = get_group_asset_perm(etcd)
    log = Log.objects.filter(host=etcd.name)
    if perm_info:
        user_perm = []
        for perm, value in perm_info.items():
            if perm == 'user':
                for user, role_dic in value.items():
                    user_perm.append([user, role_dic.get('role', '')])
            elif perm == 'user_group' or perm == 'role':
                user_group_perm = value
    print perm_info

    etcd_record = EtcdRecord.objects.filter(etcd=etcd).order_by('-alert_time')

    return my_render('upetcd/etcd_detail.html', locals(), request)
Пример #7
0
def system_detail(request):
    """
    System detail view
    """
    header_title, path1, path2 = u'系统详细信息', u'灰度管理', u'系统详情'
    system_id = request.GET.get('id', '')
    system = get_object(System, id=system_id)
    perm_info = get_group_asset_perm(system)
    log = Log.objects.filter(host=system.name)
    if perm_info:
        user_perm = []
        for perm, value in perm_info.items():
            if perm == 'user':
                for user, role_dic in value.items():
                    user_perm.append([user, role_dic.get('role', '')])
            elif perm == 'user_group' or perm == 'role':
                user_group_perm = value
    print perm_info

    etcd_record = SystemRecord.objects.filter(system=system).order_by('-alert_time')

    return my_render('upgray/system_detail.html', locals(), request)
Пример #8
0
def rule_detail(request):
    """
    rule detail view
    """
    header_title, path1, path2 = u'规则详细信息', u'灰度管理', u'规则详情'
    rule_id = request.GET.get('id', '')
    rule = get_object(Rule, id=rule_id)
    perm_info = get_group_asset_perm(rule)
    log = Log.objects.filter(host=rule.name)
    if perm_info:
        user_perm = []
        for perm, value in perm_info.items():
            if perm == 'user':
                for user, role_dic in value.items():
                    user_perm.append([user, role_dic.get('role', '')])
            elif perm == 'user_group' or perm == 'role':
                user_group_perm = value
    print perm_info

    rule_record = RuleRecord.objects.filter(rule=rule).order_by('-alert_time')

    return my_render('upgray/rule_detail.html', locals(), request)
Пример #9
0
def system_detail(request):
    """
    System detail view
    """
    header_title, path1, path2 = u'系统详细信息', u'灰度管理', u'系统详情'
    system_id = request.GET.get('id', '')
    system = get_object(System, id=system_id)
    perm_info = get_group_asset_perm(system)
    log = Log.objects.filter(host=system.name)
    if perm_info:
        user_perm = []
        for perm, value in perm_info.items():
            if perm == 'user':
                for user, role_dic in value.items():
                    user_perm.append([user, role_dic.get('role', '')])
            elif perm == 'user_group' or perm == 'role':
                user_group_perm = value
    print perm_info

    etcd_record = SystemRecord.objects.filter(
        system=system).order_by('-alert_time')

    return my_render('upgray/system_detail.html', locals(), request)