Skip to content
This repository was archived by the owner on Jul 21, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ <h1>Athena Usage Dashboard</h1>
<div id="table-container">
<div class="row mt-3 table-header">
<div class="col-9 col-sm-6 col-md-4">Username</div>
<div class="col col-sm-3 col-md-3 d-none d-sm-block">Daily</div>
<div class="col-3 col-sm-3 col-md-2">Weekly</div>
<div class="col-md-3 d-none d-md-block">Monthly</div>
<div class="col col-sm-3 col-md-3 d-none d-sm-block">Last day</div>
<div class="col-3 col-sm-3 col-md-2">Last week</div>
<div class="col-md-3 d-none d-md-block">Last month</div>
</div>
{% for name, usages_timespan_dict in summary_specials_timespan_size + summary_user_timespan_size %}
<div id="table_data" class="row mt-3 table-data">
Expand Down
5 changes: 2 additions & 3 deletions dashboard/plugins/s3_usage/statsdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def get_usage_by_storage_class(self, path):
return {
sclass: {
'size': sizeof_fmt(data[0][sclass]),
'percent': data[0][sclass] / data[0]['size']
'percent': data[0][sclass] / data[0]['size'] if data[0]['size'] > 0 else 0
} for sclass in ['size_standard', 'size_ia', 'size_glacier']
}

Expand All @@ -30,7 +30,6 @@ def describe(self, node, strip=''):
def get_jstree_buckets(self, order):
total = self.db.query('', 0)[0]
buckets = self.db.query('', 1, order, children_only=True)

return {
"text" : "All buckets " + self.describe(total), "state": {"opened": True}, "id": "root",
"children" : [{ "id": bucket['path'], "text" : self.describe(bucket, '/'), "children" : True }
Expand Down Expand Up @@ -103,7 +102,7 @@ def query(self, base, depth=None, order="size_desc", children_only=False):
try:
cursor = sqlite.cursor()
cursor.execute(query)
return cursor.fetchall()
return cursor.fetchall()
finally:
cursor.close()
sqlite.close()
2 changes: 0 additions & 2 deletions dashboard/templates/layouts/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
<body class="app header-fixed sidebar-hidden aside-menu-fixed">
<header class="app-header navbar">
<a class="navbar-brand" href="/">
<img class="navbar-brand-full" src="https://image.flaticon.com/icons/png/128/439/439186.png" width="30" height="30"
alt="CoreUI Logo">
<img class="navbar-brand-minimized" src="https://image.flaticon.com/icons/png/128/439/439186.png" width="30"
height="30" alt="CoreUI Logo">
&nbsp; {{ config['COMPANY_NAME'] }} Data
Expand Down
4 changes: 4 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
cryptography==3.1.1
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you want to commit any changes in this file? It seems that you don't use those dependencies.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I try to run it locally one lib throws an error about missing Rust compiler and that cryptography cannot be built (like here: https://stackoverflow.com/questions/59441794/error-could-not-build-wheels-for-cryptography-which-use-pep-517-and-cannot-be-i)

werkzeug==0.16.*
Flask==1.0.*
Flask-SSLify
Expand All @@ -10,3 +11,6 @@ mysqlclient==1.3.12
backoff
requests==2.20.0
boto3==1.9.67
slackclient
flask-wtf
pymysql