Fixed bug with scp Terminal command and hopefully fixed Active Scripts UI bug by making create/delete server panel fns non async

This commit is contained in:
danielyxie 2018-05-12 20:21:03 -05:00
parent 6b9dc76f41
commit b18e316821
4 changed files with 579 additions and 588 deletions

419
dist/engine.bundle.js vendored

File diff suppressed because one or more lines are too long

511
dist/tests.bundle.js vendored

File diff suppressed because one or more lines are too long

@ -26,7 +26,6 @@ let ActiveScriptsUI = {};
let ActiveScriptsTasks = []; //Sequentially schedule the creation/deletion of UI elements let ActiveScriptsTasks = []; //Sequentially schedule the creation/deletion of UI elements
function createActiveScriptsServerPanel(server) { function createActiveScriptsServerPanel(server) {
ActiveScriptsTasks.push(function(server) {
let hostname = server.hostname; let hostname = server.hostname;
var activeScriptsList = document.getElementById("active-scripts-list"); var activeScriptsList = document.getElementById("active-scripts-list");
@ -55,13 +54,11 @@ function createActiveScriptsServerPanel(server) {
}; };
return li; return li;
}.bind(null, server));
} }
//Deletes the info for a particular server (Dropdown header + Panel with all info) //Deletes the info for a particular server (Dropdown header + Panel with all info)
//in the Active Scripts page if it exists //in the Active Scripts page if it exists
function deleteActiveScriptsServerPanel(server) { function deleteActiveScriptsServerPanel(server) {
ActiveScriptsTasks.push(function(server) {
let hostname = server.hostname; let hostname = server.hostname;
if (ActiveScriptsUI[hostname] == null) { if (ActiveScriptsUI[hostname] == null) {
console.log("WARNING: Tried to delete non-existent Active Scripts Server panel. Aborting"); console.log("WARNING: Tried to delete non-existent Active Scripts Server panel. Aborting");
@ -77,7 +74,6 @@ function deleteActiveScriptsServerPanel(server) {
removeElement(ActiveScriptsUI[hostname].panel); removeElement(ActiveScriptsUI[hostname].panel);
removeElement(ActiveScriptsUI[hostname].header); removeElement(ActiveScriptsUI[hostname].header);
delete ActiveScriptsUI[hostname]; delete ActiveScriptsUI[hostname];
}.bind(null, server));
} }
function addActiveScriptsItem(workerscript) { function addActiveScriptsItem(workerscript) {
@ -87,11 +83,12 @@ function addActiveScriptsItem(workerscript) {
return; return;
} }
let hostname = server.hostname; let hostname = server.hostname;
ActiveScriptsTasks.push(function(workerscript, hostname) {
if (ActiveScriptsUI[hostname] == null) { if (ActiveScriptsUI[hostname] == null) {
createActiveScriptsServerPanel(server); createActiveScriptsServerPanel(server);
} }
ActiveScriptsTasks.push(function(workerscript, hostname) {
//Create the unique identifier (key) for this script //Create the unique identifier (key) for this script
var itemNameArray = ["active", "scripts", hostname, workerscript.name]; var itemNameArray = ["active", "scripts", hostname, workerscript.name];
for (var i = 0; i < workerscript.args.length; ++i) { for (var i = 0; i < workerscript.args.length; ++i) {

@ -1379,7 +1379,7 @@ let Terminal = {
return; return;
} }
var scriptname = args[0]; var scriptname = args[0];
if (!scriptname.endsWith(".lit") && !isScriptFilename(scriptName) && if (!scriptname.endsWith(".lit") && !isScriptFilename(scriptname) &&
!scriptname.endsWith(".txt")){ !scriptname.endsWith(".txt")){
post("Error: scp only works for .script, .txt, and .lit files"); post("Error: scp only works for .script, .txt, and .lit files");
return; return;