mirror of
https://github.com/s00500/ESPUI.git
synced 2026-01-16 18:46:21 +00:00
undo whitespace changes
This commit is contained in:
49
data/js/controls.js
vendored
49
data/js/controls.js
vendored
@@ -592,12 +592,12 @@ function start() {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case UI_FILEDISPLAY:
|
case UI_FILEDISPLAY:
|
||||||
if (data.visible) {
|
if (data.visible)
|
||||||
|
{
|
||||||
addToHTML(data);
|
addToHTML(data);
|
||||||
FileDisplayUploadFile(data);
|
FileDisplayUploadFile(data);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Update messages change the value/style of a component without adding new HTML
|
* Update messages change the value/style of a component without adding new HTML
|
||||||
*/
|
*/
|
||||||
@@ -691,7 +691,8 @@ function start() {
|
|||||||
// console.info("UI_FRAGMENT:Arrived '" + Arrived + "'");
|
// console.info("UI_FRAGMENT:Arrived '" + Arrived + "'");
|
||||||
// console.info("UI_FRAGMENT:FragmentFinal '" + FragmentFinal + "'");
|
// console.info("UI_FRAGMENT:FragmentFinal '" + FragmentFinal + "'");
|
||||||
|
|
||||||
if (!data.hasOwnProperty('control')) {
|
if (!data.hasOwnProperty('control'))
|
||||||
|
{
|
||||||
console.error("UI_FRAGMENT:Missing control record, skipping control");
|
console.error("UI_FRAGMENT:Missing control record, skipping control");
|
||||||
// console.info("Done Fragment Processing");
|
// console.info("Done Fragment Processing");
|
||||||
break;
|
break;
|
||||||
@@ -700,7 +701,8 @@ function start() {
|
|||||||
StopFragmentAssemblyTimer(data.control.id);
|
StopFragmentAssemblyTimer(data.control.id);
|
||||||
|
|
||||||
// is this the first fragment?
|
// is this the first fragment?
|
||||||
if (0 === FragementOffset) {
|
if(0 === FragementOffset)
|
||||||
|
{
|
||||||
// console.info("Found first fragment");
|
// console.info("Found first fragment");
|
||||||
controlAssemblyArray[control.id] = data;
|
controlAssemblyArray[control.id] = data;
|
||||||
// console.info("Value: " + controlAssemblyArray[control.id].control.value);
|
// console.info("Value: " + controlAssemblyArray[control.id].control.value);
|
||||||
@@ -714,7 +716,8 @@ function start() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// not first fragment. are we assembling this control?
|
// not first fragment. are we assembling this control?
|
||||||
if ("undefined" === typeof controlAssemblyArray[control.id]) {
|
if("undefined" === typeof controlAssemblyArray[control.id])
|
||||||
|
{
|
||||||
// it looks like we missed the first fragment. Start the control over
|
// it looks like we missed the first fragment. Start the control over
|
||||||
console.error("Missing first fragment for control: " + control.id);
|
console.error("Missing first fragment for control: " + control.id);
|
||||||
StartFragmentAssemblyTimer(control.id);
|
StartFragmentAssemblyTimer(control.id);
|
||||||
@@ -726,7 +729,8 @@ function start() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// is this the expected next fragment
|
// is this the expected next fragment
|
||||||
if (FragementOffset !== controlAssemblyArray[control.id].offset) {
|
if(FragementOffset !== controlAssemblyArray[control.id].offset)
|
||||||
|
{
|
||||||
console.error("Wrong next fragment. Expected: " + controlAssemblyArray[control.id].offset + " Got: " + FragementOffset);
|
console.error("Wrong next fragment. Expected: " + controlAssemblyArray[control.id].offset + " Got: " + FragementOffset);
|
||||||
StartFragmentAssemblyTimer(control.id);
|
StartFragmentAssemblyTimer(control.id);
|
||||||
let TotalRequest = JSON.stringify({ 'id' : control.id, 'offset' : controlAssemblyArray[control.id].length + controlAssemblyArray[control.id].offset });
|
let TotalRequest = JSON.stringify({ 'id' : control.id, 'offset' : controlAssemblyArray[control.id].length + controlAssemblyArray[control.id].offset });
|
||||||
@@ -741,7 +745,8 @@ function start() {
|
|||||||
controlAssemblyArray[control.id].offset = NextFragmentOffset;
|
controlAssemblyArray[control.id].offset = NextFragmentOffset;
|
||||||
// console.info("Value: " + controlAssemblyArray[control.id].control.value);
|
// console.info("Value: " + controlAssemblyArray[control.id].control.value);
|
||||||
|
|
||||||
if (true === FragmentFinal) {
|
if(true === FragmentFinal)
|
||||||
|
{
|
||||||
var fauxEvent = {
|
var fauxEvent = {
|
||||||
data: JSON.stringify(controlAssemblyArray[control.id].control),
|
data: JSON.stringify(controlAssemblyArray[control.id].control),
|
||||||
};
|
};
|
||||||
@@ -749,7 +754,8 @@ function start() {
|
|||||||
controlAssemblyArray[control.id] = null;
|
controlAssemblyArray[control.id] = null;
|
||||||
// console.info("Found last fragment");
|
// console.info("Found last fragment");
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
// console.info("Ask for next fragment.");
|
// console.info("Ask for next fragment.");
|
||||||
StartFragmentAssemblyTimer(control.id);
|
StartFragmentAssemblyTimer(control.id);
|
||||||
let TotalRequest = JSON.stringify({ 'id' : control.id, 'offset' : NextFragmentOffset});
|
let TotalRequest = JSON.stringify({ 'id' : control.id, 'offset' : NextFragmentOffset});
|
||||||
@@ -816,7 +822,8 @@ function start() {
|
|||||||
websock.onmessage = handleEvent;
|
websock.onmessage = handleEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function FileDisplayUploadFile(data) {
|
async function FileDisplayUploadFile(data)
|
||||||
|
{
|
||||||
let text = await downloadFile(data.value);
|
let text = await downloadFile(data.value);
|
||||||
let ItemToUpdateId = "fd" + data.id;
|
let ItemToUpdateId = "fd" + data.id;
|
||||||
// console.info("ItemToUpdateId: " + ItemToUpdateId);
|
// console.info("ItemToUpdateId: " + ItemToUpdateId);
|
||||||
@@ -835,7 +842,8 @@ async function FileDisplayUploadFile(data) {
|
|||||||
|
|
||||||
} // FileDisplayUploadFile
|
} // FileDisplayUploadFile
|
||||||
|
|
||||||
async function downloadFile(filename) {
|
async function downloadFile(filename)
|
||||||
|
{
|
||||||
let response = await fetch(filename);
|
let response = await fetch(filename);
|
||||||
|
|
||||||
if(response.status != 200) {
|
if(response.status != 200) {
|
||||||
@@ -848,12 +856,16 @@ async function downloadFile(filename) {
|
|||||||
return text_data;
|
return text_data;
|
||||||
} // downloadFile
|
} // downloadFile
|
||||||
|
|
||||||
function StartFragmentAssemblyTimer(Id) {
|
function StartFragmentAssemblyTimer(Id)
|
||||||
|
{
|
||||||
StopFragmentAssemblyTimer(Id);
|
StopFragmentAssemblyTimer(Id);
|
||||||
FragmentAssemblyTimer[Id] = setInterval(function (_Id) {
|
FragmentAssemblyTimer[Id] = setInterval(function(_Id)
|
||||||
|
{
|
||||||
// does the fragment assembly still exist?
|
// does the fragment assembly still exist?
|
||||||
if ("undefined" !== typeof controlAssemblyArray[_Id]) {
|
if("undefined" !== typeof controlAssemblyArray[_Id])
|
||||||
if (null !== controlAssemblyArray[_Id]) {
|
{
|
||||||
|
if(null !== controlAssemblyArray[_Id])
|
||||||
|
{
|
||||||
// we have a valid control that is being assembled
|
// we have a valid control that is being assembled
|
||||||
// ask for the next part
|
// ask for the next part
|
||||||
let TotalRequest = JSON.stringify({ 'id' : controlAssemblyArray[_Id].control.id, 'offset' : controlAssemblyArray[_Id].offset});
|
let TotalRequest = JSON.stringify({ 'id' : controlAssemblyArray[_Id].control.id, 'offset' : controlAssemblyArray[_Id].offset});
|
||||||
@@ -863,9 +875,12 @@ function StartFragmentAssemblyTimer(Id) {
|
|||||||
}, 1000, Id);
|
}, 1000, Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
function StopFragmentAssemblyTimer(Id) {
|
function StopFragmentAssemblyTimer(Id)
|
||||||
if ("undefined" !== typeof FragmentAssemblyTimer[Id]) {
|
{
|
||||||
if (FragmentAssemblyTimer[Id]) {
|
if("undefined" !== typeof FragmentAssemblyTimer[Id])
|
||||||
|
{
|
||||||
|
if(FragmentAssemblyTimer[Id])
|
||||||
|
{
|
||||||
clearInterval(FragmentAssemblyTimer[Id]);
|
clearInterval(FragmentAssemblyTimer[Id]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user