2016-03-01 11:23:03 -05:00
|
|
|
import django_tables2 as tables
|
|
|
|
|
2020-07-01 13:47:01 -04:00
|
|
|
from utilities.tables import BaseTable, ButtonsColumn, TagColumn, ToggleColumn
|
2016-05-16 12:07:12 -04:00
|
|
|
from .models import SecretRole, Secret
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Secret roles
|
|
|
|
#
|
|
|
|
|
2016-06-20 16:34:19 -04:00
|
|
|
class SecretRoleTable(BaseTable):
|
2016-06-01 13:30:33 -04:00
|
|
|
pk = ToggleColumn()
|
2019-12-10 13:03:09 -05:00
|
|
|
name = tables.LinkColumn()
|
2020-04-29 11:32:53 -04:00
|
|
|
secret_count = tables.Column(
|
|
|
|
verbose_name='Secrets'
|
|
|
|
)
|
2020-07-01 13:47:01 -04:00
|
|
|
actions = ButtonsColumn(SecretRole, pk_field='slug')
|
2016-05-16 12:07:12 -04:00
|
|
|
|
2016-06-20 16:34:19 -04:00
|
|
|
class Meta(BaseTable.Meta):
|
2016-05-16 12:07:12 -04:00
|
|
|
model = SecretRole
|
2020-08-07 16:19:18 -04:00
|
|
|
fields = ('pk', 'name', 'secret_count', 'description', 'slug', 'actions')
|
2020-04-29 11:32:53 -04:00
|
|
|
default_columns = ('pk', 'name', 'secret_count', 'description', 'actions')
|
2016-03-01 11:23:03 -05:00
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Secrets
|
|
|
|
#
|
|
|
|
|
2016-06-20 16:34:19 -04:00
|
|
|
class SecretTable(BaseTable):
|
2016-06-01 13:30:33 -04:00
|
|
|
pk = ToggleColumn()
|
2017-03-29 16:05:23 -04:00
|
|
|
device = tables.LinkColumn()
|
2020-05-06 14:42:51 -04:00
|
|
|
tags = TagColumn(
|
|
|
|
url_name='secrets:secret_list'
|
|
|
|
)
|
2016-03-01 11:23:03 -05:00
|
|
|
|
2016-06-20 16:34:19 -04:00
|
|
|
class Meta(BaseTable.Meta):
|
2016-03-01 11:23:03 -05:00
|
|
|
model = Secret
|
2020-05-06 14:42:51 -04:00
|
|
|
fields = ('pk', 'device', 'role', 'name', 'last_updated', 'hash', 'tags')
|
2020-04-29 11:32:53 -04:00
|
|
|
default_columns = ('pk', 'device', 'role', 'name', 'last_updated')
|