Compare commits
85
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
81409dc448 | ||
|
|
cd224a685b | ||
|
|
6998c7eff2 | ||
|
|
807c136143 | ||
|
|
51022e79bd | ||
|
|
b698ec446f | ||
|
|
4bceb35bd5 | ||
|
|
b3f8f890f4 | ||
|
|
fcf5f25c16 | ||
|
|
baed641f31 | ||
|
|
f57ac131ff | ||
|
|
961fb859f4 | ||
|
|
f331be7a89 | ||
|
|
a549c16548 | ||
|
|
8bb2a9d318 | ||
|
|
2be1d78d39 | ||
|
|
21e7356a99 | ||
|
|
ab663b1dec | ||
|
|
3cbff49168 | ||
|
|
6897d0f8ac | ||
|
|
feb1aea5c3 | ||
|
|
4f5df6c1fe | ||
|
|
1c8bdc69f6 | ||
|
|
a9ee37f96e | ||
|
|
3edd0542b8 | ||
|
|
3754174c7d | ||
|
|
6077dd4228 | ||
|
|
90b948a057 | ||
|
|
40f8263006 | ||
|
|
aebd74d185 | ||
|
|
d38013d00a | ||
|
|
2c14234e8d | ||
|
|
43ec84a3ca | ||
|
|
53db127b14 | ||
|
|
2f67fbf69a | ||
|
|
389409d814 | ||
|
|
c10a0258f6 | ||
|
|
fd8540d4e1 | ||
|
|
fd7c400bfe | ||
|
|
066c38db80 | ||
|
|
5c3aacfedf | ||
|
|
af3d1f3200 | ||
|
|
47c25847f0 | ||
|
|
c6168f5281 | ||
|
|
2de8a7bb99 | ||
|
|
f4fe883955 | ||
|
|
d7e9615453 | ||
|
|
f2ddbd6fdf | ||
|
|
d70c5dbde3 | ||
|
|
f1c32251f7 | ||
|
|
71ed8a60f4 | ||
|
|
ae96e7457c | ||
|
|
5da9712276 | ||
|
|
ff55c778ef | ||
|
|
bcbdc6b52a | ||
|
|
dac5d96f03 | ||
|
|
97a208f48c | ||
|
|
6e13be37e6 | ||
|
|
0789b3a0d8 | ||
|
|
4cf02f26c4 | ||
|
|
f4235556f7 | ||
|
|
dc880978ab | ||
|
|
582370a17d | ||
|
|
11b3ae1af5 | ||
|
|
82f1c364de | ||
|
|
38c22af31f | ||
|
|
112686b9c6 | ||
|
|
d64923ddad | ||
|
|
2a8b1f50f4 | ||
|
|
7e60da9362 | ||
|
|
227e725e95 | ||
|
|
a8496af806 | ||
|
|
cc6a1473cb | ||
|
|
b44d05aabd | ||
|
|
3cb81e9a79 | ||
|
|
b297462d3b | ||
|
|
40186ad08e | ||
|
|
a7751dc38b | ||
|
|
e2003e3562 | ||
|
|
7e1f59f781 | ||
|
|
4649723f87 | ||
|
|
0b64c50f36 | ||
|
|
597898885b | ||
|
|
55033f7295 | ||
|
|
8d1237011a |
@@ -1,3 +1,5 @@
|
|||||||
admin.json
|
admin.json
|
||||||
edit_admin.json
|
edit_admin.json
|
||||||
*.scss
|
*.scss
|
||||||
|
|
||||||
|
.DS_Store
|
||||||
|
|||||||
Regular → Executable
+88
-38
@@ -1,6 +1,7 @@
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import json, urllib.parse, urllib.request
|
import json
|
||||||
|
import requests
|
||||||
import sqlalchemy
|
import sqlalchemy
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
from sqlalchemy.sql import select
|
from sqlalchemy.sql import select
|
||||||
@@ -12,6 +13,7 @@ from io import BytesIO
|
|||||||
from os import listdir
|
from os import listdir
|
||||||
from os.path import isfile, join
|
from os.path import isfile, join
|
||||||
from werkzeug.utils import secure_filename
|
from werkzeug.utils import secure_filename
|
||||||
|
import random
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
@@ -19,6 +21,12 @@ db_engine = {}
|
|||||||
db_metadata = {}
|
db_metadata = {}
|
||||||
parts = {}
|
parts = {}
|
||||||
octopartURL =""
|
octopartURL =""
|
||||||
|
baseURL = "/parts"
|
||||||
|
|
||||||
|
taglines = []
|
||||||
|
with open('taglines.txt', 'r') as infile:
|
||||||
|
for line in infile:
|
||||||
|
taglines.append(line[:-1])
|
||||||
|
|
||||||
def getContainers():
|
def getContainers():
|
||||||
query = "select id, name from containers order by UPPER(name);"
|
query = "select id, name from containers order by UPPER(name);"
|
||||||
@@ -64,21 +72,21 @@ def serveImage(img):
|
|||||||
img_io.seek(0)
|
img_io.seek(0)
|
||||||
return send_file(img_io, mimetype='image/png')
|
return send_file(img_io, mimetype='image/png')
|
||||||
|
|
||||||
@app.route('/parts', strict_slashes=False)
|
@app.route(baseURL, strict_slashes=True)
|
||||||
def index():
|
def index():
|
||||||
return render_template('partsearch.html', containers=getContainers())
|
return render_template('partsearch.html', containers=getContainers(), baseURL=baseURL, tagline=random.choice(taglines))
|
||||||
|
|
||||||
@app.route('/parts/getlocationsInContainer/<containerID>')
|
@app.route(baseURL+'/getlocationsInContainer/<containerID>')
|
||||||
def get_locations_in_container(containerID):
|
def get_locations_in_container(containerID):
|
||||||
s = 'select id, name from locations where container_id = :id order by name;'
|
s = 'select id, name from locations where container_id = :id order by name;'
|
||||||
r = db_engine.execute(text(s), id=containerID)
|
r = db_engine.execute(text(s), id=containerID)
|
||||||
l={}
|
l={}
|
||||||
for row in r:
|
for row in r:
|
||||||
l[row[0]]= row[1];
|
l[str(row[0])]= row[1];
|
||||||
r.close()
|
r.close()
|
||||||
return json.dumps(l)
|
return json.dumps(l)
|
||||||
|
|
||||||
@app.route('/parts/getlocationURL/<locationID>')
|
@app.route(baseURL+'/getlocationURL/<locationID>')
|
||||||
def get_locationURL(locationID):
|
def get_locationURL(locationID):
|
||||||
s = 'select map from locations where id = :id;'
|
s = 'select map from locations where id = :id;'
|
||||||
r = db_engine.execute(text(s), id=locationID)
|
r = db_engine.execute(text(s), id=locationID)
|
||||||
@@ -88,7 +96,7 @@ def get_locationURL(locationID):
|
|||||||
r.close()
|
r.close()
|
||||||
return l[0][0]
|
return l[0][0]
|
||||||
|
|
||||||
@app.route('/parts/locationEditor')
|
@app.route(baseURL+'/locationEditor')
|
||||||
def locationEditor():
|
def locationEditor():
|
||||||
query = 'select c.name as container, l.name as name, l.id, c.id as container_id from locations as l inner join containers as c on l.container_id = c.id order by container, name;'
|
query = 'select c.name as container, l.name as name, l.id, c.id as container_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))
|
||||||
@@ -96,9 +104,20 @@ def locationEditor():
|
|||||||
for row in r:
|
for row in r:
|
||||||
locations.append(dict(row))
|
locations.append(dict(row))
|
||||||
r.close()
|
r.close()
|
||||||
return render_template('locationEditor.html', locations=locations, containers=getContainers())
|
return render_template('locationEditor.html', locations=locations, containers=getContainers(),baseURL=baseURL)
|
||||||
|
@app.route(baseURL+'/userEditor')
|
||||||
|
def userEditor():
|
||||||
|
query = 'select c.name as container, l.name as name, l.id, c.id as container_id from locations as l inner join containers as c on l.container_id = c.id order by container, name;'
|
||||||
|
query = 'select id, username from users;'
|
||||||
|
|
||||||
@app.route('/parts/alterLocation/<locationID>', methods=['POST'])
|
r = db_engine.execute(text(query))
|
||||||
|
users = []
|
||||||
|
for row in r:
|
||||||
|
users.append(dict(row))
|
||||||
|
r.close()
|
||||||
|
return render_template('userEditor.html', users=users, containers=getContainers(),baseURL=baseURL)
|
||||||
|
|
||||||
|
@app.route(baseURL+'/alterLocation/<locationID>', methods=['POST'])
|
||||||
@requires_auth
|
@requires_auth
|
||||||
def alterLocation(locationID):
|
def alterLocation(locationID):
|
||||||
locationID = int(locationID)
|
locationID = int(locationID)
|
||||||
@@ -106,7 +125,7 @@ def alterLocation(locationID):
|
|||||||
if locationID < 0:
|
if locationID < 0:
|
||||||
# New entry
|
# New entry
|
||||||
s = 'insert into locations (name, container_id) '
|
s = 'insert into locations (name, container_id) '
|
||||||
s += 'values (:name, :container, :userid);'
|
s += 'values (:name, :container);'
|
||||||
s = text(s)
|
s = text(s)
|
||||||
r = db_engine.execute(s,name=request.form['name'],container=request.form['container']);
|
r = db_engine.execute(s,name=request.form['name'],container=request.form['container']);
|
||||||
r.close()
|
r.close()
|
||||||
@@ -120,8 +139,30 @@ def alterLocation(locationID):
|
|||||||
r = db_engine.execute(s, name=request.form['name'],container=request.form['container'],locationID=locationID);
|
r = db_engine.execute(s, name=request.form['name'],container=request.form['container'],locationID=locationID);
|
||||||
r.close()
|
r.close()
|
||||||
return '{"status":"ok"}'
|
return '{"status":"ok"}'
|
||||||
|
@app.route(baseURL+'/alterUser/<userID>', methods=['POST'])
|
||||||
|
@requires_auth
|
||||||
|
def alterUser(userID):
|
||||||
|
userID = int(userID)
|
||||||
|
s = ''
|
||||||
|
if userID < 0:
|
||||||
|
# New entry
|
||||||
|
s = 'insert into users (username, password) '
|
||||||
|
s += 'values (:name, :password);'
|
||||||
|
s = text(s)
|
||||||
|
r = db_engine.execute(s,name=request.form['name'],password=request.form['password']);
|
||||||
|
r.close()
|
||||||
|
return '{"status":"ok"}'
|
||||||
|
else:
|
||||||
|
# Modify entry
|
||||||
|
s = 'update users '
|
||||||
|
s += 'set username=:name, password=:password '
|
||||||
|
s += 'where id=:userID;'
|
||||||
|
s = text(s)
|
||||||
|
r = db_engine.execute(s, name=request.form['name'],password=request.form['password'],userID=userID);
|
||||||
|
r.close()
|
||||||
|
return '{"status":"ok"}'
|
||||||
|
|
||||||
@app.route('/parts/getpartinfo/<partID>')
|
@app.route(baseURL+'/getpartinfo/<partID>')
|
||||||
def get_part_info(partID):
|
def get_part_info(partID):
|
||||||
s = 'select p.id,partno,description,notes, c.name || l.name as location_descriptor, location_id, container_id, datasheet from parts as p inner join locations as l on p.location_id = l.id inner join containers as c on l.container_id = c.id where p.id = :id;'
|
s = 'select p.id,partno,description,notes, c.name || l.name as location_descriptor, location_id, container_id, datasheet from parts as p inner join locations as l on p.location_id = l.id inner join containers as c on l.container_id = c.id where p.id = :id;'
|
||||||
r = db_engine.execute(text(s), id=partID)
|
r = db_engine.execute(text(s), id=partID)
|
||||||
@@ -131,7 +172,7 @@ def get_part_info(partID):
|
|||||||
r.close()
|
r.close()
|
||||||
return json.dumps(l[0])
|
return json.dumps(l[0])
|
||||||
|
|
||||||
@app.route('/parts/query/<filter_dummy>/<query>') # TODO: maybe change AND to OR or maybe not
|
@app.route(baseURL+'/query/<filter_dummy>/<query>') # TODO: maybe change AND to OR or maybe not
|
||||||
def query(filter_dummy, query):
|
def query(filter_dummy, query):
|
||||||
filter = request.args.to_dict()
|
filter = request.args.to_dict()
|
||||||
keywords = query.split() # Default splits with spaces
|
keywords = query.split() # Default splits with spaces
|
||||||
@@ -146,7 +187,7 @@ def query(filter_dummy, query):
|
|||||||
if filter['l'] == 'true':
|
if filter['l'] == 'true':
|
||||||
s += '('
|
s += '('
|
||||||
for i in range(len(keywords)):
|
for i in range(len(keywords)):
|
||||||
s += 'LOWER(l.name) like LOWER(:kw'+ str(i) +') AND '
|
s += 'LOWER(c.name||l.name) like LOWER(:kw'+ str(i) +') AND '
|
||||||
s = s[:-5]
|
s = s[:-5]
|
||||||
s += ') OR '
|
s += ') OR '
|
||||||
if filter['p'] == 'true':
|
if filter['p'] == 'true':
|
||||||
@@ -170,7 +211,7 @@ def query(filter_dummy, query):
|
|||||||
r.close()
|
r.close()
|
||||||
return json.dumps(l)
|
return json.dumps(l)
|
||||||
|
|
||||||
@app.route('/parts/map/<containerID>')
|
@app.route(baseURL+'/map/<containerID>')
|
||||||
def getMap(containerID):
|
def getMap(containerID):
|
||||||
s = 'select map, overlay from containers where id = :id;'
|
s = 'select map, overlay from containers where id = :id;'
|
||||||
r = db_engine.execute(text(s), id=containerID)
|
r = db_engine.execute(text(s), id=containerID)
|
||||||
@@ -195,14 +236,14 @@ def getMap(containerID):
|
|||||||
return serveImage(mapimage)
|
return serveImage(mapimage)
|
||||||
|
|
||||||
|
|
||||||
@app.route('/parts/getfile/<filename>')
|
@app.route(baseURL+'/getfile/<filename>')
|
||||||
def getfile(filename):
|
def getfile(filename):
|
||||||
if(re.match('^[\w\-_]+$', filename) == None):
|
if(re.match('^[\w\-_]+.[p|P][d|D][f|F]$', filename) == None):
|
||||||
return 'No injections pls.'
|
return 'No injections pls.'
|
||||||
|
|
||||||
return send_from_directory('/srv/datasheets/', filename + '.pdf')
|
return send_from_directory('/srv/datasheets/', filename)
|
||||||
|
|
||||||
@app.route('/parts/alter/<partID>', methods=['POST'])
|
@app.route(baseURL+'/alter/<partID>', methods=['POST'])
|
||||||
@requires_auth
|
@requires_auth
|
||||||
def alter(partID):
|
def alter(partID):
|
||||||
partID = int(partID)
|
partID = int(partID)
|
||||||
@@ -217,7 +258,7 @@ def alter(partID):
|
|||||||
datasheet_file = request.files['datasheet-file']
|
datasheet_file = request.files['datasheet-file']
|
||||||
datasheet_filename = secure_filename(datasheet_file.filename)
|
datasheet_filename = secure_filename(datasheet_file.filename)
|
||||||
i = 1
|
i = 1
|
||||||
while os.path.isfile('srv/datasheets/' + datasheet_filename):
|
while os.path.isfile('/srv/datasheets/' + datasheet_filename):
|
||||||
datasheet_filename = datasheet_filename[:-4] + str(i) + '.pdf'
|
datasheet_filename = datasheet_filename[:-4] + str(i) + '.pdf'
|
||||||
i += 1
|
i += 1
|
||||||
datasheet_file.save('/srv/datasheets/' + datasheet_filename)
|
datasheet_file.save('/srv/datasheets/' + datasheet_filename)
|
||||||
@@ -248,15 +289,15 @@ def alter(partID):
|
|||||||
datasheet_file = request.files['datasheet-file']
|
datasheet_file = request.files['datasheet-file']
|
||||||
datasheet_filename = secure_filename(datasheet_file.filename)
|
datasheet_filename = secure_filename(datasheet_file.filename)
|
||||||
i = 1
|
i = 1
|
||||||
while os.path.isfile('srv/datasheets/' + datasheet_filename):
|
while os.path.isfile('/srv/datasheets/' + datasheet_filename):
|
||||||
datasheet_filename = datasheet_filename[:-4] + str(i) + '.pdf'
|
datasheet_filename = datasheet_filename[:-4] + str(i) + '.pdf'
|
||||||
i += 1
|
i += 1
|
||||||
datasheet_file.save('/srv/datasheets/' + datasheet_filename)
|
datasheet_file.save('/srv/datasheets/' + datasheet_filename)
|
||||||
datasheet_filename = 'http://elab.kth.se/parts/getfile/' + datasheet_filename
|
datasheet_filename = 'http://elab.kth.se/parts/getfile/' + datasheet_filename
|
||||||
if l[0]['datasheet'] != None:
|
if l[0]['datasheet'] != None:
|
||||||
os.remove('/srv/datasheets/' + l[0]['datasheet'])
|
whole_url = l[0]['datasheet']
|
||||||
# elif request.form.has_key('datasheet-url'):
|
actual_filename = whole_url[whole_url.rfind('/') + 1:]
|
||||||
# datasheet_filename = request.form['datasheet-url']
|
os.remove('/srv/datasheets/' + actual_filename)
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
datasheet_filename = request.form['datasheet-url']
|
datasheet_filename = request.form['datasheet-url']
|
||||||
@@ -275,8 +316,8 @@ def alter(partID):
|
|||||||
r.close()
|
r.close()
|
||||||
return '{"status":"ok", "part_id" : ' + str(new_id) + '}'
|
return '{"status":"ok", "part_id" : ' + str(new_id) + '}'
|
||||||
|
|
||||||
@app.route('/parts/delete/<partID>')
|
@app.route(baseURL+'/delete/<partID>')
|
||||||
# @requires_auth
|
@requires_auth
|
||||||
def delete(partID):
|
def delete(partID):
|
||||||
if int(partID) < 0:
|
if int(partID) < 0:
|
||||||
abort(400)
|
abort(400)
|
||||||
@@ -284,26 +325,34 @@ def delete(partID):
|
|||||||
r = db_engine.execute(s, id=partID)
|
r = db_engine.execute(s, id=partID)
|
||||||
return '{"status":"ok"}'
|
return '{"status":"ok"}'
|
||||||
|
|
||||||
@app.route('/parts/deleteLocation/<locationID>')
|
@app.route(baseURL+'/deleteLocation/<locationID>')
|
||||||
# @requires_auth
|
@requires_auth
|
||||||
def deleteLocation(locationID):
|
def deleteLocation(locationID):
|
||||||
if int(locationID) < 0:
|
if int(locationID) < 0:
|
||||||
abort(400)
|
abort(400)
|
||||||
s = text('delete from locations where id=:id;')
|
s = text('delete from locations where id=:id;')
|
||||||
r = db_engine.execute(s, id=locationID)
|
r = db_engine.execute(s, id=locationID)
|
||||||
return '{"status":"ok"}'
|
return '{"status":"ok"}'
|
||||||
|
@app.route(baseURL+'/deleteUser/<userID>')
|
||||||
|
@requires_auth
|
||||||
|
def deleteUser(userID):
|
||||||
|
if int(userID) < 0:
|
||||||
|
abort(400)
|
||||||
|
s = text('delete from users where id=:id;')
|
||||||
|
r = db_engine.execute(s, id=userID)
|
||||||
|
return '{"status":"ok"}'
|
||||||
|
|
||||||
@app.route('/parts/fetchOctopartSnippet/<searchTerm>')
|
@app.route(baseURL+'/fetchOctopartSnippet/<searchTerm>')
|
||||||
def fetchOctopartSnippet(searchTerm):
|
def fetchOctopartSnippet(searchTerm):
|
||||||
if octopartURL == '':
|
if octopartURL == '':
|
||||||
return '{"result":"octopart integration not enabled"}'
|
return '{"result":"octopart integration not enabled"}'
|
||||||
args = [
|
args = {
|
||||||
('q', searchTerm),
|
'q': searchTerm,
|
||||||
('start', 0),
|
'start': '0',
|
||||||
('limit', 1)
|
'limit': 1
|
||||||
]
|
}
|
||||||
data = urllib.request.urlopen(octopartURL + '&' + urllib.parse.urlencode(args)).read()
|
data = requests.get(octopartURL, params=args)
|
||||||
search_response = json.loads(data)
|
search_response = json.loads(data.text)
|
||||||
|
|
||||||
result = '{"result":"no results. sorry :(("}'
|
result = '{"result":"no results. sorry :(("}'
|
||||||
if search_response['hits']>0:
|
if search_response['hits']>0:
|
||||||
@@ -323,7 +372,8 @@ def connect(user, password, db, host='localhost', port=5432):
|
|||||||
con = sqlalchemy.create_engine(url, client_encoding='utf8')
|
con = sqlalchemy.create_engine(url, client_encoding='utf8')
|
||||||
|
|
||||||
# We then bind the connection to MetaData()
|
# We then bind the connection to MetaData()
|
||||||
meta = sqlalchemy.MetaData(bind=con, reflect=True)
|
meta = sqlalchemy.MetaData(bind=con)
|
||||||
|
meta.reflect(bind=con)
|
||||||
|
|
||||||
return con, meta
|
return con, meta
|
||||||
|
|
||||||
@@ -332,7 +382,7 @@ if __name__ == '__main__':
|
|||||||
app.config['SESSION_TYPE'] = 'memcached'
|
app.config['SESSION_TYPE'] = 'memcached'
|
||||||
with open('admin.json') as f:
|
with open('admin.json') as f:
|
||||||
postgres_credentials = json.load(f)
|
postgres_credentials = json.load(f)
|
||||||
db_engine, db_metadata = connect(postgres_credentials['username'], postgres_credentials['password'], 'parts_v2')
|
db_engine, db_metadata = connect(postgres_credentials['username'], postgres_credentials['password'], 'parts_v3')
|
||||||
parts = sqlalchemy.Table('parts', db_metadata)
|
parts = sqlalchemy.Table('parts', db_metadata)
|
||||||
try:
|
try:
|
||||||
with open('octopartAPIkey.json') as f:
|
with open('octopartAPIkey.json') as f:
|
||||||
@@ -348,4 +398,4 @@ if __name__ == '__main__':
|
|||||||
'''s = select([parts]).where(parts.c.notes != '')
|
'''s = select([parts]).where(parts.c.notes != '')
|
||||||
for row in db_engine.execute(s):
|
for row in db_engine.execute(s):
|
||||||
print row'''
|
print row'''
|
||||||
app.run('0.0.0.0')
|
app.run(host='127.0.0.1', port='5000', debug=False)
|
||||||
|
|||||||
Regular → Executable
+4
-2
@@ -55,11 +55,13 @@ function saveLocation(locationID) {
|
|||||||
|
|
||||||
|
|
||||||
function deleteLocation(locationID) {
|
function deleteLocation(locationID) {
|
||||||
if (locationID < 0)
|
if (locationID < 0){
|
||||||
alert('Congratulations! You found the secret UI bug easter egg! This button should not be here, yet I left it specifically because I wanted an easter egg and not because of any other reasons! Good for you!')
|
alert('Congratulations! You found the secret UI bug easter egg! This button should not be here, yet I left it specifically because I wanted an easter egg and not because of any other reasons! Good for you!')
|
||||||
return;
|
return;
|
||||||
if (!confirm('Delete the selected location? If there are parts there, this will leave a mess in the database and Marek will be very sad.'))
|
}
|
||||||
|
if (!confirm('Delete the selected location? If there are parts there, this will leave a mess in the database and Marek will be very sad.')){
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: rootURL + 'deleteLocation/' + locationID,
|
url: rootURL + 'deleteLocation/' + locationID,
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
|
|||||||
Regular → Executable
+79
-22
@@ -1,3 +1,5 @@
|
|||||||
|
var active_timer = 100;
|
||||||
|
|
||||||
function init_edit(partID) {
|
function init_edit(partID) {
|
||||||
$('table#details tr#location td p').hide();
|
$('table#details tr#location td p').hide();
|
||||||
$('#location-dropdown').show();
|
$('#location-dropdown').show();
|
||||||
@@ -14,14 +16,19 @@ function init_edit(partID) {
|
|||||||
$('table#details tr#datasheet td input').show();
|
$('table#details tr#datasheet td input').show();
|
||||||
|
|
||||||
$('#duplicate-button').closest('div').hide();
|
$('#duplicate-button').closest('div').hide();
|
||||||
|
$('#delete-button').closest('div').hide();
|
||||||
|
|
||||||
$('tr#datasheet').show();
|
$('tr#datasheet').show();
|
||||||
|
|
||||||
$('input[name=notes-input]').show();
|
$('input[name=notes-input]').show();
|
||||||
$('table#details tr#notes td p').hide();
|
$('table#details tr#notes td p').hide();
|
||||||
|
|
||||||
var newButton = '<div class="round-button-left"><a href="#" onclick="save(' + partID + ')"><i class="fa fa-check" aria-hidden="true"></i></a></div>';
|
// var newButton = '<div class="round-button-left"><a href="#" onclick="save(' + partID + ')"><i class="fa fa-check" aria-hidden="true"></i></a></div>';
|
||||||
$('.round-button-left').replaceWith(newButton);
|
// $('.round-button-left').replaceWith(newButton);
|
||||||
|
$('#edit-button').html('<i class="fa fa-check" aria-hidden="true"></i>');
|
||||||
|
$('#edit-button').off('click').on('click', function(){
|
||||||
|
save(partID);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function new_entry() {
|
function new_entry() {
|
||||||
@@ -31,7 +38,7 @@ function new_entry() {
|
|||||||
$('table#details tr#partno td input').val('');
|
$('table#details tr#partno td input').val('');
|
||||||
$('table#details tr#description td input').val('');
|
$('table#details tr#description td input').val('');
|
||||||
$('input[name=datasheet-url-input]').val('');
|
$('input[name=datasheet-url-input]').val('');
|
||||||
container_onchange();
|
// container_onchange();
|
||||||
init_edit(-1);
|
init_edit(-1);
|
||||||
overlay_in();
|
overlay_in();
|
||||||
}
|
}
|
||||||
@@ -59,9 +66,11 @@ function end_edit() {
|
|||||||
$('table#details tr#notes td p').show();
|
$('table#details tr#notes td p').show();
|
||||||
|
|
||||||
$('#duplicate-button').closest('div').show();
|
$('#duplicate-button').closest('div').show();
|
||||||
|
$('#delete-button').closest('div').show();
|
||||||
|
|
||||||
var newButton = '<div class="round-button-left"><a href="#" id="edit-button"><i class="fa fa-pencil" aria-hidden="true"></i></a></div>';
|
$('#edit-button').html('<i class="fa fa-pencil" aria-hidden="true"></i>');
|
||||||
$('.round-button-left').replaceWith(newButton);
|
// var newButton = '<div class="round-button-left"><a href="#" id="edit-button"><i class="fa fa-pencil" aria-hidden="true"></i></a></div>';
|
||||||
|
// $('.round-button-left').replaceWith(newButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
function save(partID) {
|
function save(partID) {
|
||||||
@@ -167,31 +176,58 @@ function delete_entry(partID) {
|
|||||||
function show_part_info(partID) {
|
function show_part_info(partID) {
|
||||||
$.getJSON(rootURL + 'getpartinfo/' + partID, function(data) {
|
$.getJSON(rootURL + 'getpartinfo/' + partID, function(data) {
|
||||||
$('table#details tr#location td p').text(text_filter(data.location_descriptor)); // name is the location friendly name
|
$('table#details tr#location td p').text(text_filter(data.location_descriptor)); // name is the location friendly name
|
||||||
$('#location-dropdown').val(data.location_id);
|
|
||||||
$('#container-dropdown').val(data.container_id);
|
$('#container-dropdown').val(data.container_id);
|
||||||
|
$('img#map').attr('src', 'parts/map/' + data.container_id);
|
||||||
|
$('#location-dropdown').empty();
|
||||||
|
$.getJSON('parts/getlocationsInContainer/' + data.container_id, function(json) {
|
||||||
|
$.each(json, function(loc_id, loc_name) {
|
||||||
|
$('#location-dropdown').append('<option value="' + loc_id + '">' + loc_name + '</option>');
|
||||||
|
});
|
||||||
|
$('#location-dropdown').val(data.location_id);
|
||||||
|
});
|
||||||
$('table#details tr#partno td p').text(text_filter(data.partno));
|
$('table#details tr#partno td p').text(text_filter(data.partno));
|
||||||
$('table#details tr#partno td input').val(text_filter(data.partno));
|
$('table#details tr#partno td input').val(text_filter(data.partno));
|
||||||
$('table#details tr#description td p').text(text_filter(data.description));
|
$('table#details tr#description td p').text(text_filter(data.description));
|
||||||
$('table#details tr#description td input').val(text_filter(data.description));
|
$('table#details tr#description td input').val(text_filter(data.description));
|
||||||
$('table#details tr#notes td p').text(text_filter(data.notes));
|
$('table#details tr#notes td p').text(text_filter(data.notes));
|
||||||
$('input[name=notes-input]').val(text_filter(data.notes));
|
$('input[name=notes-input]').val(text_filter(data.notes));
|
||||||
container_onchange();
|
// Resetting file input. Super dirty hack. Disgusting
|
||||||
|
var $el = $('#datasheet-finput');
|
||||||
|
$el.wrap('<form>').closest('form').get(0).reset();
|
||||||
|
$el.unwrap();
|
||||||
if (data.datasheet != null) {
|
if (data.datasheet != null) {
|
||||||
$('tr#datasheet-head').html($('<td>DATASHEET: <a href="' + data.datasheet + '" target="_blank"><i class="fa fa-file-text" aria-hidden="true"></i></a></td>'));
|
$('tr#datasheet-head').html($('<td>DATASHEET: <a href="' + data.datasheet + '" target="_blank"><i class="fa fa-file-text" aria-hidden="true"></i></a></td>'));
|
||||||
$('input[name=datasheet-url-input]').val(data.datasheet);
|
$('input[name=datasheet-url-input]').val(data.datasheet);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
$('tr#datasheet-head td').text('DATASHEET: ');
|
$('tr#datasheet-head td').text('DATASHEET: ');
|
||||||
$('#edit-button').click(function() {
|
$('input[name=datasheet-url-input]').val('');
|
||||||
|
}
|
||||||
|
$('#edit-button').off('click').on('click', function() {
|
||||||
init_edit(partID);
|
init_edit(partID);
|
||||||
});
|
});
|
||||||
$('#delete-button').click(function() {
|
$('#delete-button').off('click').on('click', function() {
|
||||||
delete_entry(partID);
|
delete_entry(partID);
|
||||||
});
|
});
|
||||||
overlay_in();
|
overlay_in();
|
||||||
}).fail(function() {
|
}).fail(function() {
|
||||||
console.log( "Fetching part info failed" );
|
console.log( "Fetching part info failed" );
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// update URL and history
|
||||||
|
update_url(partID);
|
||||||
|
}
|
||||||
|
|
||||||
|
function update_url(partID){
|
||||||
|
params = {}
|
||||||
|
// If there is a seach bar, take its content
|
||||||
|
if($('.search-bar').length){
|
||||||
|
params['q'] = $('.search-bar').val();
|
||||||
|
}
|
||||||
|
if(partID != 0){
|
||||||
|
params['p'] = partID
|
||||||
|
}
|
||||||
|
window.history.pushState('searching', '', 'parts?' + jQuery.param(params));
|
||||||
}
|
}
|
||||||
|
|
||||||
function perform_query() {
|
function perform_query() {
|
||||||
@@ -224,6 +260,8 @@ function perform_query() {
|
|||||||
$('#no-results').animate({opacity:1},2000);
|
$('#no-results').animate({opacity:1},2000);
|
||||||
console.log( "Query failed" );
|
console.log( "Query failed" );
|
||||||
});
|
});
|
||||||
|
|
||||||
|
update_url(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
function container_onchange() {
|
function container_onchange() {
|
||||||
@@ -239,22 +277,26 @@ function container_onchange() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// function octopartFetch(){
|
||||||
function octopartFetch(){
|
// $('#magic-autofill-button').attr('disabled', 'disabled');
|
||||||
$.getJSON(rootURL + 'fetchOctopartSnippet/' + $('#partno-input').val()).done(function(json){
|
// $.getJSON(rootURL + 'fetchOctopartSnippet/' + $('#partno-input').val()).done(function(json){
|
||||||
if (json['result']=='ok'){
|
// $('#magic-autofill-button').removeAttr('disabled');
|
||||||
$('#description-input').val(json['snippet']);
|
// if (json['result']=='ok'){
|
||||||
}else{
|
// $('#description-input').val(json['snippet']);
|
||||||
$('#description-input').val('');
|
// }else{
|
||||||
$('#description-input').attr('placeholder', json['result']);
|
// $('#description-input').val('');
|
||||||
}
|
// $('#description-input').attr('placeholder', json['result']);
|
||||||
});
|
// }
|
||||||
}
|
// }).fail(function() {
|
||||||
|
// $('#magic-autofill-button').removeAttr('disabled');
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$.ajaxSetup({ cache: false });
|
$.ajaxSetup({ cache: false });
|
||||||
$('.search-bar').on('keyup', function() {
|
$('.search-bar').on('keyup', function() {
|
||||||
perform_query();
|
clearTimeout(active_timer);
|
||||||
|
active_timer = setTimeout(perform_query, 100);
|
||||||
});
|
});
|
||||||
$('.checkbox').change( function() {
|
$('.checkbox').change( function() {
|
||||||
if ( !$('#location').is(':checked')
|
if ( !$('#location').is(':checked')
|
||||||
@@ -265,4 +307,19 @@ $(document).ready(function() {
|
|||||||
else
|
else
|
||||||
perform_query();
|
perform_query();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//For linking to a search query or specific part
|
||||||
|
const search_params = new URLSearchParams(window.location.search);
|
||||||
|
if(search_params.has('q')){
|
||||||
|
$('.search-bar').val(search_params.get('q')); perform_query();
|
||||||
|
}
|
||||||
|
if(search_params.has('p')){
|
||||||
|
show_part_info(search_params.get('p'));
|
||||||
|
}
|
||||||
|
|
||||||
|
// $('#partno-input').bind('blur',function() {
|
||||||
|
// if($('#partno-input').val().length > 0){
|
||||||
|
// octopartFetch();
|
||||||
|
// }
|
||||||
|
// });
|
||||||
});
|
});
|
||||||
Executable
+223
@@ -0,0 +1,223 @@
|
|||||||
|
html {
|
||||||
|
background-color: #D7E2E2;
|
||||||
|
color: #000F0F;
|
||||||
|
font-family: 'Roboto', sans-serif;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
padding: 16px;
|
||||||
|
margin: 0;
|
||||||
|
color: #D7E2E2;
|
||||||
|
background-color: #013A3A;
|
||||||
|
font-size: 150%;
|
||||||
|
}
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
color: #5E9292;
|
||||||
|
text-align: center;
|
||||||
|
padding: 12pt;
|
||||||
|
font-size: x-large;
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
font-size: 0.6em;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type=text].search-bar {
|
||||||
|
color: #404040;
|
||||||
|
padding: 6px;
|
||||||
|
margin-top: 16px;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
width: 90%;
|
||||||
|
font-size: 1.2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-container p {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-container {
|
||||||
|
background-color: #226666;
|
||||||
|
width: 90%;
|
||||||
|
display: inline-block;
|
||||||
|
border: 1px #226666 solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-container ul {
|
||||||
|
display: flex;
|
||||||
|
justify-content: stretch;
|
||||||
|
list-style: none;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-container li {
|
||||||
|
flex: 1;
|
||||||
|
font-size: 0.8em;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type=checkbox]{
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type=checkbox] + label.toggle-btn {
|
||||||
|
padding:6px 0 6px 0;
|
||||||
|
display: block;
|
||||||
|
color: rgba(94,146,146, 0.5);
|
||||||
|
background-color: #D7E2E2;
|
||||||
|
transition: 0.2s;
|
||||||
|
-webkit-transition: 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type=checkbox]:checked + label.toggle-btn {
|
||||||
|
color: #D7E2E2;
|
||||||
|
background-color: #226666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.round-floating-button {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
position: fixed;
|
||||||
|
bottom: 20px;
|
||||||
|
right: 20px;
|
||||||
|
width: 56px;
|
||||||
|
height: 56px;
|
||||||
|
border-radius: 28px;
|
||||||
|
background-color: #5E9292;
|
||||||
|
font-size: 32px;
|
||||||
|
box-shadow: 2pt 1pt 8pt black;
|
||||||
|
}
|
||||||
|
|
||||||
|
.round-floating-button a{
|
||||||
|
color: #D7E2E2;
|
||||||
|
}
|
||||||
|
|
||||||
|
#results {
|
||||||
|
width:100%;
|
||||||
|
margin-top: 1em;
|
||||||
|
border-collapse: collapse;
|
||||||
|
/*table-layout: fixed;*/
|
||||||
|
}
|
||||||
|
|
||||||
|
#results th {
|
||||||
|
background-color: #226666;
|
||||||
|
color: #D7E2E2;
|
||||||
|
padding: 4px 0 4px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#results th#location {
|
||||||
|
width: 20%;
|
||||||
|
}
|
||||||
|
#results th#partno {
|
||||||
|
width: 30%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#results td {
|
||||||
|
/*overflow: hidden;
|
||||||
|
white-space: nowrap;*/
|
||||||
|
padding: 5px 0 5px 0;
|
||||||
|
font-size: 0.7em;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
#results tr:nth-child(odd) {
|
||||||
|
background-color: #5E9292;
|
||||||
|
}
|
||||||
|
|
||||||
|
.shadow {
|
||||||
|
background-color: black;
|
||||||
|
display: none;
|
||||||
|
height: 100%;
|
||||||
|
left: 0;
|
||||||
|
opacity: 0.0;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
width: 100%;
|
||||||
|
z-index: 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
.overlay {
|
||||||
|
opacity: 0.0;
|
||||||
|
display: none;
|
||||||
|
background-color: #226666;
|
||||||
|
color: #D7E2E2;
|
||||||
|
width: 90%;
|
||||||
|
position: absolute;
|
||||||
|
margin:auto;
|
||||||
|
left:0;
|
||||||
|
right:0;
|
||||||
|
top:0;
|
||||||
|
z-index: 201;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
background-color: #013A3A;
|
||||||
|
padding: 8px 0 8px 0;
|
||||||
|
margin-top: 0;
|
||||||
|
font-size: 1.2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
#details {
|
||||||
|
width: 100%;
|
||||||
|
margin: 16px 0 16px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.details-header {
|
||||||
|
color: #013A3A;
|
||||||
|
}
|
||||||
|
|
||||||
|
.details-content td p{
|
||||||
|
font-size: 1em;
|
||||||
|
margin: 0 0 1em 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-container {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-evenly;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.round-button {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 56px;
|
||||||
|
height: 56px;
|
||||||
|
border-radius: 28pt;
|
||||||
|
background-color: #5E9292;
|
||||||
|
font-size: 32px;
|
||||||
|
box-shadow: 2pt 1pt 8pt black;
|
||||||
|
}
|
||||||
|
|
||||||
|
.round-button a {
|
||||||
|
color: #D7E2E2;
|
||||||
|
}
|
||||||
|
|
||||||
|
#map {
|
||||||
|
width: 90%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.small-square-button {
|
||||||
|
position: absolute;
|
||||||
|
top: 5px;
|
||||||
|
right: 10px;
|
||||||
|
font-size: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.small-square-button a {
|
||||||
|
color: #D7E2E2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pinfo-input {
|
||||||
|
width: 90%;
|
||||||
|
padding: 4px;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
Regular → Executable
+88
-159
@@ -2,7 +2,8 @@ html {
|
|||||||
background-color: #D7E2E2;
|
background-color: #D7E2E2;
|
||||||
color: #000F0F;
|
color: #000F0F;
|
||||||
font-family: 'Roboto', sans-serif;
|
font-family: 'Roboto', sans-serif;
|
||||||
font-size:large;
|
overflow-y: scroll;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
@@ -10,7 +11,7 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
padding: 16pt;
|
padding: 16px;
|
||||||
margin: 0 0 20pt 0;
|
margin: 0 0 20pt 0;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
color: #D7E2E2;
|
color: #D7E2E2;
|
||||||
@@ -41,39 +42,40 @@ a {
|
|||||||
|
|
||||||
input[type=text].search-bar {
|
input[type=text].search-bar {
|
||||||
color: #404040;
|
color: #404040;
|
||||||
font-size: x-large;
|
font-size: 1.6em;
|
||||||
padding: 5pt 8pt 5pt 8pt;
|
padding: 5pt 8pt 5pt 8pt;
|
||||||
margin-top: 8pt;
|
margin-top: 8pt;
|
||||||
margin-bottom: 8pt;
|
margin-bottom: 8pt;
|
||||||
margin-left: 20pt;
|
margin-left: 20pt;
|
||||||
width: 70%;
|
width: 70%;
|
||||||
border: 2pt solid grey;
|
border: 1px solid grey;
|
||||||
border-radius: 5pt;
|
|
||||||
}
|
|
||||||
|
|
||||||
.search-bar-container {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.filter-container {
|
|
||||||
background-color: #226666;
|
|
||||||
padding: 10pt 15pt 10pt 15pt;
|
|
||||||
margin-top: 10pt;
|
|
||||||
margin-bottom: 10pt;
|
|
||||||
display: inline-block;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.filter-container p {
|
.filter-container p {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
color: #D7E2E2;
|
font-size: 10px;
|
||||||
font-size: 10pt;
|
margin: 2px;
|
||||||
margin-top: 4pt;
|
|
||||||
margin-left: 3pt;
|
|
||||||
margin-bottom: 4pt;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.filter-concontainertainer {
|
.filter-container {
|
||||||
text-align: center;
|
width: 30%;
|
||||||
|
display: inline-block;
|
||||||
|
border: 1px #226666 solid;
|
||||||
|
color: #D7E2E2;
|
||||||
|
background-color: #226666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-container ul {
|
||||||
|
display: flex;
|
||||||
|
justify-content: stretch;
|
||||||
|
list-style: none;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-container li {
|
||||||
|
flex: 1;
|
||||||
|
font-size: 0.8em;
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type=checkbox]{
|
input[type=checkbox]{
|
||||||
@@ -81,69 +83,17 @@ input[type=checkbox]{
|
|||||||
}
|
}
|
||||||
|
|
||||||
input[type=checkbox] + label.toggle-btn {
|
input[type=checkbox] + label.toggle-btn {
|
||||||
display: inline-block;
|
padding:10px 0 10px 0;
|
||||||
padding: 5pt;
|
display: block;
|
||||||
color: #D7E2E2;
|
color: rgba(94,146,146, 0.5);
|
||||||
margin-top: 6pt;
|
background-color: #D7E2E2;
|
||||||
margin-bottom: 6pt;
|
|
||||||
margin-left: 3pt;
|
|
||||||
margin-right: 3pt;
|
|
||||||
width: 80pt;
|
|
||||||
line-height: 300%;
|
|
||||||
text-align: center;
|
|
||||||
border: 1pt solid #D7E2E2;
|
|
||||||
transition: 0.2s;
|
transition: 0.2s;
|
||||||
-webkit-transition: 0.2s;
|
-webkit-transition: 0.2s;
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type=checkbox]:checked + label.toggle-btn {
|
input[type=checkbox]:checked + label.toggle-btn {
|
||||||
background-color: #D7E2E2;
|
color: #D7E2E2;
|
||||||
color: #000F0F;
|
background-color: #226666;
|
||||||
}
|
|
||||||
|
|
||||||
div label input {
|
|
||||||
margin-right:100px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tooltip {
|
|
||||||
position: relative;
|
|
||||||
display: inline-block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tooltip .tooltiptext {
|
|
||||||
font-size: 10pt;
|
|
||||||
visibility: hidden;
|
|
||||||
width: 120px;
|
|
||||||
background-color: black;
|
|
||||||
color: #fff;
|
|
||||||
text-align: center;
|
|
||||||
border-radius: 6px;
|
|
||||||
padding: 5px 0;
|
|
||||||
position: absolute;
|
|
||||||
z-index: 1;
|
|
||||||
top: -5px;
|
|
||||||
right: 105%;
|
|
||||||
margin-left: -60px;
|
|
||||||
|
|
||||||
/* Fade in tooltip - takes 1 second to go from 0% to 100% opac: */
|
|
||||||
opacity: 0;
|
|
||||||
transition: opacity 0.2s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tooltip:hover .tooltiptext {
|
|
||||||
visibility: visible;
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tooltip .tooltiptext::after {
|
|
||||||
content: " ";
|
|
||||||
position: absolute;
|
|
||||||
top: 50%;
|
|
||||||
left: 100%; /* To the right of the tooltip */
|
|
||||||
margin-top: -5px;
|
|
||||||
border-width: 5px;
|
|
||||||
border-style: solid;
|
|
||||||
border-color: transparent transparent transparent black;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.shadow {
|
.shadow {
|
||||||
@@ -177,41 +127,14 @@ div label input {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.round-button {
|
.round-button {
|
||||||
position: absolute;
|
display: flex;
|
||||||
bottom: 15pt;
|
align-items: center;
|
||||||
left: calc(11% - 20pt);
|
justify-content: center;
|
||||||
width: 40pt;
|
width: 56px;
|
||||||
height: 32pt;
|
height: 56px;
|
||||||
border-radius: 20pt;
|
border-radius: 28px;
|
||||||
|
font-size: 32px;
|
||||||
background-color: #5E9292;
|
background-color: #5E9292;
|
||||||
font-size: 20pt;
|
|
||||||
padding-top: 8pt;
|
|
||||||
box-shadow: 2pt 1pt 8pt black;
|
|
||||||
}
|
|
||||||
|
|
||||||
.round-button-left {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 15pt;
|
|
||||||
left: calc(22% - 20pt);
|
|
||||||
width: 40pt;
|
|
||||||
height: 32pt;
|
|
||||||
border-radius: 20pt;
|
|
||||||
background-color: #5E9292;
|
|
||||||
font-size: 20pt;
|
|
||||||
padding-top: 8pt;
|
|
||||||
box-shadow: 2pt 1pt 8pt black;
|
|
||||||
}
|
|
||||||
|
|
||||||
.round-button-right {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 15pt;
|
|
||||||
left: calc(33% - 20pt);
|
|
||||||
width: 40pt;
|
|
||||||
height: 32pt;
|
|
||||||
border-radius: 20pt;
|
|
||||||
background-color: #5E9292;
|
|
||||||
font-size: 20pt;
|
|
||||||
padding-top: 8pt;
|
|
||||||
box-shadow: 2pt 1pt 8pt black;
|
box-shadow: 2pt 1pt 8pt black;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -219,20 +142,11 @@ div label input {
|
|||||||
color: #D7E2E2;
|
color: #D7E2E2;
|
||||||
}
|
}
|
||||||
|
|
||||||
.round-button-left a{
|
|
||||||
color: #D7E2E2;
|
|
||||||
}
|
|
||||||
|
|
||||||
.round-button-right a{
|
|
||||||
color: #D7E2E2;
|
|
||||||
}
|
|
||||||
|
|
||||||
.small-square-button {
|
.small-square-button {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 5pt;
|
top: 5px;
|
||||||
right: 5pt;
|
right: 10px;
|
||||||
padding-right: 5pt;
|
font-size: 40px;
|
||||||
font-size: 16pt;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.small-square-button a {
|
.small-square-button a {
|
||||||
@@ -240,17 +154,18 @@ div label input {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.round-floating-button {
|
.round-floating-button {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
bottom: 15pt;
|
bottom: 20px;
|
||||||
right: 15pt;
|
right: 20px;
|
||||||
width: 40pt;
|
width: 56px;
|
||||||
height: 32pt;
|
height: 56px;
|
||||||
border-radius: 20pt;
|
border-radius: 28px;
|
||||||
|
font-size: 32px;
|
||||||
background-color: #5E9292;
|
background-color: #5E9292;
|
||||||
font-size: 22pt;
|
|
||||||
padding-top: 8pt;
|
|
||||||
box-shadow: 2pt 1pt 8pt black;
|
box-shadow: 2pt 1pt 8pt black;
|
||||||
text-align: center;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.round-floating-button a{
|
.round-floating-button a{
|
||||||
@@ -261,19 +176,16 @@ div label input {
|
|||||||
font-size: 12pt;
|
font-size: 12pt;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bottom-spacer {
|
#results {
|
||||||
height: 80pt;
|
|
||||||
}
|
|
||||||
|
|
||||||
table#results {
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 1280px;
|
max-width: 1280px;
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
|
margin-top: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
table#results th {
|
#results th {
|
||||||
background-color: #226666;
|
background-color: #226666;
|
||||||
color: #D7E2E2;
|
color: #D7E2E2;
|
||||||
padding: 5pt;
|
padding: 5pt;
|
||||||
@@ -281,36 +193,52 @@ table#results th {
|
|||||||
border-left: 2px solid #D7E2E2;
|
border-left: 2px solid #D7E2E2;
|
||||||
}
|
}
|
||||||
|
|
||||||
table#results tr:nth-child(odd) {
|
#results tr:nth-child(odd) {
|
||||||
background-color: #5E9292;
|
background-color: #5E9292;
|
||||||
}
|
}
|
||||||
|
|
||||||
table#results td {
|
#results td {
|
||||||
padding: 4pt;
|
padding: 4pt;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
table#results #location {
|
#results #location {
|
||||||
width: 18%;
|
width: 18%;
|
||||||
}
|
}
|
||||||
|
|
||||||
table#results #partno {
|
#results #partno {
|
||||||
/*width: 20%;*/
|
/*width: 20%;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
table#results #description {
|
#results #description {
|
||||||
width: 70%;
|
width: 70%;
|
||||||
}
|
}
|
||||||
|
|
||||||
table#results #docs {
|
#results #docs {
|
||||||
width: 5%;
|
width: 5%;
|
||||||
}
|
}
|
||||||
|
|
||||||
table#details {
|
#info-container {
|
||||||
position: absolute;
|
|
||||||
left: 0;
|
|
||||||
width: 35%;
|
width: 35%;
|
||||||
margin-top: 0;
|
height: 85%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction:column;
|
||||||
|
justify-content:space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
#details {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#magical_autofill{
|
||||||
|
font-size: small;
|
||||||
|
}
|
||||||
|
|
||||||
|
a.small_link{
|
||||||
|
text-decoration: none;
|
||||||
|
color: #B0B0B0;
|
||||||
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
.details-header {
|
.details-header {
|
||||||
@@ -327,6 +255,11 @@ td p {
|
|||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.button-container {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-evenly;
|
||||||
|
}
|
||||||
|
|
||||||
.map {
|
.map {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 5%;
|
right: 5%;
|
||||||
@@ -342,8 +275,4 @@ td p {
|
|||||||
|
|
||||||
.nothidden{
|
.nothidden{
|
||||||
display: initial !important;
|
display: initial !important;
|
||||||
}
|
|
||||||
|
|
||||||
.results-locations{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
Executable
+118
@@ -0,0 +1,118 @@
|
|||||||
|
function new_user_entry() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function init_User_edit(userID, name) {
|
||||||
|
$('#save-button').attr("onclick", "saveUser(" + userID + ")");
|
||||||
|
$('#delete-button').attr("onclick", "deleteUser(" + userID + ")");
|
||||||
|
$('#user-name-input').val(name);
|
||||||
|
$('#user-password-input').val('');
|
||||||
|
overlay_in();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function saveUser(userID) {
|
||||||
|
var name_v = $('#user-name-input').val();
|
||||||
|
var password_v = $('#user-password-input').val();
|
||||||
|
|
||||||
|
if(name_v.length > 100) {
|
||||||
|
alert('Name too long (max 100 characters).')
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var data = new FormData();
|
||||||
|
|
||||||
|
data.append('password', password_v);
|
||||||
|
data.append('name', name_v)
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: rootURL + 'alterUser/' + userID,
|
||||||
|
type: 'POST',
|
||||||
|
data: data,
|
||||||
|
cache: false,
|
||||||
|
contentType: false,
|
||||||
|
processData: false,
|
||||||
|
success: function(data) {
|
||||||
|
alert("k.");
|
||||||
|
},
|
||||||
|
error: function() {
|
||||||
|
alert("Couldn't update the user information. Please retry.");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
end_edit();
|
||||||
|
$('#edit-button').click(function() {
|
||||||
|
init_edit(userID);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function deleteUser(userID) {
|
||||||
|
if (userID < 0){
|
||||||
|
alert('Congratulations! You found the secret UI bug easter egg! This button should not be here, yet I left it specifically because I wanted an easter egg and not because of any other reasons! Good for you!')
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!confirm('Delete the selected user? ')){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
url: rootURL + 'deleteUser/' + userID,
|
||||||
|
type: 'GET',
|
||||||
|
cache: false,
|
||||||
|
contentType: false,
|
||||||
|
processData: false,
|
||||||
|
success: function() {
|
||||||
|
alert("User removed.");
|
||||||
|
overlay_out();
|
||||||
|
location.reload();
|
||||||
|
},
|
||||||
|
fail: function() {
|
||||||
|
console.log('An error occurred while deleting the entry');
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function end_edit(){
|
||||||
|
//intentionally left blank
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function show_user_info(userID) {
|
||||||
|
$.getJSON(rootURL + 'getpartinfo/' + partID, function(data) {
|
||||||
|
$('table#details tr#location td p').text(text_filter(data.location_descriptor)); // name is the location friendly name
|
||||||
|
$('#location-dropdown').val(data.location_id);
|
||||||
|
$('#container-dropdown').val(data.container_id);
|
||||||
|
$('table#details tr#partno td p').text(text_filter(data.partno));
|
||||||
|
$('table#details tr#partno td input').val(text_filter(data.partno));
|
||||||
|
$('table#details tr#description td p').text(text_filter(data.description));
|
||||||
|
$('table#details tr#description td input').val(text_filter(data.description));
|
||||||
|
container_onchange();
|
||||||
|
if (data.datasheet != null) {
|
||||||
|
$('tr#datasheet-head').html($('<td>DATASHEET: <a href="parts/getfile/' + data.datasheet + '"><i class="fa fa-file-text" aria-hidden="true"></i></a></td>'));
|
||||||
|
$('#datasheet-input').val(data.datasheet);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$('tr#datasheet-head td').text('DATASHEET: ');
|
||||||
|
$('#edit-button').click(function() {
|
||||||
|
init_edit(partID);
|
||||||
|
});
|
||||||
|
$('#delete-button').click(function() {
|
||||||
|
delete_entry(partID);
|
||||||
|
});
|
||||||
|
overlay_in();
|
||||||
|
}).fail(function() {
|
||||||
|
console.log( "Fetching part info failed" );
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function placeMarker(locationID){
|
||||||
|
//temporarily not used
|
||||||
|
var $img = $('#clickablemap');
|
||||||
|
var currentClickPosX = event.pageX - $img.offset().left;
|
||||||
|
var currentClickPosY = event.pageY - $img.offset().top;
|
||||||
|
|
||||||
|
var correctX = (($img.prop('naturalWidth') / $img.width()) * currentClickPosX).toFixed(0);
|
||||||
|
var correctY = (($img.prop('naturalHeight') / $img.height()) * currentClickPosY).toFixed(0);
|
||||||
|
|
||||||
|
// $("#mapURL").html("elab.png?x=" + correctX + "&y=" + correctY);
|
||||||
|
$("#clickablemap").attr("src", "map/" + $("#mapfile-input").val() + "?x=" + correctX + "&y=" + correctY);
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
Looking for obsolete ICs that were discontinued years ago? Just start typing!
|
||||||
|
Looking for obsolete ICs that were discontinued years ago? Just start typing!
|
||||||
|
Looking for obsolete ICs that were discontinued years ago? Just start typing!
|
||||||
|
Looking for obsolete ICs that were discontinued years ago? Just start typing!
|
||||||
|
Looking for obsolete ICs that were discontinued years ago? Just start typing!
|
||||||
|
Start typing to find your part
|
||||||
|
Start typing to find your part
|
||||||
|
Start typing to find your part
|
||||||
|
Start typing to find your part
|
||||||
|
Start typing to find your part
|
||||||
|
Try typing "mosfet"
|
||||||
|
Try typing "arduino"
|
||||||
|
Try typing "led driver"
|
||||||
|
Try typing "resistor"
|
||||||
|
Try typing "regulator"
|
||||||
|
Try typing "led"
|
||||||
|
Try typing "78L05"
|
||||||
|
Try typing "drv8833"
|
||||||
|
Try typing "stm32"
|
||||||
|
Try typing "logic analyzer"
|
||||||
|
Try typing "programmer"
|
||||||
|
Try typing "connector"
|
||||||
|
Try typing "motor"
|
||||||
|
Try typing "spring"
|
||||||
|
Try typing "usb"
|
||||||
|
Try typing "Flux capacitor". We don't have one, but you can try.
|
||||||
|
You can also search for tools
|
||||||
|
Now with emoji support!
|
||||||
|
I know it's here somwhere!
|
||||||
|
For every part you find, there is 1000 you won't!
|
||||||
|
'); DROP TABLE parts;--
|
||||||
|
Help! I'm trapped in a tagline randomiser!
|
||||||
Regular → Executable
+4
-3
@@ -8,10 +8,10 @@
|
|||||||
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
|
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
|
||||||
crossorigin="anonymous"></script>
|
crossorigin="anonymous"></script>
|
||||||
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400" rel="stylesheet">
|
||||||
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='style.css') }}">
|
<link rel="stylesheet" type="text/css" href="{{ baseURL }}/static/style.css">
|
||||||
<script src="https://use.fontawesome.com/2fef7be393.js"></script>
|
<script src="https://use.fontawesome.com/2fef7be393.js"></script>
|
||||||
<script type="text/javascript" src="{{ url_for('static', filename='common.js') }}"></script>
|
<script type="text/javascript" src="{{ baseURL }}/static/common.js"></script>
|
||||||
<script type="text/javascript" src="{{ url_for('static', filename='locationEditorScript.js') }}"></script>
|
<script type="text/javascript" src="{{ baseURL }}/static/locationEditorScript.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>LOCATION EDITOR</h1>
|
<h1>LOCATION EDITOR</h1>
|
||||||
@@ -34,6 +34,7 @@
|
|||||||
</table>
|
</table>
|
||||||
<div class="bottom-spacer"></div>
|
<div class="bottom-spacer"></div>
|
||||||
|
|
||||||
|
<div class="shadow" onclick="overlay_out()"></div>
|
||||||
<div class="overlay">
|
<div class="overlay">
|
||||||
<h2>Part Details</h2>
|
<h2>Part Details</h2>
|
||||||
<table id="details">
|
<table id="details">
|
||||||
|
|||||||
Regular → Executable
+45
-44
@@ -2,33 +2,33 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width">
|
||||||
<title>ELAB Part Search Engine</title>
|
<title>ELAB Part Search Engine</title>
|
||||||
<script
|
<script
|
||||||
src="https://code.jquery.com/jquery-3.2.1.min.js"
|
src="https://code.jquery.com/jquery-3.2.1.min.js"
|
||||||
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
|
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
|
||||||
crossorigin="anonymous"></script>
|
crossorigin="anonymous"></script>
|
||||||
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400" rel="stylesheet">
|
||||||
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='style.css') }}">
|
<link rel="stylesheet" type="text/css" href="{{ baseURL }}/static/style.css" media="screen and (min-width:500px)">
|
||||||
<link rel="apple-touch-icon-precomposed" href="{{ url_for('static', filename='apple-touch-icon.png') }}">
|
<link rel="stylesheet" type="text/css" href="{{ baseURL }}/static/style-m.css" media="screen and (max-width:500px)">
|
||||||
|
<link rel="apple-touch-icon-precomposed" href="{{ baseURL }}/parts/static/apple-touch-icon.png">
|
||||||
|
|
||||||
<script src="https://use.fontawesome.com/2fef7be393.js"></script>
|
<script src="https://use.fontawesome.com/2fef7be393.js"></script>
|
||||||
<script type="text/javascript" src="{{ url_for('static', filename='common.js') }}"></script>
|
<script type="text/javascript" src="{{ baseURL }}/static/common.js"></script>
|
||||||
<script type="text/javascript" src="{{ url_for('static', filename='script.js') }}"></script>
|
<script type="text/javascript" src="{{ baseURL }}/static/script.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>ELAB Part Search Engine</h1>
|
<h1>ELAB Part Search Engine</h1>
|
||||||
<p>Looking for obsolete ICs that were discontinued years ago? Just start typing!</p>
|
<p>{{ tagline }}</p>
|
||||||
<div class="search-bar-container">
|
|
||||||
<input type="text" name="search-bar" class="search-bar" placeholder="Search parts">
|
<input type="text" name="search-bar" class="search-bar" placeholder="Search parts">
|
||||||
</div>
|
|
||||||
<div class="filter-concontainertainer">
|
|
||||||
<div class="filter-container">
|
<div class="filter-container">
|
||||||
<p>SEARCH IN</p>
|
<p>SEARCH IN</p>
|
||||||
<input type="checkbox" class="checkbox" id="location"></input><label class="toggle-btn" for="location">Locations<br/><i class="fa fa-map" style="font-size:28pt"></i></label>
|
<ul>
|
||||||
<input type="checkbox" class="checkbox" id="partno" checked></input><label class="toggle-btn" for="partno">Part Number<br/><i class="fa fa-hashtag" style="font-size:28pt"></i></label>
|
<li><input type="checkbox" class="checkbox" id="location"><label class="toggle-btn" for="location">Locations<br><i class="fa fa-map" style="font-size:20pt"></i></label></li>
|
||||||
<input type="checkbox" class="checkbox" id="description" checked></input><label class="toggle-btn" for="description">Description<br/><i class="fa fa-edit" style="font-size:28pt"></i></label>
|
<li><input type="checkbox" class="checkbox" id="partno" checked=""><label class="toggle-btn" for="partno">Part Number<br><i class="fa fa-hashtag" style="font-size:20pt"></i></label></li>
|
||||||
|
<li><input type="checkbox" class="checkbox" id="description" checked=""><label class="toggle-btn" for="description">Description<br><i class="fa fa-edit" style="font-size:20pt"></i></label></li>
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<table id="results">
|
<table id="results">
|
||||||
<tr>
|
<tr>
|
||||||
<th id="location">Location</th>
|
<th id="location">Location</th>
|
||||||
@@ -37,42 +37,43 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<h3 id="no-results">No results.</h3>
|
<h3 id="no-results">No results.</h3>
|
||||||
<div class="bottom-spacer"></div>
|
<div class="shadow" onclick="overlay_out();update_url(0);"></div>
|
||||||
|
|
||||||
<div class="shadow" onclick="overlay_out()"></div>
|
|
||||||
<div class="overlay">
|
<div class="overlay">
|
||||||
<h2>Part Details</h2>
|
<h2>Part Details</h2>
|
||||||
<div>
|
<div id="info-container">
|
||||||
<table id="details">
|
<img src="" id="map" class="map"/>
|
||||||
<tr id="location-head" class="details-header"><td>LOCATION</td></tr>
|
<table id="details">
|
||||||
<tr id="location" class="details-content"><td><p></p>
|
<tr id="location-head" class="details-header"><td>LOCATION</td></tr>
|
||||||
<select class="pinfo-input" id="container-dropdown" onchange="container_onchange()">
|
<tr id="location" class="details-content"><td><p></p>
|
||||||
{% for container in containers %}
|
<select class="pinfo-input" id="container-dropdown" onchange="container_onchange()">
|
||||||
<option value="{{container['id']}}">{{container['name']}}</option>
|
{% for container in containers %}
|
||||||
{% endfor %}
|
<option value="{{container['id']}}">{{container['name']}}</option>
|
||||||
</select>
|
{% endfor %}
|
||||||
<select class="pinfo-input" id="location-dropdown">
|
</select>
|
||||||
<option value="-1" selected="true">-- Select a container --</option>
|
<select class="pinfo-input" id="location-dropdown">
|
||||||
</select>
|
<option value="-1" selected="true">-- Select a container --</option>
|
||||||
</td></tr>
|
</select>
|
||||||
<tr id="partno-head" class="details-header"><td>PART NUMBER</td></tr>
|
</td></tr>
|
||||||
<tr id="partno" class="details-content"><td><p></p><input type="text" name="partno-input" placeholder="Part Number" class="pinfo-input" id="partno-input"/></td></tr>
|
<tr id="partno-head" class="details-header"><td>PART NUMBER</td></tr>
|
||||||
<tr id="description-head" class="details-header"><td>DESCRIPTION</td></tr>
|
<tr id="partno" class="details-content"><td><p></p><input type="text" name="partno-input" placeholder="Part Number" class="pinfo-input" id="partno-input"/></td></tr>
|
||||||
<tr id="description" class="details-content"><td><p></p><input type="text" name="description-input" placeholder="Description" class="pinfo-input" id="description-input"/></td></tr>
|
<tr id="description-head" class="details-header"><td>DESCRIPTION</td></tr>
|
||||||
<tr id="magical_autofill" style="display:none"><td><input type="button" id="magic-autofill-button" onclick="octopartFetch()" value="magical auto-fill" style="margin-bottom:6pt"/></td></tr>
|
<tr id="description" class="details-content"><td><p></p><input type="text" name="description-input" placeholder="Description" class="pinfo-input" id="description-input"/></td></tr>
|
||||||
<tr id="datasheet-head" class="details-header"><td>DATASHEET: </td></tr>
|
<!-- <tr id="magical_autofill" style="display:none"><td><input type="button" id="magic-autofill-button" onclick="octopartFetch()" value="magical auto-fill" style="margin-bottom:6pt"/> powered by <a href="http://octopart.com" class="small_link">OctoPart™</a></td></tr> -->
|
||||||
<tr id="datasheet" style="display: none"><td><input type="file" accept=".pdf" class="pinfo-input" id="datasheet-finput"></td></tr>
|
<tr id="datasheet-head" class="details-header"><td>DATASHEET: </td></tr>
|
||||||
<tr id="datasheet" style="display: none"><td>OR: <input type="text" class="pinfo-input" name="datasheet-url-input" style="width:80%; margin-bottom: 6pt;" placeholder="Datasheet URL"></td></tr>
|
<tr id="datasheet" style="display: none"><td><input type="file" accept=".pdf" class="pinfo-input" id="datasheet-finput"></td></tr>
|
||||||
<tr id="notes-head" class="details-header"><td>NOTES</td></tr>
|
<tr id="datasheet" style="display: none"><td>OR: <input type="text" class="pinfo-input" name="datasheet-url-input" style="width:80%; margin-bottom: 6pt;" placeholder="Datasheet URL"></td></tr>
|
||||||
<tr id="notes" class="details-content"><td><p></p><input type="text" name="notes-input" class="pinfo-input" placeholder="Notes"></td></tr>
|
<tr id="notes-head" class="details-header"><td>NOTES</td></tr>
|
||||||
</table>
|
<tr id="notes" class="details-content"><td><p></p><input type="text" name="notes-input" class="pinfo-input" placeholder="Notes"></td></tr>
|
||||||
<img src="" id="map" class="map"/>
|
<tr id="missing" class="details-content"><td><p></p></td></tr>
|
||||||
|
</table>
|
||||||
|
<div class="button-container">
|
||||||
|
<div class="round-button"><a href="#" id="delete-button"><i class="fa fa-trash" aria-hidden="true"></i></a></div>
|
||||||
|
<div class="round-button"><a href="#" id="edit-button"><i class="fa fa-pencil" aria-hidden="true"></i></a></div>
|
||||||
|
<div class="round-button"><a href="#" id="duplicate-button" onclick="init_edit(-1)"><i class="fa fa-copy" aria-hidden="true"></i></a></div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div class="round-button-left"><a href="#" id="edit-button"><i class="fa fa-pencil" aria-hidden="true"></i></a></div>
|
<div class="small-square-button"><a href="#" onclick="overlay_out();update_url(0);"><i class="fa fa-times" aria-hidden="true"></i></a></div>
|
||||||
<div class="round-button"><a href="#" id="delete-button"><i class="fa fa-trash" aria-hidden="true"></i></a></div>
|
|
||||||
<div class="round-button-right"><a href="#" id="duplicate-button" onclick="init_edit(-1)"><i class="fa fa-copy" aria-hidden="true"></i></a></div>
|
|
||||||
<div class="small-square-button"><a href="#" onclick="overlay_out()"><i class="fa fa-times" aria-hidden="true"></i></a></div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="round-floating-button"><a href="#" onclick="new_entry()"><i class="fa fa-plus" aria-hidden="true"></i></a></div>
|
<div class="round-floating-button"><a href="#" onclick="new_entry()"><i class="fa fa-plus" aria-hidden="true"></i></a></div>
|
||||||
|
|||||||
Executable
+53
@@ -0,0 +1,53 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>ELAB Part Search Engine - User editor</title>
|
||||||
|
<script
|
||||||
|
src="https://code.jquery.com/jquery-3.2.1.min.js"
|
||||||
|
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
|
||||||
|
crossorigin="anonymous"></script>
|
||||||
|
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" type="text/css" href="{{ baseURL }}/static/style.css">
|
||||||
|
<script src="https://use.fontawesome.com/2fef7be393.js"></script>
|
||||||
|
<script type="text/javascript" src="{{ baseURL }}/static/common.js"></script>
|
||||||
|
<script type="text/javascript" src="{{ baseURL }}/static/userEditorScript.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>USER EDITOR</h1>
|
||||||
|
<p>Get in! Get out! Get your fresh users here! <a href=".">back to parts</a></p>
|
||||||
|
<table id="results" class="results-locations">
|
||||||
|
<tr>
|
||||||
|
<th>ID</th>
|
||||||
|
<th>Username</th>
|
||||||
|
</tr>
|
||||||
|
{% for user in users %}
|
||||||
|
<tr onclick="init_User_edit({{user['id']}}, '{{user['username']}}');">
|
||||||
|
<td>{{user['id']}}</td>
|
||||||
|
<td>{{user['username']}}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
<div class="bottom-spacer"></div>
|
||||||
|
|
||||||
|
<div class="shadow" onclick="overlay_out()"></div>
|
||||||
|
<div class="overlay">
|
||||||
|
<h2>User Details</h2>
|
||||||
|
<table id="details">
|
||||||
|
<tr><td>Adding a new user</td></tr>
|
||||||
|
|
||||||
|
<tr><td>Name and password for new user<br />Example: "noob"</td></tr>
|
||||||
|
<tr><td><p></p><input type="text" name="user-name-input" id="user-name-input" placeholder="Name" class="pinfo-input nothidden"/></td></tr>
|
||||||
|
<tr><td><p></p><input type="password" name="user-password-input" id="user-password-input" placeholder="Password" class="pinfo-input nothidden"/></td></tr>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</table>
|
||||||
|
<div class="round-button-left"><a href="#" id="save-button"><i class="fa fa-check" aria-hidden="true"></i></a></div>
|
||||||
|
<div class="round-button"><a href="#" id="delete-button"><i class="fa fa-trash" aria-hidden="true"></i></a></div>
|
||||||
|
<div class="small-square-button"><a href="#" onclick="overlay_out()"><i class="fa fa-times" aria-hidden="true"></i></a></div>
|
||||||
|
</div>
|
||||||
|
<div class="round-floating-button"><a href="#" onclick="init_User_edit(-1, '', 0)"><i class="fa fa-plus" aria-hidden="true"></i></a></div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 49 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 210 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 204 KiB |
@@ -1,18 +1,57 @@
|
|||||||
#ELAB Part Search
|
# ELAB Part Search
|
||||||
ELABs custom inventory system for locating components.
|
ELABs custom inventory system for locating components.
|
||||||
|
|
||||||
##Design and use
|
## Design and use
|
||||||
The system allows searching for parts in ELAB by part name or a description text and returns the location of the part - a drawer or other compartment name and a map illustration. Finding obscure, outdated ICs was never this easy!
|
The system allows searching for parts in ELAB by part name or a description text and returns the location of the part - a drawer or other compartment name and a map illustration. Finding obscure, outdated ICs was never this easy!
|
||||||
|
|
||||||
|
|
||||||
##Requirements
|
##Requirements (Debian-based systems)
|
||||||
Python, and the following packages:
|
|
||||||
|
|
||||||
|
$ sudo apt install python3 python3-pip libpq-dev postgresql-13 nginx git
|
||||||
|
|
||||||
|
Python packages:
|
||||||
|
|
||||||
* flask
|
* flask
|
||||||
* flask-login
|
* requests
|
||||||
* sqlalchemy
|
* sqlalchemy
|
||||||
* werkzeug
|
* werkzeug
|
||||||
* pillow
|
* pillow
|
||||||
|
* psycopg2
|
||||||
|
|
||||||
##Work in progress
|
## Adding a part
|
||||||
The system is currently being worked on. No touchy!
|
|
||||||
|
**PREREQUISITE** - In order to add a part to the database, you have to have access credentials.
|
||||||
|
|
||||||
|
### Procedure
|
||||||
|
|
||||||
|
To start adding a part, visit the Elab Part Search main page, then click the Add button.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
A dialog will appear in which you can input all the relevant information about the part you are adding. The more information you can fill in, the easier will be for the next person to actually find what they are looking for!
|
||||||
|
|
||||||
|
Start by selecting the primary location of where the part will be stored. A map indicating where the selected place is located will appear in the empty space to the right.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
The second drop-down menu will now be populated with all the sub-location contained in the primary location you have selected. You can now start filling in the rest of the information, following the general guidelines described in the next section.
|
||||||
|
|
||||||
|
When you are done, click the confirm button.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
If you aren't already logged in, this action will spawn a login prompt. You should need to login only once.
|
||||||
|
|
||||||
|
AND DONE! Congratulations! You have added a part to the database! Only 563945679387340 to go.
|
||||||
|
|
||||||
|
### Part information guidelines
|
||||||
|
|
||||||
|
* The Part Number field should contain the part number (you don't say) of the component. If you don't have a part number, a short description is ok. Example 1: LM358AP. Example 2 (no part number): Rubber feet.
|
||||||
|
* The Description field is meant for a longer description (wow very helpful) for the part, which helps the future user to find this component even if they don't really know what part number they are looking for. It's good to include the part package, its main features, or in general some keyword-style information. Example 1: Op-amp, dual, 30V, 700kHz, 2mV input offset, 8-DIP. Example 2: Rubber feet PCB standoff with adhesive tape.
|
||||||
|
* The *magical auto-fill* button used to fetch a description from octopart.com so you don't have to come up with one. It has been broken since Octopart changed their API. Feel free to fix it! Trust me, it'll be fun!
|
||||||
|
* For the Datasheet, you have the option of either uploading a PDF that you have on your computer, or just pasting a link you found on the internet. If you upload a file, it will be stored on our servers, so that means we will have it even after it gets completely removed from the internet. Pasting a link is quicker, though, so I get it if you do that instead.
|
||||||
|
* The Notes field is for notes.
|
||||||
|
|
||||||
|
## Work in progress
|
||||||
|
The system is currently being worked on. No touchy!
|
||||||
|
|||||||
Reference in New Issue
Block a user