From cda9bb1f5c7feecaf9b5e2138f4f833ac9136fff Mon Sep 17 00:00:00 2001
From: Eleni Mandilara <eleni.mandilara@cern.ch>
Date: Thu, 22 Mar 2018 16:41:55 +0100
Subject: [PATCH] Revert "[MARS-34] Pass property to notify that request was
 completed and hide loader"

This reverts commit bdc5bba2419d5d2c4030b71d8589ed50d79ebfae.
---
 .../directives/templates/adams-access.html    |  7 ++-
 .../directives/templates/device-state.html    |  4 +-
 .../templates/equipment-diagnostics.html      | 13 +++--
 .../directives/templates/equipment-info.html  |  2 +-
 .../templates/equipment-structure.html        |  3 +-
 .../directives/templates/impact-general.html  |  3 +-
 .../directives/templates/map-location.html    |  7 ++-
 .../directives/templates/unicos-info.html     |  3 +-
 .../directives/templates/work-orders.html     |  5 +-
 .../js/controllers/AdamsAccessController.js   |  8 +++
 .../EquipmentDiagnosticsController.js         |  9 +++
 .../js/controllers/EquipmentInfoController.js | 12 +++-
 .../EquipmentStructureController.js           | 28 ++++++++--
 .../js/controllers/ImpactGeneralController.js |  9 +++
 .../js/controllers/MapLocationController.js   | 14 ++++-
 .../js/controllers/UnicosInfoController.js    | 12 +++-
 .../js/controllers/WorkOrdersController.js    | 12 +++-
 .../main/resources/static/js/data-parsers.js  | 56 ++++++++-----------
 18 files changed, 147 insertions(+), 60 deletions(-)

diff --git a/web/src/main/resources/static/directives/templates/adams-access.html b/web/src/main/resources/static/directives/templates/adams-access.html
index 4b485be6..9e42ce62 100644
--- a/web/src/main/resources/static/directives/templates/adams-access.html
+++ b/web/src/main/resources/static/directives/templates/adams-access.html
@@ -12,13 +12,16 @@
 				</div>
 			</div>
 			<div id="adamsAccessContainer" class="panel-collapse collapse" ng-class="collapseClass">
-				<loading-data ng-hide="accessPointsInformation.completed"></loading-data>
 				<div class="panel-body">
+
+					<loading-data ng-show="requestStatus.loading.adamsAccess"></loading-data>
+
 					<a ng-href="http://service-access-data.web.cern.ch/service-access-data/lhc_access_conditions.asp" target="_blank" rel="noopener">
 						<button class="btn btn-block">Check access conditions <small class="glyphicon glyphicon-new-window"></small></button>
 					</a>
 
-					<table class="table table-hover"
+					<table ng-hide="requestStatus.loading.adamsAccess"
+						   class="table table-hover"
 						   ng-repeat="accessPointInformation in accessPointsInformation.points">
 						<br/>
 						<tbody>
diff --git a/web/src/main/resources/static/directives/templates/device-state.html b/web/src/main/resources/static/directives/templates/device-state.html
index dc7d424c..e36d66c7 100644
--- a/web/src/main/resources/static/directives/templates/device-state.html
+++ b/web/src/main/resources/static/directives/templates/device-state.html
@@ -1,5 +1,7 @@
 <div id="device-state">
-    <div>
+    <loading-data ng-show="loading.equipmentDiagnostics"></loading-data>
+
+    <div ng-hide="loading.equipmentDiagnostics || loading.identifierPosition">
         <table style="margin:0 auto;">
             <tr>
                 <td class="device-state"><h4>Device: </h4></td>
diff --git a/web/src/main/resources/static/directives/templates/equipment-diagnostics.html b/web/src/main/resources/static/directives/templates/equipment-diagnostics.html
index 559afb54..715d2f55 100644
--- a/web/src/main/resources/static/directives/templates/equipment-diagnostics.html
+++ b/web/src/main/resources/static/directives/templates/equipment-diagnostics.html
@@ -12,11 +12,12 @@
 				</div>
 			</div>
 			<div id="equipmentDiagnosticsContainer" class="panel-collapse collapse" ng-class="collapseClass">
-				<loading-data ng-hide="plcInfo.completed"></loading-data>
 				<div class="panel-body">
 					<div ng-hide="decoration.hideModules">
+						<loading-data ng-show="requestStatus.loading.equipmentDiagnostics"></loading-data>
+
 						<div class="col-lg-12 table-responsive">
-							<table class="table table-hover">
+							<table class="table table-hover" ng-hide="requestStatus.loading.equipmentDiagnostics">
 								<tbody>
 								<tr ng-repeat="metric in diagnostics.metrics">
 									<td ng-style="metric.color"><span class="led"></span></td>
@@ -27,9 +28,9 @@
 						</div>
 
 						<div class="col-lg-12 table-responsive">
-							<table class="table table-hover">
+							<table class="table table-hover" ng-hide="requestStatus.loading.equipmentDiagnostics">
 								<tbody>
-								<div class="well" ng-style="healthStatus.style.equipmentDiagnosticsPlcTime" title="{{healthStatus.tooltip.equipmentDiagnosticsPlcTime}}"><h4>{{diagnostics.infoData[0].description}}</h4></div>
+								<div class="well" ng-style="healthStatus.style.equipmentDiagnosticsPlcTime" title="{{healthStatus.tooltip.equipmentDiagnosticsPlcTime}}" ng-hide="requestStatus.loading.equipmentDiagnostics"><h4>{{diagnostics.infoData[0].description}}</h4></div>
 								<tr>
 									<td>
 										{{diagnostics.infoData[0].description}}
@@ -40,9 +41,9 @@
 								</tr>
 								</tbody>
 							</table>
-							<table class="table table-hover">
+							<table class="table table-hover" ng-hide="requestStatus.loading.equipmentDiagnostics">
 								<tbody>
-									<div class="well" ng-style="healthStatus.style.equipmentDiagnosticsPlcDiagnosticBuffer" title="{{healthStatus.tooltip.equipmentDiagnosticsPlcDiagnosticBuffer}}"><h4>{{diagnostics.infoData[1].description}}</h4></div>
+									<div class="well" ng-style="healthStatus.style.equipmentDiagnosticsPlcDiagnosticBuffer" title="{{healthStatus.tooltip.equipmentDiagnosticsPlcDiagnosticBuffer}}" ng-hide="requestStatus.loading.equipmentDiagnostics"><h4>{{diagnostics.infoData[1].description}}</h4></div>
 									<tr ng-repeat="infoDatum in diagnostics.infoData[1].value">
 										<td>{{infoDatum.split(":")[0]}}</td>
 										<td>{{infoDatum.substring(infoDatum.split(":")[0].length+2, infoDatum.length)}}</td>
diff --git a/web/src/main/resources/static/directives/templates/equipment-info.html b/web/src/main/resources/static/directives/templates/equipment-info.html
index 31e076ab..64e2f27f 100644
--- a/web/src/main/resources/static/directives/templates/equipment-info.html
+++ b/web/src/main/resources/static/directives/templates/equipment-info.html
@@ -12,8 +12,8 @@
 				</div>
 			</div>
 			<div id="equipmentInfoContainer" class="panel-collapse collapse" ng-class="collapseClass">
-				<loading-data ng-hide="info.completed"></loading-data>
 				<div class="panel-body">
+					<loading-data ng-show="requestStatus.loading.equipmentInfo"></loading-data>
 
 					<div ng-hide="requestStatus.loading.equipmentInfo"
 						 class="col-lg-12 table-responsive">
diff --git a/web/src/main/resources/static/directives/templates/equipment-structure.html b/web/src/main/resources/static/directives/templates/equipment-structure.html
index 62e3c032..5389010c 100644
--- a/web/src/main/resources/static/directives/templates/equipment-structure.html
+++ b/web/src/main/resources/static/directives/templates/equipment-structure.html
@@ -12,8 +12,9 @@
 				</div>
 			</div>
 			<div id="equipmentStructureContainer" class="panel-collapse collapse" ng-class="collapseClass">
-				<loading-data ng-hide="plcInfo.completed"></loading-data>
 				<div class="panel-body">
+					<loading-data ng-show="requestStatus.loading.equipmentStructure"></loading-data>
+
 					<div class="col-lg-12 table-responsive"
 						 ng-hide="requestStatus.loading.equipmentStructure">
 
diff --git a/web/src/main/resources/static/directives/templates/impact-general.html b/web/src/main/resources/static/directives/templates/impact-general.html
index 3c95aeaf..9a7036e3 100644
--- a/web/src/main/resources/static/directives/templates/impact-general.html
+++ b/web/src/main/resources/static/directives/templates/impact-general.html
@@ -12,8 +12,9 @@
 				</div>
 			</div>
 			<div id="impactGeneralContainer" class="panel-collapse collapse" ng-class="collapseClass">
-				<loading-data ng-hide="impactGeneralData.completed"></loading-data>
 				<div class="panel-body">
+					<loading-data ng-show="requestStatus.loading.impactGeneral"></loading-data>
+
 					<div ng-hide="requestStatus.loading.impactGeneral" class="col-lg-12">
 						<div ng-repeat="impact in impactGeneralData.impactData" class="table-responsive">
 							<div class="well" style="background:#c2c2c2">
diff --git a/web/src/main/resources/static/directives/templates/map-location.html b/web/src/main/resources/static/directives/templates/map-location.html
index 9f9d66d5..f61826b1 100644
--- a/web/src/main/resources/static/directives/templates/map-location.html
+++ b/web/src/main/resources/static/directives/templates/map-location.html
@@ -12,14 +12,15 @@
 				</div>
 			</div>
 			<div id="mapLocationContainer" class="panel-collapse collapse" ng-class="collapseClass">
-				<loading-data ng-hide="mapLocation.completed"></loading-data>
 				<div class="panel-body">
-					<div>
+					<loading-data ng-show="requestStatus.loading.mapLocation"></loading-data>
+
+					<div ng-hide="requestStatus.loading.mapLocation">
 						<a ng-href="{{mapLocation.url}}" target="_blank" rel="noopener">
 							<button class="btn btn-block">Show in CERN Maps <small class="glyphicon glyphicon-new-window"></small></button>
 						</a>
 						<br/>
-						<iframe ng-src="{{mapLocation.url | trusted}}" id="mapLocationFrame" scrolling="no"></iframe>
+						<iframe ng-hide="requestStatus.loading.mapLocation" ng-src="{{mapLocation.url | trusted}}" id="mapLocationFrame" scrolling="no"></iframe>
 					</div>
 				</div>
 			</div>
diff --git a/web/src/main/resources/static/directives/templates/unicos-info.html b/web/src/main/resources/static/directives/templates/unicos-info.html
index a9be9599..1e02415e 100644
--- a/web/src/main/resources/static/directives/templates/unicos-info.html
+++ b/web/src/main/resources/static/directives/templates/unicos-info.html
@@ -13,8 +13,9 @@
             </div>
 
             <div id="unicosInfoContainer" class="panel-collapse collapse" ng-class="collapseClass">
-                <loading-data ng-hide="unicosInfo.completed"></loading-data>
                 <div class="panel-body">
+                    <loading-data ng-show="requestStatus.loading.unicosInfo"></loading-data>
+
                     <div ng-hide="requestStatus.loading.unicosInfo" class="col-lg-12 table-responsive">
                         <table class="table table-hover">
                             <tbody>
diff --git a/web/src/main/resources/static/directives/templates/work-orders.html b/web/src/main/resources/static/directives/templates/work-orders.html
index b4faac83..9abc2dde 100644
--- a/web/src/main/resources/static/directives/templates/work-orders.html
+++ b/web/src/main/resources/static/directives/templates/work-orders.html
@@ -13,10 +13,11 @@
 			</div>
 
 			<div id="workOrdersContainer" class="panel-collapse collapse" ng-class="collapseClass">
-				<loading-data ng-hide="workOrders.completed"></loading-data>
 				<div class="panel-body">
+					<loading-data ng-show="requestStatus.loading.workOrders"></loading-data>
+
 					<div>
-						<table class="table table-hover table-responsive">
+						<table class="table table-hover table-responsive" ng-hide="requestStatus.loading.workOrders">
 							<thead>
 								<tr class="work-orders">
 									<th>ID</th>
diff --git a/web/src/main/resources/static/js/controllers/AdamsAccessController.js b/web/src/main/resources/static/js/controllers/AdamsAccessController.js
index 26d9d73d..5439c9f4 100644
--- a/web/src/main/resources/static/js/controllers/AdamsAccessController.js
+++ b/web/src/main/resources/static/js/controllers/AdamsAccessController.js
@@ -6,6 +6,11 @@ app.controller('AdamsAccessController', function ($scope, $state, $stateParams,
 
 	var userId = $scope.userInfo.userId;
 
+	$scope.requestStatus = {
+		loading : { adamsAccess : false },
+		completed : { adamsAccess : false },
+    };
+
 	$scope.decoration = {
 		style: setDecoration.style(),
 		tooltip: setDecoration.tooltip(),
@@ -22,10 +27,13 @@ app.controller('AdamsAccessController', function ($scope, $state, $stateParams,
 			success : function(response){
 				$scope.accessPointsInformation = parseAdamsAccess(response, userId);
 				$scope.toggleCollapsibleAdams();
+				$scope.requestStatus.loading.adamsAccess = false;
+				$scope.requestStatus.completed.adamsAccess = true;
 				$scope.$emit('adamsLoaded', { loaded : true , success : true});
 				$scope.collapseClass = "in";
 			},
 			failure : function(reason){
+				$scope.requestStatus.loading.adamsAccess = false;
 				$scope.$emit('adamsLoaded', { loaded : true , success : false});
 			}
 		}
diff --git a/web/src/main/resources/static/js/controllers/EquipmentDiagnosticsController.js b/web/src/main/resources/static/js/controllers/EquipmentDiagnosticsController.js
index f97ba80d..200a5f26 100644
--- a/web/src/main/resources/static/js/controllers/EquipmentDiagnosticsController.js
+++ b/web/src/main/resources/static/js/controllers/EquipmentDiagnosticsController.js
@@ -4,6 +4,11 @@
 
 app.controller('EquipmentDiagnosticsController', function ($scope, $state, $stateParams, $http, $rootScope) {
 
+	$scope.requestStatus = {
+		loading : { equipmentDiagnostics : false },
+		completed : { equipmentDiagnostics : false }
+	};
+
 	$scope.decoration = {
 		style: setDecoration.style(),
 		tooltip: setDecoration.tooltip(),
@@ -23,6 +28,8 @@ app.controller('EquipmentDiagnosticsController', function ($scope, $state, $stat
 				$scope.moonDeviceInformation = parsedMoonDeviceInfo.moonDeviceInformationParsed;
 				$scope.diagnostics = parsedMoonDeviceInfo.diagnosticsParsed;
 				$scope.toggleCollapsibleDiagnostics();
+				$scope.requestStatus.loading.equipmentDiagnostics = false;
+				$scope.requestStatus.completed.equipmentDiagnostics = true;
 				$scope.decoration.hideModules = false;
 				$scope.collapseClass = "in";
 			},
@@ -31,12 +38,14 @@ app.controller('EquipmentDiagnosticsController', function ($scope, $state, $stat
 					points: [],
 					status: "unknown"
 				};
+				$scope.requestStatus.loading.equipmentDiagnostics = false;
 				$scope.decoration.hideModules = true;
 			}
         }
     };
 
 	$scope.createGetRequest = function(url, successCallbackFn, errorCallbackFn){
+		$scope.requestStatus.loading = true;
 		$http({
 			method: 'GET',
 			url: url
diff --git a/web/src/main/resources/static/js/controllers/EquipmentInfoController.js b/web/src/main/resources/static/js/controllers/EquipmentInfoController.js
index a9e27e6b..b0f39186 100644
--- a/web/src/main/resources/static/js/controllers/EquipmentInfoController.js
+++ b/web/src/main/resources/static/js/controllers/EquipmentInfoController.js
@@ -4,6 +4,11 @@
 
 app.controller('EquipmentInfoController', function ($scope, $state, $stateParams, $http, $rootScope) {
 
+	$scope.requestStatus = {
+		loading : { equipmentInfo : false },
+		completed : { equipmentInfo : false }
+    };
+
 	$scope.decoration = {
 		style: setDecoration.style(),
 		tooltip: setDecoration.tooltip(),
@@ -19,14 +24,19 @@ app.controller('EquipmentInfoController', function ($scope, $state, $stateParams
 		callbacks: {
 			success : function(response){
 				$scope.info = parseLanDb(response);
+				$scope.requestStatus.loading.equipmentInfo = false;
+				$scope.requestStatus.completed.equipmentInfo = true;
 				$scope.toggleCollapsibleInfo();
 				$scope.collapseClass = "in";
 			},
-			failure : function(reason){}
+			failure : function(reason){
+				$scope.requestStatus.loading.equipmentInfo = false;
+			}
 		}
 	};
 
 	$scope.createGetRequest = function(url, successCallbackFn, errorCallbackFn){
+		$scope.requestStatus.loading = true;
 		$http({
 			method: 'GET',
 			url: url
diff --git a/web/src/main/resources/static/js/controllers/EquipmentStructureController.js b/web/src/main/resources/static/js/controllers/EquipmentStructureController.js
index 0765908f..45f185c4 100644
--- a/web/src/main/resources/static/js/controllers/EquipmentStructureController.js
+++ b/web/src/main/resources/static/js/controllers/EquipmentStructureController.js
@@ -2,7 +2,12 @@
  * Created by Eleni Mandilara on 8/3/2018.
  */
 
-app.controller('EquipmentStructureController', function ($scope, $state, $stateParams, $http, $rootScope, $q, RequestService) {
+app.controller('EquipmentStructureController', function ($scope, $state, $stateParams, $http, $rootScope) {
+
+	$scope.requestStatus = {
+		loading : { equipmentStructure : false },
+		completed : { equipmentStructure : false }
+	};
 
 	$scope.decoration = {
 		style: setDecoration.style(),
@@ -23,13 +28,24 @@ app.controller('EquipmentStructureController', function ($scope, $state, $stateP
 				$scope.collapseClass = "in";
 				renderTree( $scope.plcInfo.plcDataEquipment.treeData , ".tree-vizualization" );
 			},
-			failure : function(reason){}
+			failure : function(reason){
+				$scope.requestStatus.loading.equipmentStructure = false;
+			}
         }
     };
 
-	RequestService($scope.apiInfo.url + $stateParams.code).then(
-		function(response) { $scope.apiInfo.callbacks.success(response); },
-		function(reason) { $scope.apiInfo.callbacks.failure(reason) }
-	);
+	$scope.createGetRequest = function(url, successCallbackFn, errorCallbackFn){
+		$scope.requestStatus.loading = true;
+		$http({
+			method: 'GET',
+			url: url
+		}).then(
+			successCallbackFn
+		).catch(function (reason) {
+			errorCallbackFn(reason)
+		});
+	};
+
+	$scope.createGetRequest($scope.apiInfo.url + $stateParams.code, $scope.apiInfo.callbacks.success, $scope.apiInfo.callbacks.failure);
 
 });
\ No newline at end of file
diff --git a/web/src/main/resources/static/js/controllers/ImpactGeneralController.js b/web/src/main/resources/static/js/controllers/ImpactGeneralController.js
index 033b1a7d..b9c7d64d 100644
--- a/web/src/main/resources/static/js/controllers/ImpactGeneralController.js
+++ b/web/src/main/resources/static/js/controllers/ImpactGeneralController.js
@@ -6,6 +6,11 @@ app.controller('ImpactGeneralController', function ($scope, $state, $stateParams
 
 	var userId = $scope.userInfo.userId;
 
+	$scope.requestStatus = {
+		loading : { impactGeneral : false },
+		completed : { impactGeneral : false }
+    };
+
 	$scope.decoration = {
 		style: setDecoration.style(),
 		tooltip: setDecoration.tooltip(),
@@ -22,16 +27,20 @@ app.controller('ImpactGeneralController', function ($scope, $state, $stateParams
 			success : function(response){
 			  	$scope.impactGeneralData = parseImpactGeneral(response);
 			  	$scope.toggleCollapsibleImpact();
+				$scope.requestStatus.loading.impactGeneral = false;
+				$scope.requestStatus.completed.impactGeneral = true;
 				$scope.$emit('impactLoaded', { loaded : true, success : true });
 				$scope.collapseClass = "in";
 			},
 			failure : function(reason){
+				$scope.requestStatus.loading.impactGeneral = false;
 				$scope.$emit('impactLoaded', { loaded : true, success : false });
 			}
 		}
 	};
 
 	$scope.createGetRequest = function(url, successCallbackFn, errorCallbackFn){
+		$scope.requestStatus.loading = true;
 		$http({
 			method: 'GET',
 			url: url
diff --git a/web/src/main/resources/static/js/controllers/MapLocationController.js b/web/src/main/resources/static/js/controllers/MapLocationController.js
index 3fb3759f..8a54f9b3 100644
--- a/web/src/main/resources/static/js/controllers/MapLocationController.js
+++ b/web/src/main/resources/static/js/controllers/MapLocationController.js
@@ -6,6 +6,11 @@ app.controller('MapLocationController', function ($scope, $state, $stateParams,
 
     $scope.mapLocation = '';
 
+	$scope.requestStatus = {
+		loading : { mapLocation : false },
+		completed : { mapLocation : false }
+    };
+
 	$scope.decoration = {
 		style: setDecoration.style(),
 		tooltip: setDecoration.tooltip(),
@@ -21,15 +26,22 @@ app.controller('MapLocationController', function ($scope, $state, $stateParams,
 		url : 'api/map/location?code=',
 		callbacks: {
 			success : function(response){
+//				$scope.link.mapLocation += $scope.searchBy;
 				$scope.mapLocation = parseMapLocation(response);
 				$scope.toggleCollapsibleMap();
+				$scope.requestStatus.loading.mapLocation = false;
+				$scope.requestStatus.completed.mapLocation = true;
 				$scope.collapseClass = "in";
+
 			},
-			failure : function(reason){}
+			failure : function(reason){
+				$scope.requestStatus.loading.mapLocation = false;
+			}
 		}
 	};
 
 	$scope.createGetRequest = function(url, successCallbackFn, errorCallbackFn){
+		$scope.requestStatus.loading = true;
 		$http({
 			method: 'GET',
 			url: url
diff --git a/web/src/main/resources/static/js/controllers/UnicosInfoController.js b/web/src/main/resources/static/js/controllers/UnicosInfoController.js
index 68e75d52..3a61c873 100644
--- a/web/src/main/resources/static/js/controllers/UnicosInfoController.js
+++ b/web/src/main/resources/static/js/controllers/UnicosInfoController.js
@@ -4,6 +4,11 @@
 
 app.controller('UnicosInfoController', function ($scope, $state, $stateParams, $http, $rootScope) {
 
+	$scope.requestStatus = {
+		loading : { unicosInfo : false },
+		completed : { unicosInfo : false }
+    };
+
 	$scope.decoration = {
 		style: setDecoration.style(),
 		tooltip: setDecoration.tooltip(),
@@ -34,13 +39,18 @@ app.controller('UnicosInfoController', function ($scope, $state, $stateParams, $
 			success : function(response){
  				$scope.unicosInfo = parseIceSasGeneral(response);
  				$scope.toggleCollapsibleUnicos("unicosInfo");
+				$scope.requestStatus.loading.unicosInfo = false;
+				$scope.requestStatus.completed.unicosInfo = true;
 				$scope.collapseClass = "in";
 			},
-			failure : function(reason){}
+			failure : function(reason){
+				$scope.requestStatus.loading.unicosInfo = false;
+			}
 		}
 	};
 
 	$scope.createGetRequest = function(url, successCallbackFn, errorCallbackFn){
+		$scope.requestStatus.loading = true;
 		$http({
 			method: 'GET',
 			url: url
diff --git a/web/src/main/resources/static/js/controllers/WorkOrdersController.js b/web/src/main/resources/static/js/controllers/WorkOrdersController.js
index 5f270483..b3ced742 100644
--- a/web/src/main/resources/static/js/controllers/WorkOrdersController.js
+++ b/web/src/main/resources/static/js/controllers/WorkOrdersController.js
@@ -4,6 +4,11 @@
 
 app.controller('WorkOrdersController', function ($scope, $state, $stateParams, $http, $rootScope) {
 
+	$scope.requestStatus = {
+		loading : { workOrders : false },
+		completed : { workOrders : false }
+    };
+
 	$scope.decoration = {
 		style: setDecoration.style(),
 		tooltip: setDecoration.tooltip(),
@@ -21,13 +26,18 @@ app.controller('WorkOrdersController', function ($scope, $state, $stateParams, $
 			success : function(response){
  				$scope.workOrders = parseInforWorkOrders(response);
  				$scope.toggleCollapsibleWorkOrders();
+				$scope.requestStatus.loading.workOrders = false;
+				$scope.requestStatus.completed.workOrders = true;
 				$scope.collapseClass = "in";
 			},
-			failure : function(reason){}
+			failure : function(reason){
+				$scope.requestStatus.loading.workOrders = false;
+			}
 		}
 	};
 
 	$scope.createGetRequest = function(url, successCallbackFn, errorCallbackFn){
+		$scope.requestStatus.loading = true;
 		$http({
 			method: 'GET',
 			url: url
diff --git a/web/src/main/resources/static/js/data-parsers.js b/web/src/main/resources/static/js/data-parsers.js
index b8d48c3b..aef7cd43 100644
--- a/web/src/main/resources/static/js/data-parsers.js
+++ b/web/src/main/resources/static/js/data-parsers.js
@@ -21,20 +21,19 @@ emptyDataCallback = function(dataSource, reason){
 parseInforPosition = function(response) {
     console.log("%c Data received from InforPosition about PLC equipment:", 'color: green', response.data);
     var treeData = {
-    	name : response.data.code,
-    	children : response.data.children.components[0].children
+    	name: "Root",
+    	children: response.data.children.components[0].children
     };
     return {
             plcData : response.data.children.components[0].children,
             plcDataEquipment : {
-                name : response.data.children.components[0].name,
-                description : response.data.children.components[0].description,
-                treeData : treeData,
-                link : "https://cmmsx.cern.ch/SSO/eamlight/position.xhtml?code=" + response.data.code
+                name: response.data.children.components[0].name,
+                description: response.data.children.components[0].description,
+                treeData: treeData,
+                link: "https://cmmsx.cern.ch/SSO/eamlight/position.xhtml?code=" + response.data.code,
+                status: "healthy"
             },
-            plcCode : response.data.code,
-            status : "healthy",
-            completed : true
+            plcCode : response.data.code
     };
 };
 
@@ -46,9 +45,8 @@ parseInforWorkOrders = function(response) {
         workOrders[i].link = workOrdersBaseUrl + workOrders[i].workOrderId;
     }
     return {
-    	workOrders : workOrders,
-    	status : "healthy",
-    	completed : true
+    	workOrders: workOrders,
+    	status: "healthy"
     }
 };
 
@@ -58,8 +56,7 @@ parseMapLocation = function(response) {
     return {
         emptyData : isNotEmpty,
         url : response.data.mapLocation,
-        status : "healthy",
-        completed : true
+        status : "healthy"
     };
 };
 
@@ -71,9 +68,8 @@ parseImpactGeneral = function(response) {
         impactData[i].link = impactBaseUrl + impactData[i].id;
     }
     return {
-    	impactData : impactData,
-    	status : "healthy",
-		completed : true
+    	impactData: impactData,
+    	status: "healthy"
     }
 };
 
@@ -81,8 +77,8 @@ parseLanDb = function(response) {
     var data = response.data;
     console.log("%c Data received from Landb about equipment info:", 'color: green',data);
     return {
-        hostName : data.hostName,
-        description : data.description,
+        hostName: data.hostName,
+        description: data.description,
         equipmentType : data.genericType,
         deviceMaker : data.maker,
         hardwareType : data.hardwareType,
@@ -92,8 +88,7 @@ parseLanDb = function(response) {
         responsiblePerson : data.responsiblePerson,
         mainUser : data.mainUser,
         link : "https://network.cern.ch/sc/fcgi/sc.fcgi?Action=SearchForDisplay&DeviceName=" + data.hostName,
-        status : "healthy",
-        completed : true
+        status : "healthy"
     };
 };
 
@@ -117,8 +112,8 @@ parseMoonDeviceInfo = function(response) {
     for(i=0;i<metricsValues.length;i++){
         diagnosticsParsed.metrics.push(
             {
-                "description" : metricsValues[i].moonDpConfig.description,
-                "color" : { "background" : metricsValues[i].colour }
+                "description": metricsValues[i].moonDpConfig.description,
+                "color": { "background": metricsValues[i].colour }
             }
         )
     }
@@ -128,8 +123,8 @@ parseMoonDeviceInfo = function(response) {
     for(i=0;i<infoData.length;i++){
         diagnosticsParsed.infoData.push(
             {
-                "description" : infoData[i].moonDpConfig.description,
-                "value" : infoData[i].value
+                "description": infoData[i].moonDpConfig.description,
+                "value": infoData[i].value
             }
         )
     }
@@ -137,8 +132,7 @@ parseMoonDeviceInfo = function(response) {
     return {
         moonDeviceInformationParsed : moonDeviceInformationParsed,
         diagnosticsParsed : diagnosticsParsed,
-        status : "healthy",
-		completed : true
+        status : "healthy"
     }
 };
 
@@ -152,9 +146,8 @@ parseAdamsAccess = function(response, userId) {
         accessPointsInformationParsed[i].link = adamsBaseUrl + userId + "/" + accessPointsInformationParsed[i].accessPoint.accesspointcode + "/Y";
     }
     return {
-    	points : accessPointsInformationParsed,
-    	status : "healthy",
-		completed : true
+    	points: accessPointsInformationParsed,
+    	status: "healthy"
     }
 };
 
@@ -187,8 +180,7 @@ parseIceSasGeneral = function(response) {
         redundantHost : data.redundantHost,
         application : comments.Application,
         resources : comments.Resources,
-        status : "healthy",
-		completed : true
+        status : "healthy"
     }
 };
 
-- 
GitLab