mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-20 23:06:16 -04:00
Display preview of output in output tab headers.
Remove unused argument from setLogLevel()
This commit is contained in:
parent
ad982746dd
commit
be0e12589d
2 changed files with 44 additions and 10 deletions
|
@ -74,6 +74,21 @@ class OutputWaiter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the dish object for an output.
|
||||||
|
*
|
||||||
|
* @param inputNum - The inputNum of the output to get the dish of
|
||||||
|
* @returns {Dish}
|
||||||
|
*/
|
||||||
|
getOutputDish(inputNum) {
|
||||||
|
if (this.outputExists(inputNum) &&
|
||||||
|
this.outputs[inputNum].data &&
|
||||||
|
this.outputs[inputNum].data.dish) {
|
||||||
|
return this.outputs[inputNum].data.dish;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if an output exists in the output dictionary
|
* Checks if an output exists in the output dictionary
|
||||||
*
|
*
|
||||||
|
@ -189,6 +204,7 @@ class OutputWaiter {
|
||||||
delete this.outputs[inputNum].error;
|
delete this.outputs[inputNum].error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.displayTabInfo(inputNum);
|
||||||
this.set(inputNum);
|
this.set(inputNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -293,7 +309,6 @@ class OutputWaiter {
|
||||||
outputHtml.innerHTML = "";
|
outputHtml.innerHTML = "";
|
||||||
} else if (output.status === "baked" || output.status === "inactive") {
|
} else if (output.status === "baked" || output.status === "inactive") {
|
||||||
document.querySelector("#output-loader .loading-msg").textContent = `Loading output ${inputNum}`;
|
document.querySelector("#output-loader .loading-msg").textContent = `Loading output ${inputNum}`;
|
||||||
this.displayTabInfo(inputNum);
|
|
||||||
this.closeFile();
|
this.closeFile();
|
||||||
let scriptElements, lines, length;
|
let scriptElements, lines, length;
|
||||||
|
|
||||||
|
@ -642,6 +657,8 @@ class OutputWaiter {
|
||||||
document.getElementById("output-tabs").lastElementChild.style.boxShadow = "-15px 0px 15px -15px var(--primary-border-colour) inset";
|
document.getElementById("output-tabs").lastElementChild.style.boxShadow = "-15px 0px 15px -15px var(--primary-border-colour) inset";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.displayTabInfo(inputNum);
|
||||||
|
|
||||||
if (changeTab) {
|
if (changeTab) {
|
||||||
this.changeTab(inputNum, false);
|
this.changeTab(inputNum, false);
|
||||||
}
|
}
|
||||||
|
@ -673,6 +690,10 @@ class OutputWaiter {
|
||||||
const tabsRight = (newOutputs[newOutputs.length - 1] !== this.getLargestInputNum());
|
const tabsRight = (newOutputs[newOutputs.length - 1] !== this.getLargestInputNum());
|
||||||
|
|
||||||
this.manager.tabs.refreshOutputTabs(newOutputs, inputNum, tabsLeft, tabsRight);
|
this.manager.tabs.refreshOutputTabs(newOutputs, inputNum, tabsLeft, tabsRight);
|
||||||
|
|
||||||
|
for (let i = 0; i < newOutputs.length; i++) {
|
||||||
|
this.displayTabInfo(newOutputs[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.app.debounce(this.set, 50, "setOutput", this, [inputNum])();
|
this.app.debounce(this.set, 50, "setOutput", this, [inputNum])();
|
||||||
|
@ -919,6 +940,11 @@ class OutputWaiter {
|
||||||
tabsRight = (newNums[newNums.length - 1] !== this.getLargestInputNum());
|
tabsRight = (newNums[newNums.length - 1] !== this.getLargestInputNum());
|
||||||
|
|
||||||
this.manager.tabs.refreshOutputTabs(newNums, activeTab, tabsLeft, tabsRight);
|
this.manager.tabs.refreshOutputTabs(newNums, activeTab, tabsLeft, tabsRight);
|
||||||
|
|
||||||
|
for (let i = 0; i < newNums.length; i++) {
|
||||||
|
this.displayTabInfo(newNums[i]);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -926,14 +952,26 @@ class OutputWaiter {
|
||||||
*
|
*
|
||||||
* @param {number} inputNum
|
* @param {number} inputNum
|
||||||
*/
|
*/
|
||||||
displayTabInfo(inputNum) {
|
async displayTabInfo(inputNum) {
|
||||||
const tabItem = this.manager.tabs.getOutputTabItem(inputNum);
|
const tabItem = this.manager.tabs.getOutputTabItem(inputNum);
|
||||||
|
|
||||||
if (!tabItem) return;
|
if (!tabItem) return;
|
||||||
|
|
||||||
const tabContent = tabItem.firstElementChild;
|
const tabContent = tabItem.firstElementChild,
|
||||||
|
dish = this.getOutputDish(inputNum);
|
||||||
|
let tabStr = "";
|
||||||
|
|
||||||
tabContent.innerText = `Tab ${inputNum}`;
|
if (dish !== null) {
|
||||||
|
tabStr = await this.getDishStr(this.getOutputDish(inputNum));
|
||||||
|
tabStr = tabStr.replace(/[\n\r]/g, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
tabStr = tabStr.slice(0, 200);
|
||||||
|
if (tabStr === "") {
|
||||||
|
tabStr = `Tab ${inputNum}`;
|
||||||
|
} else {
|
||||||
|
tabStr = `${inputNum}: ${tabStr}`;
|
||||||
|
}
|
||||||
|
tabContent.innerText = tabStr;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -207,8 +207,6 @@ class WorkerWaiter {
|
||||||
break;
|
break;
|
||||||
case "dishReturned":
|
case "dishReturned":
|
||||||
this.callbacks[r.data.id](r.data);
|
this.callbacks[r.data.id](r.data);
|
||||||
this.dishWorker.terminate();
|
|
||||||
this.dishWorker = null;
|
|
||||||
break;
|
break;
|
||||||
case "silentBakeComplete":
|
case "silentBakeComplete":
|
||||||
break;
|
break;
|
||||||
|
@ -623,10 +621,8 @@ class WorkerWaiter {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the console log level in the workers.
|
* Sets the console log level in the workers.
|
||||||
*
|
|
||||||
* @param {string} level
|
|
||||||
*/
|
*/
|
||||||
setLogLevel(level) {
|
setLogLevel() {
|
||||||
for (let i = 0; i < this.chefWorkers.length; i++) {
|
for (let i = 0; i < this.chefWorkers.length; i++) {
|
||||||
this.chefWorkers[i].worker.postMessage({
|
this.chefWorkers[i].worker.postMessage({
|
||||||
action: "setLogLevel",
|
action: "setLogLevel",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue