diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2016-02-11 18:57:39 +0100 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2016-02-16 14:44:59 +0100 |
commit | 4621ff0206176da5af9fc8c1c704a2ca5aded1ad (patch) | |
tree | b2b6bbcb5ae6812c591f8c71e454454566f3d493 /server/sonar-web/src/main/js/api | |
parent | e53211f03c6d95428b387cc3beddf5378579769a (diff) | |
download | sonarqube-4621ff0206176da5af9fc8c1c704a2ca5aded1ad.tar.gz sonarqube-4621ff0206176da5af9fc8c1c704a2ca5aded1ad.zip |
SONAR-7191 Update the background tasks page to reflect latest WS changes
Diffstat (limited to 'server/sonar-web/src/main/js/api')
-rw-r--r-- | server/sonar-web/src/main/js/api/ce.js | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/server/sonar-web/src/main/js/api/ce.js b/server/sonar-web/src/main/js/api/ce.js index c31db7b0dbc..dc36ed444a3 100644 --- a/server/sonar-web/src/main/js/api/ce.js +++ b/server/sonar-web/src/main/js/api/ce.js @@ -18,6 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import $ from 'jquery'; +import { getJSON, post } from '../helpers/request.js'; export function getQueue (data) { const url = baseUrl + '/api/ce/queue'; @@ -30,22 +31,30 @@ export function getActivity (data) { } export function getTask (id) { - const url = baseUrl + '/api/ce/task'; - return $.get(url, { id }); + const url = window.baseUrl + '/api/ce/task'; + return getJSON(url, { id }).then(r => r.task); } export function cancelTask (id) { - const url = baseUrl + '/api/ce/cancel'; - return $.post(url, { id }).then(getTask.bind(null, id)); + const url = window.baseUrl + '/api/ce/cancel'; + return post(url, { id }).then( + getTask.bind(null, id), + getTask.bind(null, id) + ); } export function cancelAllTasks () { - const url = baseUrl + '/api/ce/cancel_all'; - return $.post(url); + const url = window.baseUrl + '/api/ce/cancel_all'; + return post(url); } -export function getTasksForComponent(componentId) { +export function getTasksForComponent (componentId) { const url = baseUrl + '/api/ce/component'; const data = { componentId }; return new Promise((resolve) => $.get(url, data).done(resolve)); } + +export function getTypes () { + const url = window.baseUrl + '/api/ce/task_types'; + return getJSON(url).then(r => r.taskTypes); +} |