From be36f35e637ace99705b843c7d4ef31d2eb9d59f Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Tue, 24 Jan 2017 13:11:34 +0100 Subject: SONAR-8692 Replace calls to api/timemachine/index WS by api/measures/search_history --- server/sonar-web/src/main/js/api/time-machine.js | 29 ++++++++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'server/sonar-web/src/main/js/api') diff --git a/server/sonar-web/src/main/js/api/time-machine.js b/server/sonar-web/src/main/js/api/time-machine.js index 25d65c43c71..8f81cd82f94 100644 --- a/server/sonar-web/src/main/js/api/time-machine.js +++ b/server/sonar-web/src/main/js/api/time-machine.js @@ -17,10 +17,29 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +// @flow import { getJSON } from '../helpers/request'; -export function getTimeMachineData (componentKey, metrics) { - const url = '/api/timemachine/index'; - const data = { resource: componentKey, metrics }; - return getJSON(url, data); -} +type Response = { + measures: Array<{ + metric: string, + history: Array<{ + date: string, + value: string + }> + }>, + paging: { + pageIndex: number, + pageSize: number, + total: number + } +}; + +export const getTimeMachineData = (component: string, metrics: Array, other?: {}): Promise => ( + getJSON('/api/measures/search_history', { + component, + metrics: metrics.join(), + ps: 1000, + ...other + }) +); -- cgit v1.2.3