188 Commits
Author SHA1 Message Date
marek 43006ce150 Updated to sqlalchemy 2.x, as well as newer python version.
New syntax to query execution, as well as some string literal comparison stuff
2026-05-13 13:20:09 +02:00
marek c3f1bba1d7 Merge pull request 'map-with-names' (#14) from map-with-names into master
Reviewed-on: #14
2024-02-19 23:33:44 +01:00
marek 736cf7e065 final change because now it works 2024-02-19 23:30:09 +01:00
marek 68e10ec2ea maybe working with add part button 2024-02-19 23:23:41 +01:00
marek b9142f71e0 made map show annotation on edit 2024-02-19 23:09:23 +01:00
marek 8818b7d801 this is the only way to tests things 2024-02-19 23:01:52 +01:00
marek 34d58dcfc9 fix the stoopid 2024-02-19 22:56:18 +01:00
marek 0b77656e05 map with names 2024-02-19 22:53:44 +01:00
marek 316c9323c2 can i even push to master 2024-02-19 19:45:11 +01:00
marek 1e6ac07e9e Merge pull request 'fixed bug where it was possible to set an empty location' (#13) from fix-empty-location into master
Reviewed-on: #13
2024-02-19 18:57:47 +01:00
marek 0c8ebeea3b fixed inability to edit parts 2024-02-19 18:38:29 +01:00
marek c4da0395fa added how to on adding users 2023-04-05 21:30:52 +02:00
marek 2d412372b1 Merge pull request 'fixed issue with being able to add a part to an empty location' (#12) from fix-empty-location into master
Reviewed-on: #12
2023-04-05 21:26:31 +02:00
marek c11c192d1c fixed issue with being able to add a part to an empty location 2023-04-05 21:25:51 +02:00
marek 3c3f72b14f removed autodeploy 2023-04-05 21:24:11 +02:00
marek 435e771e10 Merge pull request 'fixed creating new users using userEditor' (#10) from fix-creating-users into master
Reviewed-on: #10
2023-04-05 19:36:52 +02:00
marek 81409dc448 fixed creating new users using userEditor 2023-04-05 19:20:53 +02:00
marek cd224a685b Merge pull request 'clear-partid-when-closing-part-vuew' (#7) from clear-partid-when-closing-part-vuew into master
Reviewed-on: #7
2022-11-30 13:07:06 +01:00
marek 6998c7eff2 clicking away the overlay by clicking outside of it also works with url 2022-11-30 13:05:15 +01:00
marek 807c136143 fixed previous commit by writing javascript not in python 2022-11-30 13:01:47 +01:00
marek 51022e79bd made url not contain part id when part view closed 2022-11-30 12:52:46 +01:00
marek b698ec446f Merge pull request 'tagline-randomizer' (#4) from tagline-randomizer into master
Reviewed-on: #4
2022-11-28 22:18:37 +01:00
marek 4bceb35bd5 added more taglines 2022-11-28 22:15:33 +01:00
marek b3f8f890f4 tagline randomiser 2022-11-28 22:08:37 +01:00
marek fcf5f25c16 de-triced a piece of code 2022-11-28 21:38:57 +01:00
willd baed641f31 Merge pull request 'wilhelm-usereditor' (#2) from wilhelm-usereditor into master
Reviewed-on: #2
2022-11-28 21:32:47 +01:00
marek f57ac131ff Merge remote-tracking branch 'origin/wilhelm-usereditor' into wilhelm-usereditor 2022-11-28 21:32:28 +01:00
willd 961fb859f4 Flask run fix 2022-11-28 21:32:02 +01:00
willd f331be7a89 Change to prod url 2022-11-28 21:32:02 +01:00
willd a549c16548 User editor, baseURL change, remove octopart autofill 2022-11-28 21:32:02 +01:00
willd 8bb2a9d318 Preparatory work for user editor 2022-11-28 21:31:34 +01:00
Parts 2be1d78d39 Updated readme 2022-11-28 21:31:34 +01:00
root 21e7356a99 Python3 fixes 2022-11-28 21:31:18 +01:00
marek ab663b1dec Merge pull request 'html spot for missing since text' (#3) from missing-feature into master
Reviewed-on: #3
2022-11-28 21:30:10 +01:00
marek 3cbff49168 html spot for missing since text 2022-11-28 21:28:32 +01:00
willd 6897d0f8ac Flask run fix 2022-11-28 21:23:06 +01:00
willd feb1aea5c3 Change to prod url 2022-11-28 21:21:56 +01:00
willd 4f5df6c1fe User editor, baseURL change, remove octopart autofill 2022-11-28 21:16:34 +01:00
willd 1c8bdc69f6 Preparatory work for user editor 2022-11-28 21:13:49 +01:00
marek a9ee37f96e commented out Octopart Magic autofill until we fix the API 2022-11-28 20:25:21 +01:00
marek 3edd0542b8 gitignore mac garbage 2022-11-28 20:23:53 +01:00
marek 3754174c7d URL is now shareable 2022-11-28 20:23:43 +01:00
marek 6077dd4228 direct linking to search queries and parts 2022-11-28 19:21:52 +01:00
Parts 90b948a057 Updated readme 2022-11-23 21:39:20 +01:00
davide 40f8263006 Update 'readme.md' 2022-02-17 10:05:34 +01:00
davide aebd74d185 Update 'readme.md' 2022-02-17 10:01:38 +01:00
davide d38013d00a Update 'readme.md' 2022-02-17 09:55:16 +01:00
davide 2c14234e8d Update 'readme.md' 2022-02-17 09:53:05 +01:00
davide 43ec84a3ca Upload files to 'pics' 2022-02-17 09:26:21 +01:00
root 53db127b14 Python3 fixes 2022-02-16 18:56:53 +01:00
Wilhelm Westermark 2f67fbf69a Updated for python 3.9 compat 2021-08-19 20:21:19 +02:00
davide 389409d814 Hiding UI elements on first overlay in on mobile 2018-11-20 00:11:21 +01:00
davide c10a0258f6 Also forgot to include style for no results 2018-11-20 00:08:29 +01:00
davide fd8540d4e1 Forgot to remove a line 2018-11-20 00:04:50 +01:00
davide fd7c400bfe Fixed filter colors 2018-11-20 00:02:04 +01:00
davide 066c38db80 Left align text 2018-11-20 00:01:27 +01:00
davide 5c3aacfedf Oops. Re-fixed addressing. 2018-11-19 23:35:59 +01:00
davide af3d1f3200 Changed script to accommodate for heavy restyling 2018-11-19 23:32:06 +01:00
davide 47c25847f0 Heavy restyling 2018-11-19 23:31:43 +01:00
davide c6168f5281 Added viewport width and CSS media queries 2018-11-19 22:19:46 +01:00
davide 2de8a7bb99 Merge branch 'master' of git.elab.kth.se:davide/ELAB-partsearch 2018-11-19 22:14:48 +01:00
davide f4fe883955 Added CSS for mobile 2018-11-19 22:14:19 +01:00
davide d7e9615453 Always show scrollbar 2018-11-19 09:35:08 +01:00
davide f2ddbd6fdf Changed inactive filter button color 2018-11-19 09:32:00 +01:00
davide d70c5dbde3 ... and height 2018-11-16 17:26:32 +01:00
davide f1c32251f7 Corrected css property name 2018-11-16 17:25:39 +01:00
davide 71ed8a60f4 Fixed floating button style to more consistently center the plus sign. 2018-11-16 08:12:52 +01:00
davide ae96e7457c Re-activating button in case of failure 2018-11-15 16:37:55 +01:00
davide 5da9712276 Location should now stay the same on creation of new part 2018-11-15 16:33:47 +01:00
davide ff55c778ef Added background shadow 2018-11-15 16:31:24 +01:00
davide bcbdc6b52a Whoops. Fixed for real now 2018-11-15 15:42:36 +01:00
davide dac5d96f03 Fixed setting location in dropdown on show_part_info 2018-11-15 15:37:17 +01:00
davide 97a208f48c Fixed dropdown population order 2018-11-15 13:10:56 +01:00
davide 6e13be37e6 Merge branch 'master' of git.elab.kth.se:davide/ELAB-partsearch 2018-11-14 18:41:10 +01:00
davide 0789b3a0d8 Fixed location search 2018-11-14 18:40:39 +01:00
marek 4cf02f26c4 octopart link pretty 2018-11-14 16:40:40 +01:00
marek f4235556f7 octopart-fetch button is mash-like-an-idiot proof 2018-11-14 16:40:28 +01:00
davide dc880978ab Updated dependencies in readme 2018-11-14 14:09:06 +01:00
davide 582370a17d Merge branch 'master' of git.elab.kth.se:davide/ELAB-partsearch 2018-11-13 22:50:59 +01:00
davide 11b3ae1af5 Reset file input when opening new part info. 2018-11-13 22:50:54 +01:00
marek 82f1c364de Merge branch 'master' of https://git.elab.kth.se/davide/ELAB-partsearch 2018-11-13 22:50:41 +01:00
marek 38c22af31f fixed octopart fetch for server encoding issues 2018-11-13 22:50:29 +01:00
davide 112686b9c6 Merge branch 'master' of git.elab.kth.se:davide/ELAB-partsearch 2018-11-13 22:38:55 +01:00
davide d64923ddad Added missing leading slash 2018-11-13 22:38:40 +01:00
marek 2a8b1f50f4 Merge branch 'master' of https://git.elab.kth.se/davide/ELAB-partsearch 2018-11-13 22:10:44 +01:00
marek 7e60da9362 octopart button now with more sponsor product placement! 2018-11-13 22:10:26 +01:00
marek 227e725e95 more magical octopart button prototype (temporarily disabled) 2018-11-13 22:09:34 +01:00
davide a8496af806 Merge branch 'master' of git.elab.kth.se:davide/ELAB-partsearch 2018-11-13 22:07:32 +01:00
davide cc6a1473cb Correctly deleting existing datasheet 2018-11-13 22:07:19 +01:00
davide b44d05aabd Resetting url input on new part if datasheet is empty 2018-11-13 22:07:02 +01:00
marek 3cb81e9a79 Merge branch 'master' of https://git.elab.kth.se/davide/ELAB-partsearch 2018-11-13 21:58:49 +01:00
marek b297462d3b fixed location editor 2018-11-13 21:58:38 +01:00
davide 40186ad08e Fixed getfile 2018-11-13 21:51:56 +01:00
davide a7751dc38b Added query timer 2018-11-13 21:35:37 +01:00
davide e2003e3562 Merge branch 'master' of git.elab.kth.se:davide/ELAB-partsearch 2018-11-13 21:09:31 +01:00
davide 7e1f59f781 Delete button now deletes only once. 2018-11-13 21:09:17 +01:00
marek 4649723f87 Merge branch 'master' of https://git.elab.kth.se/davide/ELAB-partsearch 2018-11-13 20:56:51 +01:00
marek 0b64c50f36 fixed links for the locationEditor 2018-11-13 20:56:44 +01:00
davide 597898885b Re-inserted auth requirements 2018-11-13 20:49:10 +01:00
davide 55033f7295 Fixed static files paths. 4real 2018-11-13 20:38:48 +01:00
davide 8d1237011a Corrected static folder location 2018-11-13 20:18:21 +01:00
davide 70401139f9 Fixed parenthesis issue 2018-11-13 19:31:43 +01:00
davide 4429a2a4f6 Merge branch 'master' of git.elab.kth.se:davide/ELAB-partsearch
# Conflicts:
#	parts/server.py
2018-11-13 19:28:54 +01:00
davide 725d2b0cdd Deleted some old code 2018-11-13 19:24:45 +01:00
davide 3793f4a865 Added notes feature 2018-11-13 19:24:33 +01:00
marek e3f25e76f2 added tracking of who added which part; requires database update though. 2018-11-13 19:12:45 +01:00
davide d6f0421b9f Returning notes in query 2018-11-13 19:04:33 +01:00
marek e5f6341d4e Merge branch 'master' of https://git.elab.kth.se/davide/ELAB-partsearch 2018-11-13 18:14:32 +01:00
marek c29d0af836 main results table width limited 2018-11-13 18:14:16 +01:00
davide 383bf4d220 Merge branch 'master' of git.elab.kth.se:davide/ELAB-partsearch 2018-11-13 18:13:28 +01:00
davide 1e8576af1c Removed margin from part details 2018-11-13 18:13:13 +01:00
marek c0f0fd732f Merge branch 'master' of https://git.elab.kth.se/davide/ELAB-partsearch 2018-11-13 17:33:25 +01:00
marek b871e98cbb removed the key file from the repo, so it doesn't get overwritten 2018-11-13 17:33:10 +01:00
davide db55a5769e Merge branch 'master' of git.elab.kth.se:davide/ELAB-partsearch
# Conflicts:
#	parts/static/script.js
2018-11-13 17:23:15 +01:00
davide 0e949dff50 Minor style adjustments 2018-11-13 17:16:33 +01:00
marek ad643464cb octopart search added. note: the API key is NOT included in the public repo, for obvious reasons. 2018-11-13 15:23:51 +01:00
davide 4541fab34e Removed debug prints 2018-11-13 14:58:31 +01:00
davide 50e4903a30 Check if user has selected a location 2018-11-13 14:58:20 +01:00
davide d65de687d8 Opening datasheet in new tab 2018-11-13 14:58:07 +01:00
davide afecca7172 Appending datasheet url to form data 2018-11-13 14:50:24 +01:00
davide 623770091b Fixed not retrieving correctly the location_id 2018-11-13 14:50:10 +01:00
davide 7098d19225 Fixed datsheet info upload check. NOW WITH TRY-CATCH! 2018-11-13 14:49:35 +01:00
davide 08b8646374 Minor style adjustments 2018-11-13 14:48:03 +01:00
davide 590701fe22 Typo 2018-11-13 13:51:33 +01:00
davide da5339a473 Handling datasheet URLs 2018-11-13 13:50:18 +01:00
davide caf1efce0c Fixed shadow position 2018-11-13 13:37:06 +01:00
davide a222906fe2 Added datasheet URL possiblity 2018-11-13 13:36:57 +01:00
davide c568635f60 Removed has docs filter 2018-11-13 13:36:21 +01:00
davide b3aad9a1ca Merge branch 'master' of git.elab.kth.se:davide/ELAB-partsearch 2018-11-13 08:57:17 +01:00
davide db19e86f73 Fixed location search filter 2018-11-13 08:55:44 +01:00
marek 4f1e51e7bd made the site a little better looking on any mobile phone that is exactly my iphone. 2018-11-13 01:20:59 +01:00
marek 6120420f56 added an ugly favicon. Note: the default one that we get the 404 error about will be taken from the root domain elab.kth.se anyway. 2018-11-13 00:34:45 +01:00
marek d1bd2aa0ec Locations can now be deleted. I have created you, now I can destroy you! 2018-11-13 00:14:05 +01:00
marek 954b449757 location editor can now be used to edit locations. And add them! 2018-11-12 20:56:12 +01:00
marek a99a356985 hiding overlay is more reliable 2018-11-12 20:55:34 +01:00
marek 44adb43466 made /parts/ work in URL just as well as /parts 2018-11-12 20:55:10 +01:00
davide c886f2e860 Merge branch 'master' of git.elab.kth.se:davide/ELAB-partsearch
# Conflicts:
#	parts/static/script.js
2018-11-12 17:31:56 +01:00
davide 501491ac9a Added file size check 2018-11-12 17:26:36 +01:00
davide 257a8d9754 Turned "search in notes" into "has docs". Added cool icons. Fixed animation of No results. 2018-11-12 14:31:31 +01:00
davide 005ea98f59 Empty results table if no results 2018-11-12 13:48:19 +01:00
davide e9b670bea8 Fixed syntax error. Minor refactoring. 2018-11-12 13:45:18 +01:00
marek 846b7297ce location editor lists the new style of locations. Actual adding/editing locations coming soon. 2018-11-12 01:48:16 +01:00
marek 777942aeaa removed placeholder vault.png, resized "HERE" pointer 2018-11-12 01:19:00 +01:00
marek 2ce132868c fixed saving the location_id instead of container_id when adding or editing a part 2018-11-12 01:16:16 +01:00
marek 694310a733 TEMPORARY disabled datasheet posting, because otherwise could not test other related functionality 2018-11-12 01:15:41 +01:00
marek 42fb09f89b ALL the maps and overlays! Please don't move any furniture in lab nao. 2018-11-12 00:01:31 +01:00
davide 4c78533976 Added part number empty check 2018-11-11 22:30:27 +01:00
davide 240293cf01 Various small changes 2018-11-11 22:26:18 +01:00
davide 95fe77ce16 Gave class to dropdown 2018-11-11 22:25:26 +01:00
davide 90079c70cd Removed map upper margin 2018-11-11 22:25:11 +01:00
davide 6670487ac0 Fixed minor issues 2018-11-11 20:58:08 +01:00
davide 2efb06ef3c Merge branch 'master' of git.elab.kth.se:davide/ELAB-partsearch 2018-11-11 20:45:13 +01:00
davide 863ce49e98 Added container dropdown. Modified container-dropdown onchange event. 2018-11-11 20:45:08 +01:00
marek 9c80db4943 Merge branch 'master' of https://git.elab.kth.se/davide/ELAB-partsearch 2018-11-11 20:42:26 +01:00
marek 0fdcd100ff maps with container overlays 2018-11-11 20:42:09 +01:00
marek c4ca575ca1 new maps 2018-11-11 20:41:31 +01:00
davide 3788060c78 Fetching containers instead of locations. Fixed query and relative script for get_part_info 2018-11-11 20:27:43 +01:00
marek d31799b3aa endpoint for listing locations in a given container 2018-11-11 20:05:55 +01:00
marek 5df74f1276 Merge branch 'master' of https://git.elab.kth.se/davide/ELAB-partsearch 2018-11-11 18:46:31 +01:00
marek 7c1fd24cb0 location containers part 1. Mostly broken. 2018-11-11 18:46:17 +01:00
davide 329b076dec Merge branch 'master' of git.elab.kth.se:davide/ELAB-partsearch 2018-11-11 18:26:13 +01:00
davide f072ffab4a Added new button, with style. 2018-11-11 18:26:01 +01:00
davide e25d09aa5d Removed unnecessary comments. Re-performing query on save. Hiding/showing duplicate button. Fixed text field text showing the correct thing. 2018-11-11 18:25:42 +01:00
davide a40748d0b2 Fixed deleting 2018-11-11 18:24:28 +01:00
Wilhelm Westermark 9da62db5b8 Merge branch 'master' of git.elab.kth.se:davide/ELAB-partsearch 2018-11-11 17:45:22 +01:00
Wilhelm Westermark 6158439525 More deploy stuff 2018-11-11 17:45:18 +01:00
davide 752b32cf7a Merge branch 'master' of git.elab.kth.se:davide/ELAB-partsearch 2018-11-11 17:31:31 +01:00
davide 1d5eefd87b Correctly displaying location name 2018-11-11 17:31:04 +01:00
Wilhelm Westermark e592f300bb Merge branch 'master' of git.elab.kth.se:davide/ELAB-partsearch 2018-11-11 17:25:01 +01:00
Wilhelm Westermark 706038bf09 More deploy stuff 2018-11-11 17:24:57 +01:00
davide 161c866804 Merge branch 'master' of git.elab.kth.se:davide/ELAB-partsearch 2018-11-11 17:15:39 +01:00
davide 20db75a8d7 Populating paragraphs on end edit. Can't add a bunch of stuff now. 2018-11-11 17:15:22 +01:00
davide a0a090b5c0 Server returns id of added/modified part. Removed authentication for now. 2018-11-11 17:14:40 +01:00
Wilhelm Westermark 839d2f87f5 Added secret token for webhook 2018-11-11 16:48:47 +01:00
Wilhelm Westermark 56d2f9996c Merge branch 'master' of git.elab.kth.se:davide/ELAB-partsearch 2018-11-11 16:40:51 +01:00
Wilhelm Westermark ca5d9e392d Added autodeploy stuff 2018-11-11 16:40:05 +01:00
davide c1874759e2 Fixed modify part not working 2018-11-11 16:18:44 +01:00
marek 2029ef5aeb made location listing part of the template, rather than an unnecesary AJAX request + secret sauce sorting 2018-11-11 01:19:32 +01:00
marek fd4f29ca7d temporary placeholder map for the VAULT. Hopefully just temporary and won't stay forever. 2018-11-11 00:53:19 +01:00
marek 00a2d6f070 location editor (MVP - can only add locations) 2018-11-11 00:52:30 +01:00
marek d131bcede6 removed a temporary test file and script relating to it 2018-11-11 00:52:03 +01:00
marek 3518c04c09 split script.js into a "common.js" that is useful for other pages and regular "script.js" for only the main page 2018-11-11 00:51:16 +01:00
marek 2d867f327c made the map styling reusable for the clickable map. I'm working under the wild assumption that we might not desperatly need a class called exactly "map" in a place different than specifically in an element named "overlay" 2018-11-10 23:31:16 +01:00
marek 513cc34bdd removed alpha channel from map before sending, to further reduce bandwidth abuse 2018-11-10 21:59:01 +01:00
marek 1234bdfa14 made the map not strech and display inline with the data-table 2018-11-10 21:58:18 +01:00
marek 2813481da4 updated map with chairs, so we can sit comfortably. Also reduced size 2018-11-10 21:57:40 +01:00
marek f8301552c4 made all parts relative with a global rootURL variable, for easy server deployment 2018-11-10 17:57:53 +01:00
marek efc5af0b61 added a shitty readme.md 2018-11-10 17:42:04 +01:00
84 changed files with 1466 additions and 536 deletions
+2
View File
@@ -1,3 +1,5 @@
admin.json
edit_admin.json
*.scss
.DS_Store
+11
View File
@@ -0,0 +1,11 @@
{
"port": 8084,
"repositories":
[{
"url": "https://git.elab.kth.se/davide/ELAB-partsearch",
"path": "/srv/ELAB-partsearch",
"deploy": "echo Deploying and restarting ELAB-partsearch && git reset --hard && git pull && sudo /usr/local/sbin/restart_partsearch.sh",
"secret-token": "etaeZee5eedie7sah8shaigo"
}]
}
+7
View File
@@ -0,0 +1,7 @@
#!/bin/bash
sudo cp restart_partsearch.sh /usr/local/sbin/
cd Git-Auto-Deploy
sudo python setup.py install
sudo cp /ELAB-partsearch/deploy/git-auto-deploy.service /etc/systemd/system
sudo systemctl enable git-auto-deploy.service
sudo systemctl start git-auto-deploy.service
+11
View File
@@ -0,0 +1,11 @@
[Unit]
Description=GitAutoDeploy
[Service]
User=www-data
Group=www-data
WorkingDirectory=/srv/ELAB-partsearch/deploy/Git-Auto-Deploy/
ExecStart=/usr/bin/python -m /srv/ELAB-partsearch/deploy/Git-Auto-Deploy/gitautodeploy --daemon-mode --config /srv/ELAB-partsearch/deploy/GitAutoDeploy.config.json
[Install]
WantedBy=multi-user.target
+2
View File
@@ -0,0 +1,2 @@
#!/bin/sh
sudo supervisorctl restart partsearch
Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 688 KiB

After

Width:  |  Height:  |  Size: 220 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 165 KiB

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 KiB

Regular → Executable
+386 -132
View File
@@ -1,83 +1,232 @@
import os
import re
import json
import requests
import sqlalchemy
from functools import wraps
from sqlalchemy.sql import select
from sqlalchemy.sql import text
from flask import Flask
from flask import render_template, send_from_directory, request, Response, send_file
from flask import render_template, send_from_directory, request, Response, send_file, session, jsonify
from PIL import Image, ImageDraw
from io import BytesIO
from os import listdir
from os.path import isfile, join
from werkzeug.utils import secure_filename
import random
app = Flask(__name__)
db_engine = {}
db_metadata = {}
parts = {}
octopartURL =""
baseURL = "/parts"
taglines = []
with open('taglines.txt', 'r') as infile:
for line in infile:
taglines.append(line[:-1])
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()
with db_engine.connect() as conn:
r = conn.execute(text(query))
containers = r.mappings().all()
return containers
def check_auth(username, password):
admin_list = []
with open('edit_admin.json', 'r') as admin:
admin_list = json.load(admin)
for user in admin_list:
if username == user['username']:
return password == user['password']
query = "select id, password from users where username=:usrnm;"
#r = db_engine.execute(text(query), usrnm=username) #SQLalchemy 1.x
with db_engine.connect() as conn:
r = conn.execute(text(query))
results = r.mappings().all()
if len(results)!=1:
return False;
if results[0]['password']==password:
session['uid'] = results[0]['id']
print (session['uid'])
return True
else:
return False
def authenticate():
return Response('Could not verify access level. Please retry', 401, {'WWW-Authenticate' : 'Basic realm="Login Required"'})
return Response('Could not verify access level. Please retry', 401, {'WWW-Authenticate' : 'Basic realm="Login Required"'})
def requires_auth(f):
@wraps(f)
def decorated(*args, **kwargs):
auth = request.authorization
if not auth or not check_auth(auth.username, auth.password):
return authenticate()
return f(*args, **kwargs)
return decorated
@wraps(f)
def decorated(*args, **kwargs):
auth = request.authorization
if not auth or not check_auth(auth.username, auth.password):
return authenticate()
return f(*args, **kwargs)
return decorated
def serveImage(img):
img_io = BytesIO()
img.save(img_io, 'PNG')
img.convert("RGB").save(img_io, 'PNG')
img_io.seek(0)
return send_file(img_io, mimetype='image/png')
@app.route('/parts')
@app.route(baseURL, strict_slashes=True)
def index():
return render_template('partsearch.html')
return render_template('partsearch.html', containers=getContainers(), baseURL=baseURL, tagline=random.choice(taglines))
@app.route('/parts/getlocations/')
def get_locations():
s = 'select id, name from locations order by name;'
r = db_engine.execute(text(s))
l = {}
for row in r:
l[row[0]]=row[1]
r.close()
return json.dumps(l)
@app.route(baseURL+'/getlocationsInContainer/<containerID>')
def get_locations_in_container(containerID):
s = 'select id, name from locations where container_id = :id order by name;'
# r = db_engine.execute(text(s), id=containerID)
# l={}
# for row in r:
# l[str(row[0])]= row[1];
# r.close()
# return json.dumps(l)
with db_engine.connect() as conn:
r = conn.execute(text(s), {"id": containerID})
l = {str(row.id): row.name for row in r}
@app.route('/parts/getlocationURL/<locationID>')
return jsonify(l)
@app.route(baseURL+'/getlocationURL/<locationID>')
def get_locationURL(locationID):
s = 'select map from locations where id = :id;'
r = db_engine.execute(text(s), id=locationID)
l=[];
for row in r:
l.append(row);
r.close()
return l[0][0]
# r = db_engine.execute(text(s), id=locationID)
# l=[];
# for row in r:
# l.append(row);
# r.close()
# return l[0][0]
with db_engine.connect() as conn:
result = conn.execute(text(s), {"id": locationID}).fetchone()
@app.route('/parts/getpartinfo/<partID>')
if result is None:
return ""
return result[0]
@app.route(baseURL+'/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;'
# r = db_engine.execute(text(query))
# locations = []
# for row in r:
# locations.append(dict(row))
# r.close()
# return render_template('locationEditor.html', locations=locations, containers=getContainers(),baseURL=baseURL)
with db_engine.connect() as conn:
result = conn.execute(text(query))
locations = [dict(row._mapping) for row in result]
return render_template(
'locationEditor.html',
locations=locations,
containers=getContainers(),
baseURL=baseURL
)
@app.route(baseURL+'/userEditor')
def userEditor():
query = 'select id, username from users;'
# r = db_engine.execute(text(query))
# users = []
# for row in r:
# users.append(dict(row))
# r.close()
with db_engine.connect() as conn:
result = conn.execute(text(query))
users = [dict(row._mapping) for row in result]
return render_template('userEditor.html', users=users, containers=getContainers(),baseURL=baseURL)
@app.route(baseURL + '/alterLocation/<locationID>', methods=['POST'])
@requires_auth
def alterLocation(locationID):
locationID = int(locationID)
if locationID < 0:
# New entry
query = text("""
insert into locations (name, container_id)
values (:name, :container)
""")
with db_engine.begin() as conn:
conn.execute(query, {
"name": request.form['name'],
"container": request.form['container']
})
return jsonify(status="ok")
else:
# Modify entry
query = text("""
update locations
set name=:name,
container_id=:container
where id=:locationID
""")
with db_engine.begin() as conn:
conn.execute(query, {
"name": request.form['name'],
"container": request.form['container'],
"locationID": locationID
})
return jsonify(status="ok")
@app.route(baseURL + '/alterUser/<userID>', methods=['POST'])
@requires_auth
def alterUser(userID):
userID = int(userID)
if userID < 0:
# New entry
query = text("""
insert into users (username, password)
values (:name, :password)
""")
with db_engine.begin() as conn:
conn.execute(query, {
"name": request.form['name'],
"password": request.form['password']
})
return jsonify(status="ok")
else:
# Modify entry
query = text("""
update users
set username=:name, password=:password
where id=:userID
""")
with db_engine.begin() as conn:
conn.execute(query, {
"name": request.form['name'],
"password": request.form['password'],
"userID": userID
})
return jsonify(status="ok")
@app.route(baseURL+'/getpartinfo/<partID>')
def get_part_info(partID):
s = 'select * from parts as p inner join locations as l on p.location_id=l.id where p.id = :id;'
r = db_engine.execute(text(s), id=partID)
l = []
for row in r:
l.append(dict(row))
r.close()
return json.dumps(l[0])
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;'
with db_engine.connect() as conn:
result = conn.execute(text(s), {"id": partID})
row = result.mappings().first()
@app.route('/parts/query/<filter_dummy>/<query>') # TODO: maybe change AND to OR or maybe not
return jsonify(dict(row) if row else {})
@app.route(baseURL+'/query/<filter_dummy>/<query>') # TODO: maybe change AND to OR or maybe not
def query(filter_dummy, query):
filter = request.args.to_dict()
keywords = query.split() # Default splits with spaces
@@ -87,127 +236,218 @@ def query(filter_dummy, query):
for i in range(len(keywords)):
kw_dict["kw" + str(i)] = keywords[i]
s = 'select p.id,partno,description,l.name as location_descriptor from parts as p inner join locations as l on p.location_id = l.id where '
if filter['l']:
s = 'select p.id,partno,description, c.name || l.name as location_descriptor 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 '
if filter['l'] == 'true':
s += '('
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 += ') OR '
if filter['p']:
if filter['p'] == 'true':
s += '('
for i in range(len(keywords)):
s += 'LOWER(partno) like LOWER(:kw'+ str(i) +') AND '
s = s[:-5]
s += ') OR '
if filter['d']:
if filter['d'] == 'true':
s += '('
for i in range(len(keywords)):
s += 'LOWER(description) like LOWER(:kw'+ str(i) +') AND '
s = s[:-5]
s += ') OR '
if filter['n']:
s += '('
for i in range(len(keywords)):
s += 'LOWER(notes) like LOWER(:kw'+ str(i) +') AND '
s = s[:-5]
s += ') OR '
s = s[:-4] + ';'
s = text(s)
r = db_engine.execute(s, kw_dict)
l = []
for row in r:
l.append(dict(row))
r.close()
# s = text(s)
# r = db_engine.execute(s, kw_dict)
# l = []
# for row in r:
# l.append(dict(row))
# r.close()
with db_engine.connect() as conn:
l = [dict(row) for row in conn.execute(text(s), kw_dict).mappings()]
return json.dumps(l)
@app.route('/parts/map/<mapurl>')
def getMap(mapurl):
@app.route(baseURL+'/map/<containerID>')
@app.route(baseURL+'/map/<containerID>/<annotate>')
def getMap(containerID, annotate=None):
s = 'select map, overlay from containers where id = :id;'
with db_engine.connect() as conn:
row = conn.execute(text(s), {"id": containerID}).mappings().first()
mapFile = row['map']
overlayFile = row['overlay']
try:
mapimage = Image.open('maps/' + mapurl)
mapImage = Image.open('maps/' + mapFile).convert("RGBA")
overlayImage = Image.open('maps/overlays/' + overlayFile).convert("RGBA")
except FileNotFoundError:
return serveImage(Image.open("maps/404.png"))
if request.args.get('x') is not None and request.args.get('y') is not None:
x = int(request.args.get('x'))
y = int(request.args.get('y'))
pointer = Image.open('maps/here.png')
pointerLayer = Image.new("RGBA", mapimage.size)
width, height = pointer.size
pointerLayer.paste(pointer, (x - int(width/2), y-int(height/2)))
mapimage = Image.alpha_composite(mapimage, pointerLayer)
# if request.args.get('x') is not None and request.args.get('y') is not None:
# x = int(request.args.get('x'))
# y = int(request.args.get('y'))
# pointer = Image.open('maps/here.png')
# pointerLayer = Image.new("RGBA", mapimage.size)
# width, height = pointer.size
# pointerLayer.paste(pointer, (x - int(width/2), y-int(height/2)))
mapimage = Image.alpha_composite(mapImage, overlayImage)
if annotate=='a':
try:
annotationName = mapFile.split('.')[0] + '-annotated.' + mapFile.split('.')[1]
annotationImage = Image.open('maps/' + annotationName).convert("RGBA")
mapimage = Image.alpha_composite(mapimage, annotationImage)
except FileNotFoundError:
pass
return serveImage(mapimage)
@app.route('/parts/getfile/<filename>')
@app.route(baseURL+'/getfile/<filename>')
def getfile(filename):
if(re.match('^[\w\-_]+$', filename) == None):
# if(re.match('^[\w\-_]+.[p|P][d|D][f|F]$', filename) == None):
if(re.match(r'^[\w-]+\.pdf$', filename, re.IGNORECASE) == None):
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'])
# @requires_auth
@app.route(baseURL + '/alter/<partID>', methods=['POST'])
@requires_auth
def alter(partID):
partID = int(partID)
s = ''
if partID < 0:
# New entry
s = 'insert into parts (partno, description, datasheet, location_id) '
s += 'values (:partno, :description, :datasheet, :location_id);'
s = text(s)
if len(request.files) != 0:
datasheet_file = request.files['datasheet-file']
datasheet_filename = secure_filename(datasheet_file.filename)
i = 1
while os.path.isfile('srv/datasheet/' + datasheet_filename):
datasheet_filename = datasheet_filename[:-4] + str(i) + '.pdf'
i += 1
datasheet_file.save('/srv/datasheets/' + datasheet_filename)
else:
datasheet_filename = None
r = db_engine.execute(s, partno=request.form['partno'],
description=request.form['description'],
datasheet=datasheet_filename,
location_id=request.form['location_id'])
# -------------------------
# HANDLE FILE UPLOAD
# -------------------------
if len(request.files) != 0:
datasheet_file = request.files['datasheet-file']
datasheet_filename = secure_filename(datasheet_file.filename)
i = 1
while os.path.isfile('/srv/datasheets/' + datasheet_filename):
datasheet_filename = datasheet_filename[:-4] + str(i) + '.pdf'
i += 1
datasheet_file.save('/srv/datasheets/' + datasheet_filename)
datasheet_filename = 'http://elab.kth.se/parts/getfile/' + datasheet_filename
else:
# Modify entry
r = db_engine.execute(text('select * from parts where id=:id;'), id=partID)
l = []
for row in r:
l.append(dict(row))
r.close()
s = 'update parts '
s += 'set partno=:partno, description=:description, datasheet=:datasheet, location_id=:location_id '
if len(request.files) != 0:
datasheet_file = request.files['datasheet-file']
datasheet_filename = secure_filename(datasheet_file.filename)
i = 1
while os.path.isfile('srv/datasheet/' + datasheet_filename):
datasheet_filename = datasheet_filename[:-4] + str(i) + '.pdf'
i += 1
datasheet_file.save('/srv/datasheets/' + datasheet_filename)
if l[0]['datasheet'] != None:
os.remove('/srv/datasheets/' + l[0]['datasheet'])
else:
datasheet_filename = l[0]['datasheet']
s += 'where id=:id;'
s = text(s)
r = db_engine.execute(s, partno=request.form['partno'],
description=request.form['description'],
datasheet=datasheet_filename,
location_id=request.form['location_id'])
try:
datasheet_filename = request.form['datasheet-url']
except:
datasheet_filename = None
# -------------------------
# INSERT
# -------------------------
if partID < 0:
query = text("""
insert into parts
(partno, description, datasheet, location_id, whoadded, notes)
values
(:partno, :description, :datasheet, :location_id, :user_id, :notes)
returning id
""")
return '{"status":"ok"}'
with db_engine.begin() as conn:
result = conn.execute(query, {
"partno": request.form['partno'],
"description": request.form['description'],
"datasheet": datasheet_filename,
"location_id": request.form['location_id'],
"notes": request.form['notes'],
"user_id": session['uid']
})
@app.route('/parts/delete/<partID>')
new_id = result.mappings().first()["id"]
return jsonify(status="ok", part_id=new_id)
# -------------------------
# UPDATE
# -------------------------
else:
query = text("""
update parts
set partno=:partno,
description=:description,
datasheet=:datasheet,
location_id=:location_id,
notes=:notes
where id=:id
returning id
""")
with db_engine.begin() as conn:
result = conn.execute(query, {
"partno": request.form['partno'],
"description": request.form['description'],
"datasheet": datasheet_filename,
"location_id": request.form['location_id'],
"notes": request.form['notes'],
"id": partID
})
new_id = result.mappings().first()["id"]
return jsonify(status="ok", part_id=new_id)
@app.route(baseURL + '/delete/<partID>')
@requires_auth
def delete(partID):
partID = int(partID)
if partID < 0:
abort(400)
s = text('delete from parts where id=:id;')
r = db_engine.execute(s, id=partID)
return '{"status":"ok"}'
query = text('delete from parts where id=:id')
with db_engine.begin() as conn:
conn.execute(query, {"id": partID})
return jsonify(status="ok")
@app.route(baseURL + '/deleteLocation/<locationID>')
@requires_auth
def deleteLocation(locationID):
locationID = int(locationID)
if locationID < 0:
abort(400)
query = text('delete from locations where id=:id')
with db_engine.begin() as conn:
conn.execute(query, {"id": locationID})
return jsonify(status="ok")
@app.route(baseURL + '/deleteUser/<userID>')
@requires_auth
def deleteUser(userID):
userID = int(userID)
if userID < 0:
abort(400)
query = text('delete from users where id=:id')
with db_engine.begin() as conn:
conn.execute(query, {"id": userID})
return jsonify(status="ok")
@app.route(baseURL+'/fetchOctopartSnippet/<searchTerm>')
def fetchOctopartSnippet(searchTerm):
if octopartURL == '':
return '{"result":"octopart integration not enabled"}'
args = {
'q': searchTerm,
'start': '0',
'limit': 1
}
data = requests.get(octopartURL, params=args)
search_response = json.loads(data.text)
result = '{"result":"no results. sorry :(("}'
if search_response['hits']>0:
try:
result = '{"result":"ok", "snippet":"' + (search_response['results'][0]['snippet']) + '"}';
except TypeError:
result = '{"result":"no results?"}'
return result
def connect(user, password, db, host='localhost', port=5432):
'''Returns a connection and a metadata object'''
@@ -219,17 +459,31 @@ def connect(user, password, db, host='localhost', port=5432):
con = sqlalchemy.create_engine(url, client_encoding='utf8')
# We then bind the connection to MetaData()
meta = sqlalchemy.MetaData(bind=con, reflect=True)
meta = sqlalchemy.MetaData()
meta.reflect(con)
return con, meta
if __name__ == '__main__':
app.secret_key = 'asuiygdiahsdo[ainsfl]asfkjnb;asklnj'
app.config['SESSION_TYPE'] = 'memcached'
with open('admin.json') as 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)
try:
with open('octopartAPIkey.json') as f:
j = json.load(f);
if j['key'] != '':
octopartURL = j['URL'] + j['key']
print ("Octopart credentials loaded.")
else:
raise FileNotFoundError
except FileNotFoundError:
print ("NO OCTOPART KEY FOUND. ABANDONING THAT PART")
# Example query
'''s = select([parts]).where(parts.c.notes != '')
for row in db_engine.execute(s):
print row'''
app.run('0.0.0.0')
with db_engine.connect() as conn:
r = conn.execute(text(query))
'''
app.run(host='127.0.0.1', port='5000', debug=False)
Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

+18
View File
@@ -0,0 +1,18 @@
var rootURL = '/parts/'
function overlay_in() {
$('.shadow').show();
$('.overlay').show();
$('.shadow').animate({'opacity' : 0.7});
$('.overlay').animate({'opacity' : 1.0, 'top' : '5%'});
}
function overlay_out() {
$('.shadow').animate({'opacity' : 0.0}, function () {
$('.shadow').hide();
});
$('.overlay').animate({'opacity' : 0.0, 'top' : '0'}, function () {
$('.overlay').hide();
});
end_edit();
}
+126
View File
@@ -0,0 +1,126 @@
function new_location_entry() {
}
function init_Location_edit(locationID, name, containerID) {
$('#save-button').attr("onclick", "saveLocation(" + locationID + ")");
$('#delete-button').attr("onclick", "deleteLocation(" + locationID + ")");
$('#location-name-input').val(name);
if(containerID > 0){
$("#container-input").val(containerID);
update_map();
}
overlay_in();
}
function update_map() {
var selected_map_file = $('#container-input').val();
$('#map').attr('src', 'map/' + selected_map_file);
}
function saveLocation(locationID) {
var container_v = $('#container-input').val();
var name_v = $('#location-name-input').val();
if(name_v.length > 100) {
alert('Name too long (max 100 characters).')
return;
}
var data = new FormData();
data.append('container', container_v);
data.append('name', name_v)
$.ajax({
url: rootURL + 'alterLocation/' + locationID,
type: 'POST',
data: data,
cache: false,
contentType: false,
processData: false,
success: function(data) {
alert("k.");
},
error: function() {
alert("Couldn't update the part information. Please retry.");
}
});
end_edit();
$('#edit-button').click(function() {
init_edit(partID);
});
}
function deleteLocation(locationID) {
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!')
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.')){
return;
}
$.ajax({
url: rootURL + 'deleteLocation/' + locationID,
type: 'GET',
cache: false,
contentType: false,
processData: false,
success: function() {
alert("location removed.");
overlay_out();
location.reload();
},
fail: function() {
console.log('An error occurred while deleting the entry');
},
});
}
function end_edit(){
//intentionally left blank
}
function show_location_info(locationID) {
$.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);
}
Regular → Executable
+186 -134
View File
@@ -1,129 +1,134 @@
function overlay_in() {
$('.shadow').css({'display' : 'block'});
$('.overlay').css({'display' : 'block'});
$('.shadow').animate({'opacity' : 0.7});
$('.overlay').animate({'opacity' : 1.0, 'top' : '5%'});
}
function overlay_out() {
$('.shadow').animate({'opacity' : 0.0}, function () {
$('.overlay').css({'display' : 'none'});
});
$('.overlay').animate({'opacity' : 0.0, 'top' : '0'}, function () {
$('.shadow').css({'display' : 'none'});
});
end_edit();
}
var active_timer = 100;
function init_edit(partID) {
$('table#details tr#location td p').hide();
$('table#details tr#location td select').show();
$('#location-dropdown').show();
$('#container-dropdown').show();
$('table#details tr#partno td p').hide();
$('table#details tr#partno td input').show();
$('input[name=partno-input]').show();
$('#magical_autofill').show();
$('table#details tr#description td p').hide();
$('table#details tr#description td input').show();
$('input[name=description-input]').show();
$('table#details tr#datasheet td input').closest().show();
$('table#details tr#datasheet td input').show();
var datasheet_input = $('<input type="file" class="part-edit-file" id="datasheet-input" accept=".pdf">')
$('#datasheet-info').replaceWith(datasheet_input);
$('#duplicate-button').closest('div').hide();
$('#delete-button').closest('div').hide();
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);
$('tr#datasheet').show();
$('input[name=notes-input]').show();
$('table#details tr#notes td p').hide();
// make map have names of containers for this one click
if (!$('img#map').attr('src').endsWith('/a')){
$('img#map').attr('src', $('img#map').attr('src') + '/a')
}
// 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);
$('#edit-button').html('<i class="fa fa-check" aria-hidden="true"></i>');
$('#edit-button').off('click').on('click', function(){
save(partID);
});
}
function new_entry() {
$('table#details tr#location td p').text('');
$('table#details tr#partno td p').text('');
$('table#details tr#description td p').text('');
// $('table#details tr#location select').text('');
$('table#details tr#partno td input').text('');
$('table#details tr#description td input').text('');
$('table#details tr#partno td input').val('');
$('table#details tr#description td input').val('');
$('input[name=datasheet-url-input]').val('');
init_edit(-1);
overlay_in();
container_onchange();
// make map have names of containers for this one click
if (!$('img#map').attr('src').endsWith('/a')){
$('img#map').attr('src', $('img#map').attr('src') + '/a')
}
}
function end_edit() {
$('table#details tr#location td p').show();
$('table#details tr#location td select').hide();
$('table#details tr#location td p').text($('table#details tr#location td select option:checked').text());
$('table#details tr#location td p').show();
$('#location-dropdown').hide();
$('#container-dropdown').hide();
$('table#details tr#partno td p').text($('table#details tr#partno td input').val());
$('table#details tr#partno td p').show();
$('table#details tr#partno td input').hide();
$('#magical_autofill').hide();
$('table#details tr#description td p').text($('table#details tr#description td input').val());
$('table#details tr#description td p').show();
$('table#details tr#description td input').hide();
$('table#details tr#datasheet td input').hide();
$('tr#datasheet').hide();
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);
$('input[name=notes-input]').hide();
$('table#details tr#notes td p').show();
$('#duplicate-button').closest('div').show();
$('#delete-button').closest('div').show();
$('#edit-button').html('<i class="fa fa-pencil" aria-hidden="true"></i>');
// 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) {
// var block_v = $('#block-input').val();
// var type_v = $('#type-input').val();
var location_id_v = $('table#details tr#location td select').val();
var partno_v = $('table#details tr#partno td input').val();
var description_v = $('table#details tr#description td input').val();
// var quantity_v = $('#quantity-input').val();
// var notes_v = $('#notes-input').val();
var datasheet = $('table#details tr#datasheet td input')[0].files;
// if(! partno_v.match(/^([a-zA-Z0-9]{1,20}\s*){1,3}$/g)) {
// alert('Invalid part number format. Accepted: <Part-number-line-1(max 20 chars)> <Part-number-line-2(max 20 chars)> <Part-number-line-3(max 20 chars)>');
// return;
// }
// if(! block_v.match(/^[0-9]+$/g)) {
// alert('Invalid location field. Only numbers accepted.');
// return;
// }
// if(type_v.length > 25) {
// alert('Manufacturer name too long (max 25 characters).')
// return;
// }
if(description_v.length > 200) {
alert('Description too long (max 200 characters).')
if (!$('#location-dropdown').val() || $('#location-dropdown').val()== -1 ) {
alert('Please select a location.');
return;
}
var location_id_v = $('#location-dropdown').val();
var partno_v = $('input[name=partno-input]').val();
var description_v = $('input[name=description-input]').val();
var datasheet = $('table#details tr#datasheet td input')[0].files;
var datasheet_url_v = $('input[name=datasheet-url-input]').val();
var notes_v = $('input[name=notes-input]').val();
if(partno_v.length == 0){
alert('Please enter a part number.');
return;
}
if(description_v.length > 200) {
alert('Description too long (max 200 characters).');
return;
}
if(description_v.length == 0) {
alert('Please enter a description.');
return;
}
// if(quantity_v.length > 10) {
// alert('Quantity info too long (max 10 characters).')
// return;
// }
// if(notes_v.length > 200) {
// alert('Notes too long (max 200 characters).')
// return;
// }
// var partnos = partno_v.split(' ');
var data = new FormData();
if (datasheet.length == 1)
if (datasheet.length == 1) {
if(! datasheet[0]['name'].match(/^[\w\-]+\.pdf$/g)) {
alert('Invalid filename. Please match /^[\w\-]+\.pdf$/g');
return;
}
if (datasheet[0]['size'] > 20 * 1000000) {
alert('File too large. Must be < 20MB.');
return;
}
data.append('datasheet-file', datasheet[0]);
// data.append('block', block_v);
// data.append('type', type_v);
} else if (datasheet_url_v.length > 0) {
data.append('datasheet-url', datasheet_url_v);
}
data.append('partno', partno_v);
data.append('location_id', location_id_v)
// if (partnos.length > 1)
// data.append('partnoalt', partnos[1]);
// else
// data.append('partnoalt', '');
// if(partnos.length > 2)
// data.append('partnoalt2', partnos[2]);
// else
// data.append('partnoalt2', '');
data.append('location_id', location_id_v);
data.append('description', description_v);
// data.append('quantity', quantity_v);
// data.append('notes', notes_v);
data.append('notes', notes_v);
$.ajax({
// Your server script to process the upload
url: 'http://127.0.0.1:5000/parts/alter/' + partID,
url: rootURL + 'alter/' + partID,
type: 'POST',
data: data,
@@ -135,7 +140,10 @@ function save(partID) {
processData: false,
success: function(data) {
var datasheet_par = '<p id="datasheet-info"><i class="fa fa-check"></i></p>';
$('#datasheet-info').replaceWith(datasheet_par);
$('#datasheet-info').replaceWith(datasheet_par); // Fix addressing
$('#edit-button').click(function() {
init_edit(JSON.parse(data).part_id);
});
},
error: function() {
alert("Couldn't update the part information. Please retry.");
@@ -144,9 +152,7 @@ function save(partID) {
});
end_edit();
$('#edit-button').click(function() {
init_edit(partID);
});
perform_query();
}
function text_filter(string) {
@@ -162,7 +168,7 @@ function delete_entry(partID) {
if (!confirm('Delete the selected entry?'))
return;
$.ajax({
url: 'http://127.0.0.1:5000/parts/delete/' + partID,
url: rootURL + 'delete/' + partID,
type: 'GET',
cache: false,
contentType: false,
@@ -178,42 +184,75 @@ function delete_entry(partID) {
}
function show_part_info(partID) {
$.getJSON('http://127.0.0.1:5000/parts/getpartinfo/' + partID, function(data) {
$('table#details tr#location td p').text(text_filter(data.name)); // name is the location friendly name
$('table#details tr#location td select').val(data.location_id); // name is the location friendly name
$.getJSON(rootURL + 'getpartinfo/' + partID, function(data) {
$('table#details tr#location td p').text(text_filter(data.location_descriptor)); // name is the location friendly name
$('#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 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));
$('img#map').attr('src', 'parts/map/' + data.map);
if (data.datasheet != null)
$('tr#datasheet-head').html($('<td>DATASHEET: <a href="http://127.0.0.1:5000/parts/getfile/' + data.datasheet.substring(0, data.datasheet.length - 4) + '"><i class="fa fa-file-text" aria-hidden="true"></i></a></td>'));
else
$('table#details tr#notes td p').text(text_filter(data.notes));
$('input[name=notes-input]').val(text_filter(data.notes));
// 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) {
$('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);
}
else {
$('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);
});
$('#delete-button').click(function() {
$('#delete-button').off('click').on('click', function() {
delete_entry(partID);
});
overlay_in();
}).fail(function() {
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() {
$('#no-results').stop();
$('#no-results').css("opacity", 0);
$('#no-results').hide();
var query = $('.search-bar').val();
var data = {
l:$('#type').is(':checked'),
l:$('#location').is(':checked'),
p:$('#partno').is(':checked'),
d:$('#description').is(':checked'),
n:$('#notes').is(':checked')
d:$('#description').is(':checked')
};
filter = '0';
$.getJSON('http://127.0.0.1:5000/parts/query/' + filter + '/' + query, data, function(data) {
$("#results").find("tr:not(:first)").remove(); // Delete all table rows
$("#results").find("tr:not(:first)").remove(); // Delete all table rows
$.getJSON(rootURL + 'query/' + filter + '/' + query, data, function(data) {
for(var i = 0; i < data.length; i++) {
var newRow = $('<tr onclick="show_part_info(' + data[i].id + ')"></tr>');
@@ -223,61 +262,74 @@ function perform_query() {
$('#results').append(newRow);
}
if(data.length == 0) {
$('#no-results').animate({opacity:1},2000);
$('#no-results').show();
$('#no-results').animate({opacity:1},2000);
}
}).fail(function() {
var newResults = '<div class="results">';
newResults += '<h3>No results.</h3>';
newResults += '</div>';
$('.results').replaceWith(newResults);
$('#no-results').show();
$('#no-results').animate({opacity:1},2000);
console.log( "Query failed" );
});
update_url(0);
}
function update_map() {
var selected_id = $('table#details tr#location td select').val();
$.ajax('parts/getlocationURL/' + selected_id).done( function(data) {
$('img#map').attr('src', 'parts/map/' + data);
});
function container_onchange() {
var selected_container_id = $('#container-dropdown').val();
if (selected_container_id > 0) {
$('img#map').attr('src', 'parts/map/' + selected_container_id);
$('#location-dropdown').empty();
$.getJSON('parts/getlocationsInContainer/' + selected_container_id, function(data) {
$.each(data, function(location_id, location_name) {
$('#location-dropdown').append('<option value="' + location_id + '">' + location_name + '</option>');
});
});
}
}
// function octopartFetch(){
// $('#magic-autofill-button').attr('disabled', 'disabled');
// $.getJSON(rootURL + 'fetchOctopartSnippet/' + $('#partno-input').val()).done(function(json){
// $('#magic-autofill-button').removeAttr('disabled');
// if (json['result']=='ok'){
// $('#description-input').val(json['snippet']);
// }else{
// $('#description-input').val('');
// $('#description-input').attr('placeholder', json['result']);
// }
// }).fail(function() {
// $('#magic-autofill-button').removeAttr('disabled');
// });
// }
$(document).ready(function() {
$.getJSON('parts/getlocations', function(data){
$.each(data, function(i, val) {
$('table#details tr#location td select').append('<option value="' + i + '">' + val + '</option>');
});
});
$.ajaxSetup({ cache: false });
$('.search-bar').on('keyup', function() {
perform_query();
clearTimeout(active_timer);
active_timer = setTimeout(perform_query, 100);
});
$('.checkbox').change( function() {
if ( !$('#location').is(':checked')
&& !$('#partno').is(':checked')
&& !$('#description').is(':checked')
&& !$('#notes').is(':checked'))
&& !$('#has-docs').is(':checked'))
$(this).prop('checked', true);
else
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'));
}
$(document).ready(function() {
$("#clickablemap").on("click", function(event) {
var $img = $(this);
var currentClickPosX = event.pageX - $img.offset().left;
var currentClickPosY = event.pageY - $img.offset().top;
var currentWidth = $img.width();
var currentHeight = $img.height();
var naturalWidth = this.naturalWidth;
var naturalHeight = this.naturalHeight;
var correctX = ((naturalWidth / currentWidth) * currentClickPosX).toFixed(0);
var correctY = ((naturalHeight / currentHeight) * currentClickPosY).toFixed(0);
$("#mapURL").html("elab.png?x=" + correctX + "&y=" + correctY);
$("#clickablemap").attr("src", "http://127.0.0.1:5000/parts/map/elab.png?x=" + correctX + "&y=" + correctY);
});
// $('#partno-input').bind('blur',function() {
// if($('#partno-input').val().length > 0){
// octopartFetch();
// }
// });
});
+223
View File
@@ -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
+113 -221
View File
@@ -2,6 +2,8 @@ html {
background-color: #D7E2E2;
color: #000F0F;
font-family: 'Roboto', sans-serif;
overflow-y: scroll;
text-align: center;
}
body {
@@ -9,7 +11,7 @@ body {
}
h1 {
padding: 16pt;
padding: 16px;
margin: 0 0 20pt 0;
text-align: center;
color: #D7E2E2;
@@ -26,7 +28,7 @@ h3 {
color: #5E9292;
text-align: center;
padding: 12pt;
font-size: 20pt;
font-size: x-large;
opacity: 0;
}
@@ -40,40 +42,40 @@ a {
input[type=text].search-bar {
color: #404040;
font-size: 20pt;
padding: 5pt 8pt 5pt 8pt;
margin-top: 8pt;
margin-bottom: 8pt;
font-size: 1.6em;
padding: 5pt 8pt 5pt 8pt;
margin-top: 8pt;
margin-bottom: 8pt;
margin-left: 20pt;
width: 70%;
border: 2pt 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;
border-radius: 2pt;
display: inline-block;
border: 1px solid grey;
}
.filter-container p {
text-align: left;
color: #D7E2E2;
font-size: 10pt;
margin-top: 4pt;
margin-left: 16pt;
margin-bottom: 4pt;
font-size: 10px;
margin: 2px;
}
.filter-concontainertainer {
text-align: center;
.filter-container {
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]{
@@ -81,69 +83,17 @@ input[type=checkbox]{
}
input[type=checkbox] + label.toggle-btn {
border-radius: 3pt;
display: inline-block;
padding: 5pt;
color: #D7E2E2;
margin-top: 6pt;
margin-bottom: 6pt;
margin-left: 3pt;
margin-right: 3pt;
width: 100pt;
text-align: center;
border: 1pt solid #D7E2E2;
padding:10px 0 10px 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 {
background-color: #D7E2E2;
color: #000F0F;
}
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;
color: #D7E2E2;
background-color: #226666;
}
.shadow {
@@ -152,7 +102,7 @@ div label input {
height: 100%;
left: 0;
opacity: 0.0;
position: absolute;
position: fixed;
top: 0;
width: 100%;
z-index: 200;
@@ -163,59 +113,28 @@ div label input {
color: #D7E2E2;
display: none;
height: 90%;
left: 20%;
padding: 0;
position: fixed;
margin:auto;
left:0;
right:0;
top:0;
width: 60%;
min-width: 60%;
width:900px;
z-index: 201;
border-radius: 2pt;
text-align: center;
opacity: 0.0;
}
.details-item {
display: inline-block;
width: 25%;
padding: 12pt 10pt 12pt 0;
text-align: right;
text-transform: uppercase;
}
.details-content {
display: inline-block;
width: 65%;
padding-left: 20pt;
text-align: left;
}
.details-content p {
text-align: left;
}
.round-button {
position: absolute;
bottom: 15pt;
left: calc(15% - 20pt);
width: 40pt;
height: 32pt;
border-radius: 20pt;
display: flex;
align-items: center;
justify-content: center;
width: 56px;
height: 56px;
border-radius: 28px;
font-size: 32px;
background-color: #5E9292;
font-size: 20pt;
padding-top: 8pt;
box-shadow: 2pt 1pt 8pt black;
}
.round-button-left {
position: absolute;
bottom: 15pt;
left: calc(30% - 20pt);
width: 40pt;
height: 32pt;
border-radius: 20pt;
background-color: #5E9292;
font-size: 20pt;
padding-top: 8pt;
box-shadow: 2pt 1pt 8pt black;
}
@@ -223,16 +142,11 @@ div label input {
color: #D7E2E2;
}
.round-button-left a{
color: #D7E2E2;
}
.small-square-button {
position: absolute;
top: 5pt;
right: 5pt;
padding-right: 5pt;
font-size: 16pt;
top: 5px;
right: 10px;
font-size: 40px;
}
.small-square-button a {
@@ -240,17 +154,18 @@ div label input {
}
.round-floating-button {
display: flex;
align-items: center;
justify-content: center;
position: fixed;
bottom: 15pt;
right: 15pt;
width: 40pt;
height: 32pt;
border-radius: 20pt;
bottom: 20px;
right: 20px;
width: 56px;
height: 56px;
border-radius: 28px;
font-size: 32px;
background-color: #5E9292;
font-size: 22pt;
padding-top: 8pt;
box-shadow: 2pt 1pt 8pt black;
text-align: center;
}
.round-floating-button a{
@@ -261,110 +176,78 @@ div label input {
font-size: 12pt;
}
.bottom-spacer {
height: 80pt;
}
table#results {
#results {
width: 100%;
max-width: 1280px;
margin-left: auto;
margin-right: auto;
border-collapse: collapse;
margin-top: 1em;
}
table#results th {
#results th {
background-color: #226666;
color: #D7E2E2;
padding: 4pt;
padding: 5pt;
border-right: 2px solid #D7E2E2;
border-left: 2px solid #D7E2E2;
}
table#results tr:nth-child(odd) {
#results tr:nth-child(odd) {
background-color: #5E9292;
}
table#results td {
#results td {
padding: 4pt;
cursor: pointer;
text-align: left;
}
table#results #location {
width: 15%;
#results #location {
width: 18%;
}
table#results #partno {
#results #partno {
/*width: 20%;*/
}
table#results #description {
#results #description {
width: 70%;
}
table#results #docs {
#results #docs {
width: 5%;
}
table#details {
position: absolute;
left: 0;
width: 45%;
margin-top: 4%;
#info-container {
width: 35%;
height: 85%;
display: flex;
flex-direction:column;
justify-content:space-between;
}
table#details #location-head {
height: 10%;
#details {
width: 100%;
}
#magical_autofill{
font-size: small;
}
a.small_link{
text-decoration: none;
color: #B0B0B0;
font-weight: 600;
}
.details-header {
color: #013A3A;
}
table#details #location {
height: 10%;
}
table#details #location td{
height: 10%;
}
table#details #partno-head {
height: 10%;
color: #013A3A;
}
table#details #partno-head td{
padding-top: 16pt;
}
table#details #partno{
height: 10%;
}
table#details #partno td{
height: 10%;
}
table#details #description-head {
height: 10%;
color: #013A3A;
}
table#details #description-head td {
padding-top: 16pt;
}
table#details #description {
height: 20%;
}
table#details #description td {
padding-left: 5%;
padding-right: 5%;
}
table#details #datasheet-head {
height: 10%;
color: #013A3A;
}
table#details #datasheet-head td {
padding-top: 16pt;
.details-content td{
padding-top:6pt;
padding-bottom:16pt;
}
td p {
@@ -372,15 +255,24 @@ td p {
padding: 0;
}
.overlay img#map {
.button-container {
display: flex;
justify-content: space-evenly;
}
.map {
position: absolute;
right: 5%;
bottom: 5%;
height: calc(90% - 42pt);
max-width: 50%;
/*margin-top: 4%;*/
max-height: calc(90% - 42pt);
max-width: 60%;
}
.pinfo-input {
display: none;
width: 90%;
}
.nothidden{
display: initial !important;
}
+118
View File
@@ -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);
}
+32
View File
@@ -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!
+65
View File
@@ -0,0 +1,65 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>ELAB Part Search Engine - Location 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/locationEditorScript.js"></script>
</head>
<body>
<h1>LOCATION EDITOR</h1>
<p>Looking for a place to store your obsolete ICs discontinued years ago? Just toss them anywhere and mark that location here! <a href=".">back to parts</a></p>
<table id="results" class="results-locations">
<tr>
<th>ID</th>
<th>c.ID</th>
<th>Container name</th>
<th>Location name</th>
</tr>
{% for location in locations %}
<tr onclick="init_Location_edit({{location['id']}}, '{{location['name']}}', {{location['container_id']}});">
<td>{{location['id']}}</td>
<td>{{location['container_id']}}</td>
<td>{{location['container']}}</td>
<td>{{location['name']}}</td>
</tr>
{% endfor %}
</table>
<div class="bottom-spacer"></div>
<div class="shadow" onclick="overlay_out()"></div>
<div class="overlay">
<h2>Part Details</h2>
<table id="details">
<tr><td>Adding a new LOCATION inside a given CONTAINER</td></tr>
<tr><td>
<select class="pinfo-input nothidden" onchange="update_map()" name="mapfile-input" id="container-input">
{% for container in containers %}
<option value="{{container['id']}}">{{container['name']}}</option>
{% endfor %}
</select>
</td></tr>
<tr><td>Location name (obs! If a drawer has an identification sticker, start the name with it.<br />Example: ".2 - Power resistors"</td></tr>
<tr><td><p></p><input type="text" name="location-name-input" id="location-name-input" placeholder="Location name" class="pinfo-input nothidden"/></td></tr>
<tr><td>Note: adding custom "containers" is currently insupported and unpossible.</td></tr>
</table>
<img src="map/{{containers[0]['id']}}" id="map" class="map"/>
<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_Location_edit(-1, '', 0)"><i class="fa fa-plus" aria-hidden="true"></i></a></div>
</body>
</html>
Regular → Executable
+50 -29
View File
@@ -2,31 +2,33 @@
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>ELAB Part Search Engine</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="{{ 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="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 type="text/javascript" src="{{ url_for('static', filename='script.js') }}"></script>
<script type="text/javascript" src="{{ baseURL }}/static/common.js"></script>
<script type="text/javascript" src="{{ baseURL }}/static/script.js"></script>
</head>
<body>
<h1>ELAB Part Search Engine</h1>
<p>Looking for obsolete ICs that were discontinued years ago? Just start typing!</p>
<div class="search-bar-container">
<p>{{ tagline }}</p>
<input type="text" name="search-bar" class="search-bar" placeholder="Search parts">
</div>
<div class="filter-concontainertainer">
<div class="filter-container">
<p>Search in:</p>
<input type="checkbox" class="checkbox" id="location"></input><label class="toggle-btn" for="location">Locations</label>
<input type="checkbox" class="checkbox" id="partno" checked></input><label class="toggle-btn" for="partno">Part Number</label>
<input type="checkbox" class="checkbox" id="description" checked></input><label class="toggle-btn" for="description">Description</label>
<input type="checkbox" class="checkbox" id="notes" checked></input><label class="toggle-btn" for="notes">Notes</label>
<p>SEARCH IN</p>
<ul>
<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>
<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>
<table id="results">
<tr>
<th id="location">Location</th>
@@ -35,25 +37,44 @@
</tr>
</table>
<h3 id="no-results">No results.</h3>
<div class="bottom-spacer"></div>
<div class="shadow" onclick="overlay_out()"></div>
<div class="shadow" onclick="overlay_out();update_url(0);"></div>
<div class="overlay">
<h2>Part Details</h2>
<table id="details">
<tr id="location-head"><td>LOCATION</td></tr>
<tr id="location"><td><p></p><select class="pinfo-input" onchange="update_map()"></select></td></tr>
<tr id="partno-head"><td>PART NUMBER</td></tr>
<tr id="partno"><td><p></p><input type="text" name="partno-input" placeholder="Part Number" class="pinfo-input"/></td></tr>
<tr id="description-head"><td>DESCRIPTION</td></tr>
<tr id="description"><td><p></p><input type="text" name="description-input" placeholder="Description" class="pinfo-input"/></td></tr>
<tr id="datasheet-head"><td>DATASHEET: </td></tr>
<tr id="datasheet"><td><input type="file" accept=".pdf" class="pinfo-input"></td></tr>
</table>
<img src="" id="map"/>
<div class="round-button-left"><a href="#" id="edit-button"><i class="fa fa-pencil" 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 id="info-container">
<img src="" id="map" class="map"/>
<table id="details">
<tr id="location-head" class="details-header"><td>LOCATION</td></tr>
<tr id="location" class="details-content"><td><p></p>
<select class="pinfo-input" id="container-dropdown" onchange="container_onchange()">
{% for container in containers %}
<option value="{{container['id']}}">{{container['name']}}</option>
{% endfor %}
</select>
<select class="pinfo-input" id="location-dropdown">
<option value="-1" selected="true">-- Select a container --</option>
</select>
</td></tr>
<tr id="partno-head" class="details-header"><td>PART NUMBER</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-head" class="details-header"><td>DESCRIPTION</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="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-head" class="details-header"><td>DATASHEET: </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" 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-head" class="details-header"><td>NOTES</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="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 class="small-square-button"><a href="#" onclick="overlay_out();update_url(0);"><i class="fa fa-times" aria-hidden="true"></i></a></div>
</div>
</div>
<div class="round-floating-button"><a href="#" onclick="new_entry()"><i class="fa fa-plus" aria-hidden="true"></i></a></div>
</body>
+53
View File
@@ -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>
-20
View File
@@ -1,20 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>ELAB Part Search Engine</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="static/style.css">
<script src="https://use.fontawesome.com/2fef7be393.js"></script>
<script type="text/javascript" src="static/script.js"></script>
</head>
<body>
<div id="mapURL">unknown.png</div>
<br />
<img src="maps/elab.png" id="clickablemap" style="margin-top: 50px; margin-left: 3em; max-height: 830px;"/>
</body>
</html>
Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 210 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 KiB

+63
View File
@@ -0,0 +1,63 @@
# ELAB Part Search
ELABs custom inventory system for locating components.
## 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!
##Requirements (Debian-based systems)
$ sudo apt install python3 python3-pip libpq-dev postgresql-13 nginx git
Python packages:
* flask
* requests
* sqlalchemy
* werkzeug
* pillow
* psycopg2
## Adding a part
**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.
![Add button](https://git.elab.kth.se/davide/ELAB-partsearch/raw/branch/master/pics/clickhere.png)
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.
![Primary location selection](https://git.elab.kth.se/davide/ELAB-partsearch/raw/branch/master/pics/primarylocation.png)
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.
![Confirm button](https://git.elab.kth.se/davide/ELAB-partsearch/raw/branch/master/pics/confirm.png)
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.
### Adding users
* go to https://elab.kth.se/parts/userEditor
* add the new user with the + thing in the bottom right
* Fun fact: any user can add more users. It's like the plague
* Fun fact 2: Don't add users manualy via the database pls and tank you.
## Work in progress
The system is currently being worked on. No touchy!