mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
add activity log feature
This commit is contained in:
parent
4ca20d409b
commit
69682bd717
13 changed files with 367 additions and 119 deletions
|
@ -32,6 +32,22 @@
|
|||
DashboardPage.reloadSystemInfo(page);
|
||||
DashboardPage.reloadNews(page);
|
||||
DashboardPage.sessionUpdateTimer = setInterval(DashboardPage.refreshSessionsLocally, 60000);
|
||||
|
||||
$('.activityItems', page).activityLogList();
|
||||
},
|
||||
|
||||
onPageHide: function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
$('.activityItems', page).activityLogList('destroy');
|
||||
|
||||
$(ApiClient).off("websocketmessage", DashboardPage.onWebSocketMessage).off("websocketopen", DashboardPage.onWebSocketConnectionChange).off("websocketerror", DashboardPage.onWebSocketConnectionChange).off("websocketclose", DashboardPage.onWebSocketConnectionChange);
|
||||
DashboardPage.stopInterval();
|
||||
|
||||
if (DashboardPage.sessionUpdateTimer) {
|
||||
clearInterval(DashboardPage.sessionUpdateTimer);
|
||||
}
|
||||
},
|
||||
|
||||
renderPaths: function (page, systemInfo) {
|
||||
|
@ -134,16 +150,6 @@
|
|||
|
||||
},
|
||||
|
||||
onPageHide: function () {
|
||||
|
||||
$(ApiClient).off("websocketmessage", DashboardPage.onWebSocketMessage).off("websocketopen", DashboardPage.onWebSocketConnectionChange).off("websocketerror", DashboardPage.onWebSocketConnectionChange).off("websocketclose", DashboardPage.onWebSocketConnectionChange);
|
||||
DashboardPage.stopInterval();
|
||||
|
||||
if (DashboardPage.sessionUpdateTimer) {
|
||||
clearInterval(DashboardPage.sessionUpdateTimer);
|
||||
}
|
||||
},
|
||||
|
||||
startInterval: function () {
|
||||
|
||||
if (ApiClient.isWebSocketOpen()) {
|
||||
|
@ -1043,3 +1049,150 @@ $(document).on('pagebeforeshow', "#dashboardPage", DashboardPage.onPageShow)
|
|||
};
|
||||
|
||||
})(jQuery, document, window);
|
||||
|
||||
|
||||
(function ($, document, window) {
|
||||
|
||||
function getEntryHtml(entry) {
|
||||
|
||||
var html = '';
|
||||
|
||||
html += '<div class="newsItem" style="padding: .5em 0;">';
|
||||
|
||||
html += '<div class="notificationContent" style="display:block;">';
|
||||
|
||||
var date = parseISO8601Date(entry.Date, { toLocal: true });
|
||||
|
||||
var color = entry.Severity == 'Error' || entry.Severity == 'Fatal' || entry.Severity == 'Warn' ? '#cc0000' : 'green';
|
||||
|
||||
html += '<div style="margin: 0;color:' + color + ';">' + date.toLocaleDateString() + ' ' + date.toLocaleTimeString().toLowerCase() + '</div>';
|
||||
|
||||
html += '<div class="notificationName" style="margin:.5em 0 0;white-space:nowrap;">';
|
||||
html += entry.Name;
|
||||
html += '</div>';
|
||||
|
||||
entry.ShortOverview = entry.ShortOverview || ' ';
|
||||
|
||||
if (entry.ShortOverview) {
|
||||
|
||||
html += '<div class="newsItemDescription" style="margin: .5em 0 0;">';
|
||||
|
||||
if (entry.Overview) {
|
||||
html += '<a href="#" class="btnShowOverview" style="text-decoration:none;font-weight:500;">';
|
||||
}
|
||||
html += entry.ShortOverview;
|
||||
if (entry.Overview) {
|
||||
html += '</a>';
|
||||
}
|
||||
|
||||
html += '</div>';
|
||||
|
||||
if (entry.Overview) {
|
||||
html += '<div class="newsItemLongDescription" style="display:none;">' + entry.Overview + '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
//if (notification.Url) {
|
||||
// html += '<p style="margin: .25em 0;"><a href="' + notification.Url + '" target="_blank">' + Globalize.translate('ButtonMoreInformation') + '</a></p>';
|
||||
//}
|
||||
|
||||
html += '</div>';
|
||||
|
||||
html += '</div>';
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
function renderList(elem, result, startIndex, limit) {
|
||||
|
||||
var html = result.Items.map(getEntryHtml).join('');
|
||||
|
||||
if (result.TotalRecordCount > limit) {
|
||||
|
||||
var query = { StartIndex: startIndex, Limit: limit };
|
||||
|
||||
html += LibraryBrowser.getPagingHtml(query, result.TotalRecordCount, false, limit, false);
|
||||
}
|
||||
|
||||
$(elem).html(html).trigger('create');
|
||||
|
||||
$('.btnNextPage', elem).on('click', function () {
|
||||
reloadData(elem, startIndex + limit, limit);
|
||||
});
|
||||
|
||||
$('.btnPreviousPage', elem).on('click', function () {
|
||||
reloadData(elem, startIndex - limit, limit);
|
||||
});
|
||||
|
||||
$('.btnShowOverview', elem).on('click', function () {
|
||||
|
||||
var item = $(this).parents('.newsItem');
|
||||
var overview = $('.newsItemLongDescription', item).html();
|
||||
var name = $('.notificationName', item).html();
|
||||
|
||||
Dashboard.alert({
|
||||
message: overview,
|
||||
title: name
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function reloadData(elem, startIndex, limit) {
|
||||
|
||||
if (startIndex == null) {
|
||||
startIndex = parseInt(elem.getAttribute('data-activitystartindex') || '0');
|
||||
}
|
||||
|
||||
limit = limit || parseInt(elem.getAttribute('data-activitylimit') || '7');
|
||||
|
||||
ApiClient.getJSON(ApiClient.getUrl('System/ActivityLog/Entries', {
|
||||
|
||||
startIndex: startIndex,
|
||||
limit: limit
|
||||
|
||||
})).done(function (result) {
|
||||
|
||||
elem.setAttribute('data-activitystartindex', startIndex);
|
||||
elem.setAttribute('data-activitylimit', limit);
|
||||
|
||||
renderList(elem, result, startIndex, limit);
|
||||
});
|
||||
}
|
||||
|
||||
function createList(elem) {
|
||||
|
||||
elem.each(function () {
|
||||
|
||||
reloadData(this);
|
||||
});
|
||||
|
||||
$(ApiClient).on('websocketmessage.activityloglistener', function (e, data) {
|
||||
|
||||
var msg = data;
|
||||
|
||||
if (msg.MessageType === "ActivityLogEntryCreated") {
|
||||
elem.each(function () {
|
||||
|
||||
reloadData(this);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function destroyList(elem) {
|
||||
|
||||
$(ApiClient).off('websocketmessage.activityloglistener');
|
||||
}
|
||||
|
||||
$.fn.activityLogList = function (action) {
|
||||
|
||||
if (action == 'destroy') {
|
||||
destroyList(this);
|
||||
} else {
|
||||
createList(this);
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
})(jQuery, document, window);
|
|
@ -408,8 +408,7 @@
|
|||
}
|
||||
|
||||
if (commands.indexOf('edit') != -1) {
|
||||
html += '<li><a href="edititemmetadata.html?id=' + itemId + '">Edit metadata</a></li>';
|
||||
html += '<li><a href="edititemimages.html?id=' + itemId + '">Edit images</a></li>';
|
||||
html += '<li><a href="edititemmetadata.html?id=' + itemId + '">Edit</a></li>';
|
||||
}
|
||||
|
||||
html += '</ul>';
|
||||
|
@ -1788,9 +1787,9 @@
|
|||
if (showControls) {
|
||||
|
||||
html += '<div data-role="controlgroup" data-type="horizontal" style="display:inline-block;">';
|
||||
html += '<button data-icon="arrow-l" data-iconpos="notext" data-inline="true" data-mini="true" class="btnPreviousPage" ' + (query.StartIndex ? '' : 'disabled') + '>Previous Page</button>';
|
||||
html += '<button type="button" data-icon="arrow-l" data-iconpos="notext" data-inline="true" data-mini="true" class="btnPreviousPage" ' + (query.StartIndex ? '' : 'disabled') + '>Previous Page</button>';
|
||||
|
||||
html += '<button data-icon="arrow-r" data-iconpos="notext" data-inline="true" data-mini="true" class="btnNextPage" ' + (query.StartIndex + query.Limit >= totalRecordCount ? 'disabled' : '') + '>Next Page</button>';
|
||||
html += '<button type="button" data-icon="arrow-r" data-iconpos="notext" data-inline="true" data-mini="true" class="btnNextPage" ' + (query.StartIndex + query.Limit >= totalRecordCount ? 'disabled' : '') + '>Next Page</button>';
|
||||
html += '</div>';
|
||||
|
||||
if (showLimit !== false) {
|
||||
|
|
|
@ -168,11 +168,11 @@
|
|||
|
||||
var id = this.getAttribute('data-itemid');
|
||||
|
||||
PlaylistManager.showPanel([id]);
|
||||
|
||||
// Used by the tab menu, not the slide up
|
||||
$('.tapHoldMenu').popup('close');
|
||||
|
||||
PlaylistManager.showPanel([id]);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -981,6 +981,16 @@
|
|||
return true;
|
||||
};
|
||||
|
||||
// Replace audio version
|
||||
self.cleanup = function (playerElement) {
|
||||
|
||||
if (playerElement.tagName.toLowerCase() == 'video') {
|
||||
currentTimeElement.html('--:--');
|
||||
|
||||
unbindEventsForPlayback();
|
||||
}
|
||||
};
|
||||
|
||||
self.playVideo = function (item, mediaSource, startPosition) {
|
||||
|
||||
var mediaStreams = mediaSource.MediaStreams || [];
|
||||
|
@ -1197,6 +1207,10 @@
|
|||
|
||||
}).one("playing.mediaplayerevent", function () {
|
||||
|
||||
|
||||
// For some reason this is firing at the start, so don't bind until playback has begun
|
||||
$(this).on("ended.playbackstopped", self.onPlaybackStopped).one('ended.playnext', self.playNextAfterEnded);
|
||||
|
||||
self.onPlaybackStart(this, item, mediaSource);
|
||||
|
||||
}).on("pause.mediaplayerevent", function (e) {
|
||||
|
@ -1265,15 +1279,7 @@
|
|||
|
||||
self.toggleFullscreen();
|
||||
|
||||
}).on("ended.playbackstopped", function () {
|
||||
|
||||
currentTimeElement.html('--:--');
|
||||
|
||||
self.onPlaybackStopped.call(this);
|
||||
|
||||
unbindEventsForPlayback();
|
||||
|
||||
}).one('ended.playnext', self.playNextAfterEnded);
|
||||
});
|
||||
|
||||
bindEventsForPlayback();
|
||||
|
||||
|
|
|
@ -606,6 +606,8 @@
|
|||
|
||||
if (newItem) {
|
||||
|
||||
console.log('playing next track');
|
||||
|
||||
Dashboard.getCurrentUser().done(function (user) {
|
||||
|
||||
self.playInternal(newItem, 0, user);
|
||||
|
@ -1092,14 +1094,22 @@
|
|||
$(self).trigger('volumechange', [state]);
|
||||
};
|
||||
|
||||
self.cleanup = function() {
|
||||
|
||||
};
|
||||
|
||||
self.onPlaybackStopped = function () {
|
||||
|
||||
console.log('playback stopped');
|
||||
|
||||
$('body').removeClass('bodyWithPopupOpen');
|
||||
|
||||
var playerElement = this;
|
||||
|
||||
$(playerElement).off('.mediaplayerevent').off('ended.playbackstopped');
|
||||
|
||||
self.cleanup(playerElement);
|
||||
|
||||
clearProgressInterval();
|
||||
|
||||
var item = self.currentItem;
|
||||
|
@ -1253,27 +1263,38 @@
|
|||
|
||||
}).on("volumechange.mediaplayerevent", function () {
|
||||
|
||||
console.log('audio element event: volumechange');
|
||||
|
||||
self.onVolumeChanged(this);
|
||||
|
||||
}).one("playing.mediaplayerevent", function () {
|
||||
|
||||
console.log('audio element event: playing');
|
||||
|
||||
$('.mediaPlayerAudioContainer').hide();
|
||||
|
||||
// For some reason this is firing at the start, so don't bind until playback has begun
|
||||
$(this).on("ended.playbackstopped", self.onPlaybackStopped).one('ended.playnext', self.playNextAfterEnded);
|
||||
|
||||
self.onPlaybackStart(this, item, mediaSource);
|
||||
|
||||
}).on("pause.mediaplayerevent", function () {
|
||||
|
||||
console.log('audio element event: pause');
|
||||
|
||||
self.onPlaystateChange(this);
|
||||
|
||||
}).on("playing.mediaplayerevent", function () {
|
||||
|
||||
console.log('audio element event: playing');
|
||||
|
||||
self.onPlaystateChange(this);
|
||||
|
||||
}).on("timeupdate.mediaplayerevent", function () {
|
||||
|
||||
self.setCurrentTime(self.getCurrentTicks(this));
|
||||
|
||||
}).on("ended.playbackstopped", self.onPlaybackStopped).one('ended.playnext', self.playNextAfterEnded)[0];
|
||||
})[0];
|
||||
};
|
||||
|
||||
function canPlayAudioStreamDirect(audioStream) {
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
function loadPage(page, config, languages) {
|
||||
|
||||
$('#chkSubtitlesMovies', page).checked(config.SubtitleOptions.DownloadMovieSubtitles).checkboxradio("refresh");
|
||||
$('#chkSubtitlesEpisodes', page).checked(config.SubtitleOptions.DownloadEpisodeSubtitles).checkboxradio("refresh");
|
||||
$('#chkSubtitlesMovies', page).checked(config.DownloadMovieSubtitles).checkboxradio("refresh");
|
||||
$('#chkSubtitlesEpisodes', page).checked(config.DownloadEpisodeSubtitles).checkboxradio("refresh");
|
||||
|
||||
$('#chkSkipIfGraphicalSubsPresent', page).checked(config.SubtitleOptions.SkipIfGraphicalSubtitlesPresent).checkboxradio("refresh");
|
||||
$('#chkSkipIfAudioTrackPresent', page).checked(config.SubtitleOptions.SkipIfAudioTrackMatches).checkboxradio("refresh");
|
||||
$('#chkSkipIfGraphicalSubsPresent', page).checked(config.SkipIfGraphicalSubtitlesPresent).checkboxradio("refresh");
|
||||
$('#chkSkipIfAudioTrackPresent', page).checked(config.SkipIfAudioTrackMatches).checkboxradio("refresh");
|
||||
|
||||
$('#txtOpenSubtitleUsername', page).val(config.SubtitleOptions.OpenSubtitlesUsername);
|
||||
$('#txtOpenSubtitleUsername', page).val(config.OpenSubtitlesUsername);
|
||||
$('#txtOpenSubtitlePassword', page).val('');
|
||||
|
||||
populateLanguages(page, config, languages);
|
||||
|
@ -34,7 +34,7 @@
|
|||
|
||||
$('.downloadLanguages', page).html(html).trigger("create");
|
||||
|
||||
var langs = config.SubtitleOptions.DownloadLanguages || [];
|
||||
var langs = config.DownloadLanguages || [];
|
||||
|
||||
$('.chkLang', page).each(function () {
|
||||
|
||||
|
@ -49,7 +49,7 @@
|
|||
|
||||
var page = this;
|
||||
|
||||
var promise1 = ApiClient.getServerConfiguration();
|
||||
var promise1 = ApiClient.getNamedConfiguration("subtitles");
|
||||
var promise2 = ApiClient.getCultures();
|
||||
|
||||
$.when(promise1, promise2).done(function (response1, response2) {
|
||||
|
@ -69,29 +69,29 @@
|
|||
|
||||
var form = this;
|
||||
|
||||
ApiClient.getServerConfiguration().done(function (config) {
|
||||
ApiClient.getNamedConfiguration("subtitles").done(function (config) {
|
||||
|
||||
config.SubtitleOptions.DownloadMovieSubtitles = $('#chkSubtitlesMovies', form).checked();
|
||||
config.SubtitleOptions.DownloadEpisodeSubtitles = $('#chkSubtitlesEpisodes', form).checked();
|
||||
config.DownloadMovieSubtitles = $('#chkSubtitlesMovies', form).checked();
|
||||
config.DownloadEpisodeSubtitles = $('#chkSubtitlesEpisodes', form).checked();
|
||||
|
||||
config.SubtitleOptions.SkipIfGraphicalSubtitlesPresent = $('#chkSkipIfGraphicalSubsPresent', form).checked();
|
||||
config.SubtitleOptions.SkipIfAudioTrackMatches = $('#chkSkipIfAudioTrackPresent', form).checked();
|
||||
config.SkipIfGraphicalSubtitlesPresent = $('#chkSkipIfGraphicalSubsPresent', form).checked();
|
||||
config.SkipIfAudioTrackMatches = $('#chkSkipIfAudioTrackPresent', form).checked();
|
||||
|
||||
config.SubtitleOptions.OpenSubtitlesUsername = $('#txtOpenSubtitleUsername', form).val();
|
||||
config.OpenSubtitlesUsername = $('#txtOpenSubtitleUsername', form).val();
|
||||
|
||||
var newPassword = $('#txtOpenSubtitlePassword', form).val();
|
||||
|
||||
if (newPassword) {
|
||||
config.SubtitleOptions.OpenSubtitlesPasswordHash = newPassword;
|
||||
config.OpenSubtitlesPasswordHash = newPassword;
|
||||
}
|
||||
|
||||
config.SubtitleOptions.DownloadLanguages = $('.chkLang:checked', form).get().map(function (c) {
|
||||
config.DownloadLanguages = $('.chkLang:checked', form).get().map(function (c) {
|
||||
|
||||
return c.getAttribute('data-lang');
|
||||
|
||||
});
|
||||
|
||||
ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult);
|
||||
ApiClient.updateNamedConfiguration("subtitles", config).done(Dashboard.processServerConfigurationUpdateResult);
|
||||
});
|
||||
|
||||
// Disable default form submission
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
var options = {
|
||||
IncludeItemTypes: "Audio",
|
||||
Limit: screenWidth >= 1600 ? 18 : (screenWidth >= 1200 ? 10 : 12),
|
||||
Limit: screenWidth >= 1600 ? 21 : (screenWidth >= 1200 ? 21 : 12),
|
||||
Fields: "PrimaryImageAspectRatio",
|
||||
ParentId: parentId
|
||||
};
|
||||
|
@ -34,7 +34,7 @@
|
|||
SortBy: "DatePlayed",
|
||||
SortOrder: "Descending",
|
||||
IncludeItemTypes: "Audio",
|
||||
Limit: screenWidth >= 1600 ? 6 : (screenWidth >= 1200 ? 5 : 6),
|
||||
Limit: screenWidth >= 1600 ? 7 : (screenWidth >= 1200 ? 7 : 6),
|
||||
Recursive: true,
|
||||
Fields: "PrimaryImageAspectRatio,AudioInfo",
|
||||
Filters: "IsPlayed",
|
||||
|
@ -64,7 +64,7 @@
|
|||
SortBy: "PlayCount",
|
||||
SortOrder: "Descending",
|
||||
IncludeItemTypes: "Audio",
|
||||
Limit: screenWidth >= 1600 ? 12 : (screenWidth >= 1200 ? 10 : 12),
|
||||
Limit: screenWidth >= 1600 ? 14 : (screenWidth >= 1200 ? 14 : 12),
|
||||
Recursive: true,
|
||||
Fields: "PrimaryImageAspectRatio,AudioInfo",
|
||||
Filters: "IsPlayed",
|
||||
|
|
|
@ -396,7 +396,7 @@ var Dashboard = {
|
|||
var html = '<div data-role="popup" class="confirmFlyout" style="max-width:500px;" data-theme="a">';
|
||||
|
||||
html += '<div class="ui-bar-a" style="text-align:center;">';
|
||||
html += '<h3>' + title + '</h3>';
|
||||
html += '<h3 style="padding: 0 1em;">' + title + '</h3>';
|
||||
html += '</div>';
|
||||
|
||||
html += '<div style="padding: 1em;">';
|
||||
|
@ -1262,7 +1262,6 @@ $(function () {
|
|||
|
||||
$(document).on('contextmenu', '.ui-popup-screen', function (e) {
|
||||
|
||||
document.title = '1';
|
||||
$('.ui-popup').popup('close');
|
||||
|
||||
e.preventDefault();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue