various panel changes

This commit is contained in:
deflax 2018-03-23 00:15:50 +02:00
parent 6c566b80d4
commit 72bf9b1e9f
7 changed files with 23 additions and 20 deletions

View file

@ -22,7 +22,7 @@ import onetimepass
class Permission:
DEPLOY = 0x01
ADMINISTER = 0x80
ADMINISTER = 0xff
class Role(db.Model):
__tablename__ = 'roles'
@ -36,7 +36,7 @@ class Role(db.Model):
def insert_roles():
roles = {
'User': (Permission.DEPLOY, True),
'Administrator': (0xff, False)
'Administrator': (Permission.ADMINISTER, False)
}
for r in roles:
role = Role.query.filter_by(name=r).first()

View file

@ -13,10 +13,10 @@ class OrderForm(FlaskForm):
vmtype = SelectField('Type:', choices=vmtype_choices, coerce=int)
cpu = DecimalRangeField('Processor Cores', default=2)
memory = DecimalRangeField('Memory', default=512)
storage = DecimalRangeField('Storage', default=10)
memory = DecimalRangeField('Memory', default=2048)
storage = DecimalRangeField('Storage', default=20)
alias = StringField('Machine Alias:', [validators.Regexp(message='ex.: myservice1.com, myservice2.local', regex='^[a-zA-Z0-9][a-zA-Z0-9-_]{0,61}[a-zA-Z0-9]{0,1}\.([a-zA-Z]{1,6}|[a-zA-Z0-9-]{1,30}\.[a-zA-Z]{2,3})$'), validators.Length(6,64)])
alias = StringField('Name:', [validators.Regexp(message='ex.: myservice1.com, myservice2.local', regex='^[a-zA-Z0-9][a-zA-Z0-9-_]{0,61}[a-zA-Z0-9]{0,1}\.([a-zA-Z]{1,6}|[a-zA-Z0-9-]{1,30}\.[a-zA-Z]{2,3})$'), validators.Length(6,64)])
submit = SubmitField('DEPLOY')

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 568 B

View file

@ -24,7 +24,8 @@
{% endif %}
{% if current_user.is_authenticated %}
<!-- <li><a href="#"><span class="glyphicon glyphicon-send"></span> Deploy Application</a></li>
<li><a href="{{ url_for('panel.deploy') }}"><span class="glyphicon glyphicon-send"></span> Deploy</a></li>
<!--
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><span class="glyphicon glyphicon-send"></span> Deploy Application</a>
<ul class="dropdown-menu">
@ -34,8 +35,6 @@
</ul> -->
{% endif %}
<li><a href="{{ url_for('main.chat') }}" target="_blank"><span class="glyphicon glyphicon-question-sign"></span> Live Chat</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
@ -49,10 +48,12 @@
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><img class="avatar" src="{{ current_user.gravatar(20) }}"> {{ current_user.email }} <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="{{ url_for('panel.dashboard') }}"><span class="glyphicon glyphicon-modal-window"></span> Dashboard</a></li>
<li><a href="{{ url_for('panel.dashboard') }}"><span class="glyphicon glyphicon-pencil"></span> Dashboard</a></li>
<li role="separator" class="divider"></li>
<li><a href="{{ url_for('uinvoice.transactions') }}"><span class="glyphicon glyphicon-list-alt"></span> Transactions</a></li>
<li role="separator" class="divider"></li>
<li><a href="{{ url_for('settings.profile') }}"><span class="glyphicon glyphicon-user"></span> Profile</a></li>
<li><a href="{{ url_for('main.chat') }}" target="_blank"><span class="glyphicon glyphicon-question-sign"></span> Live Chat</a></li>
<li><a href="{{ url_for('auth.logout') }}"><span class="glyphicon glyphicon-off"></span> Logout</a></li>
</ul>
</li>

View file

@ -1,11 +1,15 @@
{% extends "base.html" %}
{% block title %}Deploy New Instance{% endblock %}
{% block title %}Deploy a server{% endblock %}
{% block scripts %}
{{ super() }}
<script>
function cpuUpdate(value) {
$('#selected-cpu').html('<h3>' + value + ' cores</h3>');
//for (i = 0; i < value; i++) {
// cpuimg += 'x';
//}
//$('#selected-cpu').html('test ' + cpuimg);
}
function memoryUpdate(value) {
@ -24,7 +28,7 @@ function storageUpdate(value) {
<center><h2>Deploy new Server</h2></center>
<div class="row">
<form method="POST" action="{{ url_for('panel.deploy') }}">
<div class="col-md-12">
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">1. Location</div>
<div class="panel-body">
@ -37,9 +41,9 @@ function storageUpdate(value) {
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">2. Type</div>
<div class="panel-heading">2. Image</div>
<div class="panel-body">
<p>
{{ form.vmtype.label }}<br /> {{ form.vmtype }}<br />
@ -57,7 +61,7 @@ function storageUpdate(value) {
<div class="col-md-4">
<p>
{{ form.cpu.label }}
{{ form.cpu(min=2, max=16, step=2, oninput="cpuUpdate(value)") }}
{{ form.cpu(min=2, max=8, step=2, oninput="cpuUpdate(value)") }}
<center><output for="cpu" id="selected-cpu"><h3>{{ form.cpu.data }} cores</h3></output></center>
{% for error in form.cpu.errors %}
{{ error }}<br />
@ -67,7 +71,7 @@ function storageUpdate(value) {
<div class="col-md-4">
<p>
{{ form.memory.label }}<br /> {{ form.memory(min=512, max=16384, step=512, oninput="memoryUpdate(value)") }}
{{ form.memory.label }}<br /> {{ form.memory(min=1024, max=8192, step=512, oninput="memoryUpdate(value)") }}
<center><output for="memory" id="selected-memory"><h3>{{ form.memory.data }} MB</h3></output></center>
{% for error in form.memory.errors %}
{{ error }}<br />
@ -77,7 +81,7 @@ function storageUpdate(value) {
<div class="col-md-4">
<p>
{{ form.storage.label }}<br /> {{ form.storage(min=10, max=100, step=10, oninput="storageUpdate(value)") }}
{{ form.storage.label }}<br /> {{ form.storage(min=20, max=240, step=20, oninput="storageUpdate(value)") }}
<center><output for="storage" id="selected-storage"><h3>{{ form.storage.data }} GB</h3></output></center>
{% for error in form.storage.errors %}
{{ error }}<br />

View file

@ -10,9 +10,8 @@
{% endif %}
<div class="panel-heading" data-toggle="collapse" data-parent="#deploycubes" href="#cube{{ deploy.machine_id }}" aria-expanded="true" aria-controls="cube{{ deploy.machine_id }}" role="tab" id="dpanel{{ deploy.machine_id }}">
{% if deploy.protected == True %}<img class="icon icons8-Security-Checked" width="24" height="24" src="data:image/png;base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Ii4mlcqNf4MRSucEp5EWkOIo6O4Zxsrnbz+vA3OohsDKxI/s2czlxZI4xyHC7HcW6dS2DDHfgn+USUuEXDhEvDFLK1wdz33VKXMBTQZFSvg4cIl5kIyUMkpeN793GT0p3zrZ12Lh/kMgc4xD5OqPtXRhBi8Yx/Pr7jsdJxtG1fwqOZUojLDLejmesxhPdgSe6A+MZq8Ei4+3AurWXMAKOJVVrK6laW0Nrhn9D/gYrB5WUx8IwEwAAAABJRU5ErkJggg==">{% endif %} <a href="#"><b>{% if status[deploy.machine_id] == 'running' %}<font color="green">{% else %}<font color="red">{% endif %}{{ deploy.machine_alias }}</font></b></a>
</div></div> <!-- end of heading -->
<!-- START OF HIDDEN PANEL -->
{% if deploy.enabled == False or deploy.warning == True %}
<div id="cube{{ deploy.machine_id }}" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="heading{{ deploy.machine_id }}" style="border:3px solid #faebcc; border-top: none; margin-bottom: 10px;">
@ -41,7 +40,7 @@
{% endif %}
</br>
</br>
Date Created: {{ moment(deploy.date_created).format('lll') }}<br />
Last Payment Date: {{ moment(deploy.date_last_charge).format('lll') }}</br />
{% if deploy.period == 1 %}
{{ deploy.period }} month payment cycle<br />
{% else %}
@ -68,7 +67,6 @@
{% endif %}
{% endif %}
</p>
</div>
<div id="graphs{{ deploy.machine_id }}" class="tab-pane fade">