diff --git a/beat/web/reports/static/reports/app/factories/dataFactory.js b/beat/web/reports/static/reports/app/factories/dataFactory.js index f10f9bdca3de6b89f328a213dcc7d77acff1ab6e..d584fb4ee98b59eecb7731f4866ed1490b0e26dd 100644 --- a/beat/web/reports/static/reports/app/factories/dataFactory.js +++ b/beat/web/reports/static/reports/app/factories/dataFactory.js @@ -1,40 +1,38 @@ /* * Copyright (c) 2016 Idiap Research Institute, http://www.idiap.ch/ * Contact: beat.support@idiap.ch - * + * * This file is part of the beat.web module of the BEAT platform. - * + * * Commercial License Usage * Licensees holding valid commercial BEAT licenses may use this file in * accordance with the terms contained in a written agreement between you * and Idiap. For further information contact tto@idiap.ch - * + * * Alternatively, this file may be used under the terms of the GNU Affero * Public License version 3 as published by the Free Software and appearing * in the file LICENSE.AGPL included in the packaging of this file. * The BEAT platform is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. - * + * * You should have received a copy of the GNU Affero Public License along * with the BEAT platform. If not, see http://www.gnu.org/licenses/. -*/ + */ //This factory retrieves data from the static files and associates it with the $scope -app.factory('dataFactory', function($http) -{ - var getData = function (URL) { - //return $http.get(URL + 'itemcontent.json'); - var obj = {content:null}; - //return $http.get(URL); - $http.get(URL).success(function(data) - { - obj.content = data; - }); +app.factory('dataFactory', function($http){ + var getData = function (URL) { + //return $http.get(URL + 'itemcontent.json'); + var obj = {content:null}; + //return $http.get(URL); + $http.get(URL).success(function(data){ + obj.content = data; + }); - return obj; - }; + return obj; + }; - return { - getData: getData - }; + return { + getData: getData + }; }); diff --git a/beat/web/reports/static/reports/app/factories/experimentFactory.js b/beat/web/reports/static/reports/app/factories/experimentFactory.js index b80feaae54b00caccc5f2a21c775b686d1ade1ec..efc742fe5a67136588855c0e570286b470da9757 100644 --- a/beat/web/reports/static/reports/app/factories/experimentFactory.js +++ b/beat/web/reports/static/reports/app/factories/experimentFactory.js @@ -1,54 +1,50 @@ /* * Copyright (c) 2016 Idiap Research Institute, http://www.idiap.ch/ * Contact: beat.support@idiap.ch - * + * * This file is part of the beat.web module of the BEAT platform. - * + * * Commercial License Usage * Licensees holding valid commercial BEAT licenses may use this file in * accordance with the terms contained in a written agreement between you * and Idiap. For further information contact tto@idiap.ch - * + * * Alternatively, this file may be used under the terms of the GNU Affero * Public License version 3 as published by the Free Software and appearing * in the file LICENSE.AGPL included in the packaging of this file. * The BEAT platform is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. - * + * * You should have received a copy of the GNU Affero Public License along * with the BEAT platform. If not, see http://www.gnu.org/licenses/. -*/ + */ //This factory retrieves data from the REST API and associates it with the $scope -app.factory('experimentFactory', function($http, $q) -{ - return { - getExperimentInformation: function (url_prefix, experiment_id) - { - urlBase = url_prefix + '/api/v1/experiments'; - return $http.get(urlBase + '/' + experiment_id + '/') - .then(function(response){ - return response.data; - }); - }, +app.factory('experimentFactory', function($http, $q){ + return { + getExperimentInformation: function (url_prefix, experiment_id){ + urlBase = url_prefix + '/api/v1/experiments'; + return $http.get(urlBase + '/' + experiment_id + '/') + .then(function(response){ + return response.data; + }); + }, - getAllExperimentResultsForAuthor: function (user, report_id, url_prefix) - { - urlBase = url_prefix + '/api/v1/reports'; - return $http.get(urlBase + '/' + user + '/' + report_id + '/results_author/') - .then(function(response){ - return response.data; - }); - }, + getAllExperimentResultsForAuthor: function (user, report_id, url_prefix){ + urlBase = url_prefix + '/api/v1/reports'; + return $http.get(urlBase + '/' + user + '/' + report_id + '/results_author/') + .then(function(response){ + return response.data; + }); + }, - getAllExperimentResults: function (url_prefix, report_number) - { - urlBase = url_prefix + '/api/v1/reports'; - return $http.get(urlBase + '/' + report_number + '/results/') - .then(function(response){ - return response.data; - }); - } + getAllExperimentResults: function (url_prefix, report_number){ + urlBase = url_prefix + '/api/v1/reports'; + return $http.get(urlBase + '/' + report_number + '/results/') + .then(function(response){ + return response.data; + }); + } - } + } }); diff --git a/beat/web/reports/static/reports/app/factories/plotterFactory.js b/beat/web/reports/static/reports/app/factories/plotterFactory.js index a84f5c0b6104a9b0d2762d7e3f12e861a253528a..56d7e4132c1f464ca073cfa8f716f54111cecf4d 100644 --- a/beat/web/reports/static/reports/app/factories/plotterFactory.js +++ b/beat/web/reports/static/reports/app/factories/plotterFactory.js @@ -1,46 +1,42 @@ /* * Copyright (c) 2016 Idiap Research Institute, http://www.idiap.ch/ * Contact: beat.support@idiap.ch - * + * * This file is part of the beat.web module of the BEAT platform. - * + * * Commercial License Usage * Licensees holding valid commercial BEAT licenses may use this file in * accordance with the terms contained in a written agreement between you * and Idiap. For further information contact tto@idiap.ch - * + * * Alternatively, this file may be used under the terms of the GNU Affero * Public License version 3 as published by the Free Software and appearing * in the file LICENSE.AGPL included in the packaging of this file. * The BEAT platform is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. - * + * * You should have received a copy of the GNU Affero Public License along * with the BEAT platform. If not, see http://www.gnu.org/licenses/. -*/ + */ //This factory retrieves data from the REST API and associates it with the $scope -app.factory('plotterFactory', ['$http', function($http) -{ - var plotterFactory = {}; +app.factory('plotterFactory', ['$http', function($http){ + var plotterFactory = {}; - plotterFactory.getPlotters = function (url_prefix) - { - urlBase = url_prefix + '/api/v1/plotters'; - return $http.get(urlBase + '/'); - }; + plotterFactory.getPlotters = function (url_prefix){ + urlBase = url_prefix + '/api/v1/plotters'; + return $http.get(urlBase + '/'); + }; - plotterFactory.getDefaultPlotters = function (url_prefix) - { - urlBase = url_prefix + '/api/v1/plotters/defaultplotters'; - return $http.get(urlBase + '/'); - }; + plotterFactory.getDefaultPlotters = function (url_prefix){ + urlBase = url_prefix + '/api/v1/plotters/defaultplotters'; + return $http.get(urlBase + '/'); + }; - plotterFactory.getPlotterParameter = function (url_prefix) - { - urlBase = url_prefix + '/api/v1/plotters/plotterparameter'; - return $http.get(urlBase + '/'); - }; + plotterFactory.getPlotterParameter = function (url_prefix){ + urlBase = url_prefix + '/api/v1/plotters/plotterparameter'; + return $http.get(urlBase + '/'); + }; - return plotterFactory; + return plotterFactory; }]); diff --git a/beat/web/reports/static/reports/app/factories/reportFactory.js b/beat/web/reports/static/reports/app/factories/reportFactory.js index ee21e1ffa99faa00eb82d46ed30c4ba6c34a3dd1..721fc8559e4fd7b4d3043e86053c735d1eddb0db 100644 --- a/beat/web/reports/static/reports/app/factories/reportFactory.js +++ b/beat/web/reports/static/reports/app/factories/reportFactory.js @@ -1,114 +1,103 @@ /* * Copyright (c) 2016 Idiap Research Institute, http://www.idiap.ch/ * Contact: beat.support@idiap.ch - * + * * This file is part of the beat.web module of the BEAT platform. - * + * * Commercial License Usage * Licensees holding valid commercial BEAT licenses may use this file in * accordance with the terms contained in a written agreement between you * and Idiap. For further information contact tto@idiap.ch - * + * * Alternatively, this file may be used under the terms of the GNU Affero * Public License version 3 as published by the Free Software and appearing * in the file LICENSE.AGPL included in the packaging of this file. * The BEAT platform is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. - * + * * You should have received a copy of the GNU Affero Public License along * with the BEAT platform. If not, see http://www.gnu.org/licenses/. -*/ + */ //This factory retrieves data from the REST API and associates it with the $scope -app.factory('reportFactory', ['$http', 'experimentFactory', function($http, experimentFactory) -{ - - var urlBase = '/api/v1/reports'; - var reportFactory = {}; - - reportFactory.getReportInformation = function (user, report_id, url_prefix) - { - urlBase = url_prefix + '/api/v1/reports'; - return $http.get(urlBase + '/' + user + '/' + report_id + '/'); - }; - - reportFactory.getReportInformationFromNumber = function (report_number, url_prefix) - { - urlBase = url_prefix + '/api/v1/reports'; - return $http.get(urlBase + '/' + report_number + '/'); - }; - - reportFactory.updateReport = function (user, report_id, reportData, url_prefix) - { - urlBase = url_prefix + '/api/v1/reports'; - //return $http.put(urlBase + '/' + user + '/' + report_id + '/'); - - return $http({ - headers: {'Content-Type': 'application/json'}, - url: urlBase + '/' + user + '/' + report_id + '/', - method: "PUT", - data: reportData, - }) - - }; - - reportFactory.lockReport = function (user, report_id, url_prefix) - { - urlBase = url_prefix + '/api/v1/reports'; - //return $http.put(urlBase + '/' + user + '/' + report_id + '/'); - - return $http({ - headers: {'Content-Type': 'application/json'}, - url: urlBase + '/' + user + '/' + report_id + '/lock/', - method: "POST", - //data: reportData, - }) - - }; - - reportFactory.publishReport = function (url_prefix, user, report_id, reportData) - { - urlBase = url_prefix + '/api/v1/reports'; - //return $http.put(urlBase + '/' + user + '/' + report_id + '/'); - - return $http({ - headers: {'Content-Type': 'application/json'}, - url: urlBase + '/' + user + '/' + report_id + '/publish/', - method: "POST", - data: reportData, - }) - - }; - - reportFactory.publishReportAlgorithms = function (user, report_id, url_prefix) - { - urlBase = url_prefix + '/api/v1/reports'; - //return $http.put(urlBase + '/' + user + '/' + report_id + '/'); - - return $http({ - headers: {'Content-Type': 'application/json'}, - url: urlBase + '/' + user + '/' + report_id + '/algorithms/', - method: "GET", - //data: reportData, - }) - - }; - - - reportFactory.removeExperiment = function (user, report_id, experiment, url_prefix) - { - urlBase = url_prefix + '/api/v1/reports'; - //return $http.put(urlBase + '/' + user + '/' + report_id + '/'); - - return $http({ - headers: {'Content-Type': 'application/json'}, - url: urlBase + '/' + user + '/' + report_id + '/remove/', - method: "POST", - data: experiment, - }) - - }; - - - return reportFactory; +app.factory('reportFactory', ['$http', 'experimentFactory', function($http, experimentFactory) { + var urlBase = '/api/v1/reports'; + var reportFactory = {}; + + reportFactory.getReportInformation = function (user, report_id, url_prefix){ + urlBase = url_prefix + '/api/v1/reports'; + return $http.get(urlBase + '/' + user + '/' + report_id + '/'); + }; + + reportFactory.getReportInformationFromNumber = function (report_number, url_prefix){ + urlBase = url_prefix + '/api/v1/reports'; + return $http.get(urlBase + '/' + report_number + '/'); + }; + + reportFactory.updateReport = function (user, report_id, reportData, url_prefix){ + urlBase = url_prefix + '/api/v1/reports'; + //return $http.put(urlBase + '/' + user + '/' + report_id + '/'); + + return $http({ + headers: {'Content-Type': 'application/json'}, + url: urlBase + '/' + user + '/' + report_id + '/', + method: "PUT", + data: reportData, + }) + + }; + + reportFactory.lockReport = function (user, report_id, url_prefix){ + urlBase = url_prefix + '/api/v1/reports'; + //return $http.put(urlBase + '/' + user + '/' + report_id + '/'); + + return $http({ + headers: {'Content-Type': 'application/json'}, + url: urlBase + '/' + user + '/' + report_id + '/lock/', + method: "POST", + //data: reportData, + }) + + }; + + reportFactory.publishReport = function (url_prefix, user, report_id, reportData){ + urlBase = url_prefix + '/api/v1/reports'; + //return $http.put(urlBase + '/' + user + '/' + report_id + '/'); + + return $http({ + headers: {'Content-Type': 'application/json'}, + url: urlBase + '/' + user + '/' + report_id + '/publish/', + method: "POST", + data: reportData, + }) + + }; + + reportFactory.publishReportAlgorithms = function (user, report_id, url_prefix){ + urlBase = url_prefix + '/api/v1/reports'; + //return $http.put(urlBase + '/' + user + '/' + report_id + '/'); + + return $http({ + headers: {'Content-Type': 'application/json'}, + url: urlBase + '/' + user + '/' + report_id + '/algorithms/', + method: "GET", + //data: reportData, + }) + + }; + + reportFactory.removeExperiment = function (user, report_id, experiment, url_prefix){ + urlBase = url_prefix + '/api/v1/reports'; + //return $http.put(urlBase + '/' + user + '/' + report_id + '/'); + + return $http({ + headers: {'Content-Type': 'application/json'}, + url: urlBase + '/' + user + '/' + report_id + '/remove/', + method: "POST", + data: experiment, + }) + + }; + + return reportFactory; }]);