@ -19,6 +19,15 @@ db_engine = {}
db_metadata = { }
parts = { }
def getContainers ( ) :
query = " select id, name from containers order by UPPER(name); "
r = db_engine . execute ( text ( query ) )
containers = [ ]
for row in r :
containers . append ( dict ( row ) )
r . close ( )
return containers
def check_auth ( username , password ) :
admin_list = [ ]
with open ( ' edit_admin.json ' , ' r ' ) as admin :
@ -47,13 +56,7 @@ def serveImage(img):
@app.route ( ' /parts ' )
def index ( ) :
query = " select id, name from containers order by UPPER(name); "
r = db_engine . execute ( text ( query ) )
containers = [ ]
for row in r :
containers . append ( dict ( row ) )
r . close ( )
return render_template ( ' partsearch.html ' , containers = containers )
return render_template ( ' partsearch.html ' , containers = getContainers ( ) )
@app.route ( ' /parts/getlocationsInContainer/<containerID> ' )
def get_locations_in_container ( containerID ) :
@ -77,15 +80,13 @@ def get_locationURL(locationID):
@app.route ( ' /parts/locationEditor ' )
def locationEditor ( ) :
query = ' select * from locations order by name;'
query = ' select c.name as container, l.name as name, l.id from locations as l inner join containers as c on l.container_id = c.id order by container, name;'
r = db_engine . execute ( text ( query ) )
locations = [ ]
for row in r :
locations . append ( dict ( row ) )
r . close ( )
know_not_map_files = [ ' here.png ' , ' 404.png ' , ' .DS_Store ' ]
mapfiles = [ f for f in listdir ( ' maps ' ) if isfile ( join ( ' maps ' , f ) ) and f not in know_not_map_files ]
return render_template ( ' locationEditor.html ' , locations = locations , mapfiles = mapfiles , defaultMapfile = " elab.png " )
return render_template ( ' locationEditor.html ' , locations = locations , containers = getContainers ( ) )
@app.route ( ' /parts/alterLocation/<locationID> ' , methods = [ ' POST ' ] )
# @requires_auth