Exemple #1
0
def edit_dashboard(id):
    dashboard = gendash.get_dashboard(id)
    if dashboard.owner == current_user.username or current_user.role == 1:
        dashboard = gendash.get_dashboard(id)
        return render_template('pages/edit.html', dashboard=dashboard)
    else:
        return redirect(url_for('dash.my_dashboards'))
Exemple #2
0
def delete_url(dashboard_id, graph_id):
    dashboard = gendash.get_dashboard(dashboard_id)
    if dashboard.owner == current_user.username or current_user.role == 1:
        gendash.delete_url(graph_id)
        return redirect('/edit/dashboard/%s' % dashboard_id)
    else:
        return redirect(url_for('dash.my_dashboards'))
Exemple #3
0
def add_url():
    dashboard = gendash.get_dashboard(request.form['dashboard'])
    if dashboard.owner == current_user.username or current_user.role == 1:
        gendash.add_url(request.form['url'], request.form['name'], 
                        request.form['dashboard'])
        return redirect('/edit/dashboard/%s' % request.form['dashboard'])
    else:
        return redirect(url_for('dash.my_dashboards'))
Exemple #4
0
def dashboard(id):
    dashboard = gendash.get_dashboard(id)
    if dashboard is None:
        abort(404)
    try:
        dashboard.layout = cPickle.loads(dashboard.layout.encode('utf-8'))
    except: 
        print "Unexpected error:", sys.exc_info()[0]
        raise
    return render_template('pages/dashboard.html', dashboard=dashboard)
Exemple #5
0
def edit_url():
    dashboard_id = request.form['dashboard_id']
    graph_id     = request.form['graph_id']
    graph_name   = request.form['graph_name']
    graph_url    = request.form['graph_url']
    dashboard = gendash.get_dashboard(dashboard_id)
    if dashboard.owner == current_user.username or current_user.role == 1:
        gendash.update_graph(graph_id, graph_name, graph_url)
        return redirect('/edit/dashboard/%s' % dashboard_id)
    else:
        return redirect(url_for('dash.my_dashboards'))
Exemple #6
0
def delete_dashboard(id):
    dashboard = gendash.get_dashboard(id)
    if dashboard.owner == current_user.username or current_user.role == 1:
        gendash.delete_dashboard(id)
    return redirect(url_for('dash.my_dashboards'))