mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-12 08:16:06 -07:00
Add terminate session button to current activity
This commit is contained in:
parent
c780b9fd65
commit
0c62a83145
4 changed files with 120 additions and 19 deletions
|
@ -781,6 +781,21 @@ a .users-poster-face:hover {
|
||||||
display: none;
|
display: none;
|
||||||
z-index: -1;
|
z-index: -1;
|
||||||
}
|
}
|
||||||
|
.dashboard-activity-terminate-session {
|
||||||
|
width: 50px;
|
||||||
|
height: 50px;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
font-size: 30px;
|
||||||
|
color: #eee;
|
||||||
|
z-index: 1;
|
||||||
|
text-align: center;
|
||||||
|
padding-top: 5px;
|
||||||
|
}
|
||||||
|
.dashboard-activity-terminate-session:hover {
|
||||||
|
color: #e9a049;
|
||||||
|
}
|
||||||
.dashboard-activity-button-info {
|
.dashboard-activity-button-info {
|
||||||
width: 50px;
|
width: 50px;
|
||||||
height: 50px;
|
height: 50px;
|
||||||
|
|
|
@ -64,7 +64,7 @@ DOCUMENTATION :: END
|
||||||
from urllib import quote
|
from urllib import quote
|
||||||
import plexpy
|
import plexpy
|
||||||
%>
|
%>
|
||||||
<div class="dashboard-instance" id="instance-${data['session_key']}" data-id="${data['session_key']}">
|
<div class="dashboard-instance" id="instance-${data['session_key']}" data-key="${data['session_key']}" data-id="${data['session_id']}">
|
||||||
<div class="dashboard-hover-container">
|
<div class="dashboard-hover-container">
|
||||||
% if (data['media_type'] == 'movie' or data['media_type'] == 'episode' or data['media_type'] == 'track') and data['rating_key']:
|
% if (data['media_type'] == 'movie' or data['media_type'] == 'episode' or data['media_type'] == 'track') and data['rating_key']:
|
||||||
<a href="info?rating_key=${data['rating_key']}">
|
<a href="info?rating_key=${data['rating_key']}">
|
||||||
|
@ -74,15 +74,15 @@ DOCUMENTATION :: END
|
||||||
<div class="dashboard-activity-poster" id="poster-${data['session_key']}">
|
<div class="dashboard-activity-poster" id="poster-${data['session_key']}">
|
||||||
% if not data['art'].startswith('interfaces') or not data['thumb'].startswith('interfaces'):
|
% if not data['art'].startswith('interfaces') or not data['thumb'].startswith('interfaces'):
|
||||||
% if (data['media_type'] == 'movie' and not plexpy.CONFIG.PMS_USE_BIF) or (plexpy.CONFIG.PMS_USE_BIF and not data['view_offset']):
|
% if (data['media_type'] == 'movie' and not plexpy.CONFIG.PMS_USE_BIF) or (plexpy.CONFIG.PMS_USE_BIF and not data['view_offset']):
|
||||||
<div id="bif-${data['session_key']}" class="dashboard-activity-poster-face" style="background-image: url(pms_image_proxy?img=${data['art']}&width=500&height=280&fallback=art);"></div>
|
<div id="bif-${data['session_key']}" class="dashboard-activity-poster-face" style="background-image: url(pms_image_proxy?img=${data['art']}&width=500&height=280&fallback=art&refresh=true);"></div>
|
||||||
% elif (data['media_type'] == 'episode' and not plexpy.CONFIG.PMS_USE_BIF) or (plexpy.CONFIG.PMS_USE_BIF and not data['view_offset']):
|
% elif (data['media_type'] == 'episode' and not plexpy.CONFIG.PMS_USE_BIF) or (plexpy.CONFIG.PMS_USE_BIF and not data['view_offset']):
|
||||||
<div id="bif-${data['session_key']}" class="dashboard-activity-poster-face" style="background-image: url(pms_image_proxy?img=${data['art']}&width=500&height=280&fallback=art);"></div>
|
<div id="bif-${data['session_key']}" class="dashboard-activity-poster-face" style="background-image: url(pms_image_proxy?img=${data['art']}&width=500&height=280&fallback=art&refresh=true);"></div>
|
||||||
% elif plexpy.CONFIG.PMS_USE_BIF:
|
% elif plexpy.CONFIG.PMS_USE_BIF:
|
||||||
<div id="bif-${data['session_key']}" class="dashboard-activity-poster-face" style="background-image: url(pms_image_proxy?img=${data['bif_thumb']}&width=500&height=280&fallback=art); display: none;"></div>
|
<div id="bif-${data['session_key']}" class="dashboard-activity-poster-face" style="background-image: url(pms_image_proxy?img=${data['bif_thumb']}&width=500&height=280&fallback=art); display: none;"></div>
|
||||||
% else:
|
% else:
|
||||||
% if data['media_type'] == 'track':
|
% if data['media_type'] == 'track':
|
||||||
<div class="dashboard-activity-cover-face-bg" style="background-image: url(pms_image_proxy?img=${data['thumb']}&width=300&height=300&fallback=cover);"></div>
|
<div class="dashboard-activity-cover-face-bg" style="background-image: url(pms_image_proxy?img=${data['thumb']}&width=300&height=300&fallback=cover&refresh=true);"></div>
|
||||||
<div class="dashboard-activity-cover-face" style="background-image: url(pms_image_proxy?img=${data['thumb']}&width=300&height=300&fallback=cover);"></div>
|
<div class="dashboard-activity-cover-face" style="background-image: url(pms_image_proxy?img=${data['thumb']}&width=300&height=300&fallback=cover&refresh=true);"></div>
|
||||||
% elif data['media_type'] == 'clip':
|
% elif data['media_type'] == 'clip':
|
||||||
% if data['art'].startswith('http'):
|
% if data['art'].startswith('http'):
|
||||||
<div class="dashboard-activity-poster-face" style="background-image: url(${data['art']});"></div>
|
<div class="dashboard-activity-poster-face" style="background-image: url(${data['art']});"></div>
|
||||||
|
@ -91,26 +91,30 @@ DOCUMENTATION :: END
|
||||||
% else:
|
% else:
|
||||||
% if data['art']:
|
% if data['art']:
|
||||||
<!--Hacky solution to escape the image url until I come up with something better-->
|
<!--Hacky solution to escape the image url until I come up with something better-->
|
||||||
<div class="dashboard-activity-poster-face" style="background-image: url(pms_image_proxy?img=${quote(data['art'])}&width=500&height=280&fallback=art&clip=true);"></div>
|
<div class="dashboard-activity-poster-face" style="background-image: url(pms_image_proxy?img=${quote(data['art'])}&width=500&height=280&fallback=art&refresh=true&clip=true);"></div>
|
||||||
% else:
|
% else:
|
||||||
<!--Hacky solution to escape the image url until I come up with something better-->
|
<!--Hacky solution to escape the image url until I come up with something better-->
|
||||||
<div class="dashboard-activity-poster-face" style="background-image: url(pms_image_proxy?img=${quote(data['thumb'])}&width=500&height=280&fallback=art&clip=true);"></div>
|
<div class="dashboard-activity-poster-face" style="background-image: url(pms_image_proxy?img=${quote(data['thumb'])}&width=500&height=280&fallback=art&refresh=true&clip=true);"></div>
|
||||||
% endif
|
% endif
|
||||||
% endif
|
% endif
|
||||||
% elif data['media_type'] == 'photo':
|
% elif data['media_type'] == 'photo':
|
||||||
<div id="bif-${data['session_key']}" class="dashboard-activity-poster-face" style="background-image: url(pms_image_proxy?img=${data['thumb']}&width=500&height=500&fallback=cover);"></div>
|
<div id="bif-${data['session_key']}" class="dashboard-activity-poster-face" style="background-image: url(pms_image_proxy?img=${data['thumb']}&width=500&height=500&fallback=cover&refresh=true);"></div>
|
||||||
% else:
|
% else:
|
||||||
<div class="dashboard-activity-cover-face" style="background-image: url(pms_image_proxy?img=${data['thumb']}&width=300&height=300&fallback=cover);"></div>
|
<div class="dashboard-activity-cover-face" style="background-image: url(pms_image_proxy?img=${data['thumb']}&width=300&height=300&fallback=cover&refresh=true);"></div>
|
||||||
% endif
|
% endif
|
||||||
% endif
|
% endif
|
||||||
% else:
|
% else:
|
||||||
<div class="dashboard-activity-poster-face" style="background-image: url(${data['art']});"></div>
|
<div class="dashboard-activity-poster-face" style="background-image: url(${data['art']});"></div>
|
||||||
% endif
|
% endif
|
||||||
% if _session['user_group'] == 'admin':
|
% if _session['user_group'] == 'admin' and plexpy.CONFIG.PMS_PLEXPASS:
|
||||||
<span class="overlay-refresh-image left" title="Refresh image"><i class="fa fa-refresh refresh_pms_image"></i></span>
|
<div class="dashboard-activity-terminate-session" id="terminate-button-${data['session_key']}" data-key="${data['session_key']}" data-id="${data['session_id']}" style="display: none;">
|
||||||
|
<span class="btn-terminate-session" data-toggle="tooltip" title="Terminate Stream">
|
||||||
|
<i class="fa fa-times"></i>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
% endif
|
% endif
|
||||||
<div class="dashboard-activity-button-info">
|
<div class="dashboard-activity-button-info">
|
||||||
<button type="button" class="btn btn-activity-info btn-lg" data-target="#stream-${data['session_key']}" data-id="${data['session_key']}">
|
<button type="button" class="btn btn-activity-info btn-lg" data-target="#stream-${data['session_key']}" data-key="${data['session_key']}">
|
||||||
<i class="fa fa-info-circle"></i>
|
<i class="fa fa-info-circle"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -141,6 +141,40 @@
|
||||||
</div>
|
</div>
|
||||||
% endif
|
% endif
|
||||||
|
|
||||||
|
% if _session['user_group'] == 'admin':
|
||||||
|
<div id="terminate-session-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="terminate-session-modal">
|
||||||
|
<div class="modal-dialog" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="fa fa-remove"></i></button>
|
||||||
|
<h4 class="modal-title">Terminate Session</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body" style="text-align: center;">
|
||||||
|
<p>Are you sure you want to terminate this session?</p>
|
||||||
|
<p>
|
||||||
|
<strong>
|
||||||
|
<span id="terminate-user"></span><br />
|
||||||
|
<span id="terminate-title"></span><br />
|
||||||
|
<span id="terminate-subtitle"></span>
|
||||||
|
</strong>
|
||||||
|
</p>
|
||||||
|
<br />
|
||||||
|
<label for="terminate-message">Terminate Message</label>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-8" style="float: none; margin: 0 auto;">
|
||||||
|
<input type="text" class="form-control" id="terminate-message" name="terminate-message" value="" placeholder="The server owner has ended the stream." style="text-align: center;">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-dark" data-dismiss="modal">Cancel</button>
|
||||||
|
<button type="button" class="btn btn-danger btn-ok" data-dismiss="modal" id="confirm-terminate-session">Terminate</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
% endif
|
||||||
|
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
<%def name="javascriptIncludes()">
|
<%def name="javascriptIncludes()">
|
||||||
|
@ -357,6 +391,7 @@
|
||||||
complete: function(xhr, status) {
|
complete: function(xhr, status) {
|
||||||
$('#currentActivity').append(xhr.responseText);
|
$('#currentActivity').append(xhr.responseText);
|
||||||
$('#instance-' + session.session_key).find('.dashboard-activity-poster-face').hide().fadeIn(1000);
|
$('#instance-' + session.session_key).find('.dashboard-activity-poster-face').hide().fadeIn(1000);
|
||||||
|
$('#terminate-button-' + session.session_key + ' span').tooltip({ container: 'body', placement: 'right', delay: 50 });
|
||||||
$('#bufferbar-' + session.session_key).tooltip({ container: 'body', placement: 'right', delay: 50 });
|
$('#bufferbar-' + session.session_key).tooltip({ container: 'body', placement: 'right', delay: 50 });
|
||||||
$('#bar-' + session.session_key).tooltip({ container: 'body', placement: 'right', delay: 50 });
|
$('#bar-' + session.session_key).tooltip({ container: 'body', placement: 'right', delay: 50 });
|
||||||
}
|
}
|
||||||
|
@ -379,20 +414,67 @@
|
||||||
$('#currentActivity').on('click', '.btn-activity-info', function (e) {
|
$('#currentActivity').on('click', '.btn-activity-info', function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
$($(this).attr('data-target')).toggle();
|
$($(this).attr('data-target')).toggle();
|
||||||
var key = $(this).data('id');
|
var key = $(this).data('key');
|
||||||
blurArtwork(key);
|
blurArtwork(key);
|
||||||
|
$('#terminate-button-' + key).toggle();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Add hover class to dashboard-instance
|
// Add hover class to dashboard-instance
|
||||||
$('#currentActivity').on('mouseover', '.dashboard-hover-container', function () {
|
$('#currentActivity').on('mouseover', '.dashboard-hover-container', function () {
|
||||||
$(this).closest('.dashboard-instance').addClass('hover');
|
$(this).closest('.dashboard-instance').addClass('hover');
|
||||||
});
|
var key = $(this).closest('.dashboard-instance').data('key');
|
||||||
$('#currentActivity').on('mouseleave', '.dashboard-hover-container', function () {
|
if (!($('#stream-' + key).is(':visible'))) {
|
||||||
var id = $(this).closest('.dashboard-instance').data('id');
|
$('#terminate-button-' + key).fadeIn(200);
|
||||||
if (!($('#stream-' + id).is(':visible'))) {
|
|
||||||
$(this).closest('.dashboard-instance').removeClass('hover');
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
$('#currentActivity').on('mouseleave', '.dashboard-hover-container', function () {
|
||||||
|
var key = $(this).closest('.dashboard-instance').data('key');
|
||||||
|
if (!($('#stream-' + key).is(':visible'))) {
|
||||||
|
$(this).closest('.dashboard-instance').removeClass('hover');
|
||||||
|
$('#terminate-button-' + key).fadeOut(200);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
% if _session['user_group'] == 'admin':
|
||||||
|
// Terminate session
|
||||||
|
$('#currentActivity').on('click', '.dashboard-activity-terminate-session', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
var session_id = $(this).data('id');
|
||||||
|
var key = $(this).data('key');
|
||||||
|
var instance = $('#instance-' + key);
|
||||||
|
|
||||||
|
$('#terminate-user').text(instance.find('.dashboard-activity-metadata-user').text());
|
||||||
|
$('#terminate-title').text(instance.find('.dashboard-activity-metadata-title').text());
|
||||||
|
$('#terminate-subtitle').text(instance.find('.dashboard-activity-metadata-subtitle').text());
|
||||||
|
|
||||||
|
$('#terminate-session-modal').modal();
|
||||||
|
$('#terminate-session-modal').one('click', '#confirm-terminate-session', function () {
|
||||||
|
var message = $('#terminate-message').val();
|
||||||
|
|
||||||
|
showMsg('Terminating session', true);
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: 'terminate_session',
|
||||||
|
data: {
|
||||||
|
session_id: session_id,
|
||||||
|
message: message
|
||||||
|
},
|
||||||
|
async: true,
|
||||||
|
success: function (data) {
|
||||||
|
if (data.result === 'success') {
|
||||||
|
setTimeout(function() {
|
||||||
|
currentActivityHeader();
|
||||||
|
getCurrentActivity();
|
||||||
|
showMsg('<i class="fa fa-check"></i> ' + data.message, false, true, 5000);
|
||||||
|
}, 2500);
|
||||||
|
} else {
|
||||||
|
showMsg('<i class="fa fa-exclamation-circle"></i> ' + data.message, false, true, 5000, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
% endif
|
||||||
</script>
|
</script>
|
||||||
% endif
|
% endif
|
||||||
% if 'watch_stats' in config['home_sections']:
|
% if 'watch_stats' in config['home_sections']:
|
||||||
|
|
|
@ -1268,7 +1268,7 @@ class PmsConnect(object):
|
||||||
'location': helpers.get_xml_attr(session_info, 'location')
|
'location': helpers.get_xml_attr(session_info, 'location')
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
session_details = {}
|
session_details = {'session_id': ''}
|
||||||
|
|
||||||
# Get the transcode details
|
# Get the transcode details
|
||||||
if session.getElementsByTagName('TranscodeSession'):
|
if session.getElementsByTagName('TranscodeSession'):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue