29 lines
1021 B
Python
29 lines
1021 B
Python
import django_tables2 as tables
|
|
from django.utils.safestring import mark_safe
|
|
from netbox.tables import NetBoxTable
|
|
from .models import dnacServer
|
|
|
|
# Hide password from being viewed
|
|
# TODO: add custom view to base64, aes256 encrypt passwords
|
|
class MaskedPassword(tables.Column):
|
|
def render(self, value):
|
|
value = "*****"
|
|
return mark_safe(value)
|
|
|
|
class dnacServerTable(NetBoxTable):
|
|
# Define the type of fields to display for a table
|
|
hostname = tables.Column(
|
|
linkify=True
|
|
)
|
|
username = tables.Column()
|
|
password = MaskedPassword()
|
|
version = tables.Column()
|
|
verify = tables.BooleanColumn()
|
|
status = tables.BooleanColumn()
|
|
default_filter_action = tables.BooleanColumn()
|
|
|
|
# Setup table ordering
|
|
class Meta(NetBoxTable.Meta):
|
|
model = dnacServer
|
|
fields = ('pk', 'id', 'hostname', 'username', 'password', 'version', 'verify', 'status', 'default_filter_action', 'actions')
|
|
default_columns = ('hostname', 'version', 'verify', 'status') |