diff --git a/src/availableplugins.html b/src/availableplugins.html new file mode 100644 index 0000000000..ea1147fbfd --- /dev/null +++ b/src/availableplugins.html @@ -0,0 +1,8 @@ +
+
+
+
${MessageNoAvailablePlugins}
+
+
+
+
\ No newline at end of file diff --git a/src/controllers/plugincatalogpage.js b/src/controllers/availableplugins.js similarity index 69% rename from src/controllers/plugincatalogpage.js rename to src/controllers/availableplugins.js index c823d7c372..62131456da 100644 --- a/src/controllers/plugincatalogpage.js +++ b/src/controllers/availableplugins.js @@ -3,7 +3,7 @@ define(["loading", "libraryMenu", "globalize", "cardStyle", "emby-button", "emby function reloadList(page) { loading.show(); - var promise1 = ApiClient.getAvailablePlugins(query); + var promise1 = ApiClient.getAvailablePlugins(); var promise2 = ApiClient.getInstalledPlugins(); Promise.all([promise1, promise2]).then(function (responses) { populateList({ @@ -33,19 +33,15 @@ define(["loading", "libraryMenu", "globalize", "cardStyle", "emby-button", "emby function populateList(options) { var availablePlugins = options.availablePlugins; var installedPlugins = options.installedPlugins; - var allPlugins = availablePlugins.filter(function (plugin) { - plugin.category = plugin.category || "General"; - plugin.categoryDisplayName = getHeaderText(plugin.category); - if (!options.categories || -1 != options.categories.indexOf(plugin.category)) { - if (!options.targetSystem || plugin.targetSystem == options.targetSystem) { - return "UserInstalled" == plugin.type; - } - } - return false; + var categories = []; + availablePlugins.forEach(function (plugin, index, array) { + plugin.category = plugin.category || 'General'; + plugin.categoryDisplayName = getHeaderText(plugin.category); + array[index] = plugin; }); - availablePlugins = allPlugins.sort(function (a, b) { + availablePlugins.sort(function (a, b) { if (a.category > b.category) { return 1; } else if (b.category > a.category) { @@ -59,45 +55,29 @@ define(["loading", "libraryMenu", "globalize", "cardStyle", "emby-button", "emby return 0; }); - var length; - var plugin; - var currentCategory; + var currentCategory = null; var html = ""; - var hasOpenTag = false; - currentCategory = null; - if (options.showCategory === false) { - html += '
'; - hasOpenTag = true; - } for (var i = 0; i < availablePlugins.length; i++) { - plugin = availablePlugins[i]; + var plugin = availablePlugins[i]; var category = plugin.categoryDisplayName; - if (category != currentCategory) { - if (false !== options.showCategory) { - if (currentCategory) { - hasOpenTag = false; - html += "
"; - html += ""; - } - html += '
'; - html += '

' + category + "

"; - html += '
'; - hasOpenTag = true; + if (currentCategory) { + html += "
"; + html += "
"; } + html += '
'; + html += '

' + category + "

"; + html += '
'; currentCategory = category; } html += getPluginHtml(plugin, options, installedPlugins); } - - if (hasOpenTag) { - html += "
"; - html += "
"; - } + html += ""; + html += ""; if (!availablePlugins.length && options.noItemsElement) { - options.noItemsElement.classList.add("hide"); + options.noItemsElement.classList.remove("hide"); } options.catalogElement.innerHTML = html; @@ -145,29 +125,19 @@ define(["loading", "libraryMenu", "globalize", "cardStyle", "emby-button", "emby function getTabs() { return [{ - href: "plugins.html", + href: "installedplugins.html", name: globalize.translate("TabMyPlugins") }, { - href: "plugincatalog.html", + href: "availableplugins.html", name: globalize.translate("TabCatalog") }]; } - var query = { - TargetSystems: "Server", - IsAppStoreSafe: true, - IsAdult: false - }; - window.PluginCatalog = { renderCatalog: populateList }; return function (view, params) { - view.querySelector("#selectSystem").addEventListener("change", function () { - query.TargetSystems = this.value; - reloadList(view); - }); view.addEventListener("viewshow", function () { libraryMenu.setTabs("plugins", 1, getTabs); reloadList(this); diff --git a/src/scripts/pluginspage.js b/src/controllers/installedplugins.js similarity index 98% rename from src/scripts/pluginspage.js rename to src/controllers/installedplugins.js index e730da8773..40de0cc191 100644 --- a/src/scripts/pluginspage.js +++ b/src/controllers/installedplugins.js @@ -88,7 +88,7 @@ define(["loading", "libraryMenu", "dom", "globalize", "cardStyle", "emby-button" } else { html += '
'; html += "

" + globalize.translate("MessageNoPluginsInstalled") + "

"; - html += '

'; + html += '

'; html += globalize.translate("BrowsePluginCatalogMessage"); html += "

"; html += "
"; @@ -141,10 +141,10 @@ define(["loading", "libraryMenu", "dom", "globalize", "cardStyle", "emby-button" function getTabs() { return [{ - href: "plugins.html", + href: "installedplugins.html", name: globalize.translate("TabMyPlugins") }, { - href: "plugincatalog.html", + href: "availableplugins.html", name: globalize.translate("TabCatalog") }] } diff --git a/src/plugins.html b/src/installedplugins.html similarity index 68% rename from src/plugins.html rename to src/installedplugins.html index 8209b60fd2..633df2df29 100644 --- a/src/plugins.html +++ b/src/installedplugins.html @@ -1,8 +1,6 @@ -
- +
-
diff --git a/src/plugincatalog.html b/src/plugincatalog.html deleted file mode 100644 index 53579d16a3..0000000000 --- a/src/plugincatalog.html +++ /dev/null @@ -1,25 +0,0 @@ -
-
-
- -
-
- -
- -
- - ${Help} -
- -
- -
${MessageNoAvailablePlugins}
- -
-
-
-
\ No newline at end of file diff --git a/src/scripts/librarymenu.js b/src/scripts/librarymenu.js index 9f21b81c16..bcfbf93ea2 100644 --- a/src/scripts/librarymenu.js +++ b/src/scripts/librarymenu.js @@ -362,7 +362,7 @@ define(["dom", "layoutManager", "inputManager", "connectionManager", "events", " name: globalize.translate("TabPlugins"), icon: "shopping_cart", color: "#9D22B1", - href: "plugins.html", + href: "installedplugins.html", pageIds: ["pluginsPage", "pluginCatalogPage"] }); links.push({ diff --git a/src/scripts/routes.js b/src/scripts/routes.js index bd735877f3..070cfdc10a 100644 --- a/src/scripts/routes.js +++ b/src/scripts/routes.js @@ -284,15 +284,16 @@ define([ roles: "admin" }); defineRoute({ - path: "/plugincatalog.html", + path: "/availableplugins.html", autoFocus: false, roles: "admin", - controller: "plugincatalogpage" + controller: "availableplugins" }); defineRoute({ - path: "/plugins.html", + path: "/installedplugins.html", autoFocus: false, - roles: "admin" + roles: "admin", + controller: "installedplugins" }); defineRoute({ path: "/scheduledtask.html",