Browse Source

LICENSE-99 Exclude license plugin from the plugins list in marketplace

tags/7.5
Grégoire Aubert 6 years ago
parent
commit
1edf0af803

+ 1
- 1
server/sonar-web/src/main/js/apps/marketplace/App.tsx View 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">

+ 10
- 4
server/sonar-web/src/main/js/apps/marketplace/utils.ts View 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))
);
});
}

Loading…
Cancel
Save