split admin pages
This commit is contained in:
parent
e7cde727b3
commit
3969f4ccd6
8 changed files with 303 additions and 224 deletions
|
@ -34,15 +34,55 @@ def after_request(response):
|
||||||
def index():
|
def index():
|
||||||
return redirect(url_for('admin.list_users'))
|
return redirect(url_for('admin.list_users'))
|
||||||
|
|
||||||
@admin.route("/listitems", methods=['GET'])
|
|
||||||
|
@admin.route("/listdeployments", methods=['GET'])
|
||||||
@login_required
|
@login_required
|
||||||
@admin_required
|
@admin_required
|
||||||
def list_items():
|
def list_deployments():
|
||||||
alldeployments = Deployment.query.order_by(Deployment.daysleft.asc()).all()
|
alldeployments = Deployment.query.order_by(Deployment.daysleft.asc()).all()
|
||||||
alldomains = Domain.query.order_by(Domain.daysleft.asc()).all()
|
return render_template('admin/list_deployments.html', deployments=alldeployments)
|
||||||
|
|
||||||
|
@admin.route("/listservices", methods=['GET'])
|
||||||
|
@login_required
|
||||||
|
@admin_required
|
||||||
|
def list_services():
|
||||||
allservices = Service.query.order_by(Service.daysleft.asc()).all()
|
allservices = Service.query.order_by(Service.daysleft.asc()).all()
|
||||||
alladdresses = Address.query.order_by(Address.user_id.asc()).all()
|
return render_template('admin/list_services.html', services=allservices)
|
||||||
return render_template('admin/list_items.html', deployments=alldeployments, domains=alldomains, services=allservices, addresses=alladdresses)
|
|
||||||
|
@admin.route("/listdomains", methods=['GET'])
|
||||||
|
@login_required
|
||||||
|
@admin_required
|
||||||
|
def list_domains():
|
||||||
|
alldomains = Domain.query.order_by(Domain.daysleft.asc()).all()
|
||||||
|
return render_template('admin/list_domains.html', domains=alldomains)
|
||||||
|
|
||||||
|
@admin.route("/listaddresses", methods=['GET'])
|
||||||
|
@login_required
|
||||||
|
@admin_required
|
||||||
|
def list_addresses():
|
||||||
|
alladdresses = Address.query.order_by(Address.ip.asc()).all()
|
||||||
|
return render_template('admin/list_addresses.html', addresses=alladdresses)
|
||||||
|
|
||||||
|
@admin.route("/addr2pool", methods=['GET', 'POST'])
|
||||||
|
@login_required
|
||||||
|
@admin_required
|
||||||
|
def addr2pool():
|
||||||
|
alladdrlist = []
|
||||||
|
alladdr = Address.query.all()
|
||||||
|
for addr in alladdr:
|
||||||
|
alladdrlist.append(str(addr.ip))
|
||||||
|
current_app.logger.info('Current IP pool: {}'.format(alladdrlist))
|
||||||
|
form = Addr2PoolForm()
|
||||||
|
if form.validate_on_submit():
|
||||||
|
if form.ip.data in alladdrlist:
|
||||||
|
flash('IP address {} is already in the pool!'.format(form.ip.data))
|
||||||
|
return redirect(url_for('admin.addr2pool'))
|
||||||
|
address = Address(ip=form.ip.data, region_id=form.region.data, enabled=True, reserved=form.reserved.data)
|
||||||
|
db.session.add(address)
|
||||||
|
db.session.commit()
|
||||||
|
flash('Address {} added to region {}'.format(form.ip.data, form.region.data))
|
||||||
|
return redirect(url_for('admin.list_addresses'))
|
||||||
|
return render_template('admin/addr2pool.html', form=form, alladdresses=alladdrlist)
|
||||||
|
|
||||||
@admin.route("/listusers", methods=['GET'])
|
@admin.route("/listusers", methods=['GET'])
|
||||||
@login_required
|
@login_required
|
||||||
|
@ -68,26 +108,34 @@ def charge(user_pid=0):
|
||||||
return redirect(url_for('admin.list_users'))
|
return redirect(url_for('admin.list_users'))
|
||||||
return render_template('admin/charge.html', form=form, usr=cuser)
|
return render_template('admin/charge.html', form=form, usr=cuser)
|
||||||
|
|
||||||
@admin.route("/addr2pool", methods=['GET', 'POST'])
|
@admin.route("/listtransactions", methods=['GET'])
|
||||||
@login_required
|
@login_required
|
||||||
@admin_required
|
@admin_required
|
||||||
def addr2pool():
|
def list_transactions():
|
||||||
alladdrlist = []
|
alltransactions = Transaction.query.order_by(Transaction.date_created.desc()).all()
|
||||||
alladdr = Address.query.all()
|
return render_template('admin/list_transactions.html', transactions=alltransactions)
|
||||||
for addr in alladdr:
|
|
||||||
alladdrlist.append(str(addr.ip))
|
@admin.route("/transaction/<int:user_pid>", methods=['GET'])
|
||||||
current_app.logger.info('Current IP pool: {}'.format(alladdrlist))
|
@login_required
|
||||||
form = Addr2PoolForm()
|
@admin_required
|
||||||
if form.validate_on_submit():
|
def transaction(user_pid=0):
|
||||||
if form.ip.data in alladdrlist:
|
cuser = User.query.filter_by(pid=user_pid).first()
|
||||||
flash('IP address {} is already in the pool!'.format(form.ip.data))
|
transactions = cuser.inv_transactions.order_by(Transaction.date_created.desc()).all()
|
||||||
return redirect(url_for('admin.addr2pool'))
|
|
||||||
address = Address(ip=form.ip.data, region_id=form.region.data, enabled=True, reserved=form.reserved.data)
|
labelslist = ['today']
|
||||||
db.session.add(address)
|
translist = [cuser.wallet]
|
||||||
db.session.commit()
|
prevvalue = cuser.wallet
|
||||||
flash('Address {} added to region {}'.format(form.ip.data, form.region.data))
|
for tr in transactions:
|
||||||
return redirect(url_for('admin.list_items'))
|
labelslist.insert(0, str(tr.date_created.strftime('%d.%m')))
|
||||||
return render_template('admin/addr2pool.html', form=form, alladdresses=alladdrlist)
|
translist.insert(0, prevvalue - tr.value)
|
||||||
|
prevvalue -= tr.value
|
||||||
|
|
||||||
|
if len(labelslist) <= 1:
|
||||||
|
labelslist.insert(0, 'before')
|
||||||
|
translist.insert(0, 0)
|
||||||
|
|
||||||
|
#current_app.logger.info('[{}] transactions: {} {} '.format(cuser.email, translist, labelslist))
|
||||||
|
return render_template('uinvoice/transactions.html', transactions=transactions, translist=translist, labelslist=labelslist, cuser=cuser)
|
||||||
|
|
||||||
@admin.route("/dashboard/<int:user_pid>", methods=['GET'])
|
@admin.route("/dashboard/<int:user_pid>", methods=['GET'])
|
||||||
@login_required
|
@login_required
|
||||||
|
@ -151,32 +199,4 @@ def dashboard(user_pid=0):
|
||||||
current_app.logger.warning('[ADMIN] {} deployments: {}, services: {}, domains: {}, services: {}'.format(cuser.email, inv_deployments_list, inv_services_list, inv_domains_list, inv_addresses_list ))
|
current_app.logger.warning('[ADMIN] {} deployments: {}, services: {}, domains: {}, services: {}'.format(cuser.email, inv_deployments_list, inv_services_list, inv_domains_list, inv_addresses_list ))
|
||||||
return render_template('main/dashboard.html', rrd=rrd, status=statuses, inv_deployments=inv_deployments, inv_services=inv_services, inv_domains=inv_domains, inv_addresses=inv_addresses, region=regions)
|
return render_template('main/dashboard.html', rrd=rrd, status=statuses, inv_deployments=inv_deployments, inv_services=inv_services, inv_domains=inv_domains, inv_addresses=inv_addresses, region=regions)
|
||||||
|
|
||||||
@admin.route("/listtransactions", methods=['GET'])
|
|
||||||
@login_required
|
|
||||||
@admin_required
|
|
||||||
def list_transactions():
|
|
||||||
alltransactions = Transaction.query.order_by(Transaction.date_created.desc()).all()
|
|
||||||
return render_template('admin/list_transactions.html', transactions=alltransactions)
|
|
||||||
|
|
||||||
@admin.route("/transaction/<int:user_pid>", methods=['GET'])
|
|
||||||
@login_required
|
|
||||||
@admin_required
|
|
||||||
def transaction(user_pid=0):
|
|
||||||
cuser = User.query.filter_by(pid=user_pid).first()
|
|
||||||
transactions = cuser.inv_transactions.order_by(Transaction.date_created.desc()).all()
|
|
||||||
|
|
||||||
labelslist = ['today']
|
|
||||||
translist = [cuser.wallet]
|
|
||||||
prevvalue = cuser.wallet
|
|
||||||
for tr in transactions:
|
|
||||||
labelslist.insert(0, str(tr.date_created.strftime('%d.%m')))
|
|
||||||
translist.insert(0, prevvalue - tr.value)
|
|
||||||
prevvalue -= tr.value
|
|
||||||
|
|
||||||
if len(labelslist) <= 1:
|
|
||||||
labelslist.insert(0, 'before')
|
|
||||||
translist.insert(0, 0)
|
|
||||||
|
|
||||||
#current_app.logger.info('[{}] transactions: {} {} '.format(cuser.email, translist, labelslist))
|
|
||||||
return render_template('uinvoice/transactions.html', transactions=transactions, translist=translist, labelslist=labelslist, cuser=cuser)
|
|
||||||
|
|
||||||
|
|
|
@ -295,7 +295,7 @@ class Address(db.Model):
|
||||||
while True:
|
while True:
|
||||||
mac = [ random.randint(0, 255) for x in range(0, 6) ]
|
mac = [ random.randint(0, 255) for x in range(0, 6) ]
|
||||||
mac[0] = (mac[0] & 0xfc) | 0x02
|
mac[0] = (mac[0] & 0xfc) | 0x02
|
||||||
mac = ''.join([ '{0:02x}'.format(x) for x in mac ])
|
mac = ':'.join([ '{0:02x}'.format(x) for x in mac ])
|
||||||
if mac in allmacs:
|
if mac in allmacs:
|
||||||
current_app.logger.warning('mac address {} is in the pool. regenerating...'.format(mac))
|
current_app.logger.warning('mac address {} is in the pool. regenerating...'.format(mac))
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -3,8 +3,11 @@
|
||||||
<div class="panel-heading">Admin Pages</div>
|
<div class="panel-heading">Admin Pages</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<center>
|
<center>
|
||||||
|
<button class="btn btn-default" onclick="window.open('{{ url_for('admin.list_deployments') }}','_self')"><span class="glyphicon glyphicon-list" aria-hidden="true"></span> Deployments</button>
|
||||||
|
<button class="btn btn-default" onclick="window.open('{{ url_for('admin.list_addresses') }}','_self')"><span class="glyphicon glyphicon-list" aria-hidden="true"></span> Addresses</button>
|
||||||
|
<button class="btn btn-default" onclick="window.open('{{ url_for('admin.list_services') }}','_self')"><span class="glyphicon glyphicon-list" aria-hidden="true"></span> Services</button>
|
||||||
|
<button class="btn btn-default" onclick="window.open('{{ url_for('admin.list_domains') }}','_self')"><span class="glyphicon glyphicon-list" aria-hidden="true"></span> Domains</button>
|
||||||
<button class="btn btn-default" onclick="window.open('{{ url_for('admin.list_users') }}','_self')"><span class="glyphicon glyphicon-user" aria-hidden="true"></span> Users</button>
|
<button class="btn btn-default" onclick="window.open('{{ url_for('admin.list_users') }}','_self')"><span class="glyphicon glyphicon-user" aria-hidden="true"></span> Users</button>
|
||||||
<button class="btn btn-default" onclick="window.open('{{ url_for('admin.list_items') }}','_self')"><span class="glyphicon glyphicon-list" aria-hidden="true"></span> Items</button>
|
|
||||||
<button class="btn btn-default" onclick="window.open('{{ url_for('admin.list_transactions') }}','_self')"><span class="glyphicon glyphicon-usd" aria-hidden="true"></span> Transactions</button>
|
<button class="btn btn-default" onclick="window.open('{{ url_for('admin.list_transactions') }}','_self')"><span class="glyphicon glyphicon-usd" aria-hidden="true"></span> Transactions</button>
|
||||||
<button class="btn btn-default" onclick="alert('Как ще си събираш зъбите със счупени ръце?')"><span class="glyphicon glyphicon-cd" aria-hidden="true"></span> Nothing</button>
|
<button class="btn btn-default" onclick="alert('Как ще си събираш зъбите със счупени ръце?')"><span class="glyphicon glyphicon-cd" aria-hidden="true"></span> Nothing</button>
|
||||||
</center>
|
</center>
|
||||||
|
|
49
app/templates/admin/list_addresses.html
Normal file
49
app/templates/admin/list_addresses.html
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{% block styles %}
|
||||||
|
{{ super() }}
|
||||||
|
</style>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block page_content %}
|
||||||
|
<div class="row">
|
||||||
|
{% include "admin/admin_tasks.html" %}
|
||||||
|
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="panel panel-warning" id="addresses">
|
||||||
|
<div class="panel-heading">Addresses</div>
|
||||||
|
<div class="panel-body"><p>
|
||||||
|
<table class="table table-hover table-striped table-condensed cf">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>IP</th>
|
||||||
|
<th>MAC Addr.</th>
|
||||||
|
<th>Reverse DNS</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for address in addresses %}
|
||||||
|
<tr>
|
||||||
|
{% if address.enabled == False %}<tr class="danger">{% else %}<tr>{% endif %}
|
||||||
|
<td>{{ address.ip }}</td>
|
||||||
|
<td>{{ address.mac }}</td>
|
||||||
|
<td>{{ address.rdns }}</td>
|
||||||
|
{% endfor %}
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<button class="btn btn-default" onclick="window.open('{{ url_for('admin.addr2pool') }}')"><span class="glyphicon glyphicon-plus" aria-hiddent="true"></span> Add IP to pool</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
|
|
65
app/templates/admin/list_deployments.html
Normal file
65
app/templates/admin/list_deployments.html
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{% block styles %}
|
||||||
|
{{ super() }}
|
||||||
|
</style>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block page_content %}
|
||||||
|
<div class="row">
|
||||||
|
{% include "admin/admin_tasks.html" %}
|
||||||
|
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="panel panel-warning" id="deployments">
|
||||||
|
<div class="panel-heading">Deployments</div>
|
||||||
|
<div class="panel-body"><p>
|
||||||
|
<table class="table table-hover table-striped table-condensed cf">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Owner</th>
|
||||||
|
<th>Cube ID</th>
|
||||||
|
<th>Alias</th>
|
||||||
|
<th>CPU</th>
|
||||||
|
<th>Mem</th>
|
||||||
|
<th>HDD</th>
|
||||||
|
<th>Price</th>
|
||||||
|
<th>Last Charged</th>
|
||||||
|
<th>Days Left</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for deploy in deployments %}
|
||||||
|
{% if deploy.enabled == False %}
|
||||||
|
<tr class="danger">
|
||||||
|
{% else %}
|
||||||
|
{% if deploy.warning == True %}
|
||||||
|
<tr class="warning">
|
||||||
|
{% else %}
|
||||||
|
<tr>
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
<td><a href="{{ url_for('admin.dashboard', user_pid=deploy.user_id) }}">{{ deploy.owner.email }}</a></td>
|
||||||
|
<td>{{ deploy.machine_id }}</td>
|
||||||
|
<td>{{ deploy.machine_alias }}</font></td>
|
||||||
|
<td>{{ deploy.machine_cpu }}</td>
|
||||||
|
<td>{{ deploy.machine_mem }} MB</td>
|
||||||
|
<td>{{ deploy.machine_hdd }} GB</td>
|
||||||
|
<td>{{ deploy.price }}</td>
|
||||||
|
<td>{{ moment(deploy.date_last_charge).format('lll') }} ({{ moment(deploy.date_last_charge).fromNow() }})</td>
|
||||||
|
<td>{{ deploy.daysleft }}</td>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
|
|
55
app/templates/admin/list_domains.html
Normal file
55
app/templates/admin/list_domains.html
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{% block styles %}
|
||||||
|
{{ super() }}
|
||||||
|
</style>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block page_content %}
|
||||||
|
<div class="row">
|
||||||
|
{% include "admin/admin_tasks.html" %}
|
||||||
|
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="panel panel-warning" id="domains">
|
||||||
|
<div class="panel-heading">Domains</div>
|
||||||
|
<div class="panel-body"><p>
|
||||||
|
<table class="table table-hover table-striped table-condensed cf">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Owner</th>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Expiry Date</th>
|
||||||
|
<th>Days Left</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for domain in domains %}
|
||||||
|
{% if domain.enabled == False %}
|
||||||
|
<tr class="danger">
|
||||||
|
{% else %}
|
||||||
|
{% if domain.warning == True %}
|
||||||
|
<tr class="warning">
|
||||||
|
{% else %}
|
||||||
|
<tr>
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
<td><a href="{{ url_for('admin.dashboard', user_pid=domain.user_id) }}">{{ domain.owner.email }}</a></td>
|
||||||
|
<td><b><a href="http://{{ domain.fqdn }}">{{ domain.fqdn }}</a></b></td>
|
||||||
|
<td>{{ domain.date_expire }}</td>
|
||||||
|
<td>{{ domain.daysleft }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
|
|
|
@ -1,171 +0,0 @@
|
||||||
{% extends "base.html" %}
|
|
||||||
|
|
||||||
{% block styles %}
|
|
||||||
{{ super() }}
|
|
||||||
</style>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block page_content %}
|
|
||||||
<div class="row">
|
|
||||||
{% include "admin/admin_tasks.html" %}
|
|
||||||
|
|
||||||
<div class="col-md-12">
|
|
||||||
<div class="panel panel-warning" id="deployments">
|
|
||||||
<div class="panel-heading">Deployments</div>
|
|
||||||
<div class="panel-body"><p>
|
|
||||||
<table class="table table-hover table-striped table-condensed cf">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Owner</th>
|
|
||||||
<th>Cube ID</th>
|
|
||||||
<th>Alias</th>
|
|
||||||
<th>CPU</th>
|
|
||||||
<th>Mem</th>
|
|
||||||
<th>HDD</th>
|
|
||||||
<th>Price</th>
|
|
||||||
<th>Last Charged</th>
|
|
||||||
<th>Days Left</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{% for deploy in deployments %}
|
|
||||||
{% if deploy.enabled == False %}
|
|
||||||
<tr class="danger">
|
|
||||||
{% else %}
|
|
||||||
{% if deploy.warning == True %}
|
|
||||||
<tr class="warning">
|
|
||||||
{% else %}
|
|
||||||
<tr>
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
||||||
<td><a href="{{ url_for('admin.dashboard', user_pid=deploy.user_id) }}">{{ deploy.owner.email }}</a></td>
|
|
||||||
<td>{{ deploy.machine_id }}</td>
|
|
||||||
<td>{{ deploy.machine_alias }}</font></td>
|
|
||||||
<td>{{ deploy.machine_cpu }}</td>
|
|
||||||
<td>{{ deploy.machine_mem }} MB</td>
|
|
||||||
<td>{{ deploy.machine_hdd }} GB</td>
|
|
||||||
<td>{{ deploy.price }}</td>
|
|
||||||
<td>{{ moment(deploy.date_last_charge).format('lll') }} ({{ moment(deploy.date_last_charge).fromNow() }})</td>
|
|
||||||
<td>{{ deploy.daysleft }}</td>
|
|
||||||
{% endfor %}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-md-12">
|
|
||||||
<div class="panel panel-warning" id="services">
|
|
||||||
<div class="panel-heading">Services</div>
|
|
||||||
<div class="panel-body"><p>
|
|
||||||
<table class="table table-hover table-striped table-condensed cf">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Owner</th>
|
|
||||||
<th>Category</th>
|
|
||||||
<th>Description</th>
|
|
||||||
<th>Price</th>
|
|
||||||
<th>Last Charged</th>
|
|
||||||
<th>Days Left</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{% for service in services %}
|
|
||||||
{% if service.enabled == False %}
|
|
||||||
<tr class="danger">
|
|
||||||
{% else %}
|
|
||||||
{% if service.warning == True %}
|
|
||||||
<tr class="warning">
|
|
||||||
{% else %}
|
|
||||||
<tr>
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
||||||
<td><a href="{{ url_for('admin.dashboard', user_pid=service.user_id) }}">{{ service.owner.email }}</a></td>
|
|
||||||
<td>{{ service.category }}</td>
|
|
||||||
<td>{{ service.description }}</td>
|
|
||||||
<td>{{ service.price }}</td>
|
|
||||||
<td>{{ moment(service.date_last_charge).format('ll') }} ({{ moment(service.date_last_charge).fromNow() }})</td>
|
|
||||||
<td>{{ service.daysleft }}</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="col-md-12">
|
|
||||||
<div class="panel panel-warning" id="domains">
|
|
||||||
<div class="panel-heading">Domains</div>
|
|
||||||
<div class="panel-body"><p>
|
|
||||||
<table class="table table-hover table-striped table-condensed cf">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Owner</th>
|
|
||||||
<th>Name</th>
|
|
||||||
<th>Expiry Date</th>
|
|
||||||
<th>Days Left</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{% for domain in domains %}
|
|
||||||
{% if domain.enabled == False %}
|
|
||||||
<tr class="danger">
|
|
||||||
{% else %}
|
|
||||||
{% if domain.warning == True %}
|
|
||||||
<tr class="warning">
|
|
||||||
{% else %}
|
|
||||||
<tr>
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
||||||
<td><a href="{{ url_for('admin.dashboard', user_pid=domain.user_id) }}">{{ domain.owner.email }}</a></td>
|
|
||||||
<td><b><a href="http://{{ domain.fqdn }}">{{ domain.fqdn }}</a></b></td>
|
|
||||||
<td>{{ domain.date_expire }}</td>
|
|
||||||
<td>{{ domain.daysleft }}</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-md-12">
|
|
||||||
<div class="panel panel-warning" id="addresses">
|
|
||||||
<div class="panel-heading">Addresses</div>
|
|
||||||
<div class="panel-body"><p>
|
|
||||||
<table class="table table-hover table-striped table-condensed cf">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>IP</th>
|
|
||||||
<th>MAC Addr.</th>
|
|
||||||
<th>Reverse DNS</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{% for address in addresses %}
|
|
||||||
<tr>
|
|
||||||
{% if address.enabled == False %}<tr class="danger">{% else %}<tr>{% endif %}
|
|
||||||
<td>{{ address.ip }}</td>
|
|
||||||
<td>{{ address.mac }}</td>
|
|
||||||
<td>{{ address.rdns }}</td>
|
|
||||||
{% endfor %}
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<button class="btn btn-default" onclick="window.open('{{ url_for('admin.addr2pool') }}')"><span class="glyphicon glyphicon-plus" aria-hiddent="true"></span> Add IP to pool</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% endblock %}
|
|
||||||
|
|
58
app/templates/admin/list_services.html
Normal file
58
app/templates/admin/list_services.html
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{% block styles %}
|
||||||
|
{{ super() }}
|
||||||
|
</style>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block page_content %}
|
||||||
|
<div class="row">
|
||||||
|
{% include "admin/admin_tasks.html" %}
|
||||||
|
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="panel panel-warning" id="services">
|
||||||
|
<div class="panel-heading">Services</div>
|
||||||
|
<div class="panel-body"><p>
|
||||||
|
<table class="table table-hover table-striped table-condensed cf">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Owner</th>
|
||||||
|
<th>Category</th>
|
||||||
|
<th>Description</th>
|
||||||
|
<th>Price</th>
|
||||||
|
<th>Last Charged</th>
|
||||||
|
<th>Days Left</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for service in services %}
|
||||||
|
{% if service.enabled == False %}
|
||||||
|
<tr class="danger">
|
||||||
|
{% else %}
|
||||||
|
{% if service.warning == True %}
|
||||||
|
<tr class="warning">
|
||||||
|
{% else %}
|
||||||
|
<tr>
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
<td><a href="{{ url_for('admin.dashboard', user_pid=service.user_id) }}">{{ service.owner.email }}</a></td>
|
||||||
|
<td>{{ service.category }}</td>
|
||||||
|
<td>{{ service.description }}</td>
|
||||||
|
<td>{{ service.price }}</td>
|
||||||
|
<td>{{ moment(service.date_last_charge).format('ll') }} ({{ moment(service.date_last_charge).fromNow() }})</td>
|
||||||
|
<td>{{ service.daysleft }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
|
|
Loading…
Reference in a new issue