From c25fcd5de583d79cb135b3ec506b8eb31cba91ca Mon Sep 17 00:00:00 2001 From: "Steve L. Nyemba -- The Architect" Date: Sun, 18 Nov 2018 19:24:19 -0600 Subject: [PATCH] Updates with logout and data management --- src/api/index.py | 42 ++++++------- src/api/templates/account/data.html | 98 +++++++++++++++++++++++++++++ 2 files changed, 116 insertions(+), 24 deletions(-) create mode 100644 src/api/templates/account/data.html diff --git a/src/api/index.py b/src/api/index.py index 748b03c..64ee68d 100755 --- a/src/api/index.py +++ b/src/api/index.py @@ -63,30 +63,11 @@ factory = DataSourceFactory() @app.route('/') def home(): - """ - This is the initial function (entry point), This function will load a dashboard - @param key customer's key - """ - context = PARAMS['context'] - if 'title' in PARAMS : - title = PARAMS['title'] - else: - title = 'Dashboard' - apps = [] - try: - # - # The user must pass a key in heref - key = request.header['key'] - args= dict(p) - args['uid'] = key - - gReader = factory.instance(type=class_read,args=p) - apps = gReader.view('summary/nodes',key=p['uid']) - - except Exception, e: - print (e) - return render_template('dashboard.html',context=context,title=title,app_names=apps) - + return redirect("/top",200) +@app.route("/1/data") +def my_data(): + context = SYS_ARGS.PARAMS['context'] + return render_template("account/data.html",context=context) def update_plan(uid,plan,auid=None): url = ":protocol://:host/store/subscribe/smart-top" url = url.replace(":protocol",CONFIG['protocol']).replace(":host",CONFIG['api']) @@ -426,6 +407,19 @@ def notify(key): # pass +@app.route("/1/logout",methods=['GET']) +def logout(): + """ + This function will clear all the session and redirect to the main page + """ + keys = session.keys() + for id in keys : + del session[id] + uri = SYS_ARGS.PARAMS['context'] if 'context' in SYS_ARGS.PARAMS else '/' + url = ":protocol://:host/store/logout" + url = url.replace(":protocol",CONFIG['protocol']).replace(":host",CONFIG['api']) + requests.post(url) + return redirect("/top",302) @app.route('/1/get/nodes') def get_nodes(): diff --git a/src/api/templates/account/data.html b/src/api/templates/account/data.html new file mode 100644 index 0000000..ac76665 --- /dev/null +++ b/src/api/templates/account/data.html @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + +
Manage My Data
+
+
+
+
Archive
+
+ Archive to your cloud account in a smart-top folder: +

+
Using cloud storage as a device +
Share and control access to your data +

+
+
+ Archive Now +
+
+
+
Download
+ +
+ Download your logs in CSV or excel format: +

+
Conduct personal analysis +
Integrate in third party tools +
Archiving purposes (on a physical drive) +

+
+ +
+ Download Now +
+
+
+
Delete
+
+ Delete all of your logs from our servers. We recommend : +

+
Either downloading or archiving first +
This process is NOT reversible. +

+ This option does NOT delete your account. +
+
+ Delete Now +
+
+
+ +
+ + + + +
+ +
+ + +