Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
FlyingBird95 committed Mar 13, 2018
2 parents 6195126 + 2c5f76d commit 5b1eb2b
Show file tree
Hide file tree
Showing 84 changed files with 77 additions and 4,591 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Changed

- Updated functionality to retrieve the stacktrace of an Outlier

- Fixed bug with white colors from the config option

v1.10.0
----------
Expand Down
2 changes: 2 additions & 0 deletions TODO.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ Features to be implemented
- Page '/result/<endpoint>/time_per_version' - Max 10 versions per plot.
- Page '/result/<endpoint>/outliers' - Max 20 results per table.

[ ] Refactor all measurement-endpoints in a Blueprint

Work in progress
----------------
*Use this section if someone is already working on an item above.*
6 changes: 5 additions & 1 deletion flask_monitoringdashboard/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import os
from flask import Blueprint
from flask_monitoringdashboard.config import Config
from unittest import TestLoader

config = Config()
user_app = None
Expand All @@ -41,6 +40,11 @@ def bind(app, blue_print=None):
global user_app, blueprint
user_app = app

# Provide a secret-key for using WTF-forms
if not user_app.secret_key:
print('WARNING: You should provide a security key.')
user_app.secret_key = 'my-secret-key'

if blue_print:
import os
import datetime
Expand Down
3 changes: 2 additions & 1 deletion flask_monitoringdashboard/colors.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from colorhash import ColorHash
from flask_monitoringdashboard import config
import re


def get_color(hash):
Expand All @@ -10,7 +11,7 @@ def get_color(hash):
:return: a color (as string)
"""
if hash in config.colors:
rgb = config.colors[hash]
rgb = re.findall(r'\d+', config.colors[hash])
else:
rgb = ColorHash(hash).rgb
return 'rgb({0}, {1}, {2})'.format(rgb[0], rgb[1], rgb[2])
27 changes: 13 additions & 14 deletions flask_monitoringdashboard/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,26 @@
"""

from flask import Flask, redirect, url_for
import flask_monitoringdashboard as dashboard
import os

user_app = Flask(__name__)
here = os.path.abspath(os.path.dirname(__file__))
dashboard.config.init_from(file=here + '/config.cfg')

def create_app():
import flask_monitoringdashboard as dashboard

def get_session_id():
# implement here your own custom function
return '12345'
app = Flask(__name__)

def get_session_id():
# implement here your own custom function
return '12345'

dashboard.config.get_group_by = get_session_id
dashboard.bind(app=user_app)
dashboard.config.get_group_by = get_session_id
dashboard.bind(app=app)

@app.route('/')
def main():
return redirect(url_for('dashboard.index'))

@user_app.route('/')
def main():
return redirect(url_for('dashboard.index'))
return app


if __name__ == '__main__':
user_app.run(debug=True, host='0.0.0.0')
create_app().run(debug=True, host='0.0.0.0')
2 changes: 0 additions & 2 deletions flask_monitoringdashboard/outlier.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
import sys
import psutil

LOG_FILE = 'stacktrace.log'


class StackInfo(object):
def __init__(self, average):
Expand Down
6 changes: 1 addition & 5 deletions flask_monitoringdashboard/routings/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Main class for adding all route-functions to user_app.
Setup requires only to import this file. All other imports are done in this file
"""
from flask_monitoringdashboard import blueprint, loc, user_app
from flask_monitoringdashboard import blueprint, loc
from flask.helpers import send_from_directory
from flask import redirect, url_for

Expand All @@ -13,10 +13,6 @@
import flask_monitoringdashboard.routings.export_data
import flask_monitoringdashboard.routings.measurements

# Provide a secret-key for using WTF-forms
if user_app.secret_key is None:
user_app.secret_key = 'my-secret-key'


# Rule for serving static files
@blueprint.route('/static/<path:filename>')
Expand Down

0 comments on commit 5b1eb2b

Please sign in to comment.