mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-12 08:16:06 -07:00
Check for updates without refreshing the page
This commit is contained in:
parent
16f270691d
commit
cab8b1c041
5 changed files with 112 additions and 20 deletions
|
@ -44,16 +44,18 @@
|
|||
% if _session['user_group'] == 'admin':
|
||||
% if plexpy.CONFIG.CHECK_GITHUB and not plexpy.CURRENT_VERSION:
|
||||
<div id="updatebar" style="display: none;">
|
||||
You're running an unknown version of Tautulli.<br />
|
||||
You are running an unknown version of Tautulli.<br />
|
||||
<a href="update">Update</a> or <a href="#" id="updateDismiss">Close</a>
|
||||
</div>
|
||||
% elif plexpy.CONFIG.CHECK_GITHUB and plexpy.CURRENT_VERSION != plexpy.LATEST_VERSION and plexpy.COMMITS_BEHIND > 0 and plexpy.INSTALL_TYPE != 'win':
|
||||
<div id="updatebar" style="display: none;">
|
||||
A <a href="${anon_url('https://github.com/%s/%s/compare/%s...%s' % (plexpy.CONFIG.GIT_USER, plexpy.CONFIG.GIT_REPO, plexpy.CURRENT_VERSION, plexpy.LATEST_VERSION))}" target="_blank">
|
||||
newer version</a> is available.<br />
|
||||
You're ${plexpy.COMMITS_BEHIND} commits behind.<br />
|
||||
newer version</a> is available!<br />
|
||||
You are ${plexpy.COMMITS_BEHIND} commits behind.<br />
|
||||
<a href="update">Update</a> or <a href="#" id="updateDismiss">Close</a>
|
||||
</div>
|
||||
% else:
|
||||
<div id="updatebar" style="display: none;"></div>
|
||||
% endif
|
||||
% endif
|
||||
<nav class="navbar navbar-fixed-top">
|
||||
|
@ -296,7 +298,37 @@ ${next.modalIncludes()}
|
|||
});
|
||||
|
||||
if (!getCookie('updateDismiss')) {
|
||||
$('#updatebar').show();
|
||||
if ($('#updatebar').html().length > 0) {
|
||||
$('#updatebar').show();
|
||||
}
|
||||
}
|
||||
|
||||
function checkUpdate(_callback) {
|
||||
// Allow the update bar to show again if previously dismissed.
|
||||
setCookie('updateDismiss', 'true', 0);
|
||||
$.ajax({
|
||||
url: 'update_check',
|
||||
complete: function (xhr, status) {
|
||||
var result = $.parseJSON(xhr.responseText);
|
||||
var msg = '';
|
||||
if (result.update === true) {
|
||||
msg = 'A <a href="' + result.compare_url + '" target="_blank">newer version</a> is available!<br />' +
|
||||
'You are '+ result.commits_behind + ' commits behind.<br />' +
|
||||
'<a href="update">Update</a> or <a href="#" id="updateDismiss">Close</a>.';
|
||||
$('#updatebar').html(msg).show();
|
||||
} else if (result.update === false) {
|
||||
showMsg('<i class="fa fa-check"></i> ' + result.message, false, true, 2000);
|
||||
} else if (result.update === null) {
|
||||
msg = 'You are running an unknown version of Tautulli.<br />' +
|
||||
'<a href="update">Update</a> or <a href="#" id="updateDismiss">Close</a>.';
|
||||
$('#updatebar').html(msg).show();
|
||||
}
|
||||
|
||||
if (_callback) {
|
||||
_callback();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$("#nav-shutdown").click(function() {
|
||||
|
@ -315,11 +347,9 @@ ${next.modalIncludes()}
|
|||
});
|
||||
});
|
||||
|
||||
$("#nav-update").first().one("click", function () {
|
||||
// Allow the update bar to show again if previously dismissed.
|
||||
setCookie('updateDismiss', 'true', 0);
|
||||
$(this).html('<i class="fa fa-spin fa-refresh"></i> Checking');
|
||||
window.location.href = "checkGithub";
|
||||
$('#nav-update').click(function () {
|
||||
$(this).html('<i class="fa fa-fw fa-spin fa-refresh"></i> Checking');
|
||||
checkUpdate(function () { $('#nav-update').html('<i class="fa fa-fw fa-arrow-circle-up"></i> Check for Updates'); });
|
||||
});
|
||||
|
||||
$('#donation_type a.crypto-donation').on('shown.bs.tab', function () {
|
||||
|
|
|
@ -1648,11 +1648,11 @@ $(document).ready(function() {
|
|||
});
|
||||
|
||||
$('#menu_link_update_check').click(function() {
|
||||
// Allow the update bar to show again if previously dismissed.
|
||||
setCookie('updateDismiss', 'true', 0);
|
||||
$(this).html('<i class="fa fa-spin fa-refresh"></i> Checking');
|
||||
$(this).prop('disabled', true);
|
||||
window.location.href = 'checkGithub';
|
||||
$(this).html('<i class="fa fa-spin fa-refresh"></i> Checking').prop('disabled', true);
|
||||
checkUpdate(function () {
|
||||
$('#menu_link_update_check').html('<i class="fa fa-arrow-circle-up"></i> Check for Updates')
|
||||
.prop('disabled', false);
|
||||
});
|
||||
});
|
||||
|
||||
$('#modal_link_restart').click(function() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue