Verified Commit ccdc3c88 authored by Štěpán Henek's avatar Štěpán Henek 🌩

subordinates: better handling of connection interrupts to remote devices

parent 26623fe7
...@@ -200,7 +200,8 @@ ...@@ -200,7 +200,8 @@
state_element.removeClass(); state_element.removeClass();
state_element.addClass("state fas fa-exclamation-circle"); state_element.addClass("state fas fa-exclamation-circle");
delete Foris.subordinateKeepAliveTimeouts[controller_id]; delete Foris.subordinateKeepAliveTimeouts[controller_id];
$(`div[data-controller-id=${controller_id}]`).replaceWith("<div id='subordinates-edit'>Chyba</div>"); $(`div[data-controller-id=${controller_id}]`).replaceWith(`<div id='subordinates-edit' class='message error' data-controller-id='${controller_id}'>${Foris.messages.subordinatesSubordinatesFailed(controller_id)}</div>`);
Foris.subordinateInEditMode = false;
}, 3000); }, 3000);
}; };
Foris.updateSubordinateState = async (data) => { Foris.updateSubordinateState = async (data) => {
...@@ -226,6 +227,10 @@ ...@@ -226,6 +227,10 @@
Foris.subordinatesAlive[data.id] = true; Foris.subordinatesAlive[data.id] = true;
if (!Foris.subordinateInEditMode) { if (!Foris.subordinateInEditMode) {
$(`#sub-${data.id}`).find("button[value=edit]").show("slow"); $(`#sub-${data.id}`).find("button[value=edit]").show("slow");
let message = $(`div[data-controller-id=${data.id}].message`);
message.hide("slow");
await message.promise();
message.replaceWith("<div id='subordinates-edit'></div>");
} }
break; break;
case 'exitted': case 'exitted':
......
...@@ -23,6 +23,9 @@ Foris.messages.networkRestartTriggered = "{% trans %}A network restart was trigg ...@@ -23,6 +23,9 @@ Foris.messages.networkRestartTriggered = "{% trans %}A network restart was trigg
Foris.messages.tryingToReconnect = "{% trans %}Trying to reconnect to your device.{% endtrans %}"; Foris.messages.tryingToReconnect = "{% trans %}Trying to reconnect to your device.{% endtrans %}";
Foris.messages.vexYes = "{% trans %}Confirm{% endtrans %}"; Foris.messages.vexYes = "{% trans %}Confirm{% endtrans %}";
Foris.messages.vexNo = "{% trans %}Cancel{% endtrans %}"; Foris.messages.vexNo = "{% trans %}Cancel{% endtrans %}";
Foris.messages.subordinatesSubordinatesFailed = (controller_id) => {
return `{% trans controller_id="${controller_id}" %}Connection to '{{ controller_id }}' was interrupted.{% endtrans %}`;
};
Foris.pingPath = "{{ url('ping') }}"; Foris.pingPath = "{{ url('ping') }}";
Foris.backendPath = "{{ url('backend-api') }}"; Foris.backendPath = "{{ url('backend-api') }}";
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment