]> source.dussan.org Git - sonarqube.git/commitdiff
LICENSE-99 Exclude license plugin from the plugins list in marketplace
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>
Fri, 1 Jun 2018 13:42:58 +0000 (15:42 +0200)
committerSonarTech <sonartech@sonarsource.com>
Tue, 12 Jun 2018 18:21:01 +0000 (20:21 +0200)
server/sonar-web/src/main/js/apps/marketplace/App.tsx
server/sonar-web/src/main/js/apps/marketplace/utils.ts

index 2e80802d8a9d702ab426999d851507eb6ba903d0..05e36857ec9ec91f9ded64d48606c2b94b8aeb94 100644 (file)
@@ -122,7 +122,7 @@ export default class App extends React.PureComponent<Props, State> {
     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 (
       <div className="page page-limited" id="marketplace-page">
index 58e77c269bd468c65f3d56ebcf2f6d9af62f25b8..0d80dc953af0054e2665b8ba2d819efab887141f 100644 (file)
@@ -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))
     );
   });
 }