Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Vladislav Rykov
THSO.server
Commits
e324edd4
Commit
e324edd4
authored
May 25, 2020
by
Vladislav Rykov
Browse files
new application form view integrated
parent
0d72f305
Changes
7
Hide whitespace changes
Inline
Side-by-side
app/app/__pycache__/views.cpython-37.pyc
View file @
e324edd4
No preview for this file type
app/app/templates/logged_layout.html
View file @
e324edd4
...
...
@@ -107,36 +107,6 @@
<i
class=
"ni ni-settings-gear-65 text-grey"
></i>
Settings
</a>
</li>
<li
class=
"nav-item"
>
<a
class=
"nav-link "
href=
"./examples/icons.html"
>
<i
class=
"ni ni-planet text-blue"
></i>
Icons
</a>
</li>
<li
class=
"nav-item"
>
<a
class=
"nav-link "
href=
"./examples/maps.html"
>
<i
class=
"ni ni-pin-3 text-orange"
></i>
Maps
</a>
</li>
<li
class=
"nav-item"
>
<a
class=
"nav-link "
href=
"./examples/profile.html"
>
<i
class=
"ni ni-single-02 text-yellow"
></i>
User profile
</a>
</li>
<li
class=
"nav-item"
>
<a
class=
"nav-link "
href=
"./examples/tables.html"
>
<i
class=
"ni ni-bullet-list-67 text-red"
></i>
Tables
</a>
</li>
<li
class=
"nav-item"
>
<a
class=
"nav-link"
href=
"./examples/login.html"
>
<i
class=
"ni ni-key-25 text-info"
></i>
Login
</a>
</li>
<li
class=
"nav-item"
>
<a
class=
"nav-link"
href=
"./examples/register.html"
>
<i
class=
"ni ni-circle-08 text-pink"
></i>
Register
</a>
</li>
</ul>
<!-- Divider -->
<hr
class=
"my-3"
>
...
...
@@ -145,20 +115,10 @@
<!-- Navigation -->
<ul
class=
"navbar-nav mb-md-3"
>
<li
class=
"nav-item"
>
<a
class=
"nav-link"
href=
"
https://demos.creative-tim.com/argon-dashboard/docs
/getting-started/overview.html"
>
<a
class=
"nav-link"
href=
"/getting-started/overview.html"
>
<i
class=
"ni ni-spaceship"
></i>
Getting started
</a>
</li>
<li
class=
"nav-item"
>
<a
class=
"nav-link"
href=
"https://demos.creative-tim.com/argon-dashboard/docs/foundation/colors.html"
>
<i
class=
"ni ni-palette"
></i>
Foundation
</a>
</li>
<li
class=
"nav-item"
>
<a
class=
"nav-link"
href=
"https://demos.creative-tim.com/argon-dashboard/docs/components/alerts.html"
>
<i
class=
"ni ni-ui-04"
></i>
Components
</a>
</li>
</ul>
</div>
</div>
...
...
app/app/templates/
old
/public/.
dev-data-t
.html.swp
→
app/app/templates/
new
/public/.
application
.html.swp
View file @
e324edd4
No preview for this file type
app/app/templates/new/public/.device.html.swp
deleted
100644 → 0
View file @
0d72f305
File deleted
app/app/templates/new/public/application.html
View file @
e324edd4
...
...
@@ -79,7 +79,7 @@
<h3
class=
"mb-0"
>
Devices
</h3>
</div>
<div
class=
"row icon-examples"
>
{% if devs %}
{% for d in devs %}
<div
class=
"col-lg-3 col-md-6"
>
<button
type=
"button"
class=
"btn-icon-clipboard"
data-clipboard-text=
"atom"
title=
"{{ d[0] }}"
>
...
...
@@ -90,6 +90,11 @@
</button>
</div>
{% endfor %}
{% else %}
<div
class=
"col-lg-12 col-md-12"
>
<center><p>
There are no registered devices yet.
</p></center>
</div>
{% endif %}
</div>
<div
class=
"row"
style=
"margin-top: 30px;"
>
...
...
app/app/templates/new/public/new-application.html
0 → 100644
View file @
e324edd4
{% extends 'logged_layout.html' %}
{% block title %} HPC
&
A IoT - New Application {% endblock %}
{% block location %}
<a
class=
"h4 mb-0 text-white text-uppercase d-none d-lg-inline-block"
href=
"./applications"
>
Applications
</a>
{% endblock %}
{% block body %}
<!-- Page content -->
<div
class=
"container-fluid mt--7"
>
<!-- Table -->
<div
class=
"row"
>
<div
class=
"col"
>
<div
class=
"card shadow"
>
<div
class=
"card-header bg-transparent"
>
<h3
class=
"mb-0"
>
Applications
</h3>
</div>
<div
class=
"card-body"
>
<form
action=
"new-application"
method=
"post"
>
<div
class=
"form-group"
>
<label>
Name:
</label><br>
<input
type=
"text"
maxlength=
"30"
class=
"form-control"
id=
"appname"
name=
"appname"
required
><br>
</div>
<div
class=
"form-group"
>
<label>
Description:
</label><br>
<textarea
id=
"appdesc"
maxlength=
"200"
class=
"form-control"
name=
"appdesc"
rows=
"5"
></textarea>
</div>
<br>
<div
class=
"custom-control custom-control-alternative custom-checkbox"
>
<input
class=
"custom-control-input"
id=
"secure"
type=
"checkbox"
name=
"secure"
>
<label
class=
"custom-control-label"
for=
"secure"
>
<span
class=
"text-muted"
>
Secure
</span>
</label>
</div>
<br>
<p>
Note, if you use secure option, make sure your device uses aes128 ctr with the corresponding key.
</p>
<br>
<div
class=
"form-group"
>
<button
type=
"submit"
class=
"btn btn-primary"
>
Create Application
</button>
</div>
</form>
</div>
</div>
</div>
</div>
{% endblock %}
app/app/views.py
View file @
e324edd4
...
...
@@ -157,6 +157,41 @@ def application(appkey):
return
redirect
(
url_for
(
'login'
,
users_signup
=
app
.
config
[
'USERS_SIGNUP'
]))
@
app
.
route
(
'/new-application'
,
methods
=
[
'GET'
,
'POST'
])
def
new_application
():
if
'name'
in
session
:
if
request
.
method
==
'GET'
:
return
render_template
(
'new/public/new-application.html'
)
elif
request
.
method
==
'POST'
:
if
request
.
form
[
'appname'
]
==
''
:
flash
(
'Application name cannot be empty.'
,
'danger'
)
return
render_template
(
request
.
url
)
else
:
appkey
=
misc
.
rand_str
(
app
.
config
[
'APPKEY_LENGTH'
]).
decode
(
'utf-8'
)
secure_key
=
misc
.
gen_skey_b64
(
16
)
secure
=
False
if
request
.
form
.
getlist
(
'secure'
)
and
request
.
form
.
getlist
(
'secure'
)[
0
]
==
'true'
:
secure
=
True
res
=
ad
.
create
(
request
.
form
[
'appname'
],
appkey
,
session
[
'name'
],
request
.
form
[
'appdesc'
],
secure
,
secure_key
)
if
not
res
[
0
]:
flash
(
'Error: {}'
.
format
(
res
[
1
]),
'danger'
)
return
render_template
(
request
.
url
)
res
=
dd
.
create_table
(
appkey
)
if
not
res
[
0
]:
ad
.
delete
(
appkey
)
flash
(
'Error: {}'
.
format
(
res
[
1
]),
'danger'
)
return
render_template
(
request
.
url
)
return
redirect
(
url_for
(
'applications'
))
else
:
return
redirect
(
url_for
(
'login'
,
users_signup
=
app
.
config
[
'USERS_SIGNUP'
]))
@
app
.
route
(
'/application/<appkey>/device/<devid>'
)
def
app_device
(
appkey
,
devid
):
if
'name'
in
session
:
...
...
@@ -183,7 +218,7 @@ def app_device(appkey, devid):
@
app
.
route
(
'/new-app'
)
def
new_app
lication
():
def
new_app
():
if
'name'
in
session
:
return
render_template
(
'old/public/new-app.html'
)
else
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment