From a3f80ce874727b55c9a1ece2daf7d76c36d735ca Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Thu, 19 Jan 2017 10:59:44 +0100 Subject: [PATCH] SONAR-7298 replace usage of /api/projects/index by /api/components/search --- server/sonar-web/src/main/js/api/components.js | 8 -------- .../src/main/js/apps/account/notifications/Projects.js | 5 +++-- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/server/sonar-web/src/main/js/api/components.js b/server/sonar-web/src/main/js/api/components.js index aaccb414a4d..a3cdc21021f 100644 --- a/server/sonar-web/src/main/js/api/components.js +++ b/server/sonar-web/src/main/js/api/components.js @@ -111,14 +111,6 @@ export function searchProjects (data?: Object) { return getJSON(url, data); } -export function simpleSearchProjects (data?: Object) { - const url = '/api/projects/index'; - return getJSON(url, data).then(projects => projects.map(project => ({ - key: project.k, - name: project.nm - }))); -} - /** * Change component's key * @param {string} key diff --git a/server/sonar-web/src/main/js/apps/account/notifications/Projects.js b/server/sonar-web/src/main/js/apps/account/notifications/Projects.js index 53a6670be39..b9c189b4002 100644 --- a/server/sonar-web/src/main/js/apps/account/notifications/Projects.js +++ b/server/sonar-web/src/main/js/apps/account/notifications/Projects.js @@ -23,7 +23,7 @@ import { connect } from 'react-redux'; import differenceBy from 'lodash/differenceBy'; import ProjectNotifications from './ProjectNotifications'; import { translate } from '../../../helpers/l10n'; -import { simpleSearchProjects } from '../../../api/components'; +import { getComponents } from '../../../api/components'; import { getProjectsWithNotifications } from '../../../store/rootReducer'; type Props = { @@ -62,7 +62,8 @@ class Projects extends React.Component { loadOptions = query => { // TODO filter existing out - return simpleSearchProjects({ search: query }) + return getComponents({ qualifiers: 'TRK', q: query }) + .then(r => r.components) .then(projects => projects.map(project => ({ value: project.key, label: project.name -- 2.39.5