search all plugins when on download tab
This commit is contained in:
Barış Soner Uşaklı
2024-09-30 10:27:03 -04:00
parent b1993ff01d
commit c4a60dbbcc
4 changed files with 47 additions and 51 deletions

View File

@@ -17,6 +17,7 @@ pluginsController.get = async function (req, res) {
const compatiblePkgNames = compatible.map(pkgData => pkgData.name);
const installedPlugins = compatible.filter(plugin => plugin && (plugin.installed || (nconf.get('plugins:active') && plugin.active)));
const activePlugins = all.filter(plugin => plugin && (plugin.installed || nconf.get('plugins:active')) && plugin.active);
const inactivePlugins = all.filter(plugin => plugin && (plugin.installed || nconf.get('plugins:active')) && !plugin.active);
const trendingScores = trending.reduce((memo, cur) => {
memo[cur.label] = cur.value;
@@ -30,18 +31,17 @@ pluginsController.get = async function (req, res) {
return plugin;
});
const upgrade = compatible.filter(p => p.installed && p.outdated);
res.render('admin/extend/plugins', {
installed: installedPlugins,
installedCount: installedPlugins.length,
active: activePlugins,
activeCount: activePlugins.length,
inactiveCount: Math.max(0, installedPlugins.length - activePlugins.length),
inactive: inactivePlugins,
inactiveCount: inactivePlugins.length,
canChangeState: !nconf.get('plugins:active'),
upgradeCount: compatible.reduce((count, current) => {
if (current.installed && current.outdated) {
count += 1;
}
return count;
}, 0),
upgrade: upgrade,
upgradeCount: upgrade.length,
download: compatible.filter(plugin => !plugin.installed),
incompatible: all.filter(plugin => !compatiblePkgNames.includes(plugin.name)),
trending: trendingPlugins,