alias log dashboard
This commit is contained in:
parent
4e84815375
commit
5af974fc5d
|
@ -31,7 +31,7 @@ COLOR_LOG = "COLOR_LOG" in os.environ
|
|||
PROMO_CODE = "SIMPLEISBETTER"
|
||||
|
||||
# Debug mode
|
||||
DEBUG = os.environ['DEBUG']
|
||||
DEBUG = os.environ["DEBUG"]
|
||||
# Server url
|
||||
URL = os.environ["URL"]
|
||||
print(">>> URL:", URL)
|
||||
|
@ -45,7 +45,7 @@ SUPPORT_EMAIL = os.environ["SUPPORT_EMAIL"]
|
|||
ADMIN_EMAIL = os.environ.get("ADMIN_EMAIL")
|
||||
MAX_NB_EMAIL_FREE_PLAN = int(os.environ["MAX_NB_EMAIL_FREE_PLAN"])
|
||||
# allow to override postfix server locally
|
||||
POSTFIX_SERVER = os.environ.get("POSTFIX_SERVER", "1.1.1.1")
|
||||
POSTFIX_SERVER = os.environ.get("POSTFIX_SERVER", "0.0.0.0")
|
||||
|
||||
# list of (priority, email server)
|
||||
EMAIL_SERVERS_WITH_PRIORITY = eval(
|
||||
|
|
|
@ -1,7 +1,68 @@
|
|||
{% extends 'default.html' %}
|
||||
|
||||
{% set active_page = "dashboard" %}
|
||||
{% block head %}
|
||||
<style>
|
||||
{# https://bootsnipp.com/snippets/rljEW#}
|
||||
.card-counter{
|
||||
box-shadow: 2px 2px 10px #DADADA;
|
||||
margin: 5px;
|
||||
padding: 20px 10px;
|
||||
background-color: #fff;
|
||||
height: 100px;
|
||||
border-radius: 5px;
|
||||
transition: .3s linear all;
|
||||
}
|
||||
|
||||
.card-counter:hover{
|
||||
box-shadow: 4px 4px 20px #DADADA;
|
||||
transition: .3s linear all;
|
||||
}
|
||||
|
||||
.card-counter.primary{
|
||||
background-color: #007bff;
|
||||
color: #FFF;
|
||||
}
|
||||
|
||||
.card-counter.danger{
|
||||
background-color: #ef5350;
|
||||
color: #FFF;
|
||||
}
|
||||
|
||||
.card-counter.success{
|
||||
background-color: #66bb6a;
|
||||
color: #FFF;
|
||||
}
|
||||
|
||||
.card-counter.info{
|
||||
background-color: #26c6da;
|
||||
color: #FFF;
|
||||
}
|
||||
|
||||
.card-counter i{
|
||||
font-size: 5em;
|
||||
opacity: 0.2;
|
||||
}
|
||||
|
||||
.card-counter .count-numbers{
|
||||
position: absolute;
|
||||
right: 35px;
|
||||
top: 20px;
|
||||
font-size: 32px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.card-counter .count-name{
|
||||
position: absolute;
|
||||
right: 35px;
|
||||
top: 65px;
|
||||
text-transform: capitalize;
|
||||
opacity: 0.5;
|
||||
display: block;
|
||||
font-size: 18px;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
{% block title %}
|
||||
Alias Activity
|
||||
{% endblock %}
|
||||
|
@ -12,7 +73,37 @@
|
|||
{{ alias }}
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-3">
|
||||
<div class="card-counter primary">
|
||||
<i class="fa fa-at"></i>
|
||||
<span class="count-numbers">{{ total }}</span>
|
||||
<span class="count-name">Email Handled</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="card-counter primary">
|
||||
<i class="fa fa-paper-plane"></i>
|
||||
<span class="count-numbers">{{ email_forwarded }}</span>
|
||||
<span class="count-name">Email Forwarded</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="card-counter primary">
|
||||
<i class="fa fa-reply"></i>
|
||||
<span class="count-numbers">{{ email_replied }}</span>
|
||||
<span class="count-name">Email Replied</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="card-counter danger">
|
||||
<i class="fa fa-ban"></i>
|
||||
<span class="count-numbers">{{ email_forwarded }}</span>
|
||||
<span class="count-name">Email Blocked</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<h2 class="pt-4">Activities</h2>
|
||||
<div class="row">
|
||||
{% for log in logs %}
|
||||
<div class="col-12">
|
||||
|
|
|
@ -38,6 +38,15 @@ def alias_log(alias, page_id):
|
|||
return redirect(url_for("dashboard.index"))
|
||||
|
||||
logs = get_alias_log(gen_email, page_id)
|
||||
base = (
|
||||
db.session.query(ForwardEmail, ForwardEmailLog)
|
||||
.filter(ForwardEmail.id == ForwardEmailLog.forward_id)
|
||||
.filter(ForwardEmail.gen_email_id == gen_email.id)
|
||||
)
|
||||
total = base.count()
|
||||
email_forwarded = base.filter(ForwardEmailLog.is_reply == False).count()
|
||||
email_replied = base.filter(ForwardEmailLog.is_reply == True).count()
|
||||
email_blocked = base.filter(ForwardEmailLog.blocked == True).count()
|
||||
last_page = (
|
||||
len(logs) < _LIMIT
|
||||
) # lightweight pagination without counting all objects
|
||||
|
|
Loading…
Reference in New Issue