From 0d500aa41ecabb75ee6fdf6453d1534e754c5f62 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 8 Mar 2015 13:58:45 -0400 Subject: [PATCH] display sync services --- dashboard-ui/scripts/plugincatalogpage.js | 2 +- dashboard-ui/scripts/pluginspage.js | 22 +++++++++++++++------- dashboard-ui/scripts/syncservices.js | 20 ++++++++++++++++++-- dashboard-ui/syncservices.html | 3 +-- 4 files changed, 35 insertions(+), 12 deletions(-) diff --git a/dashboard-ui/scripts/plugincatalogpage.js b/dashboard-ui/scripts/plugincatalogpage.js index bacc203733..6f82d0eba4 100644 --- a/dashboard-ui/scripts/plugincatalogpage.js +++ b/dashboard-ui/scripts/plugincatalogpage.js @@ -132,7 +132,7 @@ } var installedPlugin = plugin.isApp ? null : installedPlugins.filter(function (ip) { - return ip.Name == plugin.name; + return ip.Id == plugin.guid; })[0]; html += "
"; diff --git a/dashboard-ui/scripts/pluginspage.js b/dashboard-ui/scripts/pluginspage.js index 566484f874..a91d4a0e56 100644 --- a/dashboard-ui/scripts/pluginspage.js +++ b/dashboard-ui/scripts/pluginspage.js @@ -108,6 +108,15 @@ return html; } + function renderPlugins(page, plugins) { + + ApiClient.getJSON(ApiClient.getUrl("dashboard/configurationpages") + "?pageType=PluginConfiguration").done(function (configPages) { + + populateList(page, plugins, configPages); + + }); + } + function populateList(page, plugins, pluginConfigurationPages) { plugins = plugins.sort(function (plugin1, plugin2) { @@ -198,14 +207,9 @@ Dashboard.showLoadingMsg(); - var promise1 = ApiClient.getInstalledPlugins(); - - var promise2 = ApiClient.getJSON(ApiClient.getUrl("dashboard/configurationpages") + "?pageType=PluginConfiguration"); - - $.when(promise1, promise2).done(function (response1, response2) { - - populateList(page, response1[0], response2[0]); + ApiClient.getInstalledPlugins().done(function (plugins) { + renderPlugins(page, plugins); }); } @@ -214,4 +218,8 @@ reloadList(this); }); + window.PluginsPage = { + renderPlugins: renderPlugins + }; + })(jQuery, window); \ No newline at end of file diff --git a/dashboard-ui/scripts/syncservices.js b/dashboard-ui/scripts/syncservices.js index b16bdab774..20e05e050e 100644 --- a/dashboard-ui/scripts/syncservices.js +++ b/dashboard-ui/scripts/syncservices.js @@ -11,11 +11,27 @@ var promise2 = ApiClient.getInstalledPlugins(); $.when(promise1, promise2).done(function (response1, response2) { - populateList(page, response1[0], response2[0]); + renderInstalled(page, response1[0], response2[0]); + renderCatalog(page, response1[0], response2[0]); }); } - function populateList(page, availablePlugins, installedPlugins) { + function renderInstalled(page, availablePlugins, installedPlugins) { + + installedPlugins = installedPlugins.filter(function (i) { + + var catalogEntry = availablePlugins.filter(function (a) { + return a.guid == i.Id; + })[0]; + + return catalogEntry && catalogEntry.category == 'Sync'; + + }); + + PluginsPage.renderPlugins(page, installedPlugins); + } + + function renderCatalog(page, availablePlugins, installedPlugins) { PluginCatalog.renderCatalog({ diff --git a/dashboard-ui/syncservices.html b/dashboard-ui/syncservices.html index a25ed48213..363f98f000 100644 --- a/dashboard-ui/syncservices.html +++ b/dashboard-ui/syncservices.html @@ -16,8 +16,7 @@
${HeaderInstalledServices}
- -
+