Skip to content

Commit c80c671

Browse files
committed
add small notification to terminal if new invisible output is available
1 parent 96462a1 commit c80c671

File tree

2 files changed

+48
-4
lines changed

2 files changed

+48
-4
lines changed

public/themes/default/css/pterodactyl.css

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,24 @@ li.btn.btn-default.pill:active,li.btn.btn-default.pill:focus,li.btn.btn-default.
286286
opacity: 1;
287287
}
288288

289+
#consoleNotify {
290+
position: absolute;
291+
bottom: 0;
292+
margin-right: 17px;
293+
margin-bottom: 2px;
294+
z-index: 10;
295+
background: white;
296+
right: 0;
297+
opacity: .6;
298+
padding: 5px 7px;
299+
border-radius: 5px;
300+
cursor: pointer;
301+
}
302+
303+
#consoleNotify:hover {
304+
opacity: .9;
305+
}
306+
289307
.hasFileHover {
290308
border: 2px dashed #0087F7;
291309
border-radius: 5px;

resources/views/server/index.blade.php

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@
5050
<div class="alert alert-info hidden" id="consoleThrottled">
5151
The console is currently being throttled due to the speed at which data is being sent. Messages are being queued and will appear as the queue is worked through.
5252
</div>
53+
<div id="consoleNotify" class="hidden">
54+
<i class="fa fa-bell"></i>
55+
</div>
5356
<div id="terminal">
5457
</div>
5558
</div>
@@ -198,6 +201,24 @@
198201
return false;
199202
}
200203
});
204+
205+
const $consoleNotify = $('#consoleNotify');
206+
$consoleNotify.on('click', function () {
207+
terminal.scroll_to_bottom();
208+
$consoleNotify.removeClass('hidden');
209+
});
210+
211+
terminal.on('scroll', function() {
212+
if (terminal.is_bottom()) {
213+
$consoleNotify.addClass('hidden');
214+
}
215+
})
216+
217+
function terminalNotifyOutput() {
218+
if (!terminal.is_bottom()) {
219+
$consoleNotify.removeClass('hidden');
220+
}
221+
}
201222
202223
var ctc = $('#chart_cpu');
203224
var timeLabels = [];
@@ -327,10 +348,13 @@ function pushOutputQueue()
327348
$('#consoleThrottled').addClass('hidden');
328349
}
329350
330-
for (var i = 0; i < {{ env('CONSOLE_PUSH_COUNT', 10) }} && outputQueue.length > 0; i++)
331-
{
332-
terminal.echo(outputQueue[0]);
333-
outputQueue.shift();
351+
if (outputQueue.length > 0) {
352+
for (var i = 0; i < {{ env('CONSOLE_PUSH_COUNT', 10) }} && outputQueue.length > 0; i++)
353+
{
354+
terminal.echo(outputQueue[0]);
355+
outputQueue.shift();
356+
}
357+
terminalNotifyOutput();
334358
}
335359
}
336360
@@ -348,8 +372,10 @@ function pushOutputQueue()
348372
timeout: 10000
349373
}).done(function(data) {
350374
terminal.echo(data);
375+
terminalNotifyOutput();
351376
}).fail(function() {
352377
terminal.error('Unable to load initial server log, try reloading the page.');
378+
terminalNotifyOutput();
353379
});
354380
}
355381
updateServerPowerControls(data.status);

0 commit comments

Comments
 (0)