Merge branch 'master' of git.elab.kth.se:davide/ELAB-partsearch
# Conflicts: # parts/static/script.js
|
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 44 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 83 KiB |
|
After Width: | Height: | Size: 212 KiB |
|
After Width: | Height: | Size: 213 KiB |
|
After Width: | Height: | Size: 213 KiB |
|
After Width: | Height: | Size: 213 KiB |
|
After Width: | Height: | Size: 213 KiB |
|
After Width: | Height: | Size: 213 KiB |
|
After Width: | Height: | Size: 213 KiB |
|
After Width: | Height: | Size: 213 KiB |
@@ -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
|
||||||
|
|||||||
@@ -18,15 +18,15 @@
|
|||||||
<p>Looking for a place to store your obsolete ICs discontinued years ago? Just toss them anywhere and mark that location here!</p>
|
<p>Looking for a place to store your obsolete ICs discontinued years ago? Just toss them anywhere and mark that location here!</p>
|
||||||
<table id="results">
|
<table id="results">
|
||||||
<tr>
|
<tr>
|
||||||
<th id="id">ID</th>
|
<th id="id">Container</th>
|
||||||
<th id="location">Location name</th>
|
<th id="location">Location name</th>
|
||||||
<th id="mapURL">Map URL</th>
|
<th id="mapURL">ID</th>
|
||||||
</tr>
|
</tr>
|
||||||
{% for location in locations %}
|
{% for location in locations %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{location['id']}}</td>
|
<td>{{location['container']}}</td>
|
||||||
<td>{{location['name']}}</td>
|
<td>{{location['name']}}</td>
|
||||||
<td>{{location['map']}}</td>
|
<td>{{location['id']}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
@@ -41,8 +41,8 @@
|
|||||||
<tr><td>MAP</td></tr>
|
<tr><td>MAP</td></tr>
|
||||||
<tr><td>
|
<tr><td>
|
||||||
<select class="pinfo-input" onchange="update_clickable_map()" name="mapfile-input" id="mapfile-input">
|
<select class="pinfo-input" onchange="update_clickable_map()" name="mapfile-input" id="mapfile-input">
|
||||||
{% for mapfile in mapfiles %}
|
{% for container in containers %}
|
||||||
<option value="{{mapfile}}" {% if mapfile==defaultMapfile %}selected="true"{% endif %}>{{mapfile}}</option>
|
<option value="{{container['id']}}">{{container['name']}}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
</td></tr>
|
</td></tr>
|
||||||
|
|||||||