]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-7298 replace usage of /api/projects/index by /api/components/search
authorStas Vilchik <vilchiks@gmail.com>
Thu, 19 Jan 2017 09:59:44 +0000 (10:59 +0100)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Tue, 24 Jan 2017 17:36:48 +0000 (18:36 +0100)
server/sonar-web/src/main/js/api/components.js
server/sonar-web/src/main/js/apps/account/notifications/Projects.js

index aaccb414a4d1d1c1de4932b470695e69abc98da7..a3cdc21021ff223362b44c669878bfa49039b6f5 100644 (file)
@@ -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
index 53a6670be3903a7f45729b5ea2f9b9ec7044822b..b9c189b4002d329965fb8f1b6d9e6a01ed7d0efc 100644 (file)
@@ -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