1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

add organize now/sync prepare buttons

This commit is contained in:
Luke Pulverenti 2015-01-20 15:19:54 -05:00
parent 40fc62a233
commit a722ddc665
13 changed files with 191 additions and 210 deletions

View file

@ -18,7 +18,13 @@
<div class="listTopPaging" style="float: left; position: relative; top: 15px;"> <div class="listTopPaging" style="float: left; position: relative; top: 15px;">
</div> </div>
<button style="display: none;" class="btnClearLog" type="button" data-inline="true" data-icon="forbidden" data-mini="true">Clear</button> <!--<button style="display: none;" class="btnClearLog" type="button" data-inline="true" data-icon="forbidden" data-mini="true">Clear</button>-->
<div style="float: right; position: relative; top: 15px;margin-top: -5px;">
<button type="button" class="btnOrganize" data-icon="action" data-mini="true" data-inline="true">${ButtonOrganizeNow}</button>
<progress max="100" min="0" style="width:100px;display:none;" class="organizeProgress"></progress>
</div>
<br />
<div style="clear: both;"></div> <div style="clear: both;"></div>
</div> </div>
<table data-role="table" data-mode="reflow" class="tblOrganizationResults stripedTable ui-responsive table-stroke"> <table data-role="table" data-mode="reflow" class="tblOrganizationResults stripedTable ui-responsive table-stroke">
@ -33,12 +39,12 @@
<tbody class="resultBody"></tbody> <tbody class="resultBody"></tbody>
</table> </table>
<br /> <br />
<div style="text-align: right;" class="legend"> <div style="text-align: right;vertical-align:middle;" class="legend">
<div style="display: inline-block; height: 10px; width: 10px; background: green;"></div> <div style="display: inline-block; height: 10px; width: 10px; background: green;margin-right:1px;"></div>
<span>${LabelCompleted}</span> <span>${LabelCompleted}</span>
<div style="display: inline-block; height: 10px; width: 10px; background: red; margin-left: 1em;"></div> <div style="display: inline-block; height: 10px; width: 10px; background: red; margin-left: 1em;margin-right:1px;"></div>
<span>${LabelFailed}</span> <span>${LabelFailed}</span>
<div style="display: inline-block; height: 10px; width: 10px; background: blue; margin-left: 1em;"></div> <div style="display: inline-block; height: 10px; width: 10px; background: blue; margin-left: 1em;margin-right:1px;"></div>
<span>${LabelSkipped}</span> <span>${LabelSkipped}</span>
</div> </div>
<div class="listBottomPaging"> <div class="listBottomPaging">

View file

@ -1269,26 +1269,29 @@ span.itemCommunityRating:not(:empty) + .userDataIcons {
.listItem a:first-child { .listItem a:first-child {
margin-right: 0 !important; margin-right: 0 !important;
background-color: transparent !important; background-color: transparent !important;
}
.ui-page-theme-a .listItem a:first-child {
border-color: #d8d8d8 !important; border-color: #d8d8d8 !important;
} }
.ui-page-theme-b .listItem a:first-child {
border-color: #383838 !important;
}
.listItem a + a { .listItem a + a {
background-color: transparent !important; background-color: transparent !important;
z-index: 1000; z-index: 1000;
} }
.listItem:hover a { .ui-page-theme-a .listItem:hover a {
background-color: #eee !important; background-color: #eee !important;
} }
.page[data-theme='b'] .listItem:hover a { .ui-page-theme-b .listItem:hover a {
background-color: #333 !important; background-color: #333 !important;
} }
.page[data-theme='b'] .listItem a:first-child {
border-color: #282828 !important;
}
@media all and (max-width: 600px) { @media all and (max-width: 600px) {
.itemsListview .ui-li-aside { .itemsListview .ui-li-aside {

View file

@ -288,7 +288,7 @@
<div data-role="editableListviewContainer"> <div data-role="editableListviewContainer">
<div> <div>
<div style="display: inline-block; width: 80%;"> <div style="display: inline-block; width: 80%;">
<input type="text" /> <input type="text" class="txtEditableListview" />
</div> </div>
<a data-role="button" data-inline="true" data-mini="true" data-icon="plus" data-iconpos="notext" onclick="EditItemMetadataPage.addElementToEditableListview(this)" style="vertical-align: top;">${ButtonAdd}</a> <a data-role="button" data-inline="true" data-mini="true" data-icon="plus" data-iconpos="notext" onclick="EditItemMetadataPage.addElementToEditableListview(this)" style="vertical-align: top;">${ButtonAdd}</a>
</div> </div>
@ -300,7 +300,7 @@
<div data-role="editableListviewContainer"> <div data-role="editableListviewContainer">
<div> <div>
<div style="display: inline-block; width: 80%;"> <div style="display: inline-block; width: 80%;">
<input type="text" /> <input type="text" class="txtEditableListview" />
</div> </div>
<a data-role="button" data-inline="true" data-mini="true" data-icon="plus" data-iconpos="notext" onclick="EditItemMetadataPage.addElementToEditableListview(this)" style="vertical-align: top;">${ButtonAdd}</a> <a data-role="button" data-inline="true" data-mini="true" data-icon="plus" data-iconpos="notext" onclick="EditItemMetadataPage.addElementToEditableListview(this)" style="vertical-align: top;">${ButtonAdd}</a>
</div> </div>
@ -321,7 +321,7 @@
<div data-role="editableListviewContainer"> <div data-role="editableListviewContainer">
<div> <div>
<div style="display: inline-block; width: 80%;"> <div style="display: inline-block; width: 80%;">
<input type="text" /> <input type="text" class="txtEditableListview" />
</div> </div>
<a data-role="button" data-inline="true" data-mini="true" data-icon="plus" data-iconpos="notext" onclick="EditItemMetadataPage.addElementToEditableListview(this)" style="vertical-align: top;">${ButtonAdd}</a> <a data-role="button" data-inline="true" data-mini="true" data-icon="plus" data-iconpos="notext" onclick="EditItemMetadataPage.addElementToEditableListview(this)" style="vertical-align: top;">${ButtonAdd}</a>
</div> </div>
@ -333,7 +333,7 @@
<div data-role="editableListviewContainer"> <div data-role="editableListviewContainer">
<div> <div>
<div style="display: inline-block; width: 80%;"> <div style="display: inline-block; width: 80%;">
<input type="text" /> <input type="text" class="txtEditableListview" />
</div> </div>
<a data-role="button" data-inline="true" data-mini="true" data-icon="plus" data-iconpos="notext" onclick="EditItemMetadataPage.addElementToEditableListview(this)" style="vertical-align: top;">${ButtonAdd}</a> <a data-role="button" data-inline="true" data-mini="true" data-icon="plus" data-iconpos="notext" onclick="EditItemMetadataPage.addElementToEditableListview(this)" style="vertical-align: top;">${ButtonAdd}</a>
</div> </div>
@ -345,7 +345,7 @@
<div data-role="editableListviewContainer"> <div data-role="editableListviewContainer">
<div> <div>
<div style="display: inline-block; width: 80%;"> <div style="display: inline-block; width: 80%;">
<input type="text" /> <input type="text" class="txtEditableListview" />
</div> </div>
<a data-role="button" data-inline="true" data-mini="true" data-icon="plus" data-iconpos="notext" onclick="EditItemMetadataPage.addElementToEditableListview(this)" style="vertical-align: top;">${ButtonAdd}</a> <a data-role="button" data-inline="true" data-mini="true" data-icon="plus" data-iconpos="notext" onclick="EditItemMetadataPage.addElementToEditableListview(this)" style="vertical-align: top;">${ButtonAdd}</a>
</div> </div>

View file

@ -22,7 +22,7 @@
</div> </div>
<br /> <br />
<div class="readOnlyContent refreshLibraryPanel hide"> <div class="readOnlyContent">
<button type="button" class="btnRefresh" data-icon="refresh" data-mini="true">${ButtonScanLibrary}</button> <button type="button" class="btnRefresh" data-icon="refresh" data-mini="true">${ButtonScanLibrary}</button>
<progress max="100" min="0" style="width: 100%;" class="refreshProgress"></progress> <progress max="100" min="0" style="width: 100%;" class="refreshProgress"></progress>
<div style="margin-top: 5px;">${LabelLastResult} <span class="lastRefreshResult"></span></div> <div style="margin-top: 5px;">${LabelLastResult} <span class="lastRefreshResult"></span></div>

View file

@ -25,7 +25,7 @@
</div> </div>
<br /> <br />
<div class="refreshGuidePanel hide"> <div class="refreshGuidePanel">
<button type="button" class="btnRefreshGuide" data-icon="refresh" data-mini="true">${ButtonRefreshGuideData}</button> <button type="button" class="btnRefreshGuide" data-icon="refresh" data-mini="true">${ButtonRefreshGuideData}</button>
<progress max="100" min="0" style="width: 100%;" class="refreshGuideProgress"></progress> <progress max="100" min="0" style="width: 100%;" class="refreshGuideProgress"></progress>
<div style="margin-top: 5px;">${LabelLastResult} <span class="lastRefreshGuideResult"></span></div> <div style="margin-top: 5px;">${LabelLastResult} <span class="lastRefreshGuideResult"></span></div>

View file

@ -122,7 +122,7 @@
<label for="txtFanartApiKey">${LabelFanartApiKey}</label> <label for="txtFanartApiKey">${LabelFanartApiKey}</label>
<input type="text" id="txtFanartApiKey" /> <input type="text" id="txtFanartApiKey" />
<div class="fieldDescription">${LabelFanartApiKeyHelp}</div> <div class="fieldDescription">${LabelFanartApiKeyHelp}</div>
<div class="fieldDescription"><a href="https://fanart.tv/get-an-api-key" target="_blank">${ButtonLearnMore}</a></div> <div class="fieldDescription"><a href="https://fanart.tv/2015/01/personal-api-keys" target="_blank">${ButtonLearnMore}</a></div>
</li> </li>
<li> <li>
<input type="checkbox" id="chkEnableFanartUpdates" data-mini="true" /> <input type="checkbox" id="chkEnableFanartUpdates" data-mini="true" />

View file

@ -329,9 +329,21 @@
reloadItems(page); reloadItems(page);
// on here
$('.btnOrganize', page).taskButton({
mode: 'on',
progressElem: $('.organizeProgress', page),
taskKey: 'AutoOrganize'
});
}).on('pagehide', "#libraryFileOrganizerLogPage", function () { }).on('pagehide', "#libraryFileOrganizerLogPage", function () {
currentResult = null; currentResult = null;
// off here
$('.btnOrganize', page).taskButton({
mode: 'off'
});
}); });
window.OrganizerLogPage = { window.OrganizerLogPage = {

View file

@ -963,11 +963,13 @@
}; };
self.addElementToEditableListview = function (source, sortCallback) { self.addElementToEditableListview = function (source, sortCallback) {
var input = $(source).parent().find('input[type="text"], select');
var parent = $(source).parents('*[data-role="editableListviewContainer"]');
var input = parent.find('.txtEditableListview, select');
var text = input.val(); var text = input.val();
input.val('');
if (text == '') return; if (text == '') return;
var list = $(source).parents('[data-role="editableListviewContainer"]').find('ul[data-role="listview"]'); var list = parent.find('ul[data-role="listview"]');
var items = editableListViewValues(list); var items = editableListViewValues(list);
items.push(text); items.push(text);
populateListView(list, items, sortCallback); populateListView(list, items, sortCallback);

View file

@ -259,8 +259,6 @@
if (elem) { if (elem) {
elem.scrollIntoView(); elem.scrollIntoView();
} }
$(document).scrollTop(0);
} }
function initializeTree(page, currentUser, openItems, selectedId) { function initializeTree(page, currentUser, openItems, selectedId) {

View file

@ -161,109 +161,29 @@
}); });
} }
function pollTasks(page) { $(document).on('pageshow', "#liveTvStatusPage", function () {
ApiClient.getScheduledTasks().done(function (tasks) {
updateTasks(page, tasks);
});
}
function updateTasks(page, tasks) {
$('.refreshGuidePanel', page).removeClass('hide');
var task = tasks.filter(function (t) {
return t.Key == 'RefreshGuide';
})[0];
$('.btnRefreshGuide', page).buttonEnabled(task.State == 'Idle').attr('data-taskid', task.Id);
var progress = (task.CurrentProgressPercentage || 0).toFixed(1);
var progressElem = $('.refreshGuideProgress', page).val(progress);
if (task.State == 'Running') {
progressElem.show();
} else {
progressElem.hide();
}
var lastResult = task.LastExecutionResult ? task.LastExecutionResult.Status : '';
if (lastResult == "Failed") {
$('.lastRefreshGuideResult', page).html('<span style="color:#FF0000;">' + Globalize.translate('LabelFailed') + '</span>');
}
else if (lastResult == "Cancelled") {
$('.lastRefreshGuideResult', page).html('<span style="color:#0026FF;">' + Globalize.translate('LabelCancelled') + '</span>');
}
else if (lastResult == "Aborted") {
$('.lastRefreshGuideResult', page).html('<span style="color:#FF0000;">' + Globalize.translate('LabelAbortedByServerShutdown') + '</span>');
} else {
$('.lastRefreshGuideResult', page).html(lastResult);
}
}
function onWebSocketMessage(e, msg) {
if (msg.MessageType == "ScheduledTasksInfo") {
var tasks = msg.Data;
var page = $.mobile.activePage;
updateTasks(page, tasks);
}
}
$(document).on('pageinit', "#liveTvStatusPage", function () {
var page = this; var page = this;
$('.btnRefreshGuide', page).on('click', function () {
var button = this;
var id = button.getAttribute('data-taskid');
ApiClient.startScheduledTask(id).done(function () {
pollTasks(page);
});
});
}).on('pageshow', "#liveTvStatusPage", function () {
var page = this;
$('.refreshGuidePanel', page).addClass('hide');
reload(page); reload(page);
pollTasks(page); // on here
$('.btnRefreshGuide', page).taskButton({
if (ApiClient.isWebSocketOpen()) { mode: 'on',
ApiClient.sendWebSocketMessage("ScheduledTasksInfoStart", "1000,1000"); progressElem: $('.refreshGuideProgress', page),
} lastResultElem: $('.lastRefreshGuideResult', page),
taskKey: 'RefreshGuide'
$(ApiClient).on("websocketmessage", onWebSocketMessage).on('websocketopen', function () {
if (ApiClient.isWebSocketOpen()) {
ApiClient.sendWebSocketMessage("ScheduledTasksInfoStart", "1000,1000");
}
}); });
}).on('pagehide', "#liveTvStatusPage", function () { }).on('pagehide', "#liveTvStatusPage", function () {
var page = this; var page = this;
if (ApiClient.isWebSocketOpen()) { // off here
ApiClient.sendWebSocketMessage("ScheduledTasksInfoStop"); $('.btnRefreshGuide', page).taskButton({
} mode: 'off'
});
$(ApiClient).off("websocketmessage", onWebSocketMessage);
}); });
})(jQuery, document, window); })(jQuery, document, window);

View file

@ -371,111 +371,127 @@ var WizardLibraryPage = {
(function ($, document, window) { (function ($, document, window) {
function pollTasks(page) { $(document).on('pageshow', "#mediaLibraryPage", function () {
ApiClient.getScheduledTasks().done(function (tasks) {
updateTasks(page, tasks);
});
}
function updateTasks(page, tasks) {
$('.refreshLibraryPanel', page).removeClass('hide');
var task = tasks.filter(function (t) {
return t.Key == 'RefreshLibrary';
})[0];
$('.btnRefresh', page).buttonEnabled(task.State == 'Idle').attr('data-taskid', task.Id);
var progress = (task.CurrentProgressPercentage || 0).toFixed(1);
var progressElem = $('.refreshProgress', page).val(progress);
if (task.State == 'Running') {
progressElem.show();
} else {
progressElem.hide();
}
var lastResult = task.LastExecutionResult ? task.LastExecutionResult.Status : '';
if (lastResult == "Failed") {
$('.lastRefreshResult', page).html('<span style="color:#FF0000;">' + Globalize.translate('LabelFailed') + '</span>');
}
else if (lastResult == "Cancelled") {
$('.lastRefreshResult', page).html('<span style="color:#0026FF;">' + Globalize.translate('LabelCancelled') + '</span>');
}
else if (lastResult == "Aborted") {
$('.lastRefreshResult', page).html('<span style="color:#FF0000;">' + Globalize.translate('LabelAbortedByServerShutdown') + '</span>');
} else {
$('.lastRefreshResult', page).html(lastResult);
}
}
function onWebSocketMessage(e, msg) {
if (msg.MessageType == "ScheduledTasksInfo") {
var tasks = msg.Data;
var page = $.mobile.activePage;
updateTasks(page, tasks);
}
}
$(document).on('pageinit', "#mediaLibraryPage", function () {
var page = this; var page = this;
$('.btnRefresh', page).on('click', function () { // on here
$('.btnRefresh', page).taskButton({
var button = this; mode: 'on',
var id = button.getAttribute('data-taskid'); progressElem: $('.refreshProgress', page),
lastResultElem: $('.lastRefreshResult', page),
ApiClient.startScheduledTask(id).done(function () { taskKey: 'RefreshLibrary'
pollTasks(page);
});
});
}).on('pageshow', "#mediaLibraryPage", function () {
var page = this;
$('.refreshLibraryPanel', page).addClass('hide');
pollTasks(page);
var apiClient = ApiClient;
if (apiClient.isWebSocketOpen()) {
apiClient.sendWebSocketMessage("ScheduledTasksInfoStart", "1000,1000");
}
$(apiClient).on("websocketmessage", onWebSocketMessage).on('websocketopen', function () {
if (apiClient.isWebSocketOpen()) {
apiClient.sendWebSocketMessage("ScheduledTasksInfoStart", "1000,1000");
}
}); });
}).on('pagehide', "#mediaLibraryPage", function () { }).on('pagehide', "#mediaLibraryPage", function () {
var page = this; var page = this;
var apiClient = ApiClient; // off here
$('.btnRefresh', page).taskButton({
mode: 'off'
});
if (apiClient.isWebSocketOpen()) {
apiClient.sendWebSocketMessage("ScheduledTasksInfoStop");
}
$(apiClient).off("websocketmessage", onWebSocketMessage);
}); });
})(jQuery, document, window); })(jQuery, document, window);
$.fn.taskButton = function (options) {
function pollTasks(button) {
ApiClient.getScheduledTasks().done(function (tasks) {
updateTasks(button, tasks);
});
}
function updateTasks(button, tasks) {
var task = tasks.filter(function (t) {
return t.Key == options.taskKey;
})[0];
button.buttonEnabled(task.State == 'Idle').attr('data-taskid', task.Id);
var progress = (task.CurrentProgressPercentage || 0).toFixed(1);
if (options.progressElem) {
var progressElem = options.progressElem.val(progress);
if (task.State == 'Running') {
progressElem.show();
} else {
progressElem.hide();
}
}
if (options.lastResultElem) {
var lastResult = task.LastExecutionResult ? task.LastExecutionResult.Status : '';
if (lastResult == "Failed") {
options.lastResultElem.html('<span style="color:#FF0000;">' + Globalize.translate('LabelFailed') + '</span>');
}
else if (lastResult == "Cancelled") {
options.lastResultElem.html('<span style="color:#0026FF;">' + Globalize.translate('LabelCancelled') + '</span>');
}
else if (lastResult == "Aborted") {
options.lastResultElem.html('<span style="color:#FF0000;">' + Globalize.translate('LabelAbortedByServerShutdown') + '</span>');
} else {
options.lastResultElem.html(lastResult);
}
}
}
var self = this;
if (options.mode == 'off') {
if (ApiClient.isWebSocketOpen()) {
ApiClient.sendWebSocketMessage("ScheduledTasksInfoStop");
}
$(ApiClient).off(".taskbutton");
} else {
this.on('click', function () {
var button = this;
var id = button.getAttribute('data-taskid');
ApiClient.startScheduledTask(id).done(function () {
pollTasks(self);
});
});
pollTasks(self);
if (ApiClient.isWebSocketOpen()) {
ApiClient.sendWebSocketMessage("ScheduledTasksInfoStart", "1000,1000");
}
$(ApiClient).on("websocketmessage.taskbutton", function (e, msg) {
if (msg.MessageType == "ScheduledTasksInfo") {
var tasks = msg.Data;
updateTasks(self, tasks);
}
}).on('websocketopen.taskbutton', function () {
if (ApiClient.isWebSocketOpen()) {
ApiClient.sendWebSocketMessage("ScheduledTasksInfoStart", "1000,1000");
}
});
}
return this;
};

View file

@ -246,6 +246,25 @@
reloadData(page); reloadData(page);
// on here
$('.btnSync', page).taskButton({
mode: 'on',
progressElem: $('.syncProgress', page),
taskKey: 'SyncPrepare'
});
}).on('pagehide', ".syncActivityPage", function () {
var page = this;
reloadData(page);
// off here
$('.btnSync', page).taskButton({
mode: 'off'
});
}); });
})(); })();

View file

@ -14,6 +14,11 @@
<a href="syncsettings.html" data-role="button">${TabSettings}</a> <a href="syncsettings.html" data-role="button">${TabSettings}</a>
</div> </div>
<div style="text-align:right;margin-top:-20px;">
<button type="button" class="btnSync" data-icon="cloud" data-mini="true" data-inline="true">${ButtonConvertMedia}</button>
<progress max="100" min="0" style="width:100px;display:none;" class="syncProgress"></progress>
</div>
<br />
<div class="syncActivity"> <div class="syncActivity">
</div> </div>