From 475508baa9f0b21087eb85048d51af342aa09692 Mon Sep 17 00:00:00 2001 From: Fulup Ar Foll Date: Wed, 16 Dec 2015 17:15:43 +0100 Subject: Add the app!!! --- afb-client/app/Frontend/services/ConfigApp.js | 25 ++++++++++++++++ afb-client/app/Frontend/services/JQueryEmu.js | 42 +++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 afb-client/app/Frontend/services/ConfigApp.js create mode 100644 afb-client/app/Frontend/services/JQueryEmu.js (limited to 'afb-client/app/Frontend/services') diff --git a/afb-client/app/Frontend/services/ConfigApp.js b/afb-client/app/Frontend/services/ConfigApp.js new file mode 100644 index 0000000..f36d79b --- /dev/null +++ b/afb-client/app/Frontend/services/ConfigApp.js @@ -0,0 +1,25 @@ +(function () { + 'use strict'; + + // _all modules only reference dependencies + angular.module('ConfigApp', []) + + // Factory is a singleton and share its context within all instances. + .factory('ConfigApp', function () { + + + var myConfig = { + paths: { // Warning paths should end with / + images : 'images/', + avatars: 'images/avatars/' + }, + + api: { // Warning paths should end with / + token : '/api/token/' + } + }; + + return myConfig; + }); + +})(); \ No newline at end of file diff --git a/afb-client/app/Frontend/services/JQueryEmu.js b/afb-client/app/Frontend/services/JQueryEmu.js new file mode 100644 index 0000000..5112052 --- /dev/null +++ b/afb-client/app/Frontend/services/JQueryEmu.js @@ -0,0 +1,42 @@ +(function () { + 'use strict'; + + // _all modules only reference dependencies + angular.module('JQueryEmu', []) + + // Factory is a singleton and share its context within all instances. + .factory('JQemu', function () { + + // JQueryLight cannot search a tag within ancestrors + var parent = function (element, selector) { + var parent = element; + var search = selector.toUpperCase(); + while (parent[0]) { + if (search === parent[0].tagName) { + return parent; + } // HTMLDivElement properties + parent = parent.parent(); + } + }; + + // JQueryLight cannot search by type + var findByType= function (element, selector) { + var search = selector.toLowerCase(); + var children = element.children(); + while (children[0]) { + if (search === children[0].type) { + return children; + } // HTMLDivElement properties + children = children.next(); + } + }; + + var myMethods = { + parent: parent, + findByType: findByType + }; + + return myMethods; + }); + +})(); \ No newline at end of file -- cgit From fbdd26b4a4aa8eb3d83333fe44e93590bc174e11 Mon Sep 17 00:00:00 2001 From: Fulup Ar Foll Date: Wed, 16 Dec 2015 19:17:46 +0100 Subject: Work in Progress --- afb-client/app/Frontend/services/ConfigApp.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'afb-client/app/Frontend/services') diff --git a/afb-client/app/Frontend/services/ConfigApp.js b/afb-client/app/Frontend/services/ConfigApp.js index f36d79b..cafda3f 100644 --- a/afb-client/app/Frontend/services/ConfigApp.js +++ b/afb-client/app/Frontend/services/ConfigApp.js @@ -16,6 +16,15 @@ api: { // Warning paths should end with / token : '/api/token/' + }, + + session: { // Those data are updated by session service + refresh : '/api/token/refresh', + check : '/api/token/check', + token : '123456789', // typical dev initial token + timeout : 3600, // timeout is updated client sessin context creation + uuid : '', // uuid map with cookie or long term session access key + pingrate: 60 // Ping rate to check if server is still alive } }; -- cgit From 98522d2a6ce7c7a709728872ed892970d0a1df7b Mon Sep 17 00:00:00 2001 From: Fulup Ar Foll Date: Wed, 16 Dec 2015 21:38:04 +0100 Subject: Added AFB monitoring and token auto-refresh --- afb-client/app/Frontend/services/ConfigApp.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'afb-client/app/Frontend/services') diff --git a/afb-client/app/Frontend/services/ConfigApp.js b/afb-client/app/Frontend/services/ConfigApp.js index cafda3f..adec5ac 100644 --- a/afb-client/app/Frontend/services/ConfigApp.js +++ b/afb-client/app/Frontend/services/ConfigApp.js @@ -20,7 +20,7 @@ session: { // Those data are updated by session service refresh : '/api/token/refresh', - check : '/api/token/check', + ping : '/api/token/check', token : '123456789', // typical dev initial token timeout : 3600, // timeout is updated client sessin context creation uuid : '', // uuid map with cookie or long term session access key -- cgit From 5669aa501d13221bbbedb93b5358d3f8073310c7 Mon Sep 17 00:00:00 2001 From: Fulup Ar Foll Date: Thu, 17 Dec 2015 00:47:38 +0100 Subject: Cleanup --- afb-client/app/Frontend/services/ConfigApp.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'afb-client/app/Frontend/services') diff --git a/afb-client/app/Frontend/services/ConfigApp.js b/afb-client/app/Frontend/services/ConfigApp.js index adec5ac..310ef88 100644 --- a/afb-client/app/Frontend/services/ConfigApp.js +++ b/afb-client/app/Frontend/services/ConfigApp.js @@ -21,10 +21,11 @@ session: { // Those data are updated by session service refresh : '/api/token/refresh', ping : '/api/token/check', - token : '123456789', // typical dev initial token + initial : '123456789', // typical dev initial token timeout : 3600, // timeout is updated client sessin context creation + pingrate: 60, // Ping rate to check if server is still alive uuid : '', // uuid map with cookie or long term session access key - pingrate: 60 // Ping rate to check if server is still alive + token : '' // will be returned from authentication } }; -- cgit From 4136c1506e0c894e604ec069339313987a7e05e7 Mon Sep 17 00:00:00 2001 From: Fulup Ar Foll Date: Sun, 20 Dec 2015 21:04:34 +0100 Subject: Implemented client upload with rangeslider and zip open --- afb-client/app/Frontend/services/ConfigApp.js | 35 ------------------ afb-client/app/Frontend/services/JQueryEmu.js | 51 +++++++++++++++++++++++---- 2 files changed, 44 insertions(+), 42 deletions(-) delete mode 100644 afb-client/app/Frontend/services/ConfigApp.js (limited to 'afb-client/app/Frontend/services') diff --git a/afb-client/app/Frontend/services/ConfigApp.js b/afb-client/app/Frontend/services/ConfigApp.js deleted file mode 100644 index 310ef88..0000000 --- a/afb-client/app/Frontend/services/ConfigApp.js +++ /dev/null @@ -1,35 +0,0 @@ -(function () { - 'use strict'; - - // _all modules only reference dependencies - angular.module('ConfigApp', []) - - // Factory is a singleton and share its context within all instances. - .factory('ConfigApp', function () { - - - var myConfig = { - paths: { // Warning paths should end with / - images : 'images/', - avatars: 'images/avatars/' - }, - - api: { // Warning paths should end with / - token : '/api/token/' - }, - - session: { // Those data are updated by session service - refresh : '/api/token/refresh', - ping : '/api/token/check', - initial : '123456789', // typical dev initial token - timeout : 3600, // timeout is updated client sessin context creation - pingrate: 60, // Ping rate to check if server is still alive - uuid : '', // uuid map with cookie or long term session access key - token : '' // will be returned from authentication - } - }; - - return myConfig; - }); - -})(); \ No newline at end of file diff --git a/afb-client/app/Frontend/services/JQueryEmu.js b/afb-client/app/Frontend/services/JQueryEmu.js index 5112052..6d6e338 100644 --- a/afb-client/app/Frontend/services/JQueryEmu.js +++ b/afb-client/app/Frontend/services/JQueryEmu.js @@ -1,14 +1,39 @@ +/* + * Copyright (C) 2015 "IoT.bzh" + * Author "Fulup Ar Foll" + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * Usage: + * + * // mouse event probably point on icon and not on button div + * ... ng-click="LockChannel($event) + var target= angular.element(event.currentTarget); + var button= JQemu.FindInParent (target, 'div'); + * + */ + + (function () { 'use strict'; + + // _all modules only reference dependencies angular.module('JQueryEmu', []) // Factory is a singleton and share its context within all instances. .factory('JQemu', function () { - // JQueryLight cannot search a tag within ancestrors - var parent = function (element, selector) { + var FindInParent = function (element, selector) { var parent = element; var search = selector.toUpperCase(); while (parent[0]) { @@ -19,12 +44,23 @@ } }; - // JQueryLight cannot search by type - var findByType= function (element, selector) { + var FindByTag= function (element, tag, selector) { + var search = selector.toLowerCase(); + var type = tag.toLowerCase()+ "Name"; + var children = element.children(); + while (children[0]) { + if (search === children[0][type]) { + return children; + } // HTMLDivElement properties + children = children.next(); + } + }; + + var FindByClass= function (element, selector) { var search = selector.toLowerCase(); var children = element.children(); while (children[0]) { - if (search === children[0].type) { + if (children.hasClass(search)) { return children; } // HTMLDivElement properties children = children.next(); @@ -32,8 +68,9 @@ }; var myMethods = { - parent: parent, - findByType: findByType + FindInParent: FindInParent, + FindByTag: FindByTag, + FindByClass: FindByClass }; return myMethods; -- cgit