32 lines
958 B
Python
32 lines
958 B
Python
from __future__ import annotations
|
|
|
|
from sqladmin import ModelView
|
|
|
|
from app.models.mariadb.system import AuditLog, SystemConfig
|
|
|
|
|
|
class SystemConfigAdmin(ModelView, model=SystemConfig):
|
|
column_list = [SystemConfig.id, SystemConfig.key, SystemConfig.value, SystemConfig.is_secret]
|
|
column_searchable_list = [SystemConfig.key]
|
|
can_create = True
|
|
can_edit = True
|
|
can_delete = True
|
|
name = "System Config"
|
|
name_plural = "System Configs"
|
|
icon = "fa-solid fa-gear"
|
|
|
|
|
|
class AuditLogAdmin(ModelView, model=AuditLog):
|
|
column_list = [
|
|
AuditLog.id, AuditLog.user_id, AuditLog.action,
|
|
AuditLog.resource_type, AuditLog.resource_id, AuditLog.created_at,
|
|
]
|
|
column_sortable_list = [AuditLog.id, AuditLog.created_at]
|
|
column_default_sort = ("id", True)
|
|
can_create = False
|
|
can_edit = False
|
|
can_delete = False
|
|
name = "Audit Log"
|
|
name_plural = "Audit Logs"
|
|
icon = "fa-solid fa-clipboard-list"
|