diff --git a/dashboard-ui/scripts/plugincatalogpage.js b/dashboard-ui/scripts/plugincatalogpage.js index ecc41ac715..1fa5fa4cf4 100644 --- a/dashboard-ui/scripts/plugincatalogpage.js +++ b/dashboard-ui/scripts/plugincatalogpage.js @@ -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 += '
'; - html += '
'; - html += '
'; - } + if (options.showCategory !== false) { + if (currentCategory) { + html += '
'; + html += '
'; + html += '
'; + } - html += '
' + category + '
'; + html += '
' + category + '
'; + } 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); \ No newline at end of file diff --git a/dashboard-ui/scripts/syncservices.js b/dashboard-ui/scripts/syncservices.js new file mode 100644 index 0000000000..815464993d --- /dev/null +++ b/dashboard-ui/scripts/syncservices.js @@ -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); \ No newline at end of file diff --git a/dashboard-ui/syncactivity.html b/dashboard-ui/syncactivity.html index 3318b33042..16726d34ea 100644 --- a/dashboard-ui/syncactivity.html +++ b/dashboard-ui/syncactivity.html @@ -11,6 +11,7 @@
${TabActivity} + ${TabServices} ${TabSettings}
diff --git a/dashboard-ui/syncjob.html b/dashboard-ui/syncjob.html index 1daba6457e..b7efb95029 100644 --- a/dashboard-ui/syncjob.html +++ b/dashboard-ui/syncjob.html @@ -11,6 +11,7 @@
${TabActivity} + ${TabServices} ${TabSettings}
diff --git a/dashboard-ui/syncservices.html b/dashboard-ui/syncservices.html new file mode 100644 index 0000000000..a25ed48213 --- /dev/null +++ b/dashboard-ui/syncservices.html @@ -0,0 +1,31 @@ + + + + ${TitleSync} + + +
+ +
+
+ + + +
${HeaderInstalledServices}
+ +
+
+
+
+
${HeaderAvailableServices}
+
+ +
+
+
+ + diff --git a/dashboard-ui/syncsettings.html b/dashboard-ui/syncsettings.html index 4586e6592d..fe111383ec 100644 --- a/dashboard-ui/syncsettings.html +++ b/dashboard-ui/syncsettings.html @@ -11,6 +11,7 @@
${TabActivity} + ${TabServices} ${TabSettings}