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
2271353e
Commit
2271353e
authored
May 21, 2020
by
Vladislav Rykov
Browse files
dashboard badges integrated
parent
02fd123a
Changes
12
Show whitespace changes
Inline
Side-by-side
app/app/__pycache__/views.cpython-37.pyc
View file @
2271353e
No preview for this file type
app/app/dao/device/__pycache__/device.cpython-37.pyc
View file @
2271353e
No preview for this file type
app/app/dao/device/device.py
View file @
2271353e
from
psycopg2
import
sql
from
app.helpers.misc
import
with_psql
import
app.dao.application.application
as
ad
@
with_psql
def
create_datatable
(
cur
,
appkey
,
dev_id
):
...
...
@@ -119,25 +120,30 @@ def get_count(cur, appkey):
return
(
True
,
cur
.
fetchone
())
@
with_psql
def
get_
device_table_names
(
cur
):
def
get_
count_all
(
cur
):
query
=
"""
SELECT
table_name
FROM
SELECT
COUNT(*)
FROM
information_schema.tables
WHERE
table_name ~ '^dev
ices
'
table_name ~ '^dev
_
'
"""
cur
.
execute
(
query
,
())
return
(
True
,
cur
.
fetch
all
())
return
(
True
,
cur
.
fetch
one
())
def
get_count_all
():
@
with_psql
def
get_count_by_user
(
cur
,
username
):
apps
=
ad
.
get_list
(
username
)[
1
]
count
=
0
tns
=
get_device_table_names
()
if
tns
[
0
]
and
len
(
tns
[
1
])
>
0
:
for
tn
in
tns
[
1
]:
sp
=
tn
[
0
].
split
(
'_'
)
r
=
get_count
(
sp
[
1
])
if
r
[
0
]:
count
+=
r
[
1
][
0
]
for
a
in
apps
:
query
=
"""
SELECT COUNT(*) FROM
information_schema.tables
WHERE
table_name ~ '^dev_{}'
"""
.
format
(
a
[
1
])
cur
.
execute
(
query
,
())
count
+=
cur
.
fetchone
()[
0
]
return
count
app/app/
templates/old/public/.signup.html
.swp
→
app/app/
dao/misc/.misc.py
.swp
View file @
2271353e
No preview for this file type
app/app/dao/misc/__pycache__/__init__.cpython-37.pyc
0 → 100644
View file @
2271353e
File added
app/app/dao/misc/__pycache__/misc.cpython-37.pyc
0 → 100644
View file @
2271353e
File added
app/app/dao/misc/misc.py
View file @
2271353e
from
psycopg2
import
sql
from
app.helpers.misc
import
with_psql
from
app.helpers.misc
import
with_psql
,
utc_roundhour
,
utc_roundday
import
app.dao.application.application
as
ad
import
app.dao.device.device
as
dd
# appkeys is a list of tuples [(app1), (app2), ..., (appn)]
# devids is a list of lists of tuples [[(dev1),...],[(dev1),...]]
@
with_psql
def
get_user_data_count
(
cur
,
apps
,
devs
):
def
get_user_data_count
(
cur
,
username
):
apps
=
ad
.
get_list
(
username
)[
1
]
devs
=
[]
for
a
in
apps
:
devs
.
append
(
dd
.
get_list
(
a
[
1
])[
1
])
query
=
'WITH t AS ('
i
=
0
for
a
in
apps
:
for
d
in
devs
[
i
]:
query
+=
"""
SELECT COUNT(*) FROM dev_{}_{} UNION ALL
"""
.
format
(
a
[
1
],
d
[
1
])
query
+=
'SELECT COUNT(*) FROM dev_{}_{} UNION ALL '
.
format
(
a
[
1
],
d
[
1
])
i
+=
1
query
=
query
[
0
:
-
9
]
query
+=
') SELECT SUM(count) FROM t'
print
(
query
)
cur
.
execute
(
query
,
())
return
(
True
,
cur
.
fetchone
())
@
with_psql
def
get_user_data_count_per_hour
(
cur
,
apps
,
devs
,
utc_hour
):
def
get_user_data_count_per_hour
(
cur
,
username
,
hour
):
apps
=
ad
.
get_list
(
username
)[
1
]
devs
=
[]
for
a
in
apps
:
devs
.
append
(
dd
.
get_list
(
a
[
1
])[
1
])
utc_hour
=
utc_roundhour
(
hour
)
query
=
'WITH t AS ('
i
=
0
for
a
in
apps
:
for
d
in
devs
[
i
]:
query
+=
"""
SELECT COUNT(*) FROM dev_{}_{} UNION ALL
"""
.
format
(
a
[
1
],
d
[
1
])
query
+=
'SELECT COUNT(*) FROM dev_{}_{} UNION ALL '
.
format
(
a
[
1
],
d
[
1
])
i
+=
1
query
=
query
[
0
:
-
10
]
query
+=
') SELECT SUM(count) FROM t WHERE utc > {} AND utc < {}'
.
format
(
utc_hour
,
utc_hour
+
60
*
60
)
print
(
query
)
#
print(query)
cur
.
execute
(
query
,
())
return
(
True
,
cur
.
fetchone
())
@
with_psql
def
get_user_data_count_per_day
(
cur
,
apps
,
devs
,
utc_day
):
def
get_user_data_count_per_day
(
cur
,
username
,
day
=
0
):
apps
=
ad
.
get_list
(
username
)[
1
]
devs
=
[]
for
a
in
apps
:
devs
.
append
(
dd
.
get_list
(
a
[
1
])[
1
])
utc_day
=
utc_roundday
(
day
)
query
=
'WITH t AS ('
i
=
0
for
a
in
apps
:
for
d
in
devs
[
i
]:
query
+=
"""
SELECT COUNT(*) FROM dev_{}_{} UNION ALL
"""
.
format
(
a
[
1
],
d
[
1
])
query
+=
'SELECT utc FROM dev_{}_{} UNION ALL '
.
format
(
a
[
1
],
d
[
1
])
i
+=
1
query
+=
') SELECT SUM(count) FROM t WHERE utc > {} AND utc < {}'
.
format
(
utc_day
,
utc_day
+
24
*
60
*
60
)
query
=
query
[
0
:
-
10
]
query
+=
') SELECT COUNT(*) FROM t WHERE utc > {} AND utc < {}'
.
format
(
utc_day
,
utc_day
+
24
*
60
*
60
)
print
(
query
)
cur
.
execute
(
query
,
())
...
...
@@ -70,8 +89,7 @@ def get_recent_activity(cur, apps, devs, n):
(SELECT '{}' as appname) AS appname,
(SELECT {} as devname) AS devname)
UNION ALL
"""
.
format
(
a
[
1
],
d
[
1
],
a
[
0
],
d
[
0
])
"""
.
format
(
a
[
1
],
d
[
1
],
a
[
0
],
d
[
0
])
i
+=
1
query
=
query
[
0
:
-
9
]
query
+=
'ORDER BY utc DESC LIMIT 5'
...
...
app/app/templates/general_layout.html
View file @
2271353e
...
...
@@ -70,6 +70,8 @@
<script
src=
"{{ url_for('static', filename='assets/js/plugins/jquery/dist/jquery.min.js') }}"
></script>
<script
src=
"{{ url_for('static', filename='assets/js/plugins/bootstrap/dist/js/bootstrap.bundle.min.js') }}"
></script>
<!-- Optional JS -->
<script
src=
"{{ url_for('static', filename='assets/js/plugins/chart.js/dist/Chart.min.js') }}"
></script>
<script
src=
"{{ url_for('static', filename='assets/js/plugins/chart.js/dist/Chart.extension.js') }}"
></script>
<!-- Argon JS -->
<script
src=
"{{ url_for('static', filename='assets/js/argon-dashboard.min.js') }}?v=1.1.2"
></script>
{% block script %} {% endblock %}
...
...
app/app/templates/logged_layout.html
0 → 100644
View file @
2271353e
{% extends 'general_layout.html' %}
{% block content %}
<body
class=
""
>
<nav
class=
"navbar navbar-vertical fixed-left navbar-expand-md navbar-light bg-white"
id=
"sidenav-main"
>
<div
class=
"container-fluid"
>
<!-- Toggler -->
<button
class=
"navbar-toggler"
type=
"button"
data-toggle=
"collapse"
data-target=
"#sidenav-collapse-main"
aria-controls=
"sidenav-main"
aria-expanded=
"false"
aria-label=
"Toggle navigation"
>
<span
class=
"navbar-toggler-icon"
></span>
</button>
<!-- Brand -->
<a
class=
"navbar-brand pt-0"
href=
"../"
>
<img
src=
"{{ url_for('static', filename='assets/img/brand/blue.png') }}"
class=
"navbar-brand-img"
alt=
"..."
>
</a>
<!-- User -->
<ul
class=
"nav align-items-center d-md-none"
>
<li
class=
"nav-item dropdown"
>
<a
class=
"nav-link nav-link-icon"
href=
"#"
role=
"button"
data-toggle=
"dropdown"
aria-haspopup=
"true"
aria-expanded=
"false"
>
<i
class=
"ni ni-bell-55"
></i>
</a>
<div
class=
"dropdown-menu dropdown-menu-arrow dropdown-menu-right"
aria-labelledby=
"navbar-default_dropdown_1"
>
<a
class=
"dropdown-item"
href=
"#"
>
Action
</a>
<a
class=
"dropdown-item"
href=
"#"
>
Another action
</a>
<div
class=
"dropdown-divider"
></div>
<a
class=
"dropdown-item"
href=
"#"
>
Something else here
</a>
</div>
</li>
<li
class=
"nav-item dropdown"
>
<a
class=
"nav-link"
href=
"#"
role=
"button"
data-toggle=
"dropdown"
aria-haspopup=
"true"
aria-expanded=
"false"
>
<div
class=
"media align-items-center"
>
<span
class=
"avatar avatar-sm rounded-circle"
>
<img
alt=
"Image placeholder"
src=
"{{ url_for('static', filename='assets/img/theme/team-1-800x800.jpg') }}"
>
</span>
</div>
</a>
<div
class=
"dropdown-menu dropdown-menu-arrow dropdown-menu-right"
>
<div
class=
" dropdown-header noti-title"
>
<h6
class=
"text-overflow m-0"
>
Welcome!
</h6>
</div>
<a
href=
"./examples/profile.html"
class=
"dropdown-item"
>
<i
class=
"ni ni-single-02"
></i>
<span>
My profile
</span>
</a>
<a
href=
"./examples/profile.html"
class=
"dropdown-item"
>
<i
class=
"ni ni-settings-gear-65"
></i>
<span>
Settings
</span>
</a>
<a
href=
"./examples/profile.html"
class=
"dropdown-item"
>
<i
class=
"ni ni-calendar-grid-58"
></i>
<span>
Activity
</span>
</a>
<a
href=
"./examples/profile.html"
class=
"dropdown-item"
>
<i
class=
"ni ni-support-16"
></i>
<span>
Support
</span>
</a>
<div
class=
"dropdown-divider"
></div>
<a
href=
"#!"
class=
"dropdown-item"
>
<i
class=
"ni ni-user-run"
></i>
<span>
Logout
</span>
</a>
</div>
</li>
</ul>
<!-- Collapse -->
<div
class=
"collapse navbar-collapse"
id=
"sidenav-collapse-main"
>
<!-- Collapse header -->
<div
class=
"navbar-collapse-header d-md-none"
>
<div
class=
"row"
>
<div
class=
"col-6 collapse-brand"
>
<a
href=
"./"
>
<img
src=
"{{ url_for('static', filename='assets/img/brand/blue.png') }}"
>
</a>
</div>
<div
class=
"col-6 collapse-close"
>
<button
type=
"button"
class=
"navbar-toggler"
data-toggle=
"collapse"
data-target=
"#sidenav-collapse-main"
aria-controls=
"sidenav-main"
aria-expanded=
"false"
aria-label=
"Toggle sidenav"
>
<span></span>
<span></span>
</button>
</div>
</div>
</div>
<!-- Navigation -->
<ul
class=
"navbar-nav"
>
<li
class=
"nav-item active "
>
<a
class=
"nav-link active "
href=
"./index.html"
>
<i
class=
"ni ni-tv-2 text-primary"
></i>
Dashboard
</a>
</li>
<li
class=
"nav-item"
>
<a
class=
"nav-link "
href=
"./examples/applications.html"
>
<i
class=
"ni ni-air-baloon text-yellow"
></i>
Applications
</a>
</li>
<li
class=
"nav-item"
>
<a
class=
"nav-link "
href=
"./examples/icons.html"
>
<i
class=
"ni ni-briefcase-24 text-pink"
></i>
Administration
</a>
</li>
<li
class=
"nav-item"
>
<a
class=
"nav-link "
href=
"./examples/icons.html"
>
<i
class=
"ni ni-single-02 text-info"
></i>
Users
</a>
</li>
<li
class=
"nav-item"
>
<a
class=
"nav-link "
href=
"./examples/icons.html"
>
<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"
>
<!-- Heading -->
<h6
class=
"navbar-heading text-muted"
>
Documentation
</h6>
<!-- 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"
>
<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>
</nav>
<div
class=
"main-content"
>
<!-- Navbar -->
<nav
class=
"navbar navbar-top navbar-expand-md navbar-dark"
id=
"navbar-main"
>
<div
class=
"container-fluid"
>
<!-- Brand -->
<a
class=
"h4 mb-0 text-white text-uppercase d-none d-lg-inline-block"
href=
"./index.html"
>
Dashboard
</a>
<!-- User -->
<ul
class=
"navbar-nav align-items-center d-none d-md-flex"
>
<li
class=
"nav-item dropdown"
>
<a
class=
"nav-link pr-0"
href=
"#"
role=
"button"
data-toggle=
"dropdown"
aria-haspopup=
"true"
aria-expanded=
"false"
>
<div
class=
"media align-items-center"
>
<span
class=
"avatar avatar-sm rounded-circle"
>
<img
alt=
"Image placeholder"
src=
"{{ url_for('static', filename='assets/img/theme/team-4-800x800.jpg') }}"
>
</span>
<div
class=
"media-body ml-2 d-none d-lg-block"
>
<span
class=
"mb-0 text-sm font-weight-bold"
>
Jessica Jones
</span>
</div>
</div>
</a>
<div
class=
"dropdown-menu dropdown-menu-arrow dropdown-menu-right"
>
<div
class=
" dropdown-header noti-title"
>
<h6
class=
"text-overflow m-0"
>
Welcome!
</h6>
</div>
<a
href=
"./examples/profile.html"
class=
"dropdown-item"
>
<i
class=
"ni ni-single-02"
></i>
<span>
My profile
</span>
</a>
<a
href=
"./examples/profile.html"
class=
"dropdown-item"
>
<i
class=
"ni ni-settings-gear-65"
></i>
<span>
Settings
</span>
</a>
<a
href=
"./examples/profile.html"
class=
"dropdown-item"
>
<i
class=
"ni ni-calendar-grid-58"
></i>
<span>
Activity
</span>
</a>
<a
href=
"./examples/profile.html"
class=
"dropdown-item"
>
<i
class=
"ni ni-support-16"
></i>
<span>
Support
</span>
</a>
<div
class=
"dropdown-divider"
></div>
<a
href=
"#!"
class=
"dropdown-item"
>
<i
class=
"ni ni-user-run"
></i>
<span>
Logout
</span>
</a>
</div>
</li>
</ul>
</div>
</nav>
<!-- End Navbar -->
{% block body %} {% endblock %}
</div>
</body>
{% endblock %}
app/app/templates/new/public/.dashboard.html.swp
0 → 100644
View file @
2271353e
File added
app/app/templates/new/public/
index
.html
→
app/app/templates/new/public/
dashboard
.html
View file @
2271353e
<!--
{% extends 'logged_layout.html' %}
=========================================================
* Argon Dashboard - v1.1.2
=========================================================
{% block title %} HPC
&
A IoT - Dashboard {% endblock %}
* Product Page: https://www.creative-tim.com/product/argon-dashboard
* Copyright 2020 Creative Tim (https://www.creative-tim.com)
* Licensed under MIT (https://github.com/creativetimofficial/argon-dashboard/blob/master/LICENSE.md)
* Coded by Creative Tim
=========================================================
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -->
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"utf-8"
/>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1, shrink-to-fit=no"
>
<title>
HPC
&
A IoT
</title>
<!-- Favicon -->
<link
href=
"./assets/img/brand/favicon.png"
rel=
"icon"
type=
"image/png"
>
<!-- Fonts -->
<link
href=
"https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700"
rel=
"stylesheet"
>
<!-- Icons -->
<link
href=
"./assets/js/plugins/nucleo/css/nucleo.css"
rel=
"stylesheet"
/>
<link
href=
"./assets/js/plugins/@fortawesome/fontawesome-free/css/all.min.css"
rel=
"stylesheet"
/>
<!-- CSS Files -->
<link
href=
"./assets/css/argon-dashboard.css?v=1.1.2"
rel=
"stylesheet"
/>
</head>
<body
class=
""
>
<nav
class=
"navbar navbar-vertical fixed-left navbar-expand-md navbar-light bg-white"
id=
"sidenav-main"
>
<div
class=
"container-fluid"
>
<!-- Toggler -->
<button
class=
"navbar-toggler"
type=
"button"
data-toggle=
"collapse"
data-target=
"#sidenav-collapse-main"
aria-controls=
"sidenav-main"
aria-expanded=
"false"
aria-label=
"Toggle navigation"
>
<span
class=
"navbar-toggler-icon"
></span>
</button>
<!-- Brand -->
<a
class=
"navbar-brand pt-0"
href=
"./index.html"
>
<img
src=
"./assets/img/brand/blue.png"
class=
"navbar-brand-img"
alt=
"..."
>
</a>
<!-- User -->
<ul
class=
"nav align-items-center d-md-none"
>
<li
class=
"nav-item dropdown"
>
<a
class=
"nav-link nav-link-icon"
href=
"#"
role=
"button"
data-toggle=
"dropdown"
aria-haspopup=
"true"
aria-expanded=
"false"
>
<i
class=
"ni ni-bell-55"
></i>
</a>
<div
class=
"dropdown-menu dropdown-menu-arrow dropdown-menu-right"
aria-labelledby=
"navbar-default_dropdown_1"
>
<a
class=
"dropdown-item"
href=
"#"
>
Action
</a>
<a
class=
"dropdown-item"
href=
"#"
>
Another action
</a>
<div
class=
"dropdown-divider"
></div>
<a
class=
"dropdown-item"
href=
"#"
>
Something else here
</a>
</div>
</li>
<li
class=
"nav-item dropdown"
>
<a
class=
"nav-link"
href=
"#"
role=
"button"
data-toggle=
"dropdown"
aria-haspopup=
"true"
aria-expanded=
"false"
>
<div
class=
"media align-items-center"
>
<span
class=
"avatar avatar-sm rounded-circle"
>
<img
alt=
"Image placeholder"
src=
"./assets/img/theme/team-1-800x800.jpg
"
>
</span>
</div>
</a>
<div
class=
"dropdown-menu dropdown-menu-arrow dropdown-menu-right"
>
<div
class=
" dropdown-header noti-title"
>
<h6
class=
"text-overflow m-0"
>
Welcome!
</h6>
</div>
<a
href=
"./examples/profile.html"
class=
"dropdown-item"
>
<i
class=
"ni ni-single-02"
></i>
<span>
My profile
</span>
</a>
<a
href=
"./examples/profile.html"
class=
"dropdown-item"
>
<i
class=
"ni ni-settings-gear-65"
></i>
<span>
Settings
</span>
</a>
<a
href=
"./examples/profile.html"
class=
"dropdown-item"
>
<i
class=
"ni ni-calendar-grid-58"
></i>
<span>
Activity
</span>
</a>
<a
href=
"./examples/profile.html"
class=
"dropdown-item"
>
<i
class=
"ni ni-support-16"
></i>
<span>
Support
</span>
</a>
<div
class=
"dropdown-divider"
></div>
<a
href=
"#!"
class=
"dropdown-item"
>
<i
class=
"ni ni-user-run"
></i>
<span>
Logout
</span>
</a>
</div>
</li>
</ul>
<!-- Collapse -->
<div
class=
"collapse navbar-collapse"
id=
"sidenav-collapse-main"
>
<!-- Collapse header -->
<div
class=
"navbar-collapse-header d-md-none"
>
<div
class=
"row"
>
<div
class=
"col-6 collapse-brand"
>
<a
href=
"./index.html"
>
<img
src=
"./assets/img/brand/blue.png"
>
</a>
</div>
<div
class=
"col-6 collapse-close"
>
<button
type=
"button"
class=
"navbar-toggler"
data-toggle=
"collapse"
data-target=
"#sidenav-collapse-main"
aria-controls=
"sidenav-main"
aria-expanded=
"false"
aria-label=
"Toggle sidenav"
>
<span></span>
<span></span>
</button>
</div>
</div>
</div>
<!-- Navigation -->
<ul
class=
"navbar-nav"
>
<li
class=
"nav-item active "
>
<a
class=
"nav-link active "
href=
"./index.html"
>
<i
class=
"ni ni-tv-2 text-primary"
></i>
Dashboard
</a>
</li>
<li
class=
"nav-item"
>
<a
class=
"nav-link "
href=
"./examples/applications.html"
>
<i
class=
"ni ni-air-baloon text-yellow"
></i>
Applications
</a>
</li>
<li
class=
"nav-item"
>
<a
class=
"nav-link "
href=
"./examples/icons.html"
>
<i
class=
"ni ni-briefcase-24 text-pink"
></i>
Administration
</a>
</li>
<li
class=
"nav-item"
>
<a
class=
"nav-link "
href=
"./examples/icons.html"
>
<i
class=
"ni ni-single-02 text-info"
></i>
Users
</a>
</li>
<li
class=
"nav-item"
>
<a
class=
"nav-link "
href=
"./examples/icons.html"
>
<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"
>
<!-- Heading -->
<h6
class=
"navbar-heading text-muted"
>
Documentation
</h6>
<!-- 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"
>
<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>
</nav>
<div
class=
"main-content"
>
<!-- Navbar -->
<nav
class=
"navbar navbar-top navbar-expand-md navbar-dark"
id=
"navbar-main"
>
<div
class=
"container-fluid"
>
<!-- Brand -->
<a
class=
"h4 mb-0 text-white text-uppercase d-none d-lg-inline-block"
href=
"./index.html"
>
Dashboard
</a>
<!-- User -->
<ul
class=
"navbar-nav align-items-center d-none d-md-flex"
>
<li
class=
"nav-item dropdown"
>
<a
class=
"nav-link pr-0"
href=
"#"
role=
"button"
data-toggle=
"dropdown"
aria-haspopup=
"true"
aria-expanded=
"false"
>
<div
class=
"media align-items-center"
>
<span
class=
"avatar avatar-sm rounded-circle"
>
<img
alt=
"Image placeholder"
src=
"./assets/img/theme/team-4-800x800.jpg"
>
</span>
<div
class=
"media-body ml-2 d-none d-lg-block"
>
<span
class=
"mb-0 text-sm font-weight-bold"
>
Jessica Jones
</span>
</div>
</div>
</a>
<div
class=
"dropdown-menu dropdown-menu-arrow dropdown-menu-right"
>
<div
class=
" dropdown-header noti-title"
>
<h6
class=
"text-overflow m-0"
>
Welcome!
</h6>
</div>
<a
href=
"./examples/profile.html"
class=
"dropdown-item"
>
<i
class=
"ni ni-single-02"
></i>
<span>
My profile
</span>
</a>
<a
href=
"./examples/profile.html"
class=
"dropdown-item"
>
<i
class=
"ni ni-settings-gear-65"
></i>
<span>
Settings
</span>
</a>
<a
href=
"./examples/profile.html"
class=
"dropdown-item"
>
<i
class=
"ni ni-calendar-grid-58"
></i>
<span>
Activity
</span>
</a>
<a
href=
"./examples/profile.html"
class=
"dropdown-item"
>
<i
class=
"ni ni-support-16"
></i>
<span>
Support
</span>
</a>
<div
class=
"dropdown-divider"
></div>
<a
href=
"#!"
class=
"dropdown-item"
>
<i
class=
"ni ni-user-run"
></i>
<span>
Logout
</span>
</a>
</div>
</li>
</ul>
</div>
</nav>
<!-- End Navbar -->
{% block body %}
<!-- Header -->
<div
class=
"header bg-gradient-primary pb-8 pt-5 pt-md-8"
>
<div
class=
"container-fluid"
>
...
...
@@ -257,7 +15,7 @@
<div
class=
"row"
>
<div
class=
"col"
>
<h5
class=
"card-title text-uppercase text-muted mb-0"
>
Created Apps
</h5>
<span
class=
"h2 font-weight-bold mb-0"
>
3
</span>
<span
class=
"h2 font-weight-bold mb-0"
>
{{ info[0] }}
</span>
</div>
<div
class=
"col-auto"
>
<div
class=
"icon icon-shape bg-danger text-white rounded-circle shadow"
>
...
...
@@ -274,7 +32,7 @@
<div
class=
"row"
>
<div
class=
"col"
>
<h5
class=
"card-title text-uppercase text-muted mb-0"
>
Active Devices
</h5>
<span
class=
"h2 font-weight-bold mb-0"
>
10
</span>
<span
class=
"h2 font-weight-bold mb-0"
>
{{ info[1] }}
</span>
</div>
<div
class=
"col-auto"
>
<div
class=
"icon icon-shape bg-warning text-white rounded-circle shadow"
>
...
...
@@ -291,7 +49,7 @@
<div
class=
"row"
>
<div
class=
"col"
>
<h5
class=
"card-title text-uppercase text-muted mb-0"
>
Total Activity
</h5>
<span
class=
"h2 font-weight-bold mb-0"
>
924
</span>
<span
class=
"h2 font-weight-bold mb-0"
>
{{ info[2] }}
</span>
</div>
<div
class=
"col-auto"
>
<div
class=
"icon icon-shape bg-yellow text-white rounded-circle shadow"
>
...
...
@@ -308,7 +66,7 @@
<div
class=
"row"
>
<div
class=
"col"
>
<h5
class=
"card-title text-uppercase text-muted mb-0"
>
Last 24 Hours Activity
</h5>
<span
class=
"h2 font-weight-bold mb-0"
>
46
</span>
<span
class=
"h2 font-weight-bold mb-0"
>
{{ info[3] }}
</span>
</div>
<div
class=
"col-auto"
>
<div
class=
"icon icon-shape bg-info text-white rounded-circle shadow"
>
...
...
@@ -470,38 +228,10 @@
</div>
</div>
</div>
<!-- Footer -->
<footer
class=
"footer"
>
<div
class=
"row align-items-center"
>
<div
class=
"col-xl-6"
>
<div
class=
"copyright text-center text-xl-left text-muted"
>
©
2020
<a
href=
"https://www.creative-tim.com"
class=
"font-weight-bold ml-1"
target=
"_blank"
>
HPC
&
A
</a>
</div>
</div>
<div
class=
"col-xl-6"
>
<ul
class=
"nav nav-footer justify-content-center"
>
<li
class=
"nav-item"
>
<a
href=
"https://www.creative-tim.com/presentation"
class=
"nav-link"
target=
"_blank"
>
About Us
</a>
</li>
<li
class=
"nav-item"
>
<a
href=
"https://github.com/creativetimofficial/argon-dashboard/blob/master/LICENSE.md"
class=
"nav-link"
target=
"_blank"
>
MIT License
</a>
</li>
</ul>
</div>
</div>
</footer>
</div>
</div>
<!-- Core -->
<script
src=
"./assets/js/plugins/jquery/dist/jquery.min.js"
></script>
<script
src=
"./assets/js/plugins/bootstrap/dist/js/bootstrap.bundle.min.js"
></script>
<!-- Optional JS -->
<script
src=
"./assets/js/plugins/chart.js/dist/Chart.min.js"
></script>
<script
src=
"./assets/js/plugins/chart.js/dist/Chart.extension.js"
></script>
<!-- Argon JS -->
<script
src=
"./assets/js/argon-dashboard.min.js?v=1.1.2"
></script>
<script
src=
"https://cdn.trackjs.com/agent/v3/latest/t.js"
></script>
{% endblock %}
{% block script %}
<script
type=
"text/javascript"
>
OrdersChart
=
function
()
{
...
...
@@ -609,14 +339,4 @@
}),
e
.
data
(
"
chart
"
,
a
))
}()
</script>
<script>
window
.
TrackJS
&&
TrackJS
.
install
({
token
:
"
ee6fab19c5a04ac1a32a645abde4613a
"
,
application
:
"
argon-dashboard-free
"
});
</script>
</body>
</html>
{% endblock %}
app/app/views.py
View file @
2271353e
...
...
@@ -12,6 +12,7 @@ import app.dao.data.data as data
import
app.dao.notification.notification
as
nfs
import
app.dao.trigger.trigger
as
tr
import
app.dao.notification_queue.notification_queue
as
nq
import
app.dao.misc.misc
as
md
import
app.helpers.misc
as
misc
import
app.helpers.mailer
as
mailer
...
...
@@ -28,13 +29,26 @@ MAX_PG_ENTRIES_GRAPH_HOURS = 24
@
app
.
route
(
'/'
)
def
index
():
if
'name'
in
session
and
len
(
session
[
'name'
])
>
0
:
apps
=
ad
.
get_list
(
session
[
'name'
])
session
.
pop
(
'appkey'
,
None
)
if
apps
[
0
]:
return
render_template
(
'old/public/index.html'
,
apps
=
apps
[
1
],
users_signup
=
app
.
config
[
'USERS_SIGNUP'
])
else
:
return
render_template
(
'old/public/index.html'
,
feedback
=
apps
[
1
],
users_signup
=
app
.
config
[
'USERS_SIGNUP'
])
created_apps
=
ad
.
get_count_by_user
(
session
[
'name'
])[
1
][
0
]
active_devices
=
dd
.
get_count_by_user
(
session
[
'name'
])
total_activity
=
md
.
get_user_data_count
(
session
[
'name'
])[
1
][
0
]
last_activity
=
md
.
get_user_data_count_per_day
(
session
[
'name'
])[
1
][
0
]
print
(
'created_apps'
,
created_apps
)
print
(
'active_devices'
,
active_devices
)
print
(
'total_activity'
,
total_activity
)
print
(
'last_activity'
,
last_activity
)
info
=
[
created_apps
,
active_devices
,
total_activity
,
last_activity
]
return
render_template
(
'new/public/dashboard.html'
,
info
=
info
)
#apps = ad.get_list(session['name'])
#session.pop('appkey', None)
#if apps[0]:
# return render_template('old/public/index.html', apps=apps[1], users_signup=app.config['USERS_SIGNUP'])
#else:
# return render_template('old/public/index.html', feedback=apps[1], users_signup=app.config['USERS_SIGNUP'])
else
:
return
render_template
(
'new/public/login.html'
,
users_signup
=
app
.
config
[
'USERS_SIGNUP'
])
...
...
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