@ -19,6 +19,15 @@ db_engine = {}
db_metadata = { }
db_metadata = { }
parts = { }
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 ) :
def check_auth ( username , password ) :
admin_list = [ ]
admin_list = [ ]
with open ( ' edit_admin.json ' , ' r ' ) as admin :
with open ( ' edit_admin.json ' , ' r ' ) as admin :
@ -47,13 +56,7 @@ def serveImage(img):
@app.route ( ' /parts ' )
@app.route ( ' /parts ' )
def index ( ) :
def index ( ) :
query = " select id, name from containers order by UPPER(name); "
return render_template ( ' partsearch.html ' , containers = getContainers ( ) )
r = db_engine . execute ( text ( query ) )
containers = [ ]
for row in r :
containers . append ( dict ( row ) )
r . close ( )
return render_template ( ' partsearch.html ' , containers = containers )
@app.route ( ' /parts/getlocationsInContainer/<containerID> ' )
@app.route ( ' /parts/getlocationsInContainer/<containerID> ' )
def get_locations_in_container ( containerID ) :
def get_locations_in_container ( containerID ) :
@ -77,15 +80,13 @@ def get_locationURL(locationID):
@app.route ( ' /parts/locationEditor ' )
@app.route ( ' /parts/locationEditor ' )
def 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 ) )
r = db_engine . execute ( text ( query ) )
locations = [ ]
locations = [ ]
for row in r :
for row in r :
locations . append ( dict ( row ) )
locations . append ( dict ( row ) )
r . close ( )
r . close ( )
know_not_map_files = [ ' here.png ' , ' 404.png ' , ' .DS_Store ' ]
return render_template ( ' locationEditor.html ' , locations = locations , containers = getContainers ( ) )
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 " )
@app.route ( ' /parts/alterLocation/<locationID> ' , methods = [ ' POST ' ] )
@app.route ( ' /parts/alterLocation/<locationID> ' , methods = [ ' POST ' ] )
# @requires_auth
# @requires_auth