def admin_home(admin_id): """ Homepage for an admin account """ project_list = [] db = DB() resp = db.get_project_list() if resp['status']: for project in resp['project_list']: if 'admin' in list(project.keys()) and not project['admin']: project_list.append(project) return render_template('admin_home.html', admin_detail=g.admin, project_list=project_list)
def index(): """ Loads the STACK homepage w/ list of project accounts """ start_workers() db = DB() resp = db.get_project_list() project_list = None admins = None if resp and resp['project_list']: project_list = resp['project_list'] admins = [ project for project in project_list if 'admin' in list(project.keys()) and project['admin'] == 1 ] # Renders index of at least one admin account exists, if not calls the new install setup if admins: return render_template('index.html', project_list=project_list) else: return redirect(url_for('setup'))
print json.dumps(resp, indent=1) elif method == 'auth': """ python __main__.py db auth project_name password """ project_name = sys.argv[3] password = sys.argv[4] resp = db.auth(project_name, password) print json.dumps(resp, indent=1) elif method == 'get_project_list': """ python __main__.py db get_project_list """ resp = db.get_project_list() print json.dumps(resp, indent=1) elif method == 'get_collector_ids': """ python __main__.py db get_collector_ids project_id """ project_id = sys.argv[3] resp = db.get_collector_ids(project_id) print json.dumps(resp, indent=1) elif method == 'get_project_detail': """ python __main__.py db get_project_detail project_id """ project_id = sys.argv[3] resp = db.get_project_detail(project_id)
print json.dumps(resp, indent=1) elif method == 'auth': """ python __main__.py db auth project_name password """ project_name = sys.argv[3] password = sys.argv[4] resp = db.auth(project_name, password) print json.dumps(resp, indent=1) elif method == 'get_project_list': """ python __main__.py db get_project_list """ resp = db.get_project_list() print json.dumps(resp, indent=1) elif method == 'get_collector_ids': """ python __main__.py db get_collector_ids project_id """ project_id = sys.argv[3] resp = db.get_collector_ids(project_id) print json.dumps(resp, indent=1) elif method == 'get_project_detail': """ python __main__.py db get_project_detail project_id """ project_id = sys.argv[3] resp = db.get_project_detail(project_id)