106 lines
2.6 KiB
Python
106 lines
2.6 KiB
Python
from django.contrib import admin
|
|
|
|
from .models import ImportFile, ImportRun, IngestionError, IngestionRun
|
|
|
|
|
|
class ImportFileInline(admin.TabularInline):
|
|
model = ImportFile
|
|
extra = 0
|
|
readonly_fields = (
|
|
"relative_path",
|
|
"source_name",
|
|
"snapshot_date",
|
|
"status",
|
|
"checksum",
|
|
"file_size_bytes",
|
|
"rows_total",
|
|
"rows_upserted",
|
|
"rows_failed",
|
|
"error_message",
|
|
"processed_at",
|
|
"created_at",
|
|
)
|
|
|
|
|
|
@admin.register(ImportRun)
|
|
class ImportRunAdmin(admin.ModelAdmin):
|
|
list_display = (
|
|
"id",
|
|
"source",
|
|
"status",
|
|
"files_total",
|
|
"files_processed",
|
|
"rows_total",
|
|
"rows_upserted",
|
|
"rows_failed",
|
|
"started_at",
|
|
"finished_at",
|
|
"created_at",
|
|
)
|
|
list_filter = ("source", "status")
|
|
search_fields = ("source", "error_summary")
|
|
readonly_fields = (
|
|
"source",
|
|
"status",
|
|
"triggered_by",
|
|
"started_at",
|
|
"finished_at",
|
|
"files_total",
|
|
"files_processed",
|
|
"rows_total",
|
|
"rows_upserted",
|
|
"rows_failed",
|
|
"error_summary",
|
|
"context",
|
|
"created_at",
|
|
)
|
|
inlines = (ImportFileInline,)
|
|
|
|
|
|
@admin.register(ImportFile)
|
|
class ImportFileAdmin(admin.ModelAdmin):
|
|
list_display = (
|
|
"id",
|
|
"import_run",
|
|
"relative_path",
|
|
"source_name",
|
|
"snapshot_date",
|
|
"status",
|
|
"rows_total",
|
|
"rows_upserted",
|
|
"rows_failed",
|
|
"processed_at",
|
|
)
|
|
list_filter = ("status",)
|
|
search_fields = ("relative_path", "source_name", "checksum", "error_message")
|
|
readonly_fields = (
|
|
"import_run",
|
|
"relative_path",
|
|
"source_name",
|
|
"snapshot_date",
|
|
"status",
|
|
"checksum",
|
|
"file_size_bytes",
|
|
"rows_total",
|
|
"rows_upserted",
|
|
"rows_failed",
|
|
"error_message",
|
|
"payload_preview",
|
|
"processed_at",
|
|
"created_at",
|
|
)
|
|
|
|
|
|
@admin.register(IngestionRun)
|
|
class LegacyIngestionRunAdmin(admin.ModelAdmin):
|
|
list_display = ("provider_namespace", "job_type", "status", "started_at", "finished_at")
|
|
list_filter = ("provider_namespace", "job_type", "status")
|
|
search_fields = ("provider_namespace", "error_summary")
|
|
|
|
|
|
@admin.register(IngestionError)
|
|
class LegacyIngestionErrorAdmin(admin.ModelAdmin):
|
|
list_display = ("provider_namespace", "entity_type", "external_id", "severity", "occurred_at")
|
|
list_filter = ("severity", "provider_namespace")
|
|
search_fields = ("entity_type", "external_id", "message")
|