From 551172fd284782b74d2b8c4071c5a41d5d66f8b9 Mon Sep 17 00:00:00 2001 From: Ahmed Zarioh Date: Thu, 19 Nov 2015 15:21:05 +0100 Subject: [PATCH] Some fix for login --- app/Controller/KairosController.php | 2 - app/Dispatcher.php | 2 +- app/RestController.php | 5 +- app/RestService.php | 1 + app/main.php | 1 + executionware-ui-apis.json | 4 +- index.php | 2 +- .../js/controller/Charts/ChartsController.js | 58 +++++++++++-------- public/js/service/ajaxFactory.js | 3 + public/js/service/resolverFactory.js | 1 + public/partials/application-detail.html | 41 +++++++++---- 11 files changed, 79 insertions(+), 41 deletions(-) diff --git a/app/Controller/KairosController.php b/app/Controller/KairosController.php index bb26aea..a22fde4 100644 --- a/app/Controller/KairosController.php +++ b/app/Controller/KairosController.php @@ -22,10 +22,8 @@ class KairosController extends RestController { - public static $SERVICE = 'KairosService'; - public static function getChart() { $service = static::getService("charts"); diff --git a/app/Dispatcher.php b/app/Dispatcher.php index eb58cb0..1bf53a0 100644 --- a/app/Dispatcher.php +++ b/app/Dispatcher.php @@ -56,7 +56,7 @@ class Dispatcher switch ($controller_route) { case "": - $GLOBALS["return"] = ""; + $GLOBALS["return"] = null; //client side $GLOBALS['client']['apisObjects'] = json_decode(file_get_contents("config/apisObjects.json"), true); diff --git a/app/RestController.php b/app/RestController.php index 1feac3f..d804ecf 100644 --- a/app/RestController.php +++ b/app/RestController.php @@ -72,8 +72,9 @@ class RestController { $service = static::getService("login"); $putData = static::getRequestContent(); - $service::login($putData->email,$putData->password); - return ""; + //if() + //$service::login($putData->email,$putData->password); + return true; } public static function logout() diff --git a/app/RestService.php b/app/RestService.php index 295067f..5628c58 100644 --- a/app/RestService.php +++ b/app/RestService.php @@ -294,6 +294,7 @@ class RestService curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, TRUE); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); + curl_setopt($ch, CURLOPT_TIMEOUT, 8); //timeout in seconds //curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $api_response = curl_exec($ch); $api_response_info = curl_getinfo($ch); diff --git a/app/main.php b/app/main.php index 92fab0d..e089374 100644 --- a/app/main.php +++ b/app/main.php @@ -124,6 +124,7 @@ function include_all_javascript($folder)
+ diff --git a/executionware-ui-apis.json b/executionware-ui-apis.json index 9b2b0b2..9b04966 100644 --- a/executionware-ui-apis.json +++ b/executionware-ui-apis.json @@ -1,12 +1,12 @@ { "colosseumapi" : { "name": "colosseumapi", - "url": "http://52.21.93.224:9000/api", + "url": "http://52.210.93.224:9000/api", "controller": "ColosseumController" }, "kairosapi" : { "name": "kairosapi", - "url": "http://52.21.93.224:8080/api/v1/datapoints/query", + "url": "http://52.210.93.224:8080/api/v1/datapoints/query", "controller": "KairosController", "router": "KairosRouter" } diff --git a/index.php b/index.php index 9876a64..b172ef9 100644 --- a/index.php +++ b/index.php @@ -98,5 +98,5 @@ if(isset($GLOBALS["return"])) } else { - echo "error return"; + //echo "error return"; } \ No newline at end of file diff --git a/public/js/controller/Charts/ChartsController.js b/public/js/controller/Charts/ChartsController.js index e264f79..131bd9a 100644 --- a/public/js/controller/Charts/ChartsController.js +++ b/public/js/controller/Charts/ChartsController.js @@ -34,9 +34,10 @@ crudControllers.controller('ChartsCtrl', function($scope,$interval,$http,ajaxFac $scope.init(monitorInstance); } - $scope.init = function(monitorInstance) { + + $scope.wait = false; $scope.graphDetails = {}; $scope.graphDetails.monitorInstance = monitorInstance.id; @@ -79,30 +80,41 @@ crudControllers.controller('ChartsCtrl', function($scope,$interval,$http,ajaxFac $scope.change = function() { //TODO add a protection like a synchronized thread (a variable that is false durring the ajax and would hide/enabled the inputs) - - $scope.wait = true; - $scope.error = false; - - //to change to "pure" angularjs code - var graph = $("#graph-num-"+$scope.k); - $scope.canvW = graph.find("canvas").width(); - $scope.canvH = graph.find("canvas").height(); - - //$scope.azara = $scope.graphDetails; - console.log($scope.graphDetails); - ajaxFactory.post("charts",$scope.graphDetails).then(function(data, status, headers, config) - { - //$scope.azara = data; - $scope.data = getInfoChart(data.queries); - $scope.wait = false; - }, - function(data, status, headers, config) + if($scope.wait == false) { - $scope.wait = false; - $scope.error = true; - }); - }; + $scope.wait = true; + $scope.error = false; + + //to change to "pure" angularjs code + var graph = $("#graph-num-"+$scope.k); + $scope.canvW = graph.find("canvas").width(); + $scope.canvH = graph.find("canvas").height(); + + //$scope.azara = $scope.graphDetails; + console.log($scope.graphDetails); + ajaxFactory.post("charts",$scope.graphDetails).then(function(data, status, headers, config) + { + //$scope.azara = data; + if(data &&data.queries) + { + $scope.data = getInfoChart(data.queries); + } + else + { + + } + $scope.wait = false; + }, + function(data, status, headers, config) + { + $scope.wait = false; + $scope.error = true; + }); + } + }; + $scope.interval = $interval($scope.change,10000); + $scope.$on("$destroy", function(){ $interval.cancel($scope.interval); }); diff --git a/public/js/service/ajaxFactory.js b/public/js/service/ajaxFactory.js index 7556ad2..cae5bbf 100644 --- a/public/js/service/ajaxFactory.js +++ b/public/js/service/ajaxFactory.js @@ -46,6 +46,9 @@ crudFactories.factory('ajaxFactory', function ($http,$q,$rootScope,$location,res $http(req) .success(function(data, status) { + console.log(url); + console.log(data); + console.log(status); deferred.resolve(data); resolverFactory.resolveSuccess(data, status); }) diff --git a/public/js/service/resolverFactory.js b/public/js/service/resolverFactory.js index 0b038f8..12f47cd 100644 --- a/public/js/service/resolverFactory.js +++ b/public/js/service/resolverFactory.js @@ -35,6 +35,7 @@ crudFactories.factory('resolverFactory', function ($rootScope,$location) resolveError : function(data, status) { $rootScope.loading = false; + $rootScope.logged = false; if(status==401) { $rootScope.logged = false; diff --git a/public/partials/application-detail.html b/public/partials/application-detail.html index 735b1f4..25c2e9e 100644 --- a/public/partials/application-detail.html +++ b/public/partials/application-detail.html @@ -68,7 +68,7 @@
-

applicationComponent List

+

applicationComponents

+
+ +
+
+ +
+ + + + @@ -103,7 +119,7 @@
-

Communications List

+

Communications

-
+
-
+
Communication number {{communication.id}}
@@ -133,7 +149,7 @@
@@ -199,13 +215,14 @@