forked from decompiler-explorer/decompiler-explorer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aaffa1b
commit 1428641
Showing
8 changed files
with
171 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
|
||
let refreshSchedule = -1; | ||
|
||
function updateQueue() { | ||
if (refreshSchedule !== -1) { | ||
clearTimeout(refreshSchedule); | ||
} | ||
|
||
fetch("/api/queue") | ||
.then(resp => { | ||
if (resp.ok) { | ||
return resp.json(); | ||
} else { | ||
throw Error("Error loading queue"); | ||
} | ||
}) | ||
.then(data => { | ||
setQueue(data); | ||
}) | ||
.catch(() => {}) | ||
.finally(() => { | ||
refreshSchedule = setTimeout(updateQueue, 5000); | ||
}); | ||
} | ||
|
||
updateQueue(); | ||
|
||
|
||
function setQueue(data) { | ||
let queueDiv = document.getElementById("queue"); | ||
while (queueDiv.firstChild) { | ||
queueDiv.firstChild.remove(); | ||
} | ||
|
||
let generalHeader = document.createElement("h3"); | ||
generalHeader.innerText = "Overall Queue Stats:"; | ||
queueDiv.append(generalHeader) | ||
|
||
let generalContent = document.createElement("p"); | ||
|
||
if (data.general.queue_length === 0) { | ||
generalContent.innerText = "Queue is empty!"; | ||
} else { | ||
generalContent.append("Queue size: " + data.general.queue_length.toString()); | ||
generalContent.append(document.createElement("br")); | ||
generalContent.append("Oldest unfinished job: " + new Date(data.general.oldest_unfinished).toString()); | ||
} | ||
queueDiv.append(generalContent); | ||
|
||
let decomps = Object.keys(data.per_decompiler).sort((a, b) => { | ||
let aName = data.per_decompiler[a].decompiler.name.toLowerCase(); | ||
let bName = data.per_decompiler[b].decompiler.name.toLowerCase(); | ||
if (aName < bName) | ||
return -1; | ||
if (aName > bName) | ||
return 1; | ||
return 0; | ||
}); | ||
|
||
for (let id of decomps) { | ||
let decompQueue = data.per_decompiler[id]; | ||
|
||
let decompHeader = document.createElement("h4"); | ||
decompHeader.innerText = decompQueue.decompiler.name + " " + decompQueue.decompiler.version + (decompQueue.decompiler.revision === "" ? "" : " (") + decompQueue.decompiler.revision + (decompQueue.decompiler.revision === "" ? "" : ")") + ":"; | ||
queueDiv.append(decompHeader) | ||
|
||
let decompContent = document.createElement("p"); | ||
if (decompQueue.queue_length === 0) { | ||
decompContent.innerText = "Queue is empty!"; | ||
} else { | ||
decompContent.append("Queue size: " + decompQueue.queue_length.toString()); | ||
decompContent.append(document.createElement("br")); | ||
decompContent.append("Oldest unfinished job: " + new Date(decompQueue.oldest_unfinished).toString()); | ||
} | ||
queueDiv.append(decompContent); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
{% load static %} | ||
|
||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Decompiler Explorer - Queue</title> | ||
<meta name="description" content="Decompiler Explorer is an interactive online decompiler which shows equivalent C-like output of decompiled programs from many popular decompilers."> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1"> | ||
|
||
<meta property="og:type" content="website"> | ||
<meta property="og:url" content="https://dogbolt.org"> | ||
<meta property="og:site_name" content="Decompiler Explorer"> | ||
<meta property="og:title" content="Decompiler Explorer - Queue"> | ||
<meta property="og:description" content="Decompiler Explorer is an interactive online decompiler which shows equivalent C-like output of decompiled programs from many popular decompilers."> | ||
<meta property="og:image" content="TODO"> | ||
|
||
<meta name="twitter:card" content="summary"> | ||
<meta name="twitter:site" content="@dogboltorg"> | ||
<meta name="twitter:creator" content="@dogboltorg"> | ||
<meta name="twitter:title" content="Decompiler Explorer - Queue"> | ||
<meta name="twitter:description" content="Decompiler Explorer is an interactive online decompiler which shows equivalent C-like output of decompiled programs from many popular decompilers."> | ||
<meta property="twitter:image" content="TODO"> | ||
|
||
<link rel="preconnect" href="https://fonts.googleapis.com"> | ||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> | ||
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;600&display=swap" rel="stylesheet"> | ||
|
||
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous"> | ||
<link rel="stylesheet" href="{% static 'css/style.css' %}"> | ||
</head> | ||
<body> | ||
<div class="d-flex flex-column" id="main"> | ||
<header> | ||
<div class="container my-3"> | ||
<div class="row align-items-center"> | ||
<div class="col-md-9"> | ||
<a class="page-title" href="{% url 'explorer:index' %}"> | ||
<img alt="Dogbolt Logo" src="/static/img/dogbolt-small.png"> | ||
<h1 class="my-0">Decompiler Explorer</h1> | ||
</a> | ||
</div> | ||
<div class="col-md-3"> | ||
<a href="{% url 'explorer:faq' %}" class="float-end">What is this?</a> | ||
</div> | ||
</div> | ||
</div> | ||
</header> | ||
<section id="content" class="container"> | ||
<div class="row my-3"> | ||
<h2>Queue</h2> | ||
</div> | ||
<div class="row my-3" id="queue"> | ||
</div> | ||
</section> | ||
<footer class="fixed-bottom"> | ||
<div class="container"> | ||
<div class="row justify-content-between text-center my-2"> | ||
<p class="mb-0 small">Decompiler Explorer is open source! Fork it on <a href="https://github.com/decompiler-explorer/decompiler-explorer">GitHub</a>!</p> | ||
</div> | ||
</div> | ||
</footer> | ||
</div> | ||
<script src="{% static 'js/queue.js' %}"></script> | ||
</body> | ||
</html> |