mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-07 05:31:15 -07:00
Make the shutdown/restart/update screens pretty :)
This commit is contained in:
parent
dd90f2e375
commit
5b2d03f496
3 changed files with 101 additions and 8 deletions
|
@ -276,3 +276,27 @@ function millisecondsToMinutes(ms, roundToMinute) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Our countdown plugin takes a callback, a duration, and an optional message
|
||||
$.fn.countdown = function (callback, duration, message) {
|
||||
// If no message is provided, we use an empty string
|
||||
message = message || "";
|
||||
// Get reference to container, and set initial content
|
||||
var container = $(this[0]).html(duration + message);
|
||||
// Get reference to the interval doing the countdown
|
||||
var countdown = setInterval(function () {
|
||||
// If seconds remain
|
||||
if (--duration) {
|
||||
// Update our container's message
|
||||
container.html(duration + message);
|
||||
// Otherwise
|
||||
} else {
|
||||
// Clear the countdown interval
|
||||
clearInterval(countdown);
|
||||
// And fire the callback passing our container as `this`
|
||||
callback.call(container);
|
||||
}
|
||||
// Run interval every 1000ms (1 second)
|
||||
}, 1000);
|
||||
|
||||
};
|
|
@ -1,20 +1,60 @@
|
|||
<%inherit file="base.html"/>
|
||||
|
||||
<%def name="headIncludes()">
|
||||
<meta http-equiv="refresh" content="${timer};url=index">
|
||||
|
||||
</%def>
|
||||
|
||||
<%def name="body()">
|
||||
<div class="container-fluid">
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
<div class="wellbg">
|
||||
<div class="wellheader">
|
||||
<div class="dashboard-wellheader">
|
||||
<h2><i class="fa fa-refresh fa-spin"></i> PlexPy is ${message}</h2>
|
||||
<div id="state-change-modal" class="modal hide fade">
|
||||
<div class="modal-header">
|
||||
<h3>${message}</h3>
|
||||
</div>
|
||||
<div class="modal-body" id="modal-text">
|
||||
<div align="center">
|
||||
% if message == "Shutting Down":
|
||||
<h2><i class="fa fa-refresh fa-spin"></i> PlexPy is ${message}.</h2>
|
||||
<br/>
|
||||
% else:
|
||||
<h2><i class="fa fa-refresh fa-spin"></i> PlexPy is ${message}.</h2>
|
||||
<br/>
|
||||
<h3>Restart in <span class="countdown"></span></h3>
|
||||
% endif
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<div style="float: right;"><span class="muted" id="rquote"></span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</%def>
|
||||
<%def name="javascriptIncludes()">
|
||||
<script>
|
||||
// Use p.countdown as container, pass redirect, duration, and optional message
|
||||
$(".countdown").countdown(reloadPage, ${timer}, "");
|
||||
$('#state-change-modal').modal({
|
||||
keyboard: false
|
||||
})
|
||||
// Make modal visible
|
||||
$('#state-change-modal').modal('show')
|
||||
|
||||
// Redirect to home page after countdown.
|
||||
function reloadPage() {
|
||||
window.location.href = "index";
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
$.ajax({
|
||||
url: 'random_arnold_quotes',
|
||||
cache: false,
|
||||
async: true,
|
||||
success: function (data) {
|
||||
$("#rquote").html(data);
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</%def>
|
||||
|
|
|
@ -456,7 +456,7 @@ class WebInterface(object):
|
|||
@cherrypy.expose
|
||||
def do_state_change(self, signal, title, timer):
|
||||
plexpy.SIGNAL = signal
|
||||
message = title + '...'
|
||||
message = title
|
||||
return serve_template(templatename="shutdown.html", title=title,
|
||||
message=message, timer=timer)
|
||||
|
||||
|
@ -1023,3 +1023,32 @@ class WebInterface(object):
|
|||
return None
|
||||
else:
|
||||
return None
|
||||
|
||||
@cherrypy.expose
|
||||
def random_arnold_quotes(self, **kwargs):
|
||||
from random import randint
|
||||
quote_list = ['To crush your enemies, see them driven before you, and to hear the lamentation of their women!',
|
||||
'Your clothes, give them to me, now!',
|
||||
'Do it!',
|
||||
'If it bleeds, we can kill it',
|
||||
'See you at the party Richter!',
|
||||
'Let off some steam, Bennett',
|
||||
'I\'ll be back',
|
||||
'Get to the chopper!',
|
||||
'Hasta La Vista, Baby!',
|
||||
'It\'s not a tumor!',
|
||||
'Dillon, you son of a bitch!',
|
||||
'Benny!! Screw you!!',
|
||||
'Stop whining! You kids are soft. You lack discipline.',
|
||||
'Nice night for a walk.',
|
||||
'Stick around!',
|
||||
'I need your clothes, your boots and your motorcycle.',
|
||||
'No, it\'s not a tumor. It\'s not a tumor!',
|
||||
'I LIED!',
|
||||
'See you at the party, Richter!',
|
||||
'Are you Sarah Conner?',
|
||||
'I\'m a cop you idiot!'
|
||||
]
|
||||
|
||||
random_number = randint(0, len(quote_list))
|
||||
return quote_list[int(random_number)]
|
Loading…
Add table
Add a link
Reference in a new issue