Exemple #1
0
def dashboard_chart_edit():
	id = flask.request.args.get('id', default = None, type = int)
	dashboard_id = flask.request.args.get('dashboard_id', default = None, type = int)

	if flask.request.method == "GET":

		session = db_session.create_session()
		try:
			charts = get_objects(Chart, session)
			dashboard = search_object(dashboard_id, Dashboard, session)
		except Exception as error:
			print(str(error))
		finally:
			session.close()

		return flask.render_template(
			'dashboard_chart_edit.html'
			, item_type = 'dashboard_chart'
			, dashboard = dashboard
			, back_link = flask.request.referrer
			, charts = charts

			)

	if flask.request.method == "POST":
		data = flask.request.form		
		session = db_session.create_session()
		try:
			save_object('dashboard_chart', id, data, session)
			session.commit()
		except Exception as error:
			print(str(error))
		finally:
			session.close()
		return flask.redirect('/dashboard/dashboard_chart/edit?dashboard_id=' + str(dashboard_id))
Exemple #2
0
def chart_edit():
    id = flask.request.args.get('id', default=None, type=int)

    if flask.request.method == "GET":

        session = db_session.create_session()
        try:
            chart_types = get_objects(ChartType, session)
            data_obj = search_object(id, Chart, session)
        except Exception as error:
            print(str(error))
        finally:
            session.close()

        return flask.render_template('chart_edit.html',
                                     item_type='chart',
                                     data_obj=data_obj,
                                     back_link=flask.request.referrer,
                                     chart_types=chart_types)

    if flask.request.method == "POST":
        data = flask.request.form
        session = db_session.create_session()
        try:
            save_object('chart', id, data, session)
            session.commit()
        except Exception as error:
            print(str(error))
        finally:
            session.close()
        return flask.redirect('/chart')
Exemple #3
0
def group_edit():
    id = flask.request.args.get('id', default=None, type=int)
    if flask.request.method == "GET":

        session = db_session.create_session()
        try:
            group_categories = get_objects(GroupCategory, session)
            data_obj = search_object(id, Group, session)
        except Exception as error:
            print(str(error))
        finally:
            session.close()

        return flask.render_template('edit_group.html',
                                     item_type='group',
                                     data_obj=data_obj,
                                     back_link=flask.request.referrer,
                                     group_categories=group_categories)

    if flask.request.method == "POST":
        data = flask.request.form
        session = db_session.create_session()
        try:
            save_object('group', id, data, session)
            session.commit()
        except Exception as error:
            print(str(error))
        finally:
            session.close()
        return flask.redirect('/group/group?category_id=' +
                              str(data["group_category_id"]))
Exemple #4
0
def user_group_edit():
    id = flask.request.args.get('id', default=None, type=int)
    user_id = flask.request.args.get('user_id', default=None, type=int)

    if flask.request.method == "GET":

        session = db_session.create_session()
        try:
            user = search_object(user_id, User, session)
            groups = get_objects(Group, session)
        except Exception as error:
            print(str(error))
        finally:
            session.close()

        return flask.render_template('user_group_edit.html',
                                     item_type='user_group',
                                     user=user,
                                     back_link=flask.request.referrer,
                                     groups=groups)

    if flask.request.method == "POST":
        data = flask.request.form
        session = db_session.create_session()
        try:
            save_object('user_group', id, data, session)
            session.commit()
        except Exception as error:
            print(str(error))
        finally:
            session.close()
        return flask.redirect('/user/user_group/edit?user_id=' + str(user_id))
Exemple #5
0
def schedule_edit():
    id = flask.request.args.get('id', default=None, type=int)
    schedule_id = flask.request.args.get('schedule_id', default=None, type=int)

    if flask.request.method == "GET":

        session = db_session.create_session()
        try:
            schedule = search_object(schedule_id, Schedule, session)
            queries = get_objects(Query, session)
        except Exception as error:
            print(str(error))
        finally:
            session.close()

        return flask.render_template('schedule_step_edit.html',
                                     item_type='schedule_step',
                                     schedule=schedule,
                                     back_link=flask.request.referrer,
                                     queries=queries)

    if flask.request.method == "POST":
        data = flask.request.form
        session = db_session.create_session()
        try:
            save_object('schedule_step', id, data, session)
            session.commit()
        except Exception as error:
            print(str(error))
        finally:
            session.close()
        return flask.redirect('/schedule/schedule_step/edit?schedule_id=' +
                              str(schedule_id))
Exemple #6
0
def edit():
	id = flask.request.args.get('id', default = None, type = int)
	
	if flask.request.method == "GET":
	
		session = db_session.create_session()
		try:
			request_methods = get_objects(RequestMethod, session)
			data_obj = search_object(id, Endpoint, session)
		except Exception as error:
			print(str(error))
		finally:
			session.close()

	
		return flask.render_template(
			'edit.html'
			, item_type = 'endpoint'
			, data_obj = data_obj
			, back_link = flask.request.referrer
			, request_methods = request_methods
			)

	if flask.request.method == "POST":
		data = flask.request.form
		session = db_session.create_session()
		try:
			save_object('endpoint', id, data, session)
			session.commit()
		except Exception as error:
			print(str(error))
		finally:
			session.close()
		return flask.redirect('/api')
Exemple #7
0
def index():
	session = db_session.create_session()
	try:
		endpoints = get_objects(Endpoint, session)
	except Exception as error:
		print(str(error))
	finally:
		session.close()

	return flask.render_template('api_index.html', endpoints = endpoints)
Exemple #8
0
def index():

    session = db_session.create_session()
    try:
        locations = get_objects(Location, session)
    except Exception as error:
        print(str(error))
    finally:
        session.close()

    return flask.render_template('process/index.html', locations=locations)
Exemple #9
0
def chart_index():

    session = db_session.create_session()
    try:
        charts = get_objects(Chart, session)
    except Exception as error:
        print(str(error))
    finally:
        session.close()

    return flask.render_template('chart_index.html', charts=charts)
Exemple #10
0
def index():

    session = db_session.create_session()
    try:
        users = get_objects(User, session)
    except Exception as error:
        print(str(error))
    finally:
        session.close()

    return flask.render_template('user/index.html', users=users)
Exemple #11
0
def index():

    session = db_session.create_session()
    try:
        schedules = get_objects(Schedule, session)
    except Exception as error:
        print(str(error))
    finally:
        session.close()

    return flask.render_template('schedule_index.html', schedules=schedules)
Exemple #12
0
def index():

	session = db_session.create_session()
	try:
		dashboards = get_objects(Dashboard, session)
	except Exception as error:
		print(str(error))
	finally:
		session.close()

	return flask.render_template('dashboard_index.html',dashboards = dashboards)
Exemple #13
0
def category_index():

    session = db_session.create_session()
    try:
        group_categories = get_objects(GroupCategory, session)
    except Exception as error:
        print(str(error))
    finally:
        session.close()

    return flask.render_template('group_category_index.html',
                                 group_categories=group_categories)
Exemple #14
0
def edit(item_type: str):
	id = flask.request.args.get('id', default = None, type = int)
	print(id)
	if flask.request.method == "GET":
		return flask.render_template(

				type_variables[item_type+"_template"]
				, item_type = item_type
				, back_link = flask.request.referrer
				, locations = get_locations()
				, sql_types = get_objects(SqlType)
				, request_methods = get_objects(RequestMethod)
				, location_types = get_objects(LocationType)
				, data_obj = search_object(id, type_variables[item_type+"_class"])

			)


	if flask.request.method == "POST":
		data = flask.request.form
		save_lqv(item_type, id, data)
		return flask.redirect('/process')
Exemple #15
0
def edit(item_type: str):
    id = flask.request.args.get('id', default=None, type=int)
    if flask.request.method == "GET":

        session = db_session.create_session()
        try:
            locations = get_objects(Location, session)
            subtypes = get_objects(Subtype, session)
            request_methods = get_objects(RequestMethod, session)
            location_types = get_objects(LocationType, session)
            data_obj = search_object(id, type_variables[item_type + "_class"],
                                     session)
        except Exception as error:
            print(str(error))
        finally:
            session.close()

        return flask.render_template(type_variables[item_type + "_template"],
                                     item_type=item_type,
                                     back_link=flask.request.referrer,
                                     locations=locations,
                                     subtypes=subtypes,
                                     request_methods=request_methods,
                                     location_types=location_types,
                                     data_obj=data_obj)

    if flask.request.method == "POST":
        data = flask.request.form
        session = db_session.create_session()
        try:
            save_object(item_type, id, data, session)
            session.commit()
        except Exception as error:
            print(str(error))
        finally:
            session.close()
        return flask.redirect('/process')
Exemple #16
0
def index():

    return flask.render_template('user/index.html', users=get_objects(User))