From: Grégoire Aubert Date: Fri, 1 Jun 2018 13:42:58 +0000 (+0200) Subject: LICENSE-99 Exclude license plugin from the plugins list in marketplace X-Git-Tag: 7.5~1018 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1edf0af8035b93c14c2b2c031f661f7bef1a7b82;p=sonarqube.git LICENSE-99 Exclude license plugin from the plugins list in marketplace --- diff --git a/server/sonar-web/src/main/js/apps/marketplace/App.tsx b/server/sonar-web/src/main/js/apps/marketplace/App.tsx index 2e80802d8a9..05e36857ec9 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/App.tsx +++ b/server/sonar-web/src/main/js/apps/marketplace/App.tsx @@ -122,7 +122,7 @@ export default class App extends React.PureComponent { const { currentEdition, standaloneMode, pendingPlugins } = this.props; const { loadingPlugins, plugins } = this.state; const query = parseQuery(this.props.location.query); - const filteredPlugins = query.search ? filterPlugins(plugins, query.search) : plugins; + const filteredPlugins = filterPlugins(plugins, query.search); return (
diff --git a/server/sonar-web/src/main/js/apps/marketplace/utils.ts b/server/sonar-web/src/main/js/apps/marketplace/utils.ts index 58e77c269bd..0d80dc953af 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/utils.ts +++ b/server/sonar-web/src/main/js/apps/marketplace/utils.ts @@ -83,13 +83,19 @@ export function getEditionUrl( return url; } -export function filterPlugins(plugins: Plugin[], search: string): Plugin[] { +const EXCLUDED_PLUGINS = ['license']; +export function filterPlugins(plugins: Plugin[], search?: string): Plugin[] { + if (!search) { + return plugins.filter(plugin => !EXCLUDED_PLUGINS.includes(plugin.key)); + } + const s = search.toLowerCase(); return plugins.filter(plugin => { return ( - plugin.name.toLowerCase().includes(s) || - (plugin.description || '').toLowerCase().includes(s) || - (plugin.category || '').toLowerCase().includes(s) + !EXCLUDED_PLUGINS.includes(plugin.key) && + (plugin.name.toLowerCase().includes(s) || + (plugin.description || '').toLowerCase().includes(s) || + (plugin.category || '').toLowerCase().includes(s)) ); }); }