fix 1
This commit is contained in:
@@ -178,15 +178,12 @@ class AccountAdmin(AccountAdminMixin, ModelAdmin):
|
||||
# Check credits
|
||||
if obj.credits < 10:
|
||||
status = 'critical'
|
||||
icon = '🔴'
|
||||
message = 'Critical: Very low credits'
|
||||
elif obj.credits < 100:
|
||||
status = 'warning'
|
||||
icon = '⚠️'
|
||||
message = 'Warning: Low credits'
|
||||
else:
|
||||
status = 'good'
|
||||
icon = '✅'
|
||||
message = 'Good'
|
||||
|
||||
# Check for recent failed automations
|
||||
@@ -201,12 +198,10 @@ class AccountAdmin(AccountAdminMixin, ModelAdmin):
|
||||
|
||||
if failed_runs > 5:
|
||||
status = 'critical'
|
||||
icon = '🔴'
|
||||
message = f'Critical: {failed_runs} automation failures'
|
||||
elif failed_runs > 0:
|
||||
if status == 'good':
|
||||
status = 'warning'
|
||||
icon = '⚠️'
|
||||
message = f'Warning: {failed_runs} automation failures'
|
||||
except:
|
||||
pass
|
||||
@@ -214,7 +209,6 @@ class AccountAdmin(AccountAdminMixin, ModelAdmin):
|
||||
# Check account status
|
||||
if obj.status != 'active':
|
||||
status = 'critical'
|
||||
icon = '🔴'
|
||||
message = f'Critical: Account {obj.status}'
|
||||
|
||||
colors = {
|
||||
@@ -224,8 +218,8 @@ class AccountAdmin(AccountAdminMixin, ModelAdmin):
|
||||
}
|
||||
|
||||
return format_html(
|
||||
'<span style="font-size: 16px;">{}</span> <span style="color: {}; font-weight: 600;">{}</span>',
|
||||
icon, colors[status], message
|
||||
'<span style="display: inline-flex; align-items: center; padding: 4px 12px; border-radius: 6px; background-color: {}; color: white; font-weight: 500; font-size: 13px;">{}</span>',
|
||||
colors[status], message
|
||||
)
|
||||
health_indicator.short_description = 'Health'
|
||||
|
||||
@@ -238,12 +232,18 @@ class AccountAdmin(AccountAdminMixin, ModelAdmin):
|
||||
details = []
|
||||
|
||||
# Credits status
|
||||
colors = {
|
||||
'critical': '#ef4444',
|
||||
'warning': '#ff7a00',
|
||||
'good': '#0bbf87'
|
||||
}
|
||||
|
||||
if obj.credits < 10:
|
||||
details.append(f'🔴 <b>Critical:</b> Only {obj.credits} credits remaining')
|
||||
details.append(f'<span style="color: {colors["critical"]}; font-weight: 600;">Critical:</span> Only {obj.credits} credits remaining')
|
||||
elif obj.credits < 100:
|
||||
details.append(f'⚠️ <b>Warning:</b> Only {obj.credits} credits remaining')
|
||||
details.append(f'<span style="color: {colors["warning"]}; font-weight: 600;">Warning:</span> Only {obj.credits} credits remaining')
|
||||
else:
|
||||
details.append(f'✅ <b>Credits:</b> {obj.credits} available')
|
||||
details.append(f'<span style="color: {colors["good"]}; font-weight: 600;">Credits:</span> {obj.credits} available')
|
||||
|
||||
# Recent activity
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user