mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
aadd sync services tab
This commit is contained in:
parent
b013e62f2e
commit
90804e8145
6 changed files with 114 additions and 17 deletions
|
@ -15,20 +15,39 @@
|
|||
var promise2 = ApiClient.getInstalledPlugins();
|
||||
|
||||
$.when(promise1, promise2).done(function (response1, response2) {
|
||||
populateList(page, response1[0], response2[0]);
|
||||
populateList({
|
||||
|
||||
catalogElement: $('#pluginTiles', page),
|
||||
noItemsElement: $("#noPlugins", page),
|
||||
availablePlugins: response1[0],
|
||||
installedPlugins: response2[0]
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function populateList(page, availablePlugins, installedPlugins) {
|
||||
function populateList(options) {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
var availablePlugins = options.availablePlugins;
|
||||
var installedPlugins = options.installedPlugins;
|
||||
|
||||
availablePlugins = availablePlugins.filter(function (p) {
|
||||
|
||||
p.category = p.category || "General";
|
||||
p.categoryDisplayName = Globalize.translate('PluginCategory' + p.category.replace(' ', ''));
|
||||
|
||||
if (options.categories) {
|
||||
if (options.categories.indexOf(p.category) == -1) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return p.type == "UserInstalled";
|
||||
|
||||
}).sort(function (a, b) {
|
||||
|
||||
var aName = (a.category || "General") + " " + a.name;
|
||||
var bame = (b.category || "General") + " " + b.name;
|
||||
var aName = (a.category) + " " + a.name;
|
||||
var bame = (b.category) + " " + b.name;
|
||||
|
||||
return aName > bame ? 1 : -1;
|
||||
});
|
||||
|
@ -41,17 +60,19 @@
|
|||
var html = '';
|
||||
var plugin = availablePlugins[i];
|
||||
|
||||
var category = plugin.category || "General";
|
||||
var category = plugin.categoryDisplayName;
|
||||
|
||||
if (category != currentCategory) {
|
||||
|
||||
if (currentCategory) {
|
||||
html += '<br/>';
|
||||
html += '<br/>';
|
||||
html += '<br/>';
|
||||
}
|
||||
if (options.showCategory !== false) {
|
||||
if (currentCategory) {
|
||||
html += '<br/>';
|
||||
html += '<br/>';
|
||||
html += '<br/>';
|
||||
}
|
||||
|
||||
html += '<div class="detailSectionHeader">' + category + '</div>';
|
||||
html += '<div class="detailSectionHeader">' + category + '</div>';
|
||||
}
|
||||
|
||||
currentCategory = category;
|
||||
}
|
||||
|
@ -132,11 +153,11 @@
|
|||
|
||||
}
|
||||
|
||||
if (!availablePlugins.length) {
|
||||
$("#noPlugins", page).hide();
|
||||
if (!availablePlugins.length && options.noItemsElement) {
|
||||
$(options.noItemsElement).hide();
|
||||
}
|
||||
|
||||
$('#pluginTiles', page).html(pluginhtml);
|
||||
$(options.catalogElement).html(pluginhtml);
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
}
|
||||
|
@ -145,8 +166,6 @@
|
|||
|
||||
var page = this;
|
||||
|
||||
reloadList(page);
|
||||
|
||||
$('.chkPremiumFilter', page).on('change', function () {
|
||||
|
||||
if (this.checked) {
|
||||
|
@ -189,6 +208,12 @@
|
|||
this.checked = filters;
|
||||
|
||||
}).checkboxradio('refresh');
|
||||
|
||||
reloadList(page);
|
||||
});
|
||||
|
||||
window.PluginCatalog = {
|
||||
renderCatalog: populateList
|
||||
};
|
||||
|
||||
})(jQuery, document);
|
38
dashboard-ui/scripts/syncservices.js
Normal file
38
dashboard-ui/scripts/syncservices.js
Normal file
|
@ -0,0 +1,38 @@
|
|||
(function ($, document) {
|
||||
|
||||
function reloadList(page) {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
var promise1 = ApiClient.getAvailablePlugins({
|
||||
TargetSystems: 'Server'
|
||||
});
|
||||
|
||||
var promise2 = ApiClient.getInstalledPlugins();
|
||||
|
||||
$.when(promise1, promise2).done(function (response1, response2) {
|
||||
populateList(page, response1[0], response2[0]);
|
||||
});
|
||||
}
|
||||
|
||||
function populateList(page, availablePlugins, installedPlugins) {
|
||||
|
||||
PluginCatalog.renderCatalog({
|
||||
|
||||
catalogElement: $('.catalog', page),
|
||||
availablePlugins: availablePlugins,
|
||||
installedPlugins: installedPlugins,
|
||||
categories: ['Sync'],
|
||||
showCategory: false
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
$(document).on('pageshow', "#syncServicesPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
reloadList(page);
|
||||
});
|
||||
|
||||
})(jQuery, document);
|
Loading…
Add table
Add a link
Reference in a new issue