From 91c7fd2068e696a4960a236aff0ce4332bad7845 Mon Sep 17 00:00:00 2001
From: Jaden Diefenbaugh <blakcap@users.noreply.github.com>
Date: Wed, 8 Feb 2017 13:59:52 +0100
Subject: [PATCH] dont dep on globals, misc style fixes for factories

---
 .../static/reports/app/factories/dataFactory.js |  2 +-
 .../reports/app/factories/experimentFactory.js  |  5 ++---
 .../reports/app/factories/plotterFactory.js     |  2 +-
 .../reports/app/factories/reportFactory.js      | 17 ++++++-----------
 4 files changed, 10 insertions(+), 16 deletions(-)

diff --git a/beat/web/reports/static/reports/app/factories/dataFactory.js b/beat/web/reports/static/reports/app/factories/dataFactory.js
index d584fb4ee..f3fb497e0 100644
--- a/beat/web/reports/static/reports/app/factories/dataFactory.js
+++ b/beat/web/reports/static/reports/app/factories/dataFactory.js
@@ -20,7 +20,7 @@
  * 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){
+angular.module('reportApp').factory('dataFactory', function($http){
 	var getData = function (URL) {
 		//return $http.get(URL + 'itemcontent.json');
 		var obj = {content:null};
diff --git a/beat/web/reports/static/reports/app/factories/experimentFactory.js b/beat/web/reports/static/reports/app/factories/experimentFactory.js
index efc742fe5..6ef4f0b32 100644
--- a/beat/web/reports/static/reports/app/factories/experimentFactory.js
+++ b/beat/web/reports/static/reports/app/factories/experimentFactory.js
@@ -20,7 +20,7 @@
  * 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){
+angular.module('reportApp').factory('experimentFactory', function($http, $q){
 	return {
 		getExperimentInformation: function (url_prefix, experiment_id){
 			urlBase = url_prefix + '/api/v1/experiments';
@@ -45,6 +45,5 @@ app.factory('experimentFactory', function($http, $q){
 				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 56d7e4132..f19e23ec6 100644
--- a/beat/web/reports/static/reports/app/factories/plotterFactory.js
+++ b/beat/web/reports/static/reports/app/factories/plotterFactory.js
@@ -20,7 +20,7 @@
  * 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){
+angular.module('reportApp').factory('plotterFactory', ['$http', function($http){
 	var plotterFactory = {};
 
 	plotterFactory.getPlotters = function (url_prefix){
diff --git a/beat/web/reports/static/reports/app/factories/reportFactory.js b/beat/web/reports/static/reports/app/factories/reportFactory.js
index 721fc8559..431abd8bd 100644
--- a/beat/web/reports/static/reports/app/factories/reportFactory.js
+++ b/beat/web/reports/static/reports/app/factories/reportFactory.js
@@ -20,7 +20,7 @@
  * 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) {
+angular.module('reportApp').factory('reportFactory', ['$http', 'experimentFactory', function($http, experimentFactory) {
 	var urlBase = '/api/v1/reports';
 	var reportFactory = {};
 
@@ -43,8 +43,7 @@ app.factory('reportFactory', ['$http', 'experimentFactory', function($http, expe
 			url: urlBase + '/' + user + '/' + report_id + '/',
 			method: "PUT",
 			data: reportData,
-		})
-
+		});
 	};
 
 	reportFactory.lockReport = function (user, report_id, url_prefix){
@@ -56,8 +55,7 @@ app.factory('reportFactory', ['$http', 'experimentFactory', function($http, expe
 			url: urlBase + '/' + user + '/' + report_id + '/lock/',
 			method: "POST",
 			//data: reportData,
-		})
-
+		});
 	};
 
 	reportFactory.publishReport = function (url_prefix, user, report_id, reportData){
@@ -69,8 +67,7 @@ app.factory('reportFactory', ['$http', 'experimentFactory', function($http, expe
 			url: urlBase + '/' + user + '/' + report_id + '/publish/',
 			method: "POST",
 			data: reportData,
-		})
-
+		});
 	};
 
 	reportFactory.publishReportAlgorithms = function (user, report_id, url_prefix){
@@ -82,8 +79,7 @@ app.factory('reportFactory', ['$http', 'experimentFactory', function($http, expe
 			url: urlBase + '/' + user + '/' + report_id + '/algorithms/',
 			method: "GET",
 			//data: reportData,
-		})
-
+		});
 	};
 
 	reportFactory.removeExperiment = function (user, report_id, experiment, url_prefix){
@@ -95,8 +91,7 @@ app.factory('reportFactory', ['$http', 'experimentFactory', function($http, expe
 			url: urlBase + '/' + user + '/' + report_id + '/remove/',
 			method: "POST",
 			data: experiment,
-		})
-
+		});
 	};
 
 	return reportFactory;
-- 
GitLab