From dcb9e3b781600bf333e1659f5a2d64432ce76ed5 Mon Sep 17 00:00:00 2001 From: ArnaudVOTA Date: Wed, 27 Jan 2016 11:24:03 +0100 Subject: Add login overlay --- client/partials/nav.html | 37 +++++++++++++++++++++++++++++++++++-- client/partials/overlays.html | 31 +++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 client/partials/overlays.html diff --git a/client/partials/nav.html b/client/partials/nav.html index a765daa..a9db597 100644 --- a/client/partials/nav.html +++ b/client/partials/nav.html @@ -31,10 +31,43 @@
  • Informations
  • Settings
  • -
  • Logout
  • +
  • Login +
  • - \ No newline at end of file + + + \ No newline at end of file diff --git a/client/partials/overlays.html b/client/partials/overlays.html new file mode 100644 index 0000000..b913f7a --- /dev/null +++ b/client/partials/overlays.html @@ -0,0 +1,31 @@ + \ No newline at end of file -- cgit v1.2.3 From 78e6e5787ce2df4ae55f5b4d64c792b8f20696d7 Mon Sep 17 00:00:00 2001 From: Eole Date: Sat, 30 Jan 2016 11:41:45 +0100 Subject: Begin of Identity Implementation, Begin of Token management for Identification --- server/config.inc.php | 3 + server/core/Identity.php | 20 +++- server/core/LibOverride/Builder.php | 169 ++++++++++++++++++++++++++++++++++ server/core/LibOverride/OpenStack.php | 43 +++++++++ server/core/LibOverride/Test.php | 63 +++++++++++++ server/core/Plugin_Api.php | 4 +- server/index.php | 13 ++- server/init.php | 29 +++++- 8 files changed, 335 insertions(+), 9 deletions(-) create mode 100644 server/core/LibOverride/Builder.php create mode 100644 server/core/LibOverride/OpenStack.php create mode 100644 server/core/LibOverride/Test.php diff --git a/server/config.inc.php b/server/config.inc.php index 07adcbd..9767c72 100644 --- a/server/config.inc.php +++ b/server/config.inc.php @@ -1,7 +1,10 @@ diff --git a/server/core/Identity.php b/server/core/Identity.php index 8d1c8b6..343ed15 100644 --- a/server/core/Identity.php +++ b/server/core/Identity.php @@ -1 +1,19 @@ - +oidentity = $ostack->identityV3(); + $this->plugins = $apiP; + + } + + public function genToken(){ + global $Args; + $token = $this->oidentity->generateToken($Args); + return $token; + } +} diff --git a/server/core/LibOverride/Builder.php b/server/core/LibOverride/Builder.php new file mode 100644 index 0000000..30ea9d3 --- /dev/null +++ b/server/core/LibOverride/Builder.php @@ -0,0 +1,169 @@ + 'publicURL']; + + public function __construct(array $globalOptions = []) + { + $this->globalOptions = $globalOptions; + parent::__construct($globalOptions); + } + + public function getOptions() + { + return $this->globalOptions; + } + + public function setOptions($Options) + { + $this->globalOptions = $Options; + } + + /** + * Internal method which resolves the API and Service classes for a service. + * + * @param string $serviceName The name of the service, e.g. Compute + * @param int $serviceVersion The major version of the service, e.g. 2 + * + * @return array + */ + private function getClasses($serviceName, $serviceVersion) + { + $rootNamespace = sprintf("OpenStack\\%s\\v%d", $serviceName, $serviceVersion); + + return [ + sprintf("%s\\Api", $rootNamespace), + sprintf("%s\\Service", $rootNamespace), + ]; + } + + /** + * This method will return an OpenStack service ready fully built and ready for use. There is + * some initial setup that may prohibit users from directly instantiating the service class + * directly - this setup includes the configuration of the HTTP client's base URL, and the + * attachment of an authentication handler. + * + * @param $serviceName The name of the service as it appears in the OpenStack\* namespace + * @param $serviceVersion The major version of the service + * @param array $serviceOptions The service-specific options to use + * + * @return \OpenStack\Common\Service\ServiceInterface + * + * @throws \Exception + */ + public function createService($serviceName, $serviceVersion, array $serviceOptions = []) + { + $options = $this->mergeOptions($serviceOptions); + + $this->stockIdentityService($options); + $this->stockAuthHandler($options); + $this->stockHttpClient($options, $serviceName); + + list($apiClass, $serviceClass) = $this->getClasses($serviceName, $serviceVersion); + + return new $serviceClass($options['httpClient'], new $apiClass()); + } + + private function stockHttpClient(array &$options, $serviceName) + { + if (!isset($options['httpClient']) || !($options['httpClient'] instanceof ClientInterface)) { + if (strcasecmp($serviceName, 'identity') === 0) { + $baseUrl = $options['authUrl']; + $stack = $this->getStack($options['authHandler']); + } else { + list($token, $baseUrl) = $options['identityService']->authenticate($options); + $stack = $this->getStack($options['authHandler'], $token); + } + + $this->addDebugMiddleware($options, $stack); + + $options['httpClient'] = $this->httpClient($baseUrl, $stack); + } + } + + /** + * @codeCoverageIgnore + */ + private function addDebugMiddleware(array $options, HandlerStack &$stack) + { + if (!empty($options['debugLog']) + && !empty($options['logger']) + && !empty($options['messageFormatter']) + ) { + $stack->push(GuzzleMiddleware::log($options['logger'], $options['messageFormatter'])); + } + } + + private function stockIdentityService(array &$options) + { + if (!isset($options['identityService'])) { + $httpClient = $this->httpClient($options['authUrl'], HandlerStack::create()); + $options['identityService'] = Service::factory($httpClient); + } + } + + /** + * @param array $options + * @codeCoverageIgnore + */ + private function stockAuthHandler(array &$options) + { + if (!isset($options['authHandler'])) { + $options['authHandler'] = function () use ($options) { + return $options['identityService']->generateToken($options); + }; + } + } + + private function getStack(callable $authHandler, Token $token = null) + { + $stack = HandlerStack::create(); + $stack->push(Middleware::authHandler($authHandler, $token)); + return $stack; + } + + private function httpClient($baseUrl, HandlerStack $stack) + { + return new Client([ + 'base_uri' => Utils::normalizeUrl($baseUrl), + 'handler' => $stack, + ]); + } + + private function mergeOptions(array $serviceOptions) + { + $options = array_merge($this->defaults, $this->globalOptions, $serviceOptions); + + if (!isset($options['authUrl'])) { + throw new \InvalidArgumentException('"authUrl" is a required option'); + } + + return $options; + } +} + diff --git a/server/core/LibOverride/OpenStack.php b/server/core/LibOverride/OpenStack.php new file mode 100644 index 0000000..2b3897a --- /dev/null +++ b/server/core/LibOverride/OpenStack.php @@ -0,0 +1,43 @@ +builder = $builder ?: new Builder_override($options); + parent::__construct($options, $this->builder); + } + + public function getBuilderOptions() + { + + return $this->builder->getOptions(); + + } + + public function setBuilderOptions($options) + { + + $this->builder->setOptions($options); + + } +} diff --git a/server/core/LibOverride/Test.php b/server/core/LibOverride/Test.php new file mode 100644 index 0000000..a1c8023 --- /dev/null +++ b/server/core/LibOverride/Test.php @@ -0,0 +1,63 @@ +authenticate + // stack = getStack authhandler token + // addDebug?? + // $options['httpClient'] = httpCLient baseurl stack + + } + + /** + * @codeCoverageIgnore + */ + private function addDebugMiddleware(array $options, HandlerStack &$stack) + { + if (!empty($options['debugLog']) + && !empty($options['logger']) + && !empty($options['messageFormatter']) + ) { + $stack->push(GuzzleMiddleware::log($options['logger'], $options['messageFormatter'])); + } + } + /** + * @param array $options + * @codeCoverageIgnore + */ + private function stockAuthHandler(array &$options) + { + if (!isset($options['authHandler'])) { + $options['authHandler'] = function () use ($options) { + return $options['identityService']->generateToken($options); + }; + } + } + + private function getStack(callable $authHandler, Token $token = null) + { + $stack = HandlerStack::create(); + $stack->push(Middleware::authHandler($authHandler, $token)); + return $stack; + } + + private function httpClient($baseUrl, HandlerStack $stack) + { + return new Client([ + 'base_uri' => Utils::normalizeUrl($baseUrl), + 'handler' => $stack, + ]); + } +} diff --git a/server/core/Plugin_Api.php b/server/core/Plugin_Api.php index c2a9041..20ffd0c 100644 --- a/server/core/Plugin_Api.php +++ b/server/core/Plugin_Api.php @@ -1,9 +1,9 @@ genToken()); + $openstack_api->computeV2(['region'=> 'RegionOne']); + +// var_dump($openstack_api->getBuilderOptions()); diff --git a/server/init.php b/server/init.php index ff7f90b..5b6a6c1 100644 --- a/server/init.php +++ b/server/init.php @@ -2,7 +2,9 @@ include_once("config.inc.php"); include_once("core/Plugin_Api.php"); require "vendor/autoload.php"; - + include_once("core/LibOverride/Builder.php"); + include_once("core/LibOverride/OpenStack.php"); + //traitement requete, recuperation data if(isset($_POST["key"])){ //recuperation des donnes sauvegardes @@ -27,11 +29,32 @@ "name" => "Default") ) ), - "authUrl" => $urlAuth + "authUrl" => $config["urlAuth"] + ); + } else { + $user = "admin"; + $password = "ae5or6cn"; + $project = "admin"; + + $Args = Array( + "user" => Array( + "name" => $user, + "password" => $password, + "domain" => Array( + "name" => "Default") + ), + "scope" => Array( + "project" => Array( + "name" => $project, + "domain" => Array( + "name" => "Default") + ) + ), + "authUrl" => $config["urlAuth"] ); } $openstack_api = new OpenStack\OpenStack($Args); - + $pluginApi = plugin_api::getInstance(); ?> -- cgit v1.2.3 From de1f3020478a471e0041c1030231bb5462640fd8 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 31 Jan 2016 02:38:05 +0100 Subject: Test Authentification --- server/core/LibOverride/Test.php | 69 +++++++++++++++++++++++----------------- server/index.php | 7 ++-- server/init.php | 12 ++++++- 3 files changed, 54 insertions(+), 34 deletions(-) mode change 100644 => 100755 server/core/LibOverride/Test.php mode change 100644 => 100755 server/index.php mode change 100644 => 100755 server/init.php diff --git a/server/core/LibOverride/Test.php b/server/core/LibOverride/Test.php old mode 100644 new mode 100755 index a1c8023..09f08d5 --- a/server/core/LibOverride/Test.php +++ b/server/core/LibOverride/Test.php @@ -1,24 +1,56 @@ Utils::normalizeUrl($options['authUrl']), + // 'handler' => HandlerStack::create(), + //]); + + $httpClient = new Client([ + 'base_uri' => Utils::normalizeUrl($options['authUrl']), + 'handler' => $stack, + ]); + + $options['identityService'] = Service::factory($httpClient); //AuthHadler? // + $options['authHandler'] = function () use ($options) { + return $options['identityService']->generateToken($options); + }; //StockClient? // creer $options['httpClient'] instance de ClientInterface // token, baseUrl = identity->authenticate // stack = getStack authhandler token // addDebug?? // $options['httpClient'] = httpCLient baseurl stack - + $baseUrl = $options['authUrl']; + + //$stack = HandlerStack::create(); + $stack->push(Middleware::authHandler($options['authHandler'], $token)); + + $this->addDebugMiddleware($options, $stack); + + $options['httpClient'] = $httpClient; + + $this->optionsGlobal = $options; } /** @@ -33,31 +65,8 @@ class genTokenOptions $stack->push(GuzzleMiddleware::log($options['logger'], $options['messageFormatter'])); } } - /** - * @param array $options - * @codeCoverageIgnore - */ - private function stockAuthHandler(array &$options) - { - if (!isset($options['authHandler'])) { - $options['authHandler'] = function () use ($options) { - return $options['identityService']->generateToken($options); - }; - } - } - - private function getStack(callable $authHandler, Token $token = null) - { - $stack = HandlerStack::create(); - $stack->push(Middleware::authHandler($authHandler, $token)); - return $stack; - } - - private function httpClient($baseUrl, HandlerStack $stack) - { - return new Client([ - 'base_uri' => Utils::normalizeUrl($baseUrl), - 'handler' => $stack, - ]); - } + + public function getOptions(){ + return $this->optionsGlobal; + } } diff --git a/server/index.php b/server/index.php old mode 100644 new mode 100755 index ceba59e..5259a69 --- a/server/index.php +++ b/server/index.php @@ -5,12 +5,13 @@ // $task = $_POST["task"]; // $action = $_POST["action"]; - - include_once("core/Identity.php"); + //$id = new identity($openstack_api, $pluginApi); // var_dump($id->genToken()); - $openstack_api->computeV2(['region'=> 'RegionOne']); + $compute = $openstack_api->computeV2(['region'=> 'RegionOne']); + $servers = $compute->listServers(true); + var_dump($servers); // var_dump($openstack_api->getBuilderOptions()); diff --git a/server/init.php b/server/init.php old mode 100644 new mode 100755 index 5b6a6c1..e186667 --- a/server/init.php +++ b/server/init.php @@ -4,6 +4,8 @@ require "vendor/autoload.php"; include_once("core/LibOverride/Builder.php"); include_once("core/LibOverride/OpenStack.php"); + include_once("core/LibOverride/Test.php"); + include_once("core/Identity.php"); //traitement requete, recuperation data if(isset($_POST["key"])){ @@ -54,7 +56,15 @@ ); } + $pluginApi = plugin_api::getInstance(); + $openstack_api = new OpenStack\OpenStack($Args); + $id = new identity($openstack_api, $pluginApi); + + $token = $id->genToken(); + + $tmp = new genTokenOptions($Args, $token); + $array = $tmp->getOptions(); + $openstack_api = new OpenStack\OpenStack($array); - $pluginApi = plugin_api::getInstance(); ?> -- cgit v1.2.3 From 7276d3f0334785a33ab23ef80db1e2ea77d24922 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 31 Jan 2016 03:24:02 +0100 Subject: Suite Test Token Management --- server/core/LibOverride/Test.php | 60 ++++++++++++++++++++-------------------- server/index.php | 2 +- server/init.php | 13 +++++---- 3 files changed, 38 insertions(+), 37 deletions(-) diff --git a/server/core/LibOverride/Test.php b/server/core/LibOverride/Test.php index 09f08d5..4e8e540 100755 --- a/server/core/LibOverride/Test.php +++ b/server/core/LibOverride/Test.php @@ -10,47 +10,26 @@ use OpenStack\Common\Transport\Utils; class genTokenOptions { private $optionsGlobal; + + private $stack; - public function __construct($options, $token){ + public function __construct($options){ echo "test"; - $stack = HandlerStack::create(); - //IdentityService? - // $options['IdentityService'] pas oblige?... - // creer HttpClient authurl HandlerStack::create() - // $option['identityService'] = factory httpClient - //$httpClient = new Client([ - // 'base_uri' => Utils::normalizeUrl($options['authUrl']), - // 'handler' => HandlerStack::create(), - //]); + $this->stack = HandlerStack::create(); - $httpClient = new Client([ + $httpClient['Common'] = new Client([ 'base_uri' => Utils::normalizeUrl($options['authUrl']), 'handler' => $stack, ]); $options['identityService'] = Service::factory($httpClient); - //AuthHadler? - // + $options['authHandler'] = function () use ($options) { return $options['identityService']->generateToken($options); }; - //StockClient? - // creer $options['httpClient'] instance de ClientInterface - // token, baseUrl = identity->authenticate - // stack = getStack authhandler token - // addDebug?? - // $options['httpClient'] = httpCLient baseurl stack - $baseUrl = $options['authUrl']; - - //$stack = HandlerStack::create(); - $stack->push(Middleware::authHandler($options['authHandler'], $token)); - - $this->addDebugMiddleware($options, $stack); - $options['httpClient'] = $httpClient; - - $this->optionsGlobal = $options; + $this->optionsGlobal['Common'] = $options; } /** @@ -66,7 +45,28 @@ class genTokenOptions } } - public function getOptions(){ - return $this->optionsGlobal; + public genComputeToken(){ + $options = $this->optionsGlobal['Common']; + $options['catalogName'] = 'nova'; + $options['catalogType'] = 'compute'; + $options['region'] = 'RegionOne'; + + list($token, $baseUrl) = $options['identityService']->authenticate($options); + + //$stack = HandlerStack::create(); + $this->stack->push(Middleware::authHandler($options['authHandler'], $token)); + + $this->addDebugMiddleware($options, $this->stack); + + $options['httpClient'] = new Client([ + 'base_uri' => Utils::normalizeUrl($options['authUrl']), + 'handler' => $stack, + ]); + + $this->optionsGlobal['Compute'] = $options; + } + + public function getOptionsCompute(){ + return $this->optionsGlobal['Compute']; } } diff --git a/server/index.php b/server/index.php index 5259a69..23c99a1 100755 --- a/server/index.php +++ b/server/index.php @@ -10,7 +10,7 @@ //$id = new identity($openstack_api, $pluginApi); // var_dump($id->genToken()); - $compute = $openstack_api->computeV2(['region'=> 'RegionOne']); + $compute = $openstack_api->computeV2($array); $servers = $compute->listServers(true); var_dump($servers); diff --git a/server/init.php b/server/init.php index e186667..a7989ce 100755 --- a/server/init.php +++ b/server/init.php @@ -58,13 +58,14 @@ $pluginApi = plugin_api::getInstance(); - $openstack_api = new OpenStack\OpenStack($Args); - $id = new identity($openstack_api, $pluginApi); + //$openstack_api = new OpenStack\OpenStack($Args); + //$id = new identity($openstack_api, $pluginApi); - $token = $id->genToken(); + //$token = $id->genToken(); - $tmp = new genTokenOptions($Args, $token); - $array = $tmp->getOptions(); - $openstack_api = new OpenStack\OpenStack($array); + $tmp = new genTokenOptions($Args); + $tmp->genComputeToken(); + $array = $tmp->getOptionsCompute(); + $openstack_api = new OpenStack\OpenStack(new array()); ?> -- cgit v1.2.3 From 6c4cdf62ac99a56cefb663ad4779dd07f0944a26 Mon Sep 17 00:00:00 2001 From: Eole Date: Sun, 31 Jan 2016 04:00:20 +0100 Subject: Test Serialization Token Debut --- server/core/LibOverride/Test.php | 43 ++++++++++++++++++++++++++++++++++------ server/index.php | 13 ++++++++++++ server/init.php | 7 +++++-- 3 files changed, 55 insertions(+), 8 deletions(-) diff --git a/server/core/LibOverride/Test.php b/server/core/LibOverride/Test.php index 4e8e540..5babc35 100755 --- a/server/core/LibOverride/Test.php +++ b/server/core/LibOverride/Test.php @@ -12,15 +12,16 @@ class genTokenOptions private $optionsGlobal; private $stack; + private $backup = []; public function __construct($options){ echo "test"; $this->stack = HandlerStack::create(); - $httpClient['Common'] = new Client([ + $httpClient = new Client([ 'base_uri' => Utils::normalizeUrl($options['authUrl']), - 'handler' => $stack, + 'handler' => $this->stack, ]); $options['identityService'] = Service::factory($httpClient); @@ -45,26 +46,56 @@ class genTokenOptions } } - public genComputeToken(){ + public function genComputeToken(){ $options = $this->optionsGlobal['Common']; $options['catalogName'] = 'nova'; $options['catalogType'] = 'compute'; $options['region'] = 'RegionOne'; list($token, $baseUrl) = $options['identityService']->authenticate($options); - + var_dump($token); //$stack = HandlerStack::create(); $this->stack->push(Middleware::authHandler($options['authHandler'], $token)); $this->addDebugMiddleware($options, $this->stack); $options['httpClient'] = new Client([ - 'base_uri' => Utils::normalizeUrl($options['authUrl']), - 'handler' => $stack, + 'base_uri' => Utils::normalizeUrl($baseUrl), + 'handler' => $this->stack, ]); + $this->backup['Compute'] = array('token' => serialize($token), 'baseUrl' => $baseUrl ); + $this->optionsGlobal['Compute'] = $options; + } + + public function loadComputeBackup($opt){ + + $options = $this->optionsGlobal['Common']; + $options['catalogName'] = 'nova'; + $options['catalogType'] = 'compute'; + $options['region'] = 'RegionOne'; + //list($token, $baseUrl) = $options['identityService']->authenticate($options); + $this->backup['Compute'] = unserialize($opt); + $token = unserialize($this->backup['Compute'] ['token']); + $baseUrl = $this->backup['Compute']['baseUrl']; + + //$stack = HandlerStack::create(); + + $this->stack->push(Middleware::authHandler($options['authHandler'], $token)); + + $this->addDebugMiddleware($options, $this->stack); + + $options['httpClient'] = new Client([ + 'base_uri' => Utils::normalizeUrl($baseUrl), + 'handler' => $this->stack, + ]); + $this->backup['Compute'] = array('token' => serialize($token), 'baseUrl' => $baseUrl ); $this->optionsGlobal['Compute'] = $options; } + + public function getBackup($service){ + return serialize($this->backup[$service]); + } public function getOptionsCompute(){ return $this->optionsGlobal['Compute']; diff --git a/server/index.php b/server/index.php index 23c99a1..b5424da 100755 --- a/server/index.php +++ b/server/index.php @@ -13,5 +13,18 @@ $compute = $openstack_api->computeV2($array); $servers = $compute->listServers(true); var_dump($servers); + foreach($servers as $server){ + echo $server->id." !!!!!!!!! "; + } + $tmp = new genTokenOptions($Args); + $tmp->loadComputeBackup($computBack); + $array = $tmp->getOptionsCompute(); + + $openstackTest = new OpenStack\OpenStack([]); + $computeTest = $openstackTest->computeV2($array); + $serversTest = $computeTest->listServers(true); + foreach($serversTest as $server){ + echo $server->id." %%%%%% "; + } // var_dump($openstack_api->getBuilderOptions()); diff --git a/server/init.php b/server/init.php index a7989ce..3c5f848 100755 --- a/server/init.php +++ b/server/init.php @@ -66,6 +66,9 @@ $tmp = new genTokenOptions($Args); $tmp->genComputeToken(); $array = $tmp->getOptionsCompute(); - $openstack_api = new OpenStack\OpenStack(new array()); - + $openstack_api = new OpenStack\OpenStack([]); + + $computBack = $tmp->getBackup("Compute"); + //file_put_contents("token", serialize($tmp)); + ?> -- cgit v1.2.3 From c796facb137a908b36e5477abfc3ff7828b45c6e Mon Sep 17 00:00:00 2001 From: Eole Date: Sun, 31 Jan 2016 10:47:57 +0100 Subject: Begin Serialization Token --- server/core/LibOverride/Test.php | 55 +++++++++++++++++++++++++++++++++++----- 1 file changed, 49 insertions(+), 6 deletions(-) diff --git a/server/core/LibOverride/Test.php b/server/core/LibOverride/Test.php index 5babc35..beb4e70 100755 --- a/server/core/LibOverride/Test.php +++ b/server/core/LibOverride/Test.php @@ -53,7 +53,7 @@ class genTokenOptions $options['region'] = 'RegionOne'; list($token, $baseUrl) = $options['identityService']->authenticate($options); - var_dump($token); + //var_dump($token); //$stack = HandlerStack::create(); $this->stack->push(Middleware::authHandler($options['authHandler'], $token)); @@ -63,7 +63,49 @@ class genTokenOptions 'base_uri' => Utils::normalizeUrl($baseUrl), 'handler' => $this->stack, ]); - $this->backup['Compute'] = array('token' => serialize($token), 'baseUrl' => $baseUrl ); + $this->backup['Compute'] = array('token' => json_encode($token), 'baseUrl' => $baseUrl ); + serialize($token->methods); + foreach($token->roles as $role){ + serialize($role->name); + serialize($role->links); + serialize($role->id); + } + serialize($token->expires); + serialize($token->project->domainId); + serialize($token->project->parentId); + serialize($token->project->enabled); + serialize($token->project->description); + serialize($token->project->id); + serialize($token->project->links); + serialize($token->project->name); + foreach($token->catalog->services as $service){ + serialize($service->id); + serialize($service->name); + serialize($service->description); + serialize($service->type); + foreach($service->endpoints as $end){ + serialize($end->id); + serialize($end->interface); + serialize($end->name); + serialize($end->serviceId); + serialize($end->region); + serialize($end->links); + serialize($end->url); + } + serialize($service->links); + } + serialize($token->extras); + serialize($token->user->domainId); + serialize($token->user->defaultProjectId); + serialize($token->user->id); + serialize($token->user->email); + serialize($token->user->enabled); + serialize($token->user->description); + serialize($token->user->links); + serialize($token->user->name); + serialize($token->issued); + serialize($token->id); + var_dump($token->id); $this->optionsGlobal['Compute'] = $options; } @@ -75,8 +117,9 @@ class genTokenOptions $options['region'] = 'RegionOne'; //list($token, $baseUrl) = $options['identityService']->authenticate($options); - $this->backup['Compute'] = unserialize($opt); - $token = unserialize($this->backup['Compute'] ['token']); + $this->backup['Compute'] = json_decode($opt, true); + var_dump($this->backup['Compute']); + $token = json_decode($this->backup['Compute']['token'], true); $baseUrl = $this->backup['Compute']['baseUrl']; //$stack = HandlerStack::create(); @@ -89,12 +132,12 @@ class genTokenOptions 'base_uri' => Utils::normalizeUrl($baseUrl), 'handler' => $this->stack, ]); - $this->backup['Compute'] = array('token' => serialize($token), 'baseUrl' => $baseUrl ); + $this->backup['Compute'] = array('token' => json_encode($token), 'baseUrl' => $baseUrl ); $this->optionsGlobal['Compute'] = $options; } public function getBackup($service){ - return serialize($this->backup[$service]); + return json_encode($this->backup[$service]); } public function getOptionsCompute(){ -- cgit v1.2.3 From b8cf0f6e5c0ea9b03815f8ac51b26ed1bd419263 Mon Sep 17 00:00:00 2001 From: manzerbredes Date: Sun, 31 Jan 2016 11:14:13 +0100 Subject: Change client folders --- client/js/directives/empty | 0 client/js/filters/empty | 0 client/js/requests/identity.js | 0 client/js/services/empty | 0 4 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 client/js/directives/empty delete mode 100644 client/js/filters/empty create mode 100644 client/js/requests/identity.js delete mode 100644 client/js/services/empty diff --git a/client/js/directives/empty b/client/js/directives/empty deleted file mode 100644 index e69de29..0000000 diff --git a/client/js/filters/empty b/client/js/filters/empty deleted file mode 100644 index e69de29..0000000 diff --git a/client/js/requests/identity.js b/client/js/requests/identity.js new file mode 100644 index 0000000..e69de29 diff --git a/client/js/services/empty b/client/js/services/empty deleted file mode 100644 index e69de29..0000000 -- cgit v1.2.3 From ae774e381148ef3a3a34d2f3bc51f15b033995f1 Mon Sep 17 00:00:00 2001 From: manzerbredes Date: Sun, 31 Jan 2016 11:19:24 +0100 Subject: Remove useless folder --- client/fonts/glyphicons-halflings-regular.eot | Bin 20127 -> 0 bytes client/fonts/glyphicons-halflings-regular.svg | 288 ------------------------ client/fonts/glyphicons-halflings-regular.ttf | Bin 45404 -> 0 bytes client/fonts/glyphicons-halflings-regular.woff | Bin 23424 -> 0 bytes client/fonts/glyphicons-halflings-regular.woff2 | Bin 18028 -> 0 bytes 5 files changed, 288 deletions(-) delete mode 100644 client/fonts/glyphicons-halflings-regular.eot delete mode 100644 client/fonts/glyphicons-halflings-regular.svg delete mode 100644 client/fonts/glyphicons-halflings-regular.ttf delete mode 100644 client/fonts/glyphicons-halflings-regular.woff delete mode 100644 client/fonts/glyphicons-halflings-regular.woff2 diff --git a/client/fonts/glyphicons-halflings-regular.eot b/client/fonts/glyphicons-halflings-regular.eot deleted file mode 100644 index b93a495..0000000 Binary files a/client/fonts/glyphicons-halflings-regular.eot and /dev/null differ diff --git a/client/fonts/glyphicons-halflings-regular.svg b/client/fonts/glyphicons-halflings-regular.svg deleted file mode 100644 index 94fb549..0000000 --- a/client/fonts/glyphicons-halflings-regular.svg +++ /dev/null @@ -1,288 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/client/fonts/glyphicons-halflings-regular.ttf b/client/fonts/glyphicons-halflings-regular.ttf deleted file mode 100644 index 1413fc6..0000000 Binary files a/client/fonts/glyphicons-halflings-regular.ttf and /dev/null differ diff --git a/client/fonts/glyphicons-halflings-regular.woff b/client/fonts/glyphicons-halflings-regular.woff deleted file mode 100644 index 9e61285..0000000 Binary files a/client/fonts/glyphicons-halflings-regular.woff and /dev/null differ diff --git a/client/fonts/glyphicons-halflings-regular.woff2 b/client/fonts/glyphicons-halflings-regular.woff2 deleted file mode 100644 index 64539b5..0000000 Binary files a/client/fonts/glyphicons-halflings-regular.woff2 and /dev/null differ -- cgit v1.2.3 From 58e5c44db2f3343c491495d7077f13450db4e324 Mon Sep 17 00:00:00 2001 From: manzerbredes Date: Sun, 31 Jan 2016 11:47:13 +0100 Subject: Make status bar dynamic ! --- client/index.html | 8 +++++++- client/js/controllers/status.js | 18 ++++++++++++++---- client/js/requests/identity.js | 15 +++++++++++++++ 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/client/index.html b/client/index.html index 0c02623..c2d1862 100644 --- a/client/index.html +++ b/client/index.html @@ -62,8 +62,14 @@ - + + + + + + + diff --git a/client/js/controllers/status.js b/client/js/controllers/status.js index 3534912..0767202 100644 --- a/client/js/controllers/status.js +++ b/client/js/controllers/status.js @@ -4,9 +4,19 @@ -mainApp.controller('statusCtrl', function ($scope) +mainApp.controller('statusCtrl', function ($scope,$interval) { - $scope.username="User 1"; - $scope.connection="Online"; - $scope.lastconnection="1 Septembre"; + + // Update status every 2 seconds + $interval(function(){ + var status=identity.fetchStatus(); + $scope.connection=status[0]; + $scope.username=status[1]; + $scope.lastconnection=status[2]; + }, 2000); + + + + + }); \ No newline at end of file diff --git a/client/js/requests/identity.js b/client/js/requests/identity.js index e69de29..369ce85 100644 --- a/client/js/requests/identity.js +++ b/client/js/requests/identity.js @@ -0,0 +1,15 @@ + + +// Make Namespace +var identity = {} ; + + + +// Fetch Status +identity.fetchStatus = function(){ + + // TODO + + return new Array("1", "user1", "25/02/2016"); + +} \ No newline at end of file -- cgit v1.2.3 From f6c4c90567161fdb73e0fcec5f3d330c3a118a60 Mon Sep 17 00:00:00 2001 From: Eole Date: Sun, 31 Jan 2016 11:54:53 +0100 Subject: Fin test Token Management --- server/core/LibOverride/Test.php | 172 ++++++++++++++++++++++++++++----------- server/index.php | 6 +- 2 files changed, 126 insertions(+), 52 deletions(-) diff --git a/server/core/LibOverride/Test.php b/server/core/LibOverride/Test.php index beb4e70..91ea84d 100755 --- a/server/core/LibOverride/Test.php +++ b/server/core/LibOverride/Test.php @@ -4,8 +4,10 @@ use GuzzleHttp\Client; use OpenStack\Common\Transport\HandlerStack; use OpenStack\Common\Transport\Middleware; use OpenStack\Identity\v3\Service; +use OpenStack\Identity\v3\Api; use OpenStack\Common\Auth\Token; use OpenStack\Common\Transport\Utils; +use OpenStack\Identity\v3\Models; class genTokenOptions { @@ -13,9 +15,9 @@ class genTokenOptions private $stack; private $backup = []; + private $httpClient; public function __construct($options){ - echo "test"; $this->stack = HandlerStack::create(); @@ -24,6 +26,8 @@ class genTokenOptions 'handler' => $this->stack, ]); + $this->httpClient = $httpClient; + $options['identityService'] = Service::factory($httpClient); $options['authHandler'] = function () use ($options) { @@ -63,49 +67,8 @@ class genTokenOptions 'base_uri' => Utils::normalizeUrl($baseUrl), 'handler' => $this->stack, ]); - $this->backup['Compute'] = array('token' => json_encode($token), 'baseUrl' => $baseUrl ); - serialize($token->methods); - foreach($token->roles as $role){ - serialize($role->name); - serialize($role->links); - serialize($role->id); - } - serialize($token->expires); - serialize($token->project->domainId); - serialize($token->project->parentId); - serialize($token->project->enabled); - serialize($token->project->description); - serialize($token->project->id); - serialize($token->project->links); - serialize($token->project->name); - foreach($token->catalog->services as $service){ - serialize($service->id); - serialize($service->name); - serialize($service->description); - serialize($service->type); - foreach($service->endpoints as $end){ - serialize($end->id); - serialize($end->interface); - serialize($end->name); - serialize($end->serviceId); - serialize($end->region); - serialize($end->links); - serialize($end->url); - } - serialize($service->links); - } - serialize($token->extras); - serialize($token->user->domainId); - serialize($token->user->defaultProjectId); - serialize($token->user->id); - serialize($token->user->email); - serialize($token->user->enabled); - serialize($token->user->description); - serialize($token->user->links); - serialize($token->user->name); - serialize($token->issued); - serialize($token->id); - var_dump($token->id); + $this->backup['Compute'] = array('token' => $this->serializeToken($token), 'baseUrl' => $baseUrl ); + $this->optionsGlobal['Compute'] = $options; } @@ -117,9 +80,9 @@ class genTokenOptions $options['region'] = 'RegionOne'; //list($token, $baseUrl) = $options['identityService']->authenticate($options); - $this->backup['Compute'] = json_decode($opt, true); - var_dump($this->backup['Compute']); - $token = json_decode($this->backup['Compute']['token'], true); + $this->backup['Compute'] = unserialize($opt); + //var_dump($this->backup['Compute']); + $token = $this->unserializeToken($this->backup['Compute']['token']); $baseUrl = $this->backup['Compute']['baseUrl']; //$stack = HandlerStack::create(); @@ -132,15 +95,126 @@ class genTokenOptions 'base_uri' => Utils::normalizeUrl($baseUrl), 'handler' => $this->stack, ]); - $this->backup['Compute'] = array('token' => json_encode($token), 'baseUrl' => $baseUrl ); + $this->backup['Compute'] = array('token' => $this->serializeToken($token), 'baseUrl' => $baseUrl ); $this->optionsGlobal['Compute'] = $options; } public function getBackup($service){ - return json_encode($this->backup[$service]); + return serialize($this->backup[$service]); } public function getOptionsCompute(){ return $this->optionsGlobal['Compute']; } + + private function serializeToken($token){ + $tokenSerialized = []; + $tokenSerialized["methods"] = serialize($token->methods); + $tokenSerialized["roles"] = []; + //var_dump($token->roles); + foreach($token->roles as $role){ + $tokenSerialized["roles"][serialize($role->name)]["links"] = serialize($role->links); + $tokenSerialized["roles"][serialize($role->name)]["id"] = serialize($role->id); + } + $tokenSerialized["expires"] = serialize($token->expires); + $tokenSerialized["project"]["domainId"] = serialize($token->project->domainId); + $tokenSerialized["project"]["parentId"] = serialize($token->project->parentId); + $tokenSerialized["project"]["enabled"] = serialize($token->project->enabled); + $tokenSerialized["project"]["description"] = serialize($token->project->description); + $tokenSerialized["project"]["id"] = serialize($token->project->id); + $tokenSerialized["project"]["links"] = serialize($token->project->links); + $tokenSerialized["project"]["name"] = serialize($token->project->name); + foreach($token->catalog->services as $service){ + $tokenSerialized["catalog"][serialize($service->id)]["name"] = serialize($service->name); + $tokenSerialized["catalog"][serialize($service->id)]["description"] = serialize($service->description); + $tokenSerialized["catalog"][serialize($service->id)]["type"] = serialize($service->type); + foreach($service->endpoints as $end){ + $tokenSerialized["catalog"][serialize($service->id)]["endpoints"][serialize($end->id)]["interface"] = serialize($end->interface); + $tokenSerialized["catalog"][serialize($service->id)]["endpoints"][serialize($end->id)]["name"] = serialize($end->name); + $tokenSerialized["catalog"][serialize($service->id)]["endpoints"][serialize($end->id)]["serviceId"] = serialize($end->serviceId); + $tokenSerialized["catalog"][serialize($service->id)]["endpoints"][serialize($end->id)]["region"] = serialize($end->region); + $tokenSerialized["catalog"][serialize($service->id)]["endpoints"][serialize($end->id)]["links"] = serialize($end->links); + $tokenSerialized["catalog"][serialize($service->id)]["endpoints"][serialize($end->id)]["url"] = serialize($end->url); + } + $tokenSerialized["roles"][serialize($service->id)]["links"] = serialize($service->links); + } + $tokenSerialized["extras"] = serialize($token->extras); + $tokenSerialized["user"]["domainId"] = serialize($token->user->domainId); + $tokenSerialized["user"]["defaultProjectId"] = serialize($token->user->defaultProjectId); + $tokenSerialized["user"]["id"] = serialize($token->user->id); + $tokenSerialized["user"]["email"] = serialize($token->user->email); + $tokenSerialized["user"]["enabled"] = serialize($token->user->enabled); + $tokenSerialized["user"]["description"] = serialize($token->user->description); + $tokenSerialized["user"]["links"] = serialize($token->user->links); + $tokenSerialized["user"]["name"] = serialize($token->user->name); + $tokenSerialized["issued"] = serialize($token->issued); + $tokenSerialized["id"] = serialize($token->id); + + return $tokenSerialized; + } + + private function unserializeToken($tokenSerialized){ + $api = new Api(); + $token = new Models\Token($this->httpClient, $api); + $token->methods = unserialize($tokenSerialized["methods"]); + $token->roles = []; + foreach($tokenSerialized["roles"] as $key => $role){ + $tmp = new Models\Role($this->httpClient, $api); + + $tmp->name = unserialize($key); + $tmp->links = unserialize($role["links"]); + $tmp->id = unserialize($role["id"]); + + $token->roles[] = $tmp; + } + + $token->expires = unserialize($tokenSerialized["expires"]); + $token->project = new Models\Project($this->httpClient, $api); + $token->project->domainId = unserialize($tokenSerialized["project"]["domainId"]); + $token->project->parentId = unserialize($tokenSerialized["project"]["parentId"]); + $token->project->enabled = unserialize($tokenSerialized["project"]["enabled"]); + $token->project->description = unserialize($tokenSerialized["project"]["description"]); + $token->project->id = unserialize($tokenSerialized["project"]["id"]); + $token->project->links = unserialize($tokenSerialized["project"]["links"]); + $token->project->name = unserialize($tokenSerialized["project"]["name"]); + + $token->catalog = []; + foreach($tokenSerialized["catalog"] as $key => $service){ + $tmp = new Models\Service($this->httpClient, $api); + + $tmp->id = unserialize($key); + $tmp->name = unserialize($service["name"]); + $tmp->description = unserialize($service["description"]); + $tmp->type = unserialize($service["type"]); + $tmp->endpoints = []; + foreach($service["endpoints"] as $key => $end){ + $tmpEnd = new Models\Endpoint($this->httpClient, $api); + $tmpEnd->id = unserialize($key); + $tmpEnd->interface = unserialize($end["interface"]); + $tmpEnd->name = unserialize($end["name"]); + $tmpEnd->serviceId = unserialize($end["serviceId"]); + $tmpEnd->region = unserialize($end["region"]); + $tmpEnd->links = unserialize($end["links"]); + $tmpEnd->url = unserialize($end["url"]); + $tmp->endpoints[] = $tmpEnd; + } + $tmp->links = unserialize($service["links"]); + $token->catalog[] = $tmp; + } + + $token->extras = unserialize($tokenSerialized["extras"]); + $token->user = new Models\User($this->httpClient, $api); + $token->user->domainId = unserialize($tokenSerialized["user"]["domainId"]); + $token->user->defaultProjectId = unserialize($tokenSerialized["user"]["defaultProjectId"]); + $token->user->id = unserialize($tokenSerialized["user"]["id"]); + $token->user->email = unserialize($tokenSerialized["user"]["email"]); + $token->user->enabled = unserialize($tokenSerialized["user"]["enabled"]); + $token->user->links = unserialize($tokenSerialized["user"]["links"]); + $token->user->name = unserialize($tokenSerialized["user"]["name"]); + $token->user->description = unserialize($tokenSerialized["user"]["description"]); + $token->issued = unserialize($tokenSerialized["issued"]); + $token->id = unserialize($tokenSerialized["id"]); + + return $token; + } } diff --git a/server/index.php b/server/index.php index b5424da..c99e8bc 100755 --- a/server/index.php +++ b/server/index.php @@ -12,9 +12,9 @@ // var_dump($id->genToken()); $compute = $openstack_api->computeV2($array); $servers = $compute->listServers(true); - var_dump($servers); + //var_dump($servers); foreach($servers as $server){ - echo $server->id." !!!!!!!!! "; + // echo $server->id." !!!!!!!!! "; } $tmp = new genTokenOptions($Args); @@ -25,6 +25,6 @@ $computeTest = $openstackTest->computeV2($array); $serversTest = $computeTest->listServers(true); foreach($serversTest as $server){ - echo $server->id." %%%%%% "; + // echo $server->id." %%%%%% "; } // var_dump($openstack_api->getBuilderOptions()); -- cgit v1.2.3 From 4c0fb055903b7cc1eaf8d6c65237e362edf4b18d Mon Sep 17 00:00:00 2001 From: Eole Date: Sun, 31 Jan 2016 12:16:31 +0100 Subject: Fin Token --- server/core/LibOverride/Test.php | 25 ++++++++++++++++--------- server/index.php | 2 +- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/server/core/LibOverride/Test.php b/server/core/LibOverride/Test.php index 91ea84d..10a7837 100755 --- a/server/core/LibOverride/Test.php +++ b/server/core/LibOverride/Test.php @@ -111,11 +111,12 @@ class genTokenOptions $tokenSerialized = []; $tokenSerialized["methods"] = serialize($token->methods); $tokenSerialized["roles"] = []; - //var_dump($token->roles); + foreach($token->roles as $role){ - $tokenSerialized["roles"][serialize($role->name)]["links"] = serialize($role->links); - $tokenSerialized["roles"][serialize($role->name)]["id"] = serialize($role->id); - } + $tokenSerialized["roles"][serialize($role->id)]["links"] = serialize($role->links); + $tokenSerialized["roles"][serialize($role->id)]["name"] = serialize($role->name); + } + $tokenSerialized["expires"] = serialize($token->expires); $tokenSerialized["project"]["domainId"] = serialize($token->project->domainId); $tokenSerialized["project"]["parentId"] = serialize($token->project->parentId); @@ -124,6 +125,7 @@ class genTokenOptions $tokenSerialized["project"]["id"] = serialize($token->project->id); $tokenSerialized["project"]["links"] = serialize($token->project->links); $tokenSerialized["project"]["name"] = serialize($token->project->name); + foreach($token->catalog->services as $service){ $tokenSerialized["catalog"][serialize($service->id)]["name"] = serialize($service->name); $tokenSerialized["catalog"][serialize($service->id)]["description"] = serialize($service->description); @@ -158,14 +160,17 @@ class genTokenOptions $token = new Models\Token($this->httpClient, $api); $token->methods = unserialize($tokenSerialized["methods"]); $token->roles = []; + $i = 0; foreach($tokenSerialized["roles"] as $key => $role){ $tmp = new Models\Role($this->httpClient, $api); - $tmp->name = unserialize($key); + $tmp->id = unserialize($key); $tmp->links = unserialize($role["links"]); - $tmp->id = unserialize($role["id"]); + if(isset($role["name"])) + $tmp->name = unserialize($role["name"]); $token->roles[] = $tmp; + $i++; } $token->expires = unserialize($tokenSerialized["expires"]); @@ -178,7 +183,8 @@ class genTokenOptions $token->project->links = unserialize($tokenSerialized["project"]["links"]); $token->project->name = unserialize($tokenSerialized["project"]["name"]); - $token->catalog = []; + $token->catalog = new Models\Catalog($this->httpClient, $api); + $token->catalog->services = []; foreach($tokenSerialized["catalog"] as $key => $service){ $tmp = new Models\Service($this->httpClient, $api); @@ -198,8 +204,9 @@ class genTokenOptions $tmpEnd->url = unserialize($end["url"]); $tmp->endpoints[] = $tmpEnd; } - $tmp->links = unserialize($service["links"]); - $token->catalog[] = $tmp; + if(isset($service["links"])) + $tmp->links = unserialize($service["links"]); + $token->catalog->services[] = $tmp; } $token->extras = unserialize($tokenSerialized["extras"]); diff --git a/server/index.php b/server/index.php index c99e8bc..4d65c59 100755 --- a/server/index.php +++ b/server/index.php @@ -25,6 +25,6 @@ $computeTest = $openstackTest->computeV2($array); $serversTest = $computeTest->listServers(true); foreach($serversTest as $server){ - // echo $server->id." %%%%%% "; + echo $server->id." %%%%%% "; } // var_dump($openstack_api->getBuilderOptions()); -- cgit v1.2.3 From f10df7fee15a15728ca2f2f539c8c1e6b123a5e4 Mon Sep 17 00:00:00 2001 From: Eole Date: Sun, 31 Jan 2016 12:22:51 +0100 Subject: Implementation Token Management End --- server/core/LibOverride/Test.php | 227 ---------------------------- server/core/LibOverride/genTokenOptions.php | 222 +++++++++++++++++++++++++++ 2 files changed, 222 insertions(+), 227 deletions(-) delete mode 100755 server/core/LibOverride/Test.php create mode 100755 server/core/LibOverride/genTokenOptions.php diff --git a/server/core/LibOverride/Test.php b/server/core/LibOverride/Test.php deleted file mode 100755 index 10a7837..0000000 --- a/server/core/LibOverride/Test.php +++ /dev/null @@ -1,227 +0,0 @@ -stack = HandlerStack::create(); - - $httpClient = new Client([ - 'base_uri' => Utils::normalizeUrl($options['authUrl']), - 'handler' => $this->stack, - ]); - - $this->httpClient = $httpClient; - - $options['identityService'] = Service::factory($httpClient); - - $options['authHandler'] = function () use ($options) { - return $options['identityService']->generateToken($options); - }; - - $this->optionsGlobal['Common'] = $options; - } - - /** - * @codeCoverageIgnore - */ - private function addDebugMiddleware(array $options, HandlerStack &$stack) - { - if (!empty($options['debugLog']) - && !empty($options['logger']) - && !empty($options['messageFormatter']) - ) { - $stack->push(GuzzleMiddleware::log($options['logger'], $options['messageFormatter'])); - } - } - - public function genComputeToken(){ - $options = $this->optionsGlobal['Common']; - $options['catalogName'] = 'nova'; - $options['catalogType'] = 'compute'; - $options['region'] = 'RegionOne'; - - list($token, $baseUrl) = $options['identityService']->authenticate($options); - //var_dump($token); - //$stack = HandlerStack::create(); - $this->stack->push(Middleware::authHandler($options['authHandler'], $token)); - - $this->addDebugMiddleware($options, $this->stack); - - $options['httpClient'] = new Client([ - 'base_uri' => Utils::normalizeUrl($baseUrl), - 'handler' => $this->stack, - ]); - $this->backup['Compute'] = array('token' => $this->serializeToken($token), 'baseUrl' => $baseUrl ); - - $this->optionsGlobal['Compute'] = $options; - } - - public function loadComputeBackup($opt){ - - $options = $this->optionsGlobal['Common']; - $options['catalogName'] = 'nova'; - $options['catalogType'] = 'compute'; - $options['region'] = 'RegionOne'; - - //list($token, $baseUrl) = $options['identityService']->authenticate($options); - $this->backup['Compute'] = unserialize($opt); - //var_dump($this->backup['Compute']); - $token = $this->unserializeToken($this->backup['Compute']['token']); - $baseUrl = $this->backup['Compute']['baseUrl']; - - //$stack = HandlerStack::create(); - - $this->stack->push(Middleware::authHandler($options['authHandler'], $token)); - - $this->addDebugMiddleware($options, $this->stack); - - $options['httpClient'] = new Client([ - 'base_uri' => Utils::normalizeUrl($baseUrl), - 'handler' => $this->stack, - ]); - $this->backup['Compute'] = array('token' => $this->serializeToken($token), 'baseUrl' => $baseUrl ); - $this->optionsGlobal['Compute'] = $options; - } - - public function getBackup($service){ - return serialize($this->backup[$service]); - } - - public function getOptionsCompute(){ - return $this->optionsGlobal['Compute']; - } - - private function serializeToken($token){ - $tokenSerialized = []; - $tokenSerialized["methods"] = serialize($token->methods); - $tokenSerialized["roles"] = []; - - foreach($token->roles as $role){ - $tokenSerialized["roles"][serialize($role->id)]["links"] = serialize($role->links); - $tokenSerialized["roles"][serialize($role->id)]["name"] = serialize($role->name); - } - - $tokenSerialized["expires"] = serialize($token->expires); - $tokenSerialized["project"]["domainId"] = serialize($token->project->domainId); - $tokenSerialized["project"]["parentId"] = serialize($token->project->parentId); - $tokenSerialized["project"]["enabled"] = serialize($token->project->enabled); - $tokenSerialized["project"]["description"] = serialize($token->project->description); - $tokenSerialized["project"]["id"] = serialize($token->project->id); - $tokenSerialized["project"]["links"] = serialize($token->project->links); - $tokenSerialized["project"]["name"] = serialize($token->project->name); - - foreach($token->catalog->services as $service){ - $tokenSerialized["catalog"][serialize($service->id)]["name"] = serialize($service->name); - $tokenSerialized["catalog"][serialize($service->id)]["description"] = serialize($service->description); - $tokenSerialized["catalog"][serialize($service->id)]["type"] = serialize($service->type); - foreach($service->endpoints as $end){ - $tokenSerialized["catalog"][serialize($service->id)]["endpoints"][serialize($end->id)]["interface"] = serialize($end->interface); - $tokenSerialized["catalog"][serialize($service->id)]["endpoints"][serialize($end->id)]["name"] = serialize($end->name); - $tokenSerialized["catalog"][serialize($service->id)]["endpoints"][serialize($end->id)]["serviceId"] = serialize($end->serviceId); - $tokenSerialized["catalog"][serialize($service->id)]["endpoints"][serialize($end->id)]["region"] = serialize($end->region); - $tokenSerialized["catalog"][serialize($service->id)]["endpoints"][serialize($end->id)]["links"] = serialize($end->links); - $tokenSerialized["catalog"][serialize($service->id)]["endpoints"][serialize($end->id)]["url"] = serialize($end->url); - } - $tokenSerialized["roles"][serialize($service->id)]["links"] = serialize($service->links); - } - $tokenSerialized["extras"] = serialize($token->extras); - $tokenSerialized["user"]["domainId"] = serialize($token->user->domainId); - $tokenSerialized["user"]["defaultProjectId"] = serialize($token->user->defaultProjectId); - $tokenSerialized["user"]["id"] = serialize($token->user->id); - $tokenSerialized["user"]["email"] = serialize($token->user->email); - $tokenSerialized["user"]["enabled"] = serialize($token->user->enabled); - $tokenSerialized["user"]["description"] = serialize($token->user->description); - $tokenSerialized["user"]["links"] = serialize($token->user->links); - $tokenSerialized["user"]["name"] = serialize($token->user->name); - $tokenSerialized["issued"] = serialize($token->issued); - $tokenSerialized["id"] = serialize($token->id); - - return $tokenSerialized; - } - - private function unserializeToken($tokenSerialized){ - $api = new Api(); - $token = new Models\Token($this->httpClient, $api); - $token->methods = unserialize($tokenSerialized["methods"]); - $token->roles = []; - $i = 0; - foreach($tokenSerialized["roles"] as $key => $role){ - $tmp = new Models\Role($this->httpClient, $api); - - $tmp->id = unserialize($key); - $tmp->links = unserialize($role["links"]); - if(isset($role["name"])) - $tmp->name = unserialize($role["name"]); - - $token->roles[] = $tmp; - $i++; - } - - $token->expires = unserialize($tokenSerialized["expires"]); - $token->project = new Models\Project($this->httpClient, $api); - $token->project->domainId = unserialize($tokenSerialized["project"]["domainId"]); - $token->project->parentId = unserialize($tokenSerialized["project"]["parentId"]); - $token->project->enabled = unserialize($tokenSerialized["project"]["enabled"]); - $token->project->description = unserialize($tokenSerialized["project"]["description"]); - $token->project->id = unserialize($tokenSerialized["project"]["id"]); - $token->project->links = unserialize($tokenSerialized["project"]["links"]); - $token->project->name = unserialize($tokenSerialized["project"]["name"]); - - $token->catalog = new Models\Catalog($this->httpClient, $api); - $token->catalog->services = []; - foreach($tokenSerialized["catalog"] as $key => $service){ - $tmp = new Models\Service($this->httpClient, $api); - - $tmp->id = unserialize($key); - $tmp->name = unserialize($service["name"]); - $tmp->description = unserialize($service["description"]); - $tmp->type = unserialize($service["type"]); - $tmp->endpoints = []; - foreach($service["endpoints"] as $key => $end){ - $tmpEnd = new Models\Endpoint($this->httpClient, $api); - $tmpEnd->id = unserialize($key); - $tmpEnd->interface = unserialize($end["interface"]); - $tmpEnd->name = unserialize($end["name"]); - $tmpEnd->serviceId = unserialize($end["serviceId"]); - $tmpEnd->region = unserialize($end["region"]); - $tmpEnd->links = unserialize($end["links"]); - $tmpEnd->url = unserialize($end["url"]); - $tmp->endpoints[] = $tmpEnd; - } - if(isset($service["links"])) - $tmp->links = unserialize($service["links"]); - $token->catalog->services[] = $tmp; - } - - $token->extras = unserialize($tokenSerialized["extras"]); - $token->user = new Models\User($this->httpClient, $api); - $token->user->domainId = unserialize($tokenSerialized["user"]["domainId"]); - $token->user->defaultProjectId = unserialize($tokenSerialized["user"]["defaultProjectId"]); - $token->user->id = unserialize($tokenSerialized["user"]["id"]); - $token->user->email = unserialize($tokenSerialized["user"]["email"]); - $token->user->enabled = unserialize($tokenSerialized["user"]["enabled"]); - $token->user->links = unserialize($tokenSerialized["user"]["links"]); - $token->user->name = unserialize($tokenSerialized["user"]["name"]); - $token->user->description = unserialize($tokenSerialized["user"]["description"]); - $token->issued = unserialize($tokenSerialized["issued"]); - $token->id = unserialize($tokenSerialized["id"]); - - return $token; - } -} diff --git a/server/core/LibOverride/genTokenOptions.php b/server/core/LibOverride/genTokenOptions.php new file mode 100755 index 0000000..0b00163 --- /dev/null +++ b/server/core/LibOverride/genTokenOptions.php @@ -0,0 +1,222 @@ +stack = HandlerStack::create(); + + $httpClient = new Client([ + 'base_uri' => Utils::normalizeUrl($options['authUrl']), + 'handler' => $this->stack, + ]); + + $this->httpClient = $httpClient; + + $options['identityService'] = Service::factory($httpClient); + + $options['authHandler'] = function () use ($options) { + return $options['identityService']->generateToken($options); + }; + + $this->optionsGlobal['Common'] = $options; + } + + /** + * @codeCoverageIgnore + */ + private function addDebugMiddleware(array $options, HandlerStack &$stack) + { + if (!empty($options['debugLog']) + && !empty($options['logger']) + && !empty($options['messageFormatter']) + ) { + $stack->push(GuzzleMiddleware::log($options['logger'], $options['messageFormatter'])); + } + } + + public function genComputeToken(){ + $options = $this->optionsGlobal['Common']; + $options['catalogName'] = 'nova'; + $options['catalogType'] = 'compute'; + $options['region'] = 'RegionOne'; + + list($token, $baseUrl) = $options['identityService']->authenticate($options); + + $this->stack->push(Middleware::authHandler($options['authHandler'], $token)); + + $this->addDebugMiddleware($options, $this->stack); + + $options['httpClient'] = new Client([ + 'base_uri' => Utils::normalizeUrl($baseUrl), + 'handler' => $this->stack, + ]); + $this->backup['Compute'] = array('token' => $this->serializeToken($token), 'baseUrl' => $baseUrl ); + + $this->optionsGlobal['Compute'] = $options; + } + + public function loadComputeBackup($opt){ + + $options = $this->optionsGlobal['Common']; + $options['catalogName'] = 'nova'; + $options['catalogType'] = 'compute'; + $options['region'] = 'RegionOne'; + + $this->backup['Compute'] = unserialize($opt); + $token = $this->unserializeToken($this->backup['Compute']['token']); + $baseUrl = $this->backup['Compute']['baseUrl']; + + $this->stack->push(Middleware::authHandler($options['authHandler'], $token)); + + $this->addDebugMiddleware($options, $this->stack); + + $options['httpClient'] = new Client([ + 'base_uri' => Utils::normalizeUrl($baseUrl), + 'handler' => $this->stack, + ]); + $this->backup['Compute'] = array('token' => $this->serializeToken($token), 'baseUrl' => $baseUrl ); + $this->optionsGlobal['Compute'] = $options; + } + + public function getBackup($service){ + return serialize($this->backup[$service]); + } + + public function getOptionsCompute(){ + return $this->optionsGlobal['Compute']; + } + + private function serializeToken($token){ + $tokenSerialized = []; + $tokenSerialized["methods"] = serialize($token->methods); + $tokenSerialized["roles"] = []; + + foreach($token->roles as $role){ + $tokenSerialized["roles"][serialize($role->id)]["links"] = serialize($role->links); + $tokenSerialized["roles"][serialize($role->id)]["name"] = serialize($role->name); + } + + $tokenSerialized["expires"] = serialize($token->expires); + $tokenSerialized["project"]["domainId"] = serialize($token->project->domainId); + $tokenSerialized["project"]["parentId"] = serialize($token->project->parentId); + $tokenSerialized["project"]["enabled"] = serialize($token->project->enabled); + $tokenSerialized["project"]["description"] = serialize($token->project->description); + $tokenSerialized["project"]["id"] = serialize($token->project->id); + $tokenSerialized["project"]["links"] = serialize($token->project->links); + $tokenSerialized["project"]["name"] = serialize($token->project->name); + + foreach($token->catalog->services as $service){ + $tokenSerialized["catalog"][serialize($service->id)]["name"] = serialize($service->name); + $tokenSerialized["catalog"][serialize($service->id)]["description"] = serialize($service->description); + $tokenSerialized["catalog"][serialize($service->id)]["type"] = serialize($service->type); + foreach($service->endpoints as $end){ + $tokenSerialized["catalog"][serialize($service->id)]["endpoints"][serialize($end->id)]["interface"] = serialize($end->interface); + $tokenSerialized["catalog"][serialize($service->id)]["endpoints"][serialize($end->id)]["name"] = serialize($end->name); + $tokenSerialized["catalog"][serialize($service->id)]["endpoints"][serialize($end->id)]["serviceId"] = serialize($end->serviceId); + $tokenSerialized["catalog"][serialize($service->id)]["endpoints"][serialize($end->id)]["region"] = serialize($end->region); + $tokenSerialized["catalog"][serialize($service->id)]["endpoints"][serialize($end->id)]["links"] = serialize($end->links); + $tokenSerialized["catalog"][serialize($service->id)]["endpoints"][serialize($end->id)]["url"] = serialize($end->url); + } + $tokenSerialized["roles"][serialize($service->id)]["links"] = serialize($service->links); + } + $tokenSerialized["extras"] = serialize($token->extras); + $tokenSerialized["user"]["domainId"] = serialize($token->user->domainId); + $tokenSerialized["user"]["defaultProjectId"] = serialize($token->user->defaultProjectId); + $tokenSerialized["user"]["id"] = serialize($token->user->id); + $tokenSerialized["user"]["email"] = serialize($token->user->email); + $tokenSerialized["user"]["enabled"] = serialize($token->user->enabled); + $tokenSerialized["user"]["description"] = serialize($token->user->description); + $tokenSerialized["user"]["links"] = serialize($token->user->links); + $tokenSerialized["user"]["name"] = serialize($token->user->name); + $tokenSerialized["issued"] = serialize($token->issued); + $tokenSerialized["id"] = serialize($token->id); + + return $tokenSerialized; + } + + private function unserializeToken($tokenSerialized){ + $api = new Api(); + $token = new Models\Token($this->httpClient, $api); + $token->methods = unserialize($tokenSerialized["methods"]); + $token->roles = []; + $i = 0; + foreach($tokenSerialized["roles"] as $key => $role){ + $tmp = new Models\Role($this->httpClient, $api); + + $tmp->id = unserialize($key); + $tmp->links = unserialize($role["links"]); + if(isset($role["name"])) + $tmp->name = unserialize($role["name"]); + + $token->roles[] = $tmp; + $i++; + } + + $token->expires = unserialize($tokenSerialized["expires"]); + $token->project = new Models\Project($this->httpClient, $api); + $token->project->domainId = unserialize($tokenSerialized["project"]["domainId"]); + $token->project->parentId = unserialize($tokenSerialized["project"]["parentId"]); + $token->project->enabled = unserialize($tokenSerialized["project"]["enabled"]); + $token->project->description = unserialize($tokenSerialized["project"]["description"]); + $token->project->id = unserialize($tokenSerialized["project"]["id"]); + $token->project->links = unserialize($tokenSerialized["project"]["links"]); + $token->project->name = unserialize($tokenSerialized["project"]["name"]); + + $token->catalog = new Models\Catalog($this->httpClient, $api); + $token->catalog->services = []; + foreach($tokenSerialized["catalog"] as $key => $service){ + $tmp = new Models\Service($this->httpClient, $api); + + $tmp->id = unserialize($key); + $tmp->name = unserialize($service["name"]); + $tmp->description = unserialize($service["description"]); + $tmp->type = unserialize($service["type"]); + $tmp->endpoints = []; + foreach($service["endpoints"] as $key => $end){ + $tmpEnd = new Models\Endpoint($this->httpClient, $api); + $tmpEnd->id = unserialize($key); + $tmpEnd->interface = unserialize($end["interface"]); + $tmpEnd->name = unserialize($end["name"]); + $tmpEnd->serviceId = unserialize($end["serviceId"]); + $tmpEnd->region = unserialize($end["region"]); + $tmpEnd->links = unserialize($end["links"]); + $tmpEnd->url = unserialize($end["url"]); + $tmp->endpoints[] = $tmpEnd; + } + if(isset($service["links"])) + $tmp->links = unserialize($service["links"]); + $token->catalog->services[] = $tmp; + } + + $token->extras = unserialize($tokenSerialized["extras"]); + $token->user = new Models\User($this->httpClient, $api); + $token->user->domainId = unserialize($tokenSerialized["user"]["domainId"]); + $token->user->defaultProjectId = unserialize($tokenSerialized["user"]["defaultProjectId"]); + $token->user->id = unserialize($tokenSerialized["user"]["id"]); + $token->user->email = unserialize($tokenSerialized["user"]["email"]); + $token->user->enabled = unserialize($tokenSerialized["user"]["enabled"]); + $token->user->links = unserialize($tokenSerialized["user"]["links"]); + $token->user->name = unserialize($tokenSerialized["user"]["name"]); + $token->user->description = unserialize($tokenSerialized["user"]["description"]); + $token->issued = unserialize($tokenSerialized["issued"]); + $token->id = unserialize($tokenSerialized["id"]); + + return $token; + } +} -- cgit v1.2.3 From d00ea4f7b1317ed5e9fe2743ea61ceb4330aadf6 Mon Sep 17 00:00:00 2001 From: Eole Date: Sun, 31 Jan 2016 12:29:20 +0100 Subject: nettoyage --- server/core/LibOverride/Builder.php | 169 ---------------------------- server/core/LibOverride/OpenStack.php | 43 ------- server/core/LibOverride/genTokenOptions.php | 5 +- 3 files changed, 2 insertions(+), 215 deletions(-) delete mode 100644 server/core/LibOverride/Builder.php delete mode 100644 server/core/LibOverride/OpenStack.php diff --git a/server/core/LibOverride/Builder.php b/server/core/LibOverride/Builder.php deleted file mode 100644 index 30ea9d3..0000000 --- a/server/core/LibOverride/Builder.php +++ /dev/null @@ -1,169 +0,0 @@ - 'publicURL']; - - public function __construct(array $globalOptions = []) - { - $this->globalOptions = $globalOptions; - parent::__construct($globalOptions); - } - - public function getOptions() - { - return $this->globalOptions; - } - - public function setOptions($Options) - { - $this->globalOptions = $Options; - } - - /** - * Internal method which resolves the API and Service classes for a service. - * - * @param string $serviceName The name of the service, e.g. Compute - * @param int $serviceVersion The major version of the service, e.g. 2 - * - * @return array - */ - private function getClasses($serviceName, $serviceVersion) - { - $rootNamespace = sprintf("OpenStack\\%s\\v%d", $serviceName, $serviceVersion); - - return [ - sprintf("%s\\Api", $rootNamespace), - sprintf("%s\\Service", $rootNamespace), - ]; - } - - /** - * This method will return an OpenStack service ready fully built and ready for use. There is - * some initial setup that may prohibit users from directly instantiating the service class - * directly - this setup includes the configuration of the HTTP client's base URL, and the - * attachment of an authentication handler. - * - * @param $serviceName The name of the service as it appears in the OpenStack\* namespace - * @param $serviceVersion The major version of the service - * @param array $serviceOptions The service-specific options to use - * - * @return \OpenStack\Common\Service\ServiceInterface - * - * @throws \Exception - */ - public function createService($serviceName, $serviceVersion, array $serviceOptions = []) - { - $options = $this->mergeOptions($serviceOptions); - - $this->stockIdentityService($options); - $this->stockAuthHandler($options); - $this->stockHttpClient($options, $serviceName); - - list($apiClass, $serviceClass) = $this->getClasses($serviceName, $serviceVersion); - - return new $serviceClass($options['httpClient'], new $apiClass()); - } - - private function stockHttpClient(array &$options, $serviceName) - { - if (!isset($options['httpClient']) || !($options['httpClient'] instanceof ClientInterface)) { - if (strcasecmp($serviceName, 'identity') === 0) { - $baseUrl = $options['authUrl']; - $stack = $this->getStack($options['authHandler']); - } else { - list($token, $baseUrl) = $options['identityService']->authenticate($options); - $stack = $this->getStack($options['authHandler'], $token); - } - - $this->addDebugMiddleware($options, $stack); - - $options['httpClient'] = $this->httpClient($baseUrl, $stack); - } - } - - /** - * @codeCoverageIgnore - */ - private function addDebugMiddleware(array $options, HandlerStack &$stack) - { - if (!empty($options['debugLog']) - && !empty($options['logger']) - && !empty($options['messageFormatter']) - ) { - $stack->push(GuzzleMiddleware::log($options['logger'], $options['messageFormatter'])); - } - } - - private function stockIdentityService(array &$options) - { - if (!isset($options['identityService'])) { - $httpClient = $this->httpClient($options['authUrl'], HandlerStack::create()); - $options['identityService'] = Service::factory($httpClient); - } - } - - /** - * @param array $options - * @codeCoverageIgnore - */ - private function stockAuthHandler(array &$options) - { - if (!isset($options['authHandler'])) { - $options['authHandler'] = function () use ($options) { - return $options['identityService']->generateToken($options); - }; - } - } - - private function getStack(callable $authHandler, Token $token = null) - { - $stack = HandlerStack::create(); - $stack->push(Middleware::authHandler($authHandler, $token)); - return $stack; - } - - private function httpClient($baseUrl, HandlerStack $stack) - { - return new Client([ - 'base_uri' => Utils::normalizeUrl($baseUrl), - 'handler' => $stack, - ]); - } - - private function mergeOptions(array $serviceOptions) - { - $options = array_merge($this->defaults, $this->globalOptions, $serviceOptions); - - if (!isset($options['authUrl'])) { - throw new \InvalidArgumentException('"authUrl" is a required option'); - } - - return $options; - } -} - diff --git a/server/core/LibOverride/OpenStack.php b/server/core/LibOverride/OpenStack.php deleted file mode 100644 index 2b3897a..0000000 --- a/server/core/LibOverride/OpenStack.php +++ /dev/null @@ -1,43 +0,0 @@ -builder = $builder ?: new Builder_override($options); - parent::__construct($options, $this->builder); - } - - public function getBuilderOptions() - { - - return $this->builder->getOptions(); - - } - - public function setBuilderOptions($options) - { - - $this->builder->setOptions($options); - - } -} diff --git a/server/core/LibOverride/genTokenOptions.php b/server/core/LibOverride/genTokenOptions.php index 0b00163..2e10cac 100755 --- a/server/core/LibOverride/genTokenOptions.php +++ b/server/core/LibOverride/genTokenOptions.php @@ -155,7 +155,7 @@ class genTokenOptions $token = new Models\Token($this->httpClient, $api); $token->methods = unserialize($tokenSerialized["methods"]); $token->roles = []; - $i = 0; + foreach($tokenSerialized["roles"] as $key => $role){ $tmp = new Models\Role($this->httpClient, $api); @@ -164,8 +164,7 @@ class genTokenOptions if(isset($role["name"])) $tmp->name = unserialize($role["name"]); - $token->roles[] = $tmp; - $i++; + $token->roles[] = $tmp } $token->expires = unserialize($tokenSerialized["expires"]); -- cgit v1.2.3 From f884e408730be1dcd6b28e5f7a55eee80677db05 Mon Sep 17 00:00:00 2001 From: Eole Date: Sun, 31 Jan 2016 12:49:56 +0100 Subject: Delete deleted class load --- server/init.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/server/init.php b/server/init.php index 3c5f848..9e0500b 100755 --- a/server/init.php +++ b/server/init.php @@ -2,9 +2,7 @@ include_once("config.inc.php"); include_once("core/Plugin_Api.php"); require "vendor/autoload.php"; - include_once("core/LibOverride/Builder.php"); - include_once("core/LibOverride/OpenStack.php"); - include_once("core/LibOverride/Test.php"); + include_once("core/LibOverride/genTokenOptions.php"); include_once("core/Identity.php"); //traitement requete, recuperation data -- cgit v1.2.3 From 217c2247567550f320dc2956615824194c20632d Mon Sep 17 00:00:00 2001 From: Eole Date: Sun, 31 Jan 2016 12:54:37 +0100 Subject: Error Correction --- server/core/LibOverride/genTokenOptions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/core/LibOverride/genTokenOptions.php b/server/core/LibOverride/genTokenOptions.php index 2e10cac..ba9e196 100755 --- a/server/core/LibOverride/genTokenOptions.php +++ b/server/core/LibOverride/genTokenOptions.php @@ -164,7 +164,7 @@ class genTokenOptions if(isset($role["name"])) $tmp->name = unserialize($role["name"]); - $token->roles[] = $tmp + $token->roles[] = $tmp; } $token->expires = unserialize($tokenSerialized["expires"]); -- cgit v1.2.3 From cf6874b169731fee39f25b3f6c75967efd63f6e4 Mon Sep 17 00:00:00 2001 From: manzerbredes Date: Sun, 31 Jan 2016 13:18:15 +0100 Subject: Add sanitize module, use angular route minified --- client/index.html | 3 +- client/js/app.js | 2 +- client/js/controllers/status.js | 9 +- client/partials/nav.html | 2 +- client/vendors/angularjs/angular-route.js | 1008 ---------------------- client/vendors/angularjs/angular-route.min.js | 15 + client/vendors/angularjs/angular-sanitize.min.js | 15 + 7 files changed, 41 insertions(+), 1013 deletions(-) delete mode 100644 client/vendors/angularjs/angular-route.js create mode 100644 client/vendors/angularjs/angular-route.min.js create mode 100644 client/vendors/angularjs/angular-sanitize.min.js diff --git a/client/index.html b/client/index.html index c2d1862..9d78732 100644 --- a/client/index.html +++ b/client/index.html @@ -62,7 +62,8 @@ - + + diff --git a/client/js/app.js b/client/js/app.js index 7fedb32..c931d7e 100644 --- a/client/js/app.js +++ b/client/js/app.js @@ -1,6 +1,6 @@ // Declare main app -var mainApp=angular.module("mainApp",['ngRoute']); +var mainApp=angular.module("mainApp",['ngRoute', 'ngSanitize']); mainApp.config(['$routeProvider', function($routeProvider){ diff --git a/client/js/controllers/status.js b/client/js/controllers/status.js index 0767202..01fdcc3 100644 --- a/client/js/controllers/status.js +++ b/client/js/controllers/status.js @@ -4,15 +4,20 @@ -mainApp.controller('statusCtrl', function ($scope,$interval) +mainApp.controller('statusCtrl', function ($scope,$interval,$sce) { // Update status every 2 seconds $interval(function(){ var status=identity.fetchStatus(); - $scope.connection=status[0]; $scope.username=status[1]; $scope.lastconnection=status[2]; + if(status[0] == "1"){ + $scope.connection=$sce.trustAsHtml("Connection : Online"); + } + else{ + $scope.connection="Connection : Offline"; + } }, 2000); diff --git a/client/partials/nav.html b/client/partials/nav.html index a765daa..b9e51df 100644 --- a/client/partials/nav.html +++ b/client/partials/nav.html @@ -20,7 +20,7 @@
  • User : {{ username }}
  • Last Connection : {{ lastconnection }}
  • -
  • Connection : {{ connection }}
  • +
  • diff --git a/client/vendors/angularjs/angular-route.js b/client/vendors/angularjs/angular-route.js deleted file mode 100644 index c340d0f..0000000 --- a/client/vendors/angularjs/angular-route.js +++ /dev/null @@ -1,1008 +0,0 @@ -/** - * @license AngularJS v1.5.0-rc.1 - * (c) 2010-2016 Google, Inc. http://angularjs.org - * License: MIT - */ -(function(window, angular, undefined) {'use strict'; - -/** - * @ngdoc module - * @name ngRoute - * @description - * - * # ngRoute - * - * The `ngRoute` module provides routing and deeplinking services and directives for angular apps. - * - * ## Example - * See {@link ngRoute.$route#example $route} for an example of configuring and using `ngRoute`. - * - * - *
    - */ - /* global -ngRouteModule */ -var ngRouteModule = angular.module('ngRoute', ['ng']). - provider('$route', $RouteProvider), - $routeMinErr = angular.$$minErr('ngRoute'); - -/** - * @ngdoc provider - * @name $routeProvider - * - * @description - * - * Used for configuring routes. - * - * ## Example - * See {@link ngRoute.$route#example $route} for an example of configuring and using `ngRoute`. - * - * ## Dependencies - * Requires the {@link ngRoute `ngRoute`} module to be installed. - */ -function $RouteProvider() { - function inherit(parent, extra) { - return angular.extend(Object.create(parent), extra); - } - - var routes = {}; - - /** - * @ngdoc method - * @name $routeProvider#when - * - * @param {string} path Route path (matched against `$location.path`). If `$location.path` - * contains redundant trailing slash or is missing one, the route will still match and the - * `$location.path` will be updated to add or drop the trailing slash to exactly match the - * route definition. - * - * * `path` can contain named groups starting with a colon: e.g. `:name`. All characters up - * to the next slash are matched and stored in `$routeParams` under the given `name` - * when the route matches. - * * `path` can contain named groups starting with a colon and ending with a star: - * e.g.`:name*`. All characters are eagerly stored in `$routeParams` under the given `name` - * when the route matches. - * * `path` can contain optional named groups with a question mark: e.g.`:name?`. - * - * For example, routes like `/color/:color/largecode/:largecode*\/edit` will match - * `/color/brown/largecode/code/with/slashes/edit` and extract: - * - * * `color: brown` - * * `largecode: code/with/slashes`. - * - * - * @param {Object} route Mapping information to be assigned to `$route.current` on route - * match. - * - * Object properties: - * - * - `controller` – `{(string|function()=}` – Controller fn that should be associated with - * newly created scope or the name of a {@link angular.Module#controller registered - * controller} if passed as a string. - * - `controllerAs` – `{string=}` – An identifier name for a reference to the controller. - * If present, the controller will be published to scope under the `controllerAs` name. - * - `template` – `{string=|function()=}` – html template as a string or a function that - * returns an html template as a string which should be used by {@link - * ngRoute.directive:ngView ngView} or {@link ng.directive:ngInclude ngInclude} directives. - * This property takes precedence over `templateUrl`. - * - * If `template` is a function, it will be called with the following parameters: - * - * - `{Array.}` - route parameters extracted from the current - * `$location.path()` by applying the current route - * - * - `templateUrl` – `{string=|function()=}` – path or function that returns a path to an html - * template that should be used by {@link ngRoute.directive:ngView ngView}. - * - * If `templateUrl` is a function, it will be called with the following parameters: - * - * - `{Array.}` - route parameters extracted from the current - * `$location.path()` by applying the current route - * - * - `resolve` - `{Object.=}` - An optional map of dependencies which should - * be injected into the controller. If any of these dependencies are promises, the router - * will wait for them all to be resolved or one to be rejected before the controller is - * instantiated. - * If all the promises are resolved successfully, the values of the resolved promises are - * injected and {@link ngRoute.$route#$routeChangeSuccess $routeChangeSuccess} event is - * fired. If any of the promises are rejected the - * {@link ngRoute.$route#$routeChangeError $routeChangeError} event is fired. - * For easier access to the resolved dependencies from the template, the `resolve` map will - * be available on the scope of the route, under `$resolve` (by default) or a custom name - * specified by the `resolveAs` property (see below). This can be particularly useful, when - * working with {@link angular.Module#component components} as route templates.
    - *
    - * **Note:** If your scope already contains a property with this name, it will be hidden - * or overwritten. Make sure, you specify an appropriate name for this property, that - * does not collide with other properties on the scope. - *
    - * The map object is: - * - * - `key` – `{string}`: a name of a dependency to be injected into the controller. - * - `factory` - `{string|function}`: If `string` then it is an alias for a service. - * Otherwise if function, then it is {@link auto.$injector#invoke injected} - * and the return value is treated as the dependency. If the result is a promise, it is - * resolved before its value is injected into the controller. Be aware that - * `ngRoute.$routeParams` will still refer to the previous route within these resolve - * functions. Use `$route.current.params` to access the new route parameters, instead. - * - * - `resolveAs` - `{string=}` - The name under which the `resolve` map will be available on - * the scope of the route. If omitted, defaults to `$resolve`. - * - * - `redirectTo` – `{(string|function())=}` – value to update - * {@link ng.$location $location} path with and trigger route redirection. - * - * If `redirectTo` is a function, it will be called with the following parameters: - * - * - `{Object.}` - route parameters extracted from the current - * `$location.path()` by applying the current route templateUrl. - * - `{string}` - current `$location.path()` - * - `{Object}` - current `$location.search()` - * - * The custom `redirectTo` function is expected to return a string which will be used - * to update `$location.path()` and `$location.search()`. - * - * - `[reloadOnSearch=true]` - `{boolean=}` - reload route when only `$location.search()` - * or `$location.hash()` changes. - * - * If the option is set to `false` and url in the browser changes, then - * `$routeUpdate` event is broadcasted on the root scope. - * - * - `[caseInsensitiveMatch=false]` - `{boolean=}` - match routes without being case sensitive - * - * If the option is set to `true`, then the particular route can be matched without being - * case sensitive - * - * @returns {Object} self - * - * @description - * Adds a new route definition to the `$route` service. - */ - this.when = function(path, route) { - //copy original route object to preserve params inherited from proto chain - var routeCopy = angular.copy(route); - if (angular.isUndefined(routeCopy.reloadOnSearch)) { - routeCopy.reloadOnSearch = true; - } - if (angular.isUndefined(routeCopy.caseInsensitiveMatch)) { - routeCopy.caseInsensitiveMatch = this.caseInsensitiveMatch; - } - routes[path] = angular.extend( - routeCopy, - path && pathRegExp(path, routeCopy) - ); - - // create redirection for trailing slashes - if (path) { - var redirectPath = (path[path.length - 1] == '/') - ? path.substr(0, path.length - 1) - : path + '/'; - - routes[redirectPath] = angular.extend( - {redirectTo: path}, - pathRegExp(redirectPath, routeCopy) - ); - } - - return this; - }; - - /** - * @ngdoc property - * @name $routeProvider#caseInsensitiveMatch - * @description - * - * A boolean property indicating if routes defined - * using this provider should be matched using a case insensitive - * algorithm. Defaults to `false`. - */ - this.caseInsensitiveMatch = false; - - /** - * @param path {string} path - * @param opts {Object} options - * @return {?Object} - * - * @description - * Normalizes the given path, returning a regular expression - * and the original path. - * - * Inspired by pathRexp in visionmedia/express/lib/utils.js. - */ - function pathRegExp(path, opts) { - var insensitive = opts.caseInsensitiveMatch, - ret = { - originalPath: path, - regexp: path - }, - keys = ret.keys = []; - - path = path - .replace(/([().])/g, '\\$1') - .replace(/(\/)?:(\w+)([\?\*])?/g, function(_, slash, key, option) { - var optional = option === '?' ? option : null; - var star = option === '*' ? option : null; - keys.push({ name: key, optional: !!optional }); - slash = slash || ''; - return '' - + (optional ? '' : slash) - + '(?:' - + (optional ? slash : '') - + (star && '(.+?)' || '([^/]+)') - + (optional || '') - + ')' - + (optional || ''); - }) - .replace(/([\/$\*])/g, '\\$1'); - - ret.regexp = new RegExp('^' + path + '$', insensitive ? 'i' : ''); - return ret; - } - - /** - * @ngdoc method - * @name $routeProvider#otherwise - * - * @description - * Sets route definition that will be used on route change when no other route definition - * is matched. - * - * @param {Object|string} params Mapping information to be assigned to `$route.current`. - * If called with a string, the value maps to `redirectTo`. - * @returns {Object} self - */ - this.otherwise = function(params) { - if (typeof params === 'string') { - params = {redirectTo: params}; - } - this.when(null, params); - return this; - }; - - - this.$get = ['$rootScope', - '$location', - '$routeParams', - '$q', - '$injector', - '$templateRequest', - '$sce', - function($rootScope, $location, $routeParams, $q, $injector, $templateRequest, $sce) { - - /** - * @ngdoc service - * @name $route - * @requires $location - * @requires $routeParams - * - * @property {Object} current Reference to the current route definition. - * The route definition contains: - * - * - `controller`: The controller constructor as defined in the route definition. - * - `locals`: A map of locals which is used by {@link ng.$controller $controller} service for - * controller instantiation. The `locals` contain - * the resolved values of the `resolve` map. Additionally the `locals` also contain: - * - * - `$scope` - The current route scope. - * - `$template` - The current route template HTML. - * - * The `locals` will be assigned to the route scope's `$resolve` property. You can override - * the property name, using `resolveAs` in the route definition. See - * {@link ngRoute.$routeProvider $routeProvider} for more info. - * - * @property {Object} routes Object with all route configuration Objects as its properties. - * - * @description - * `$route` is used for deep-linking URLs to controllers and views (HTML partials). - * It watches `$location.url()` and tries to map the path to an existing route definition. - * - * Requires the {@link ngRoute `ngRoute`} module to be installed. - * - * You can define routes through {@link ngRoute.$routeProvider $routeProvider}'s API. - * - * The `$route` service is typically used in conjunction with the - * {@link ngRoute.directive:ngView `ngView`} directive and the - * {@link ngRoute.$routeParams `$routeParams`} service. - * - * @example - * This example shows how changing the URL hash causes the `$route` to match a route against the - * URL, and the `ngView` pulls in the partial. - * - * - * - *
    - * Choose: - * Moby | - * Moby: Ch1 | - * Gatsby | - * Gatsby: Ch4 | - * Scarlet Letter
    - * - *
    - * - *
    - * - *
    $location.path() = {{$location.path()}}
    - *
    $route.current.templateUrl = {{$route.current.templateUrl}}
    - *
    $route.current.params = {{$route.current.params}}
    - *
    $route.current.scope.name = {{$route.current.scope.name}}
    - *
    $routeParams = {{$routeParams}}
    - *
    - *
    - * - * - * controller: {{name}}
    - * Book Id: {{params.bookId}}
    - *
    - * - * - * controller: {{name}}
    - * Book Id: {{params.bookId}}
    - * Chapter Id: {{params.chapterId}} - *
    - * - * - * angular.module('ngRouteExample', ['ngRoute']) - * - * .controller('MainController', function($scope, $route, $routeParams, $location) { - * $scope.$route = $route; - * $scope.$location = $location; - * $scope.$routeParams = $routeParams; - * }) - * - * .controller('BookController', function($scope, $routeParams) { - * $scope.name = "BookController"; - * $scope.params = $routeParams; - * }) - * - * .controller('ChapterController', function($scope, $routeParams) { - * $scope.name = "ChapterController"; - * $scope.params = $routeParams; - * }) - * - * .config(function($routeProvider, $locationProvider) { - * $routeProvider - * .when('/Book/:bookId', { - * templateUrl: 'book.html', - * controller: 'BookController', - * resolve: { - * // I will cause a 1 second delay - * delay: function($q, $timeout) { - * var delay = $q.defer(); - * $timeout(delay.resolve, 1000); - * return delay.promise; - * } - * } - * }) - * .when('/Book/:bookId/ch/:chapterId', { - * templateUrl: 'chapter.html', - * controller: 'ChapterController' - * }); - * - * // configure html5 to get links working on jsfiddle - * $locationProvider.html5Mode(true); - * }); - * - * - * - * - * it('should load and compile correct template', function() { - * element(by.linkText('Moby: Ch1')).click(); - * var content = element(by.css('[ng-view]')).getText(); - * expect(content).toMatch(/controller\: ChapterController/); - * expect(content).toMatch(/Book Id\: Moby/); - * expect(content).toMatch(/Chapter Id\: 1/); - * - * element(by.partialLinkText('Scarlet')).click(); - * - * content = element(by.css('[ng-view]')).getText(); - * expect(content).toMatch(/controller\: BookController/); - * expect(content).toMatch(/Book Id\: Scarlet/); - * }); - * - *
    - */ - - /** - * @ngdoc event - * @name $route#$routeChangeStart - * @eventType broadcast on root scope - * @description - * Broadcasted before a route change. At this point the route services starts - * resolving all of the dependencies needed for the route change to occur. - * Typically this involves fetching the view template as well as any dependencies - * defined in `resolve` route property. Once all of the dependencies are resolved - * `$routeChangeSuccess` is fired. - * - * The route change (and the `$location` change that triggered it) can be prevented - * by calling `preventDefault` method of the event. See {@link ng.$rootScope.Scope#$on} - * for more details about event object. - * - * @param {Object} angularEvent Synthetic event object. - * @param {Route} next Future route information. - * @param {Route} current Current route information. - */ - - /** - * @ngdoc event - * @name $route#$routeChangeSuccess - * @eventType broadcast on root scope - * @description - * Broadcasted after a route change has happened successfully. - * The `resolve` dependencies are now available in the `current.locals` property. - * - * {@link ngRoute.directive:ngView ngView} listens for the directive - * to instantiate the controller and render the view. - * - * @param {Object} angularEvent Synthetic event object. - * @param {Route} current Current route information. - * @param {Route|Undefined} previous Previous route information, or undefined if current is - * first route entered. - */ - - /** - * @ngdoc event - * @name $route#$routeChangeError - * @eventType broadcast on root scope - * @description - * Broadcasted if any of the resolve promises are rejected. - * - * @param {Object} angularEvent Synthetic event object - * @param {Route} current Current route information. - * @param {Route} previous Previous route information. - * @param {Route} rejection Rejection of the promise. Usually the error of the failed promise. - */ - - /** - * @ngdoc event - * @name $route#$routeUpdate - * @eventType broadcast on root scope - * @description - * The `reloadOnSearch` property has been set to false, and we are reusing the same - * instance of the Controller. - * - * @param {Object} angularEvent Synthetic event object - * @param {Route} current Current/previous route information. - */ - - var forceReload = false, - preparedRoute, - preparedRouteIsUpdateOnly, - $route = { - routes: routes, - - /** - * @ngdoc method - * @name $route#reload - * - * @description - * Causes `$route` service to reload the current route even if - * {@link ng.$location $location} hasn't changed. - * - * As a result of that, {@link ngRoute.directive:ngView ngView} - * creates new scope and reinstantiates the controller. - */ - reload: function() { - forceReload = true; - $rootScope.$evalAsync(function() { - // Don't support cancellation of a reload for now... - prepareRoute(); - commitRoute(); - }); - }, - - /** - * @ngdoc method - * @name $route#updateParams - * - * @description - * Causes `$route` service to update the current URL, replacing - * current route parameters with those specified in `newParams`. - * Provided property names that match the route's path segment - * definitions will be interpolated into the location's path, while - * remaining properties will be treated as query params. - * - * @param {!Object} newParams mapping of URL parameter names to values - */ - updateParams: function(newParams) { - if (this.current && this.current.$$route) { - newParams = angular.extend({}, this.current.params, newParams); - $location.path(interpolate(this.current.$$route.originalPath, newParams)); - // interpolate modifies newParams, only query params are left - $location.search(newParams); - } else { - throw $routeMinErr('norout', 'Tried updating route when with no current route'); - } - } - }; - - $rootScope.$on('$locationChangeStart', prepareRoute); - $rootScope.$on('$locationChangeSuccess', commitRoute); - - return $route; - - ///////////////////////////////////////////////////// - - /** - * @param on {string} current url - * @param route {Object} route regexp to match the url against - * @return {?Object} - * - * @description - * Check if the route matches the current url. - * - * Inspired by match in - * visionmedia/express/lib/router/router.js. - */ - function switchRouteMatcher(on, route) { - var keys = route.keys, - params = {}; - - if (!route.regexp) return null; - - var m = route.regexp.exec(on); - if (!m) return null; - - for (var i = 1, len = m.length; i < len; ++i) { - var key = keys[i - 1]; - - var val = m[i]; - - if (key && val) { - params[key.name] = val; - } - } - return params; - } - - function prepareRoute($locationEvent) { - var lastRoute = $route.current; - - preparedRoute = parseRoute(); - preparedRouteIsUpdateOnly = preparedRoute && lastRoute && preparedRoute.$$route === lastRoute.$$route - && angular.equals(preparedRoute.pathParams, lastRoute.pathParams) - && !preparedRoute.reloadOnSearch && !forceReload; - - if (!preparedRouteIsUpdateOnly && (lastRoute || preparedRoute)) { - if ($rootScope.$broadcast('$routeChangeStart', preparedRoute, lastRoute).defaultPrevented) { - if ($locationEvent) { - $locationEvent.preventDefault(); - } - } - } - } - - function commitRoute() { - var lastRoute = $route.current; - var nextRoute = preparedRoute; - - if (preparedRouteIsUpdateOnly) { - lastRoute.params = nextRoute.params; - angular.copy(lastRoute.params, $routeParams); - $rootScope.$broadcast('$routeUpdate', lastRoute); - } else if (nextRoute || lastRoute) { - forceReload = false; - $route.current = nextRoute; - if (nextRoute) { - if (nextRoute.redirectTo) { - if (angular.isString(nextRoute.redirectTo)) { - $location.path(interpolate(nextRoute.redirectTo, nextRoute.params)).search(nextRoute.params) - .replace(); - } else { - $location.url(nextRoute.redirectTo(nextRoute.pathParams, $location.path(), $location.search())) - .replace(); - } - } - } - - $q.when(nextRoute). - then(function() { - if (nextRoute) { - var locals = angular.extend({}, nextRoute.resolve), - template, templateUrl; - - angular.forEach(locals, function(value, key) { - locals[key] = angular.isString(value) ? - $injector.get(value) : $injector.invoke(value, null, null, key); - }); - - if (angular.isDefined(template = nextRoute.template)) { - if (angular.isFunction(template)) { - template = template(nextRoute.params); - } - } else if (angular.isDefined(templateUrl = nextRoute.templateUrl)) { - if (angular.isFunction(templateUrl)) { - templateUrl = templateUrl(nextRoute.params); - } - if (angular.isDefined(templateUrl)) { - nextRoute.loadedTemplateUrl = $sce.valueOf(templateUrl); - template = $templateRequest(templateUrl); - } - } - if (angular.isDefined(template)) { - locals['$template'] = template; - } - return $q.all(locals); - } - }). - then(function(locals) { - // after route change - if (nextRoute == $route.current) { - if (nextRoute) { - nextRoute.locals = locals; - angular.copy(nextRoute.params, $routeParams); - } - $rootScope.$broadcast('$routeChangeSuccess', nextRoute, lastRoute); - } - }, function(error) { - if (nextRoute == $route.current) { - $rootScope.$broadcast('$routeChangeError', nextRoute, lastRoute, error); - } - }); - } - } - - - /** - * @returns {Object} the current active route, by matching it against the URL - */ - function parseRoute() { - // Match a route - var params, match; - angular.forEach(routes, function(route, path) { - if (!match && (params = switchRouteMatcher($location.path(), route))) { - match = inherit(route, { - params: angular.extend({}, $location.search(), params), - pathParams: params}); - match.$$route = route; - } - }); - // No route matched; fallback to "otherwise" route - return match || routes[null] && inherit(routes[null], {params: {}, pathParams:{}}); - } - - /** - * @returns {string} interpolation of the redirect path with the parameters - */ - function interpolate(string, params) { - var result = []; - angular.forEach((string || '').split(':'), function(segment, i) { - if (i === 0) { - result.push(segment); - } else { - var segmentMatch = segment.match(/(\w+)(?:[?*])?(.*)/); - var key = segmentMatch[1]; - result.push(params[key]); - result.push(segmentMatch[2] || ''); - delete params[key]; - } - }); - return result.join(''); - } - }]; -} - -ngRouteModule.provider('$routeParams', $RouteParamsProvider); - - -/** - * @ngdoc service - * @name $routeParams - * @requires $route - * - * @description - * The `$routeParams` service allows you to retrieve the current set of route parameters. - * - * Requires the {@link ngRoute `ngRoute`} module to be installed. - * - * The route parameters are a combination of {@link ng.$location `$location`}'s - * {@link ng.$location#search `search()`} and {@link ng.$location#path `path()`}. - * The `path` parameters are extracted when the {@link ngRoute.$route `$route`} path is matched. - * - * In case of parameter name collision, `path` params take precedence over `search` params. - * - * The service guarantees that the identity of the `$routeParams` object will remain unchanged - * (but its properties will likely change) even when a route change occurs. - * - * Note that the `$routeParams` are only updated *after* a route change completes successfully. - * This means that you cannot rely on `$routeParams` being correct in route resolve functions. - * Instead you can use `$route.current.params` to access the new route's parameters. - * - * @example - * ```js - * // Given: - * // URL: http://server.com/index.html#/Chapter/1/Section/2?search=moby - * // Route: /Chapter/:chapterId/Section/:sectionId - * // - * // Then - * $routeParams ==> {chapterId:'1', sectionId:'2', search:'moby'} - * ``` - */ -function $RouteParamsProvider() { - this.$get = function() { return {}; }; -} - -ngRouteModule.directive('ngView', ngViewFactory); -ngRouteModule.directive('ngView', ngViewFillContentFactory); - - -/** - * @ngdoc directive - * @name ngView - * @restrict ECA - * - * @description - * # Overview - * `ngView` is a directive that complements the {@link ngRoute.$route $route} service by - * including the rendered template of the current route into the main layout (`index.html`) file. - * Every time the current route changes, the included view changes with it according to the - * configuration of the `$route` service. - * - * Requires the {@link ngRoute `ngRoute`} module to be installed. - * - * @animations - * enter - animation is used to bring new content into the browser. - * leave - animation is used to animate existing content away. - * - * The enter and leave animation occur concurrently. - * - * @scope - * @priority 400 - * @param {string=} onload Expression to evaluate whenever the view updates. - * - * @param {string=} autoscroll Whether `ngView` should call {@link ng.$anchorScroll - * $anchorScroll} to scroll the viewport after the view is updated. - * - * - If the attribute is not set, disable scrolling. - * - If the attribute is set without value, enable scrolling. - * - Otherwise enable scrolling only if the `autoscroll` attribute value evaluated - * as an expression yields a truthy value. - * @example - - -
    - Choose: - Moby | - Moby: Ch1 | - Gatsby | - Gatsby: Ch4 | - Scarlet Letter
    - -
    -
    -
    -
    - -
    $location.path() = {{main.$location.path()}}
    -
    $route.current.templateUrl = {{main.$route.current.templateUrl}}
    -
    $route.current.params = {{main.$route.current.params}}
    -
    $routeParams = {{main.$routeParams}}
    -
    -
    - - -
    - controller: {{book.name}}
    - Book Id: {{book.params.bookId}}
    -
    -
    - - -
    - controller: {{chapter.name}}
    - Book Id: {{chapter.params.bookId}}
    - Chapter Id: {{chapter.params.chapterId}} -
    -
    - - - .view-animate-container { - position:relative; - height:100px!important; - background:white; - border:1px solid black; - height:40px; - overflow:hidden; - } - - .view-animate { - padding:10px; - } - - .view-animate.ng-enter, .view-animate.ng-leave { - transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 1.5s; - - display:block; - width:100%; - border-left:1px solid black; - - position:absolute; - top:0; - left:0; - right:0; - bottom:0; - padding:10px; - } - - .view-animate.ng-enter { - left:100%; - } - .view-animate.ng-enter.ng-enter-active { - left:0; - } - .view-animate.ng-leave.ng-leave-active { - left:-100%; - } - - - - angular.module('ngViewExample', ['ngRoute', 'ngAnimate']) - .config(['$routeProvider', '$locationProvider', - function($routeProvider, $locationProvider) { - $routeProvider - .when('/Book/:bookId', { - templateUrl: 'book.html', - controller: 'BookCtrl', - controllerAs: 'book' - }) - .when('/Book/:bookId/ch/:chapterId', { - templateUrl: 'chapter.html', - controller: 'ChapterCtrl', - controllerAs: 'chapter' - }); - - $locationProvider.html5Mode(true); - }]) - .controller('MainCtrl', ['$route', '$routeParams', '$location', - function($route, $routeParams, $location) { - this.$route = $route; - this.$location = $location; - this.$routeParams = $routeParams; - }]) - .controller('BookCtrl', ['$routeParams', function($routeParams) { - this.name = "BookCtrl"; - this.params = $routeParams; - }]) - .controller('ChapterCtrl', ['$routeParams', function($routeParams) { - this.name = "ChapterCtrl"; - this.params = $routeParams; - }]); - - - - - it('should load and compile correct template', function() { - element(by.linkText('Moby: Ch1')).click(); - var content = element(by.css('[ng-view]')).getText(); - expect(content).toMatch(/controller\: ChapterCtrl/); - expect(content).toMatch(/Book Id\: Moby/); - expect(content).toMatch(/Chapter Id\: 1/); - - element(by.partialLinkText('Scarlet')).click(); - - content = element(by.css('[ng-view]')).getText(); - expect(content).toMatch(/controller\: BookCtrl/); - expect(content).toMatch(/Book Id\: Scarlet/); - }); - -
    - */ - - -/** - * @ngdoc event - * @name ngView#$viewContentLoaded - * @eventType emit on the current ngView scope - * @description - * Emitted every time the ngView content is reloaded. - */ -ngViewFactory.$inject = ['$route', '$anchorScroll', '$animate']; -function ngViewFactory($route, $anchorScroll, $animate) { - return { - restrict: 'ECA', - terminal: true, - priority: 400, - transclude: 'element', - link: function(scope, $element, attr, ctrl, $transclude) { - var currentScope, - currentElement, - previousLeaveAnimation, - autoScrollExp = attr.autoscroll, - onloadExp = attr.onload || ''; - - scope.$on('$routeChangeSuccess', update); - update(); - - function cleanupLastView() { - if (previousLeaveAnimation) { - $animate.cancel(previousLeaveAnimation); - previousLeaveAnimation = null; - } - - if (currentScope) { - currentScope.$destroy(); - currentScope = null; - } - if (currentElement) { - previousLeaveAnimation = $animate.leave(currentElement); - previousLeaveAnimation.then(function() { - previousLeaveAnimation = null; - }); - currentElement = null; - } - } - - function update() { - var locals = $route.current && $route.current.locals, - template = locals && locals.$template; - - if (angular.isDefined(template)) { - var newScope = scope.$new(); - var current = $route.current; - - // Note: This will also link all children of ng-view that were contained in the original - // html. If that content contains controllers, ... they could pollute/change the scope. - // However, using ng-view on an element with additional content does not make sense... - // Note: We can't remove them in the cloneAttchFn of $transclude as that - // function is called before linking the content, which would apply child - // directives to non existing elements. - var clone = $transclude(newScope, function(clone) { - $animate.enter(clone, null, currentElement || $element).then(function onNgViewEnter() { - if (angular.isDefined(autoScrollExp) - && (!autoScrollExp || scope.$eval(autoScrollExp))) { - $anchorScroll(); - } - }); - cleanupLastView(); - }); - - currentElement = clone; - currentScope = current.scope = newScope; - currentScope.$emit('$viewContentLoaded'); - currentScope.$eval(onloadExp); - } else { - cleanupLastView(); - } - } - } - }; -} - -// This directive is called during the $transclude call of the first `ngView` directive. -// It will replace and compile the content of the element with the loaded template. -// We need this directive so that the element content is already filled when -// the link function of another directive on the same element as ngView -// is called. -ngViewFillContentFactory.$inject = ['$compile', '$controller', '$route']; -function ngViewFillContentFactory($compile, $controller, $route) { - return { - restrict: 'ECA', - priority: -400, - link: function(scope, $element) { - var current = $route.current, - locals = current.locals; - - $element.html(locals.$template); - - var link = $compile($element.contents()); - - if (current.controller) { - locals.$scope = scope; - var controller = $controller(current.controller, locals); - if (current.controllerAs) { - scope[current.controllerAs] = controller; - } - $element.data('$ngControllerController', controller); - $element.children().data('$ngControllerController', controller); - } - scope[current.resolveAs || '$resolve'] = locals; - - link(scope); - } - }; -} - - -})(window, window.angular); diff --git a/client/vendors/angularjs/angular-route.min.js b/client/vendors/angularjs/angular-route.min.js new file mode 100644 index 0000000..ddc9c36 --- /dev/null +++ b/client/vendors/angularjs/angular-route.min.js @@ -0,0 +1,15 @@ +/* + AngularJS v1.5.0-rc.2 + (c) 2010-2016 Google, Inc. http://angularjs.org + License: MIT +*/ +(function(r,d,C){'use strict';function w(s,h,g){return{restrict:"ECA",terminal:!0,priority:400,transclude:"element",link:function(a,c,b,f,y){function k(){n&&(g.cancel(n),n=null);l&&(l.$destroy(),l=null);m&&(n=g.leave(m),n.then(function(){n=null}),m=null)}function z(){var b=s.current&&s.current.locals;if(d.isDefined(b&&b.$template)){var b=a.$new(),f=s.current;m=y(b,function(b){g.enter(b,null,m||c).then(function(){!d.isDefined(u)||u&&!a.$eval(u)||h()});k()});l=f.scope=b;l.$emit("$viewContentLoaded"); +l.$eval(x)}else k()}var l,m,n,u=b.autoscroll,x=b.onload||"";a.$on("$routeChangeSuccess",z);z()}}}function A(d,h,g){return{restrict:"ECA",priority:-400,link:function(a,c){var b=g.current,f=b.locals;c.html(f.$template);var y=d(c.contents());if(b.controller){f.$scope=a;var k=h(b.controller,f);b.controllerAs&&(a[b.controllerAs]=k);c.data("$ngControllerController",k);c.children().data("$ngControllerController",k)}a[b.resolveAs||"$resolve"]=f;y(a)}}}r=d.module("ngRoute",["ng"]).provider("$route",function(){function s(a, +c){return d.extend(Object.create(a),c)}function h(a,d){var b=d.caseInsensitiveMatch,f={originalPath:a,regexp:a},g=f.keys=[];a=a.replace(/([().])/g,"\\$1").replace(/(\/)?:(\w+)([\?\*])?/g,function(a,d,b,c){a="?"===c?c:null;c="*"===c?c:null;g.push({name:b,optional:!!a});d=d||"";return""+(a?"":d)+"(?:"+(a?d:"")+(c&&"(.+?)"||"([^/]+)")+(a||"")+")"+(a||"")}).replace(/([\/$\*])/g,"\\$1");f.regexp=new RegExp("^"+a+"$",b?"i":"");return f}var g={};this.when=function(a,c){var b=d.copy(c);d.isUndefined(b.reloadOnSearch)&& +(b.reloadOnSearch=!0);d.isUndefined(b.caseInsensitiveMatch)&&(b.caseInsensitiveMatch=this.caseInsensitiveMatch);g[a]=d.extend(b,a&&h(a,b));if(a){var f="/"==a[a.length-1]?a.substr(0,a.length-1):a+"/";g[f]=d.extend({redirectTo:a},h(f,b))}return this};this.caseInsensitiveMatch=!1;this.otherwise=function(a){"string"===typeof a&&(a={redirectTo:a});this.when(null,a);return this};this.$get=["$rootScope","$location","$routeParams","$q","$injector","$templateRequest","$sce",function(a,c,b,f,h,k,r){function l(b){var e= +t.current;(w=(p=n())&&e&&p.$$route===e.$$route&&d.equals(p.pathParams,e.pathParams)&&!p.reloadOnSearch&&!x)||!e&&!p||a.$broadcast("$routeChangeStart",p,e).defaultPrevented&&b&&b.preventDefault()}function m(){var v=t.current,e=p;if(w)v.params=e.params,d.copy(v.params,b),a.$broadcast("$routeUpdate",v);else if(e||v)x=!1,(t.current=e)&&e.redirectTo&&(d.isString(e.redirectTo)?c.path(u(e.redirectTo,e.params)).search(e.params).replace():c.url(e.redirectTo(e.pathParams,c.path(),c.search())).replace()),f.when(e).then(function(){if(e){var a= +d.extend({},e.resolve),b,c;d.forEach(a,function(b,e){a[e]=d.isString(b)?h.get(b):h.invoke(b,null,null,e)});d.isDefined(b=e.template)?d.isFunction(b)&&(b=b(e.params)):d.isDefined(c=e.templateUrl)&&(d.isFunction(c)&&(c=c(e.params)),d.isDefined(c)&&(e.loadedTemplateUrl=r.valueOf(c),b=k(c)));d.isDefined(b)&&(a.$template=b);return f.all(a)}}).then(function(c){e==t.current&&(e&&(e.locals=c,d.copy(e.params,b)),a.$broadcast("$routeChangeSuccess",e,v))},function(b){e==t.current&&a.$broadcast("$routeChangeError", +e,v,b)})}function n(){var a,b;d.forEach(g,function(f,g){var q;if(q=!b){var h=c.path();q=f.keys;var l={};if(f.regexp)if(h=f.regexp.exec(h)){for(var k=1,n=h.length;k=document.documentMode&&n(g);a=g.innerHTML;g.innerHTML=a}while(a!==g.innerHTML);for(b=g.firstChild;b;){switch(b.nodeType){case 1:c.start(b.nodeName.toLowerCase(),E(b.attributes)); +break;case 3:c.chars(b.textContent)}var d;if(!(d=b.firstChild)&&(1==b.nodeType&&c.end(b.nodeName.toLowerCase()),d=b.nextSibling,!d))for(;null==d;){b=b.parentNode;if(b===g)break;d=b.nextSibling;1==b.nodeType&&c.end(b.nodeName.toLowerCase())}b=d}for(;b=g.firstChild;)g.removeChild(b)}function E(a){for(var c={},b=0,d=a.length;b/g,">")}function v(a,c){var b=!1,d=e.bind(a,a.push);return{start:function(a,f){a=e.lowercase(a);!b&&H[a]&&(b=a);b||!0!==t[a]||(d("<"),d(a),e.forEach(f,function(b,f){var g=e.lowercase(f),h="img"===a&&"src"===g||"background"===g;!0!==I[g]||!0===y[g]&&!c(b,h)||(d(" "),d(f),d('="'),d(x(b)),d('"'))}),d(">"))},end:function(a){a=e.lowercase(a);b||!0!==t[a]||!0===z[a]||(d(""));a== +b&&(b=!1)},chars:function(a){b||d(x(a))}}}function n(a){if(a.nodeType===Node.ELEMENT_NODE)for(var c=a.attributes,b=0,d=c.length;b"\u201d\u2019]/i,b=/^mailto:/i,d=e.$$minErr("linky"),g=e.isString;return function(f,h,m){function k(a){a&&p.push(C(a))}function q(a,b){var c;p.push("');k(b);p.push("")}if(null==f||""===f)return f;if(!g(f))throw d("notstring",f);for(var r=f,p=[],s,n;f=r.match(c);)s=f[0],f[2]||f[4]||(s=(f[3]?"http://":"mailto:")+s),n=f.index,k(r.substr(0,n)),q(s,f[0].replace(b,"")),r=r.substring(n+f[0].length);k(r);return a(p.join(""))}}])})(window,window.angular); +//# sourceMappingURL=angular-sanitize.min.js.map -- cgit v1.2.3 From 6905bacd589950f2f84900fe7b501591bc8c4f68 Mon Sep 17 00:00:00 2001 From: manzerbredes Date: Sun, 31 Jan 2016 13:34:43 +0100 Subject: Change status controller and template --- client/js/controllers/status.js | 4 ++-- client/js/requests/identity.js | 2 +- client/partials/nav.html | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/js/controllers/status.js b/client/js/controllers/status.js index 01fdcc3..e4f119d 100644 --- a/client/js/controllers/status.js +++ b/client/js/controllers/status.js @@ -13,10 +13,10 @@ mainApp.controller('statusCtrl', function ($scope,$interval,$sce) $scope.username=status[1]; $scope.lastconnection=status[2]; if(status[0] == "1"){ - $scope.connection=$sce.trustAsHtml("Connection : Online"); + $scope.connection=$sce.trustAsHtml("Online"); } else{ - $scope.connection="Connection : Offline"; + $scope.connection=$sce.trustAsHtml("Offline"); } }, 2000); diff --git a/client/js/requests/identity.js b/client/js/requests/identity.js index 369ce85..d008abf 100644 --- a/client/js/requests/identity.js +++ b/client/js/requests/identity.js @@ -10,6 +10,6 @@ identity.fetchStatus = function(){ // TODO - return new Array("1", "user1", "25/02/2016"); + return new Array("0", "user1", "25/02/2016"); } \ No newline at end of file diff --git a/client/partials/nav.html b/client/partials/nav.html index b9e51df..0e26922 100644 --- a/client/partials/nav.html +++ b/client/partials/nav.html @@ -20,7 +20,7 @@
  • User : {{ username }}
  • Last Connection : {{ lastconnection }}
  • -
  • +
  • Connection :
  • -- cgit v1.2.3 From 3914858d7a00508bdef2a8caa205b5019ce39274 Mon Sep 17 00:00:00 2001 From: Eole Date: Sun, 31 Jan 2016 14:24:30 +0100 Subject: Different Service Token Implementation --- server/core/LibOverride/genTokenOptions.php | 129 ++++++++++++++++++++++++++++ 1 file changed, 129 insertions(+) diff --git a/server/core/LibOverride/genTokenOptions.php b/server/core/LibOverride/genTokenOptions.php index ba9e196..3e8414e 100755 --- a/server/core/LibOverride/genTokenOptions.php +++ b/server/core/LibOverride/genTokenOptions.php @@ -50,6 +50,135 @@ class genTokenOptions } } + public function genIdentityToken(){ + $options = $this->optionsGlobal['Common']; + $options['catalogName'] = 'false'; + $options['catalogType'] = 'false'; + $options['region'] = 'RegionOne'; + + list($token, $baseUrl) = $options['identityService']->authenticate($options); + + $this->stack->push(Middleware::authHandler($options['authHandler'], $token)); + + $this->addDebugMiddleware($options, $this->stack); + + $options['httpClient'] = new Client([ + 'base_uri' => Utils::normalizeUrl($baseUrl), + 'handler' => $this->stack, + ]); + $this->backup['Identity'] = array('token' => $this->serializeToken($token), 'baseUrl' => $baseUrl ); + + $this->optionsGlobal['Identity'] = $options; + } + + public function loadIdentityBackup($opt){ + $options = $this->optionsGlobal['Common']; + $options['catalogName'] = 'false'; + $options['catalogType'] = 'false'; + $options['region'] = 'RegionOne'; + + $this->backup['Identity'] = unserialize($opt); + $token = $this->unserializeToken($this->backup['Identity']['token']); + $baseUrl = $this->backup['Identity']['baseUrl']; + + $this->stack->push(Middleware::authHandler($options['authHandler'], $token)); + + $this->addDebugMiddleware($options, $this->stack); + + $options['httpClient'] = new Client([ + 'base_uri' => Utils::normalizeUrl($baseUrl), + 'handler' => $this->stack, + ]); + $this->backup['Identity'] = array('token' => $this->serializeToken($token), 'baseUrl' => $baseUrl ); + $this->optionsGlobal['Identity'] = $options; + } + + public function genImageToken(){ + $options = $this->optionsGlobal['Common']; + $options['catalogName'] = 'glance'; + $options['catalogType'] = 'image'; + $options['region'] = 'RegionOne'; + + list($token, $baseUrl) = $options['identityService']->authenticate($options); + + $this->stack->push(Middleware::authHandler($options['authHandler'], $token)); + + $this->addDebugMiddleware($options, $this->stack); + + $options['httpClient'] = new Client([ + 'base_uri' => Utils::normalizeUrl($baseUrl), + 'handler' => $this->stack, + ]); + $this->backup['Image'] = array('token' => $this->serializeToken($token), 'baseUrl' => $baseUrl ); + + $this->optionsGlobal['Image'] = $options; + } + + public function loadImageBackup($opt){ + $options = $this->optionsGlobal['Common']; + $options['catalogName'] = 'glance'; + $options['catalogType'] = 'image'; + $options['region'] = 'RegionOne'; + + $this->backup['Image'] = unserialize($opt); + $token = $this->unserializeToken($this->backup['Image']['token']); + $baseUrl = $this->backup['Image']['baseUrl']; + + $this->stack->push(Middleware::authHandler($options['authHandler'], $token)); + + $this->addDebugMiddleware($options, $this->stack); + + $options['httpClient'] = new Client([ + 'base_uri' => Utils::normalizeUrl($baseUrl), + 'handler' => $this->stack, + ]); + $this->backup['Image'] = array('token' => $this->serializeToken($token), 'baseUrl' => $baseUrl ); + $this->optionsGlobal['Image'] = $options; + } + + public function genNetworkToken(){ + $options = $this->optionsGlobal['Common']; + $options['catalogName'] = 'neutron'; + $options['catalogType'] = 'network'; + $options['region'] = 'RegionOne'; + + list($token, $baseUrl) = $options['identityService']->authenticate($options); + + $this->stack->push(Middleware::authHandler($options['authHandler'], $token)); + + $this->addDebugMiddleware($options, $this->stack); + + $options['httpClient'] = new Client([ + 'base_uri' => Utils::normalizeUrl($baseUrl), + 'handler' => $this->stack, + ]); + $this->backup['Network'] = array('token' => $this->serializeToken($token), 'baseUrl' => $baseUrl ); + + $this->optionsGlobal['Network'] = $options; + } + + public function loadNetworkBackup($opt){ + $options = $this->optionsGlobal['Common']; + $options['catalogName'] = 'neutron'; + $options['catalogType'] = 'network'; + $options['region'] = 'RegionOne'; + + $this->backup['Network'] = unserialize($opt); + $token = $this->unserializeToken($this->backup['Network']['token']); + $baseUrl = $this->backup['Network']['baseUrl']; + + $this->stack->push(Middleware::authHandler($options['authHandler'], $token)); + + $this->addDebugMiddleware($options, $this->stack); + + $options['httpClient'] = new Client([ + 'base_uri' => Utils::normalizeUrl($baseUrl), + 'handler' => $this->stack, + ]); + $this->backup['Network'] = array('token' => $this->serializeToken($token), 'baseUrl' => $baseUrl ); + $this->optionsGlobal['Network'] = $options; + } + public function genComputeToken(){ $options = $this->optionsGlobal['Common']; $options['catalogName'] = 'nova'; -- cgit v1.2.3 From 4f062230bcfc8209776259af9c21fc34a29668e4 Mon Sep 17 00:00:00 2001 From: Eole Date: Sun, 31 Jan 2016 14:34:43 +0100 Subject: Implementation Token Multi Service ENd --- server/core/LibOverride/genTokenOptions.php | 12 +++++++----- server/index.php | 27 ++++++++++++++++----------- server/init.php | 6 +++--- 3 files changed, 26 insertions(+), 19 deletions(-) diff --git a/server/core/LibOverride/genTokenOptions.php b/server/core/LibOverride/genTokenOptions.php index 3e8414e..9cb4100 100755 --- a/server/core/LibOverride/genTokenOptions.php +++ b/server/core/LibOverride/genTokenOptions.php @@ -56,9 +56,11 @@ class genTokenOptions $options['catalogType'] = 'false'; $options['region'] = 'RegionOne'; - list($token, $baseUrl) = $options['identityService']->authenticate($options); - - $this->stack->push(Middleware::authHandler($options['authHandler'], $token)); + //list($token, $baseUrl) = $options['identityService']->authenticate($options); + $baseUrl = $options["authUrl"]; + $token = $options['identityService']->generateToken($options); + + $this->stack->push(Middleware::authHandler($options['authHandler'], $token)); $this->addDebugMiddleware($options, $this->stack); @@ -227,8 +229,8 @@ class genTokenOptions return serialize($this->backup[$service]); } - public function getOptionsCompute(){ - return $this->optionsGlobal['Compute']; + public function getOptions($service){ + return $this->optionsGlobal[$service]; } private function serializeToken($token){ diff --git a/server/index.php b/server/index.php index 4d65c59..b3c061a 100755 --- a/server/index.php +++ b/server/index.php @@ -10,21 +10,26 @@ //$id = new identity($openstack_api, $pluginApi); // var_dump($id->genToken()); - $compute = $openstack_api->computeV2($array); - $servers = $compute->listServers(true); +// $identity = $openstack_api->identityV3($Args); + //$tmp = $identity->listEndpoints(); + //foreach($tmp as $cred){ +// echo $cred->id." %%%%%% "; + //} + //$servers = $compute->listServers(true); //var_dump($servers); - foreach($servers as $server){ + //foreach($servers as $server){ // echo $server->id." !!!!!!!!! "; - } + //} $tmp = new genTokenOptions($Args); - $tmp->loadComputeBackup($computBack); - $array = $tmp->getOptionsCompute(); + $tmp->loadIdentityBackup($identityBack); + $array = $tmp->getOptions("Identity"); $openstackTest = new OpenStack\OpenStack([]); - $computeTest = $openstackTest->computeV2($array); - $serversTest = $computeTest->listServers(true); - foreach($serversTest as $server){ - echo $server->id." %%%%%% "; + $identityTest = $openstackTest->identityV3($array); + $domainsTest = $identityTest->listDomains(); + foreach($domainsTest as $domain){ + echo $domain->id." %%%%%% "; } -// var_dump($openstack_api->getBuilderOptions()); + // var_dump($openstack_api->getBuilderOptions()); + diff --git a/server/init.php b/server/init.php index 9e0500b..2c07947 100755 --- a/server/init.php +++ b/server/init.php @@ -62,11 +62,11 @@ //$token = $id->genToken(); $tmp = new genTokenOptions($Args); - $tmp->genComputeToken(); - $array = $tmp->getOptionsCompute(); + $tmp->genIdentityToken(); + $array = $tmp->getOptions("Identity"); $openstack_api = new OpenStack\OpenStack([]); - $computBack = $tmp->getBackup("Compute"); + $identityBack = $tmp->getBackup("Identity"); //file_put_contents("token", serialize($tmp)); ?> -- cgit v1.2.3 From e11520996ae8a487ca46b00865ffcce4385f1efb Mon Sep 17 00:00:00 2001 From: Eole Date: Sun, 31 Jan 2016 16:19:13 +0100 Subject: Tests Class genTokenOptions --- server/Test/genTokenOptionsTest.php | 86 +++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100755 server/Test/genTokenOptionsTest.php diff --git a/server/Test/genTokenOptionsTest.php b/server/Test/genTokenOptionsTest.php new file mode 100755 index 0000000..54c22d2 --- /dev/null +++ b/server/Test/genTokenOptionsTest.php @@ -0,0 +1,86 @@ + Array( + "name" => $user, + "password" => $password, + "domain" => Array( + "name" => "Default") + ), + "scope" => Array( + "project" => Array( + "name" => $project, + "domain" => Array( + "name" => "Default") + ) + ), + "authUrl" => $config["urlAuth"] + ); + + $genOptions = new genTokenOptions($Args); + $genOptions->genIdentityToken(); + $genOptions->genComputeToken(); + $genOptions->genNetworkToken(); + $genOptions->genImageToken(); + + $backCompute = $genOptions->getBackup("Compute"); + $backIdentity = $genOptions->getBackup("Identity"); + $backNetwork = $genOptions->getBackup("Network"); + $backImage = $genOptions->getBackup("Image"); + + $openstack_api = new OpenStack\OpenStack([]); + + $newGenOptions = new genTokenOptions($Args); + $newGenOptions->loadIdentityBackup($backIdentity); + $newGenOptions->loadComputeBackup($backCompute); + $newGenOptions->loadImageBackup($backImage); + $newGenOptions->loadNetworkBackup($backNetwork); + + $optionsCompute = $newGenOptions->getOptions("Compute"); + $optionsIdentity = $newGenOptions->getOptions("Identity"); + $optionsNetwork = $newGenOptions->getOptions("Network"); + $optionsImage = $newGenOptions->getOptions("Image"); + + $identityTest = $openstack_api->identityV3($optionsIdentity); + $computeTest = $openstack_api->computeV2($optionsCompute); + $networkTest = $openstack_api->networkingV2($optionsNetwork); + $imageTest = $openstack_api->imagesV2($optionsImage); + + $domainsTest = $identityTest->listDomains(); + echo "Identity Test, List Domains
    "; + foreach($domainsTest as $domain){ + echo $domain->id; + echo "
    "; + } + echo "
    "; + + $imagesTest = $imageTest->listImages(); + echo "Image Test, List Images
    "; + foreach($imagesTest as $image){ + echo $image->id; + echo "
    "; + } + echo "
    "; + $serversTest = $computeTest->listServers(); + echo "Compute Test, List Servers
    "; + foreach($serversTest as $server){ + echo $server->id; + echo "
    "; + } + echo "
    "; + $networkTest = $networkTest->listNetworks(); + echo "Network Test, List networks
    "; + foreach($networkTest as $network){ + echo $network->id; + echo "
    "; + } + +?> \ No newline at end of file -- cgit v1.2.3 From 33463352403037ad03877f18bc3bdd17a7478d3c Mon Sep 17 00:00:00 2001 From: Eole Date: Sun, 31 Jan 2016 17:53:27 +0100 Subject: Debug TokenGen --- server/core/LibOverride/genTokenOptions.php | 69 ++++++++++++++++++----------- 1 file changed, 43 insertions(+), 26 deletions(-) diff --git a/server/core/LibOverride/genTokenOptions.php b/server/core/LibOverride/genTokenOptions.php index 9cb4100..81ecfc8 100755 --- a/server/core/LibOverride/genTokenOptions.php +++ b/server/core/LibOverride/genTokenOptions.php @@ -33,7 +33,7 @@ class genTokenOptions $options['authHandler'] = function () use ($options) { return $options['identityService']->generateToken($options); }; - + $this->optionsGlobal['Common'] = $options; } @@ -60,13 +60,15 @@ class genTokenOptions $baseUrl = $options["authUrl"]; $token = $options['identityService']->generateToken($options); - $this->stack->push(Middleware::authHandler($options['authHandler'], $token)); + $stack = HandlerStack::create(); + + $stack->push(Middleware::authHandler($options['authHandler'], $token)); - $this->addDebugMiddleware($options, $this->stack); + $this->addDebugMiddleware($options, $stack); $options['httpClient'] = new Client([ 'base_uri' => Utils::normalizeUrl($baseUrl), - 'handler' => $this->stack, + 'handler' => $stack, ]); $this->backup['Identity'] = array('token' => $this->serializeToken($token), 'baseUrl' => $baseUrl ); @@ -82,17 +84,20 @@ class genTokenOptions $this->backup['Identity'] = unserialize($opt); $token = $this->unserializeToken($this->backup['Identity']['token']); $baseUrl = $this->backup['Identity']['baseUrl']; - - $this->stack->push(Middleware::authHandler($options['authHandler'], $token)); - $this->addDebugMiddleware($options, $this->stack); + $stack = HandlerStack::create(); + + $stack->push(Middleware::authHandler($options['authHandler'], $token)); + + $this->addDebugMiddleware($options, $stack); $options['httpClient'] = new Client([ 'base_uri' => Utils::normalizeUrl($baseUrl), - 'handler' => $this->stack, + 'handler' => $stack, ]); $this->backup['Identity'] = array('token' => $this->serializeToken($token), 'baseUrl' => $baseUrl ); $this->optionsGlobal['Identity'] = $options; + } public function genImageToken(){ @@ -103,13 +108,15 @@ class genTokenOptions list($token, $baseUrl) = $options['identityService']->authenticate($options); - $this->stack->push(Middleware::authHandler($options['authHandler'], $token)); + $stack = HandlerStack::create(); - $this->addDebugMiddleware($options, $this->stack); + $stack->push(Middleware::authHandler($options['authHandler'], $token)); + + $this->addDebugMiddleware($options, $stack); $options['httpClient'] = new Client([ 'base_uri' => Utils::normalizeUrl($baseUrl), - 'handler' => $this->stack, + 'handler' => $stack, ]); $this->backup['Image'] = array('token' => $this->serializeToken($token), 'baseUrl' => $baseUrl ); @@ -126,13 +133,15 @@ class genTokenOptions $token = $this->unserializeToken($this->backup['Image']['token']); $baseUrl = $this->backup['Image']['baseUrl']; - $this->stack->push(Middleware::authHandler($options['authHandler'], $token)); + $stack = HandlerStack::create(); - $this->addDebugMiddleware($options, $this->stack); + $stack->push(Middleware::authHandler($options['authHandler'], $token)); + + $this->addDebugMiddleware($options, $stack); $options['httpClient'] = new Client([ 'base_uri' => Utils::normalizeUrl($baseUrl), - 'handler' => $this->stack, + 'handler' => $stack, ]); $this->backup['Image'] = array('token' => $this->serializeToken($token), 'baseUrl' => $baseUrl ); $this->optionsGlobal['Image'] = $options; @@ -146,13 +155,15 @@ class genTokenOptions list($token, $baseUrl) = $options['identityService']->authenticate($options); - $this->stack->push(Middleware::authHandler($options['authHandler'], $token)); + $stack = HandlerStack::create(); + + $stack->push(Middleware::authHandler($options['authHandler'], $token)); - $this->addDebugMiddleware($options, $this->stack); + $this->addDebugMiddleware($options, $stack); $options['httpClient'] = new Client([ 'base_uri' => Utils::normalizeUrl($baseUrl), - 'handler' => $this->stack, + 'handler' => $stack, ]); $this->backup['Network'] = array('token' => $this->serializeToken($token), 'baseUrl' => $baseUrl ); @@ -169,13 +180,15 @@ class genTokenOptions $token = $this->unserializeToken($this->backup['Network']['token']); $baseUrl = $this->backup['Network']['baseUrl']; - $this->stack->push(Middleware::authHandler($options['authHandler'], $token)); + $stack = HandlerStack::create(); + + $stack->push(Middleware::authHandler($options['authHandler'], $token)); - $this->addDebugMiddleware($options, $this->stack); + $this->addDebugMiddleware($options, $stack); $options['httpClient'] = new Client([ 'base_uri' => Utils::normalizeUrl($baseUrl), - 'handler' => $this->stack, + 'handler' => $stack, ]); $this->backup['Network'] = array('token' => $this->serializeToken($token), 'baseUrl' => $baseUrl ); $this->optionsGlobal['Network'] = $options; @@ -189,13 +202,15 @@ class genTokenOptions list($token, $baseUrl) = $options['identityService']->authenticate($options); - $this->stack->push(Middleware::authHandler($options['authHandler'], $token)); + $stack = HandlerStack::create(); + + $stack->push(Middleware::authHandler($options['authHandler'], $token)); - $this->addDebugMiddleware($options, $this->stack); + $this->addDebugMiddleware($options, $stack); $options['httpClient'] = new Client([ 'base_uri' => Utils::normalizeUrl($baseUrl), - 'handler' => $this->stack, + 'handler' => $stack, ]); $this->backup['Compute'] = array('token' => $this->serializeToken($token), 'baseUrl' => $baseUrl ); @@ -213,13 +228,15 @@ class genTokenOptions $token = $this->unserializeToken($this->backup['Compute']['token']); $baseUrl = $this->backup['Compute']['baseUrl']; - $this->stack->push(Middleware::authHandler($options['authHandler'], $token)); + $stack = HandlerStack::create(); + + $stack->push(Middleware::authHandler($options['authHandler'], $token)); - $this->addDebugMiddleware($options, $this->stack); + $this->addDebugMiddleware($options, $stack); $options['httpClient'] = new Client([ 'base_uri' => Utils::normalizeUrl($baseUrl), - 'handler' => $this->stack, + 'handler' => $stack, ]); $this->backup['Compute'] = array('token' => $this->serializeToken($token), 'baseUrl' => $baseUrl ); $this->optionsGlobal['Compute'] = $options; -- cgit v1.2.3 From 0ea58c5684abc21c341b5a93befdd7cee4ac37e1 Mon Sep 17 00:00:00 2001 From: ArnaudVOTA Date: Wed, 3 Feb 2016 12:05:04 +0100 Subject: Ajout d'une requete pour l'identification. Non testé. Modification des champs de l'overlay. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/js/requests/identity.js | 37 +++++++++++++++++++++++++++++-------- client/partials/nav.html | 21 ++++++++++++++------- client/partials/overlays.html | 21 ++++++++++++++------- 3 files changed, 57 insertions(+), 22 deletions(-) diff --git a/client/js/requests/identity.js b/client/js/requests/identity.js index d008abf..aca435f 100644 --- a/client/js/requests/identity.js +++ b/client/js/requests/identity.js @@ -1,15 +1,36 @@ -// Make Namespace -var identity = {} ; +mainApp.controller('identityCtrl', function($scope, $http) { -// Fetch Status -identity.fetchStatus = function(){ - - // TODO + $scope.identityFormData = {}; + + $scope.processForm = function() { + + $http({ + method : 'POST', + url : 'http://148.60.11.31/', + data : $.param($scope.identityFormData), + headers : { 'Content-Type': 'application/x-www-form-urlencoded' } + }) + .success(function(data) { + console.log(data); + + if (!data.success) { + // if not successful, bind errors to error variables + //$scope.errorName = data.errors.name; + //$scope.errorSuperhero = data.errors.superheroAlias; + } else { + // if successful, bind success message to message + //$scope.message = data.message; + } + }); + }; + + + +}); - return new Array("0", "user1", "25/02/2016"); + -} \ No newline at end of file diff --git a/client/partials/nav.html b/client/partials/nav.html index 869d4e2..e785eeb 100644 --- a/client/partials/nav.html +++ b/client/partials/nav.html @@ -52,21 +52,28 @@ diff --git a/client/partials/overlays.html b/client/partials/overlays.html index b913f7a..8bbce52 100644 --- a/client/partials/overlays.html +++ b/client/partials/overlays.html @@ -10,21 +10,28 @@ -- cgit v1.2.3 From c81bfeb0e8ac50bc122f653fda1f51169a753354 Mon Sep 17 00:00:00 2001 From: manzerbredes Date: Wed, 3 Feb 2016 12:28:01 +0100 Subject: Wrong implementation of identity.js --- client/js/requests/identity.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/js/requests/identity.js b/client/js/requests/identity.js index aca435f..60c74ee 100644 --- a/client/js/requests/identity.js +++ b/client/js/requests/identity.js @@ -1,7 +1,7 @@ - +/* mainApp.controller('identityCtrl', function($scope, $http) { $scope.identityFormData = {}; @@ -30,7 +30,7 @@ mainApp.controller('identityCtrl', function($scope, $http) { -}); +});*/ -- cgit v1.2.3 From 13dbbd7b36e3f12c25c45c3debc704b6632c4b46 Mon Sep 17 00:00:00 2001 From: manzerbredes Date: Wed, 3 Feb 2016 12:30:12 +0100 Subject: Edit identity.js --- client/js/requests/identity.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/client/js/requests/identity.js b/client/js/requests/identity.js index 60c74ee..19971b8 100644 --- a/client/js/requests/identity.js +++ b/client/js/requests/identity.js @@ -1,4 +1,17 @@ +// Make Namespace +var identity = {} ; + + + +// Fetch Status +identity.fetchStatus = function(){ + + // TODO + + return new Array("0", "user1", "25/02/2016"); + +} /* -- cgit v1.2.3 From 7318a57322a02de7908862e43520c650388684c1 Mon Sep 17 00:00:00 2001 From: manzerbredes Date: Wed, 3 Feb 2016 12:46:45 +0100 Subject: Edit login overlay --- client/index.html | 3 +++ client/partials/login.html | 38 ++++++++++++++++++++++++++++++++++++++ client/partials/nav.html | 41 +---------------------------------------- client/partials/overlays.html | 38 -------------------------------------- 4 files changed, 42 insertions(+), 78 deletions(-) create mode 100644 client/partials/login.html delete mode 100644 client/partials/overlays.html diff --git a/client/index.html b/client/index.html index 9d78732..6bd2669 100644 --- a/client/index.html +++ b/client/index.html @@ -18,11 +18,14 @@ +
    + +
    diff --git a/client/partials/login.html b/client/partials/login.html new file mode 100644 index 0000000..8bbce52 --- /dev/null +++ b/client/partials/login.html @@ -0,0 +1,38 @@ + \ No newline at end of file diff --git a/client/partials/nav.html b/client/partials/nav.html index e785eeb..e994b16 100644 --- a/client/partials/nav.html +++ b/client/partials/nav.html @@ -38,43 +38,4 @@
    - - - \ No newline at end of file + \ No newline at end of file diff --git a/client/partials/overlays.html b/client/partials/overlays.html deleted file mode 100644 index 8bbce52..0000000 --- a/client/partials/overlays.html +++ /dev/null @@ -1,38 +0,0 @@ - \ No newline at end of file -- cgit v1.2.3 From bf7556fb60e1ec8e96272a0a8df50c97e5f4d36b Mon Sep 17 00:00:00 2001 From: manzerbredes Date: Wed, 3 Feb 2016 15:37:36 +0100 Subject: Edit modal name --- client/index.html | 2 +- client/partials/login.html | 2 +- client/partials/nav.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/index.html b/client/index.html index 6bd2669..4ce693b 100644 --- a/client/index.html +++ b/client/index.html @@ -24,7 +24,7 @@
    - +
    diff --git a/client/partials/login.html b/client/partials/login.html index 8bbce52..e6a33f1 100644 --- a/client/partials/login.html +++ b/client/partials/login.html @@ -1,4 +1,4 @@ - -- cgit v1.2.3 From 84db461afb07c3e3ec5b038f27180991549a5f69 Mon Sep 17 00:00:00 2001 From: manzerbredes Date: Wed, 3 Feb 2016 15:54:01 +0100 Subject: Add modal lock for login at startup in comment --- client/js/controllers/home.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client/js/controllers/home.js b/client/js/controllers/home.js index d4e1b0e..d2dafff 100644 --- a/client/js/controllers/home.js +++ b/client/js/controllers/home.js @@ -7,4 +7,7 @@ mainApp.controller('homeCtrl', function ($scope) { $scope.test="Home view"; + + // Login before use App + //$('#loginModal').modal({backdrop: 'static', keyboard: false}); }); \ No newline at end of file -- cgit v1.2.3 From eb9f9c9a6e410b8feaf0f628dcbb35ceafea83e5 Mon Sep 17 00:00:00 2001 From: manzerbredes Date: Wed, 3 Feb 2016 16:40:02 +0100 Subject: Add logo, remove session checking every 2 seconds --- client/images/logo.png | Bin 0 -> 9946 bytes client/js/controllers/home.js | 1 - client/js/controllers/network.js | 1 - client/js/controllers/status.js | 4 ++-- client/js/requests/identity.js | 7 ------- client/partials/favicon.html | 2 +- client/partials/home.html | 2 +- client/partials/network.html | 2 +- 8 files changed, 5 insertions(+), 14 deletions(-) create mode 100644 client/images/logo.png diff --git a/client/images/logo.png b/client/images/logo.png new file mode 100644 index 0000000..82914f3 Binary files /dev/null and b/client/images/logo.png differ diff --git a/client/js/controllers/home.js b/client/js/controllers/home.js index d2dafff..4a9fb21 100644 --- a/client/js/controllers/home.js +++ b/client/js/controllers/home.js @@ -6,7 +6,6 @@ mainApp.controller('homeCtrl', function ($scope) { - $scope.test="Home view"; // Login before use App //$('#loginModal').modal({backdrop: 'static', keyboard: false}); diff --git a/client/js/controllers/network.js b/client/js/controllers/network.js index c2a9794..6c916ae 100644 --- a/client/js/controllers/network.js +++ b/client/js/controllers/network.js @@ -6,5 +6,4 @@ mainApp.controller('networkCtrl', function ($scope) { - $scope.test="Network View"; }); \ No newline at end of file diff --git a/client/js/controllers/status.js b/client/js/controllers/status.js index e4f119d..c24997e 100644 --- a/client/js/controllers/status.js +++ b/client/js/controllers/status.js @@ -8,7 +8,7 @@ mainApp.controller('statusCtrl', function ($scope,$interval,$sce) { // Update status every 2 seconds - $interval(function(){ + /*$interval(function(){ var status=identity.fetchStatus(); $scope.username=status[1]; $scope.lastconnection=status[2]; @@ -18,7 +18,7 @@ mainApp.controller('statusCtrl', function ($scope,$interval,$sce) else{ $scope.connection=$sce.trustAsHtml("Offline"); } - }, 2000); + }, 2000);*/ diff --git a/client/js/requests/identity.js b/client/js/requests/identity.js index 19971b8..cad1261 100644 --- a/client/js/requests/identity.js +++ b/client/js/requests/identity.js @@ -4,14 +4,7 @@ var identity = {} ; -// Fetch Status -identity.fetchStatus = function(){ - - // TODO - - return new Array("0", "user1", "25/02/2016"); -} /* diff --git a/client/partials/favicon.html b/client/partials/favicon.html index d49c651..b341f9b 100644 --- a/client/partials/favicon.html +++ b/client/partials/favicon.html @@ -1,3 +1,3 @@ - + diff --git a/client/partials/home.html b/client/partials/home.html index b00113a..3882ada 100644 --- a/client/partials/home.html +++ b/client/partials/home.html @@ -1,6 +1,6 @@
    - {{ test }} + Home
    Main Content diff --git a/client/partials/network.html b/client/partials/network.html index a520a88..341f1a0 100644 --- a/client/partials/network.html +++ b/client/partials/network.html @@ -1,6 +1,6 @@
    - {{ test }} + Network
    Main Content -- cgit v1.2.3 From 07fbfa6ad1859e16f9f957c4a26d87b11fa089a5 Mon Sep 17 00:00:00 2001 From: manzerbredes Date: Wed, 3 Feb 2016 16:59:04 +0100 Subject: Add login controller, loading after click on login button and some stuff... --- client/index.html | 1 + client/js/controllers/home.js | 3 +-- client/js/controllers/login.js | 32 ++++++++++++++++++++++++++++++++ client/partials/home.html | 3 +-- client/partials/login.html | 7 ++++--- client/partials/network.html | 1 - 6 files changed, 39 insertions(+), 8 deletions(-) create mode 100644 client/js/controllers/login.js diff --git a/client/index.html b/client/index.html index 4ce693b..018def2 100644 --- a/client/index.html +++ b/client/index.html @@ -75,6 +75,7 @@ + diff --git a/client/js/controllers/home.js b/client/js/controllers/home.js index 4a9fb21..2898de2 100644 --- a/client/js/controllers/home.js +++ b/client/js/controllers/home.js @@ -7,6 +7,5 @@ mainApp.controller('homeCtrl', function ($scope) { - // Login before use App - //$('#loginModal').modal({backdrop: 'static', keyboard: false}); + }); \ No newline at end of file diff --git a/client/js/controllers/login.js b/client/js/controllers/login.js new file mode 100644 index 0000000..4cd4bf4 --- /dev/null +++ b/client/js/controllers/login.js @@ -0,0 +1,32 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + + +mainApp.controller('loginCtrl', function ($scope,$interval,$sce) +{ + // Define default states + $('#loginModal').modal({backdrop: 'static', keyboard: false}); + $('#loadingLoginButton').hide(); + + + + $('#loginButton').click(function(){ + $('#loginButton').hide(); + $('#loadingLoginButton').show(); + + + + $interval( + function() + { + $('#loginButton').show(); + $('#loadingLoginButton').hide(); + }, 2000,1); + + + + }); +}) diff --git a/client/partials/home.html b/client/partials/home.html index 3882ada..7a5045a 100644 --- a/client/partials/home.html +++ b/client/partials/home.html @@ -1,9 +1,8 @@
    - Home + Home
    Main Content
    -
    \ No newline at end of file diff --git a/client/partials/login.html b/client/partials/login.html index 6f08f76..d9b7fee 100644 --- a/client/partials/login.html +++ b/client/partials/login.html @@ -1,4 +1,4 @@ -
    diff --git a/client/partials/network.html b/client/partials/network.html index 341f1a0..8b779be 100644 --- a/client/partials/network.html +++ b/client/partials/network.html @@ -6,4 +6,3 @@ Main Content
    -
    -- cgit v1.2.3 From 313533d25d6821ac8887b8b00bac51d8a1f135c6 Mon Sep 17 00:00:00 2001 From: manzerbredes Date: Wed, 3 Feb 2016 17:01:09 +0100 Subject: Remove forget password because YOU CAN'T FORGET YOUR PASSWORD git add -Agit add -A! --- client/partials/login.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/partials/login.html b/client/partials/login.html index d9b7fee..40680b3 100644 --- a/client/partials/login.html +++ b/client/partials/login.html @@ -27,8 +27,8 @@ placeholder="Password" type="password" ng-model="identityFormData.password">
    -

    Forgot password? -

    + -- cgit v1.2.3 From c6186b71c12dece6878ca457afa801f2a79bac0b Mon Sep 17 00:00:00 2001 From: manzerbredes Date: Wed, 3 Feb 2016 18:57:20 +0100 Subject: Change folder architecture ! --- client/index.html | 5 +++-- client/js/app.js | 4 ++-- client/js/controllers/home.js | 11 ----------- client/js/controllers/home/main.js | 11 +++++++++++ client/js/controllers/login.js | 7 +++++-- client/js/controllers/network.js | 9 --------- client/js/controllers/network/main.js | 9 +++++++++ client/js/controllers/status.js | 3 ++- client/partials/home.html | 8 -------- client/partials/home/main.html | 8 ++++++++ client/partials/login.html | 4 ++-- client/partials/nav.html | 11 ++++++----- client/partials/network.html | 8 -------- client/partials/network/main.html | 8 ++++++++ 14 files changed, 56 insertions(+), 50 deletions(-) delete mode 100644 client/js/controllers/home.js create mode 100644 client/js/controllers/home/main.js delete mode 100644 client/js/controllers/network.js create mode 100644 client/js/controllers/network/main.js delete mode 100644 client/partials/home.html create mode 100644 client/partials/home/main.html delete mode 100644 client/partials/network.html create mode 100644 client/partials/network/main.html diff --git a/client/index.html b/client/index.html index 018def2..b935137 100644 --- a/client/index.html +++ b/client/index.html @@ -74,10 +74,11 @@ - - + + + diff --git a/client/js/app.js b/client/js/app.js index c931d7e..0e9c423 100644 --- a/client/js/app.js +++ b/client/js/app.js @@ -6,11 +6,11 @@ var mainApp=angular.module("mainApp",['ngRoute', 'ngSanitize']); mainApp.config(['$routeProvider', function($routeProvider){ $routeProvider. when('/home',{ - templateUrl: 'partials/home.html', + templateUrl: 'partials/home/main.html', controller: 'homeCtrl' }). when('/network',{ - templateUrl: 'partials/network.html', + templateUrl: 'partials/network/main.html', controller: 'networkCtrl' }).otherwise({ redirectTo: '/home' diff --git a/client/js/controllers/home.js b/client/js/controllers/home.js deleted file mode 100644 index 2898de2..0000000 --- a/client/js/controllers/home.js +++ /dev/null @@ -1,11 +0,0 @@ -/* - * home Controller - */ - - - -mainApp.controller('homeCtrl', function ($scope) -{ - - -}); \ No newline at end of file diff --git a/client/js/controllers/home/main.js b/client/js/controllers/home/main.js new file mode 100644 index 0000000..2898de2 --- /dev/null +++ b/client/js/controllers/home/main.js @@ -0,0 +1,11 @@ +/* + * home Controller + */ + + + +mainApp.controller('homeCtrl', function ($scope) +{ + + +}); \ No newline at end of file diff --git a/client/js/controllers/login.js b/client/js/controllers/login.js index 6de348c..026ce36 100644 --- a/client/js/controllers/login.js +++ b/client/js/controllers/login.js @@ -4,11 +4,14 @@ * and open the template in the editor. */ - +/** + * Represents a book. + * @constructor + */ mainApp.controller('loginCtrl', function ($scope,$interval,$sce) { // Define default states - $('#loginModal').modal({backdrop: 'static', keyboard: false}); + //$('#loginModal').modal({backdrop: 'static', keyboard: false}); $('#loadingLoginButton').hide(); $('#failedToLoginAlert').hide(); diff --git a/client/js/controllers/network.js b/client/js/controllers/network.js deleted file mode 100644 index 6c916ae..0000000 --- a/client/js/controllers/network.js +++ /dev/null @@ -1,9 +0,0 @@ -/* - * network Controller - */ - - - -mainApp.controller('networkCtrl', function ($scope) -{ -}); \ No newline at end of file diff --git a/client/js/controllers/network/main.js b/client/js/controllers/network/main.js new file mode 100644 index 0000000..6c916ae --- /dev/null +++ b/client/js/controllers/network/main.js @@ -0,0 +1,9 @@ +/* + * network Controller + */ + + + +mainApp.controller('networkCtrl', function ($scope) +{ +}); \ No newline at end of file diff --git a/client/js/controllers/status.js b/client/js/controllers/status.js index c24997e..42a54d4 100644 --- a/client/js/controllers/status.js +++ b/client/js/controllers/status.js @@ -6,7 +6,8 @@ mainApp.controller('statusCtrl', function ($scope,$interval,$sce) { - + $scope.username="John Doe"; + $scope.projectname="Web Server"; // Update status every 2 seconds /*$interval(function(){ var status=identity.fetchStatus(); diff --git a/client/partials/home.html b/client/partials/home.html deleted file mode 100644 index 7a5045a..0000000 --- a/client/partials/home.html +++ /dev/null @@ -1,8 +0,0 @@ -
    -
    - Home -
    -
    - Main Content -
    -
    \ No newline at end of file diff --git a/client/partials/home/main.html b/client/partials/home/main.html new file mode 100644 index 0000000..7a5045a --- /dev/null +++ b/client/partials/home/main.html @@ -0,0 +1,8 @@ +
    +
    + Home +
    +
    + Main Content +
    +
    \ No newline at end of file diff --git a/client/partials/login.html b/client/partials/login.html index 8571e61..387b075 100644 --- a/client/partials/login.html +++ b/client/partials/login.html @@ -14,12 +14,12 @@
    + placeholder="Email" type="text" ng-model="identityFormData.user">
    + placeholder="Project Name" type="password" ng-model="identityFormData.project">
    diff --git a/client/partials/nav.html b/client/partials/nav.html index c52ba4d..f412597 100644 --- a/client/partials/nav.html +++ b/client/partials/nav.html @@ -17,10 +17,11 @@