Added more buttons from Qt GUI

This commit is contained in:
Igor Nurullaev
2019-08-29 16:36:09 +03:00
parent 2bddf31a2e
commit e4aa7a4e70
14 changed files with 511 additions and 154 deletions

7
Server/static/js/bootstrap.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -3,42 +3,25 @@ let configInput = document.getElementById('configFile');
let arucoInput = document.getElementById('arucoFile');
animationInput.onchange = function (e) {
document.getElementById('animationFileLabel').innerText = animationInput.files[0].name;
sendRows(table.getSelectedRows(), animationInput.files[0], 'animation');
};
configInput.onchange = function (e) {
document.getElementById('configFileLabel').innerText = configInput.files[0].name;
sendRows(table.getSelectedRows(), configInput.files[0], 'config');
};
arucoInput.onchange = function (e) {
document.getElementById('arucoFileLabel').innerText = arucoInput.files[0].name;
sendRows(table.getSelectedRows(), arucoInput.files[0], 'aruco');
};
function sendRows(selectedRows) {
var animationFile = animationInput.files[0];
var configFile = configInput.files[0];
var arucoFile = arucoInput.files[0];
function sendRows(selectedRows, file, file_type) {
spinner.style.display = 'inline-block';
setTimeout(function () {
selectedRows.forEach(function (element) {
if (animationFile) {
let animReq = new XMLHttpRequest();
let animFormData = new FormData();
animFormData.append("file", animationFile);
animReq.open("POST", '/set/animation?ip=' + element._row.data.ip, false);
animReq.send(animFormData);
}
if (configFile) {
let configReq = new XMLHttpRequest();
let congifFormData = new FormData();
congifFormData.append("file", configFile);
configReq.open("POST", '/set/config?ip=' + element._row.data.ip, false);
configReq.send(congifFormData);
}
if (arucoFile) {
let arucoReq = new XMLHttpRequest();
let arucoFormData = new FormData();
arucoFormData.append("file", arucoFile);
arucoReq.open("POST", '/set/animation?ip=' + element._row.data.ip, false);
arucoReq.send(arucoFormData);
if (file) {
let fileReq = new XMLHttpRequest();
let fileFormData = new FormData();
fileFormData.append("file", file);
fileReq.open("POST", '/set/' + file_type + '?ip=' + element._row.data.ip, false);
fileReq.send(fileFormData);
}
element.deselect();
});

4
Server/static/js/jquery.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,22 @@
let spinner = document.getElementById('spinner');
var tabledata = [];
var delay = 0;
updateData();
updateDelay();
function updateDelay() {
let req = new XMLHttpRequest();
req.open('POST', '/get/delay', false);
req.send();
delay = parseInt(req.response);
document.getElementById('delay').innerText = 'Set time (now is ' + delay.toString() + ')';
}
function setDelay(delay) {
let req = new XMLHttpRequest();
req.open('POST', '/set/delay?delay=' + delay.toString(), false);
req.send();
}
function updateData() {
let req = new XMLHttpRequest();
@@ -16,12 +32,11 @@ var table = new Tabulator("#copters-table", {
layout: "fitColumns",
columns: [
{title: "Name", field: "name"},
{title: "IP", field: "ip"},
{title: "Animation id", field: "anim_id"},
{title: "Batt voltage", field: "batt_voltage"},
{title: "Cell voltage", field: "cell_voltage"},
{title: "Selfcheck", field: "selfcheck"},
{title: "Time", field: "time"},
{title: "Time delta", field: "time"},
],
});
@@ -48,4 +63,56 @@ function refreshSelected() {
function refreshAll() {
refreshRows(table.getRows());
}
function selectAll() {
table.getRows().forEach(function (element) {
element.select();
});
}
function deselectAll() {
table.getRows().forEach(function (element) {
element.deselect();
});
}
function testLedSelected() {
spinner.style.display = 'inline-block';
setTimeout(function () {
table.getSelectedRows().forEach(function (element) {
let req = new XMLHttpRequest();
req.open('POST', '/test_led/selected?ip=' + element._row.data.ip);
req.send();
});
deselectAll();
spinner.style.display = 'none';
}, 20);
}
function pauseCopters() {
}
function stopCopters() {
}
function emLand() {
}
function setStartTime() {
Ply.dialog("prompt", {
title: "Set animation delay",
form: {delay: "Delay"}
}).done(function (ui) {
setDelay(parseInt(ui.data.delay));
updateDelay();
});
}
function startAnimation() {
}

2
Server/static/js/ply.js Normal file

File diff suppressed because one or more lines are too long

5
Server/static/js/popper.min.js vendored Normal file

File diff suppressed because one or more lines are too long