Marek Baczynski 6 years ago
commit 5df74f1276

@ -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

@ -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

@ -239,7 +239,7 @@ def alter(partID):
@app.route('/parts/delete/<partID>') @app.route('/parts/delete/<partID>')
# @requires_auth # @requires_auth
def delete(partID): def delete(partID):
if partID < 0: if int(partID) < 0:
abort(400) abort(400)
s = text('delete from parts where id=:id;') s = text('delete from parts where id=:id;')
r = db_engine.execute(s, id=partID) r = db_engine.execute(s, id=partID)

@ -10,6 +10,8 @@ function init_edit(partID) {
$('table#details tr#datasheet td input').show(); $('table#details tr#datasheet td input').show();
$('#duplicate-button').closest('div').hide();
var datasheet_input = $('<input type="file" class="part-edit-file" id="datasheet-input" accept=".pdf">') var datasheet_input = $('<input type="file" class="part-edit-file" id="datasheet-input" accept=".pdf">')
$('#datasheet-info').replaceWith(datasheet_input); $('#datasheet-info').replaceWith(datasheet_input);
@ -21,16 +23,15 @@ function new_entry() {
$('table#details tr#location td p').text(''); $('table#details tr#location td p').text('');
$('table#details tr#partno td p').text(''); $('table#details tr#partno td p').text('');
$('table#details tr#description td p').text(''); $('table#details tr#description td p').text('');
// $('table#details tr#location select').text(''); $('table#details tr#partno td input').val('');
$('table#details tr#partno td input').text(''); $('table#details tr#description td input').val('');
$('table#details tr#description td input').text('');
init_edit(-1); init_edit(-1);
overlay_in(); overlay_in();
} }
function end_edit() { function end_edit() {
$('table#details tr#location td p').text($('table#details tr#location td select option:checked').val()); $('table#details tr#location td p').text($('table#details tr#location td select option:checked').text());
$('table#details tr#location td p').show(); $('table#details tr#location td p').show();
$('table#details tr#location td select').hide(); $('table#details tr#location td select').hide();
@ -44,46 +45,21 @@ function end_edit() {
$('table#details tr#datasheet td input').hide(); $('table#details tr#datasheet td input').hide();
$('#duplicate-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>'; 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); $('.round-button-left').replaceWith(newButton);
} }
function save(partID) { 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 location_id_v = $('table#details tr#location td select').val();
var partno_v = $('table#details tr#partno td input').val(); var partno_v = $('table#details tr#partno td input').val();
var description_v = $('table#details tr#description 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; 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) { if(description_v.length > 200) {
alert('Description too long (max 200 characters).') alert('Description too long (max 200 characters).')
return; 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(); var data = new FormData();
if (datasheet.length == 1) if (datasheet.length == 1)
@ -92,21 +68,9 @@ function save(partID) {
return; return;
} }
data.append('datasheet-file', datasheet[0]); data.append('datasheet-file', datasheet[0]);
// data.append('block', block_v);
// data.append('type', type_v);
data.append('partno', partno_v); data.append('partno', partno_v);
data.append('location_id', location_id_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('description', description_v); data.append('description', description_v);
// data.append('quantity', quantity_v);
// data.append('notes', notes_v);
$.ajax({ $.ajax({
// Your server script to process the upload // Your server script to process the upload
@ -134,6 +98,7 @@ function save(partID) {
}); });
end_edit(); end_edit();
perform_query();
} }
function text_filter(string) { function text_filter(string) {

@ -196,7 +196,7 @@ div label input {
.round-button { .round-button {
position: absolute; position: absolute;
bottom: 15pt; bottom: 15pt;
left: calc(15% - 20pt); left: calc(11% - 20pt);
width: 40pt; width: 40pt;
height: 32pt; height: 32pt;
border-radius: 20pt; border-radius: 20pt;
@ -209,7 +209,20 @@ div label input {
.round-button-left { .round-button-left {
position: absolute; position: absolute;
bottom: 15pt; bottom: 15pt;
left: calc(30% - 20pt); 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; width: 40pt;
height: 32pt; height: 32pt;
border-radius: 20pt; border-radius: 20pt;
@ -227,6 +240,10 @@ div label input {
color: #D7E2E2; color: #D7E2E2;
} }
.round-button-right a{
color: #D7E2E2;
}
.small-square-button { .small-square-button {
position: absolute; position: absolute;
top: 5pt; top: 5pt;

@ -60,6 +60,7 @@
<img src="" id="map" class="map"/> <img src="" id="map" class="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-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="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 class="small-square-button"><a href="#" onclick="overlay_out()"><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> <div class="round-floating-button"><a href="#" onclick="new_entry()"><i class="fa fa-plus" aria-hidden="true"></i></a></div>

Loading…
Cancel
Save