From 61a033edfff33c0bccf119bc27843dfd748c8f83 Mon Sep 17 00:00:00 2001 From: Bibhas Date: Mon, 23 Apr 2018 10:12:34 +0530 Subject: [PATCH 1/3] added flask admindashboard app --- .gitignore | 2 ++ admindash-config-sample.cfg | 4 ++++ hasjob/__init__.py | 3 +++ requirements.txt | 1 + 4 files changed, 10 insertions(+) create mode 100644 admindash-config-sample.cfg diff --git a/.gitignore b/.gitignore index d5f9a9a37..fef9e2f34 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,5 @@ hasjob/static/gen *.gz *.bz2 hasjob/assets/node_modules +admindash-config.cfg +flask_monitoringdashboard.db diff --git a/admindash-config-sample.cfg b/admindash-config-sample.cfg new file mode 100644 index 000000000..bddd4c93d --- /dev/null +++ b/admindash-config-sample.cfg @@ -0,0 +1,4 @@ +[dashboard] +USERNAME=username +PASSWORD=password +CUSTOM_LINK=monitor diff --git a/hasjob/__init__.py b/hasjob/__init__.py index 93ead0be9..79de0849d 100644 --- a/hasjob/__init__.py +++ b/hasjob/__init__.py @@ -8,6 +8,7 @@ from flask_rq import RQ from flask_mail import Mail from flask_redis import FlaskRedis +import flask_monitoringdashboard as dashboard from flask_lastuser import Lastuser from flask_lastuser.sqlalchemy import UserManager from baseframe import baseframe, assets, Version @@ -59,3 +60,5 @@ redis_store.init_app(app) lastuser.init_app(app) lastuser.init_usermanager(UserManager(db, models.User)) +dashboard.config.init_from(file='admindash-config.cfg') +dashboard.bind(app) diff --git a/requirements.txt b/requirements.txt index f19437954..7dbf8c975 100644 --- a/requirements.txt +++ b/requirements.txt @@ -31,3 +31,4 @@ git+https://github.com/hasgeek/flask-lastuser git+https://github.com/hasgeek/baseframe Flask-Migrate progressbar2 +flask_monitoringdashboard From 42049a98a0ff242d5ee250efa9302fe144075fab Mon Sep 17 00:00:00 2001 From: Bibhas Date: Mon, 23 Apr 2018 11:08:53 +0530 Subject: [PATCH 2/3] added monitoring group by user id --- hasjob/__init__.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/hasjob/__init__.py b/hasjob/__init__.py index 79de0849d..7b0102989 100644 --- a/hasjob/__init__.py +++ b/hasjob/__init__.py @@ -60,5 +60,16 @@ redis_store.init_app(app) lastuser.init_app(app) lastuser.init_usermanager(UserManager(db, models.User)) + + +def get_user_id(): + from coaster.auth import current_auth + if current_auth.user is not None: + return current_auth.user.username + else: + return 'anon' + + +dashboard.config.get_group_by = get_user_id dashboard.config.init_from(file='admindash-config.cfg') dashboard.bind(app) From 0f9fc83dba698c1e924f8edb5d9cfddf7aed5838 Mon Sep 17 00:00:00 2001 From: Bibhas Date: Mon, 23 Apr 2018 11:53:31 +0530 Subject: [PATCH 3/3] added GIT to admindash config --- admindash-config-sample.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/admindash-config-sample.cfg b/admindash-config-sample.cfg index bddd4c93d..3fc60d6c3 100644 --- a/admindash-config-sample.cfg +++ b/admindash-config-sample.cfg @@ -2,3 +2,4 @@ USERNAME=username PASSWORD=password CUSTOM_LINK=monitor +GIT=./.git/