Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
slapos
Commits
4bb5a804
Commit
4bb5a804
authored
Apr 25, 2024
by
Léo-Paul Géneau
👾
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
software/js-drone/web-gui: Update state management
parent
287c1316
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
12 deletions
+15
-12
software/js-drone/buildout.hash.cfg
software/js-drone/buildout.hash.cfg
+2
-2
software/js-drone/drone-scripts/worker.js.jinja2
software/js-drone/drone-scripts/worker.js.jinja2
+4
-2
software/js-drone/web-gui/script.js.jinja2
software/js-drone/web-gui/script.js.jinja2
+9
-8
No files found.
software/js-drone/buildout.hash.cfg
View file @
4bb5a804
...
@@ -42,8 +42,8 @@ md5sum = 34a02101a607e60f4e422375beaf7fc2
...
@@ -42,8 +42,8 @@ md5sum = 34a02101a607e60f4e422375beaf7fc2
[script-js]
[script-js]
_update_hash_filename_ = web-gui/script.js.jinja2
_update_hash_filename_ = web-gui/script.js.jinja2
md5sum =
c3858b5ec7373a0932fcda911a8177b5
md5sum =
3bbb0f80b644d86784aab99b03e88c2f
[worker]
[worker]
_update_hash_filename_ = drone-scripts/worker.js.jinja2
_update_hash_filename_ = drone-scripts/worker.js.jinja2
md5sum =
4d6639424300a5f165730de6e267543
a
md5sum =
f4e21f22719347c8a22d6a82f0782eb
a
software/js-drone/drone-scripts/worker.js.jinja2
View file @
4bb5a804
...
@@ -276,12 +276,14 @@ import { evalScript, fdopen, loadFile, open } from "std";
...
@@ -276,12 +276,14 @@ import { evalScript, fdopen, loadFile, open } from "std";
while (parsed_message.timestamp !== last_message_timestamp_list[id]) {
while (parsed_message.timestamp !== last_message_timestamp_list[id]) {
if (user_me.hasOwnProperty("onGetMsg")
if (user_me.hasOwnProperty("onGetMsg")
&& [-1, user_me.id].includes(parsed_message.dest_id)) {
&& [-1, user_me.id].includes(parsed_message.dest_id)) {
console.log("running on getMsg");
user_me.onGetMsg(parsed_message.content);
user_me.onGetMsg(parsed_message.content);
}
}
last_message_timestamp_list[id] = parsed_message.timestamp;
last_message_timestamp_list[id] = parsed_message.timestamp;
parsed_message = JSON.parse(peer.message);
message = peer.message;
if (message.length > 0) {
parsed_message = JSON.parse(message);
}
}
}
}
}
});
});
...
...
software/js-drone/web-gui/script.js.jinja2
View file @
4bb5a804
...
@@ -23,12 +23,13 @@
...
@@ -23,12 +23,13 @@
socket;
socket;
function updateConnexionClass(element, status) {
function updateConnexionClass(element, status) {
element.classList.remove(
var class_name = status ? CONNECTED_CLASS_NAME : DISCONNECTED_CLASS_NAME;
status ? DISCONNECTED_CLASS_NAME : CONNECTED_CLASS_NAME
if (!element.classList.contains(class_name)) {
);
element.classList.remove(
element.classList.add(
status ? DISCONNECTED_CLASS_NAME : CONNECTED_CLASS_NAME
status ? CONNECTED_CLASS_NAME : DISCONNECTED_CLASS_NAME
);
);
element.classList.add(class_name);
}
}
}
function setWebSocketStatus(connected, status) {
function setWebSocketStatus(connected, status) {
...
@@ -87,10 +88,10 @@
...
@@ -87,10 +88,10 @@
log_textarea.value += drone["log"];
log_textarea.value += drone["log"];
{% endif -%}
{% endif -%}
});
});
} else if (message.hasOwnProperty("
state") && message.hasOwnProperty("
id")) {
} else if (message.hasOwnProperty("id")) {
flight_state_cell = document.getElementById(FLIGHT_STATUS_BASE_ID + message['id']);
flight_state_cell = document.getElementById(FLIGHT_STATUS_BASE_ID + message['id']);
flight_state_cell.innerHTML = message['state'];
flight_state_cell.innerHTML = message['state'];
updateConnexionClass(flight_state_cell, message['
inAir
']);
updateConnexionClass(flight_state_cell, message['
okState
']);
} else {
} else {
console.info(message);
console.info(message);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment