示例#1
0
class OperationLogTable(tables.Table):
    helpdoc = u'查看系统操作日志'

    uid = tables.Column(u'用户名',
                        orderable=True,
                        accessor='user.username',
                        attrs=tables.Attrs(th={'width': '10%'}))
    terminal_ip = tables.Column(u'终端IP',
                                orderable=True,
                                attrs=tables.Attrs(th={'width': '15%'}))
    action = tables.EnumColumn(u'操作',
                               'oper_obj',
                               enums={
                                   'insert': u'添加',
                                   'update': u'更新',
                                   'delete': u'删除'
                               },
                               orderable=True)
    module = tables.Column(u'操作对象', orderable=True)
    created_at = tables.DateTimeColumn(u'时间',
                                       orderable=True,
                                       format='%Y-%m-%d %H:%M:%S')
    summary = tables.PopoverColumn(u'详细')

    class Meta():
        model = OperationLog
        order_by = '-created_at'
示例#2
0
class AlarmTable(t.Table):

    ack = t.Action(name=u'确认', endpoint='alarms.alarms_ack', modalable=True)
    clear = t.Action(name=u'清除',
                     endpoint='alarms.alarms_clear',
                     modalable=True)

    check = t.CheckBoxColumn()

    severity = SeverityColumn()
    alarm_state = t.EnumColumn(u'状态',
                               name='alarm-state',
                               enums=constants.STATES,
                               orderable=True)
    alarm_alias = t.LinkColumn(u'名称',
                               endpoint='alarms.alarms_show',
                               orderable=True)
    node_alias = t.LinkColumn(u'节点', accessor='node.alias', orderable=True)
    node_addr = t.Column(u'节点地址', accessor='node.addr', orderable=True)
    summary = t.Column(u'详细')
    occur_count = t.Column(u'发生次数')
    last_occurrence = t.Column(u'最后发生时间', orderable=True)

    class Meta:
        model = Alarm
        per_page = 30
        order_by = '-last_occurrence'
        url_makers = {
            'node_alias': lambda record: redirect_node_show(record.node),
            'node_addr': lambda record: redirect_node_show(record.node)
        }
示例#3
0
class DictCodeTable(tables.Table):
    helpdoc = u'查看系统字典'
    edit = tables.Action(name=u'编辑', endpoint='system.dict_codes_edit')
    check = tables.CheckBoxColumn()

    type_label = tables.Column(u'字典类型',
                               orderable=True,
                               accessor='type.type_label')
    code_label = tables.Column(u'字典值', orderable=True)
    is_valid = tables.EnumColumn(u'是否有效', 'is_valid', enums={0: u'否', 1: u'是'})

    class Meta():
        model = DictCode
示例#4
0
class SubSystemTable(tables.Table):
    helpdoc = u'查看所有子系统 (子采集)'

    name = tables.Column(u'名称', orderable=True)
    alias = tables.Column(u'显示名')
    host = tables.Column(u'主机名', orderable=True)
    status = tables.EnumColumn(u'状态',
                               'state',
                               enums=constants.STATUS,
                               orderable=True)
    descr = tables.Column(u'描述')
    started_at = tables.DateTimeColumn(u'开始采集时间', orderable=True)

    class Meta():
        model = SubSystem
示例#5
0
class MiboidTable(t.Table):
    helpdoc = u'Mib 表'

    edit   = t.Action(name=u'编辑', endpoint='admin.miboids_edit')
    delete = t.Action(name=u'删除', endpoint='admin.miboids_delete', modalable=True)
    check  = t.CheckBoxColumn()
    
    grp      = t.Column(u'分组')
    name     = t.Column(u'名称')
    oid      = t.Column(u'oid')
    alias    = t.Column(u'显示名')
    is_valid = t.EnumColumn(u'是否有效', 'is_valid', enums={0: u'否', 1: u'是'})
    remark   = t.Column(u'备注')

    class Meta():
        model = Miboid
        group_by = 'grp'
示例#6
0
class CategoryTable(tables.Table):
    category_name = tables.EnumColumn(u'类型',
                                      name='category',
                                      enums={
                                          1: u'OLT',
                                          2: u'ONU',
                                          3: u'DSLAM',
                                          4: u'EOC',
                                          5: u'Switch'
                                      },
                                      orderable=True)
    total_count = tables.Column(u'数量')
    status1_count = tables.Column(u'正常')
    status2_count = tables.Column(u'宕机')
    status3_count = tables.Column(u'不可达')
    status4_count = tables.Column(u'未监控')

    class Meta():
        model = Node
示例#7
0
class ThresholdTable(tables.Table):
    helpdoc = u'阀值设置'
    edit = tables.Action(name=u'编辑', endpoint='system.thresholds_edit')
    check = tables.CheckBoxColumn()

    alias = tables.Column(u'阀值')
    summary = tables.Column(u'摘要')
    category_name = tables.Column(u'设备', accessor='category.alias')

    occur_cond1 = tables.Column(u'一级产生条件')
    restore_cond1 = tables.Column(u'一级恢复条件')
    severity1 = tables.Column(u'一级告警条件')

    occur_cond2 = tables.Column(u'二级产生条件')
    restore_cond2 = tables.Column(u'二级恢复条件')
    severity2 = tables.Column(u'二级告警条件')
    enabled = tables.EnumColumn(u'是否有效', 'is_valid', enums={0: u'否', 1: u'是'})

    class Meta():
        model = Threshold
示例#8
0
class AlarmKnowledgeTable(t.Table):

    class_alias = t.LinkColumn(u'故障名称',
                               endpoint='alarms.knowledges_edit',
                               accessor='alarm_class.alias',
                               orderable=True)
    probable_cause = t.Column(u'可能原因')
    resolvent = t.Column(u'解决方法')
    probability = t.EnumColumn(u'发生概率',
                               'probability',
                               enums={
                                   1: u'极少发生',
                                   2: u'偶尔发生',
                                   3: u'频繁发生'
                               })
    apply_count = t.Column(u'应用次数')

    class Meta:
        model = AlarmKnowledge
        per_page = 50
        order_by = '-id'
示例#9
0
class NodeHostTable(tables.Table):
    helpdoc = u'查看所有主机'
    edit = tables.Action(name=u'编辑', endpoint='system.hosts_edit')
    check = tables.CheckBoxColumn()

    name = tables.Column(u'名称')
    alias = tables.Column(u'显示名')
    status = tables.EnumColumn(u'状态',
                               'state',
                               enums=constants.STATUS,
                               orderable=True)
    ifaces = tables.Column(u'接口地址')
    cpu_info = tables.Column(u'CPU 信息')
    mem_info = tables.Column(u'内存 信息')
    disk_info = tables.Column(u'磁盘 信息')
    worker_num = tables.Column(u'采集进程数')
    os_type = tables.Column(u'操作系统')
    updated_at = tables.DateTimeColumn(u'更新时间')

    class Meta():
        model = NodeHost