From 95a5e12dca0e0e0eb93b3dad69e529d737840d38 Mon Sep 17 00:00:00 2001 From: Fulup Ar Foll Date: Sat, 28 May 2016 12:28:19 +0200 Subject: Clean up and documentation --- afb-client/app/Frontend/app.js | 5 +- afb-client/app/Frontend/etc/AppConfig.js | 4 +- afb-client/app/Frontend/etc/routes.js | 2 +- .../app/Frontend/images/appli/isnotvalid.png | Bin 11124 -> 0 bytes afb-client/app/Frontend/images/appli/istoobig.png | Bin 35678 -> 0 bytes .../app/Frontend/images/appli/upload-appli.png | Bin 24483 -> 0 bytes afb-client/app/Frontend/images/audio/istoobig.png | Bin 35678 -> 0 bytes .../app/Frontend/images/audio/upload-music.png | Bin 69741 -> 0 bytes afb-client/app/Frontend/images/login/fb-logo.png | Bin 2482 -> 0 bytes afb-client/app/Frontend/images/login/gg-logo.png | Bin 3554 -> 0 bytes afb-client/app/Frontend/images/login/gh-logo.png | Bin 4946 -> 0 bytes afb-client/app/Frontend/images/login/iot-logo.png | Bin 3471 -> 0 bytes afb-client/app/Frontend/images/login/lk-logo.png | Bin 4579 -> 0 bytes afb-client/app/Frontend/images/login/ms-logo.png | Bin 6036 -> 0 bytes afb-client/app/Frontend/images/login/og-logo.png | Bin 2706 -> 0 bytes afb-client/app/Frontend/images/login/pp-logo.png | Bin 3222 -> 0 bytes afb-client/app/Frontend/images/login/yh-logo.png | Bin 5491 -> 0 bytes afb-client/app/Frontend/pages/Home/Home.html | 35 ---- afb-client/app/Frontend/pages/Home/HomeModule.js | 89 --------- afb-client/app/Frontend/pages/Home/HomeModule.scss | 71 ------- afb-client/app/Frontend/pages/Sample/Sample.html | 35 ---- .../app/Frontend/pages/Sample/SampleModule.js | 18 -- .../app/Frontend/pages/Sample/SampleModule.scss | 41 ----- .../app/Frontend/pages/SampleHome/SampleHome.html | 35 ++++ .../app/Frontend/pages/SampleHome/SampleHome.js | 104 +++++++++++ .../app/Frontend/pages/SampleHome/SampleHome.scss | 71 +++++++ .../app/Frontend/pages/SamplePost/SamplePost.html | 29 +++ .../app/Frontend/pages/SamplePost/SamplePost.js | 18 ++ .../app/Frontend/pages/SamplePost/SamplePost.scss | 41 +++++ .../widgets/ActionButtons/ActionButtons.scss | 40 ++++ .../Frontend/widgets/ActionButtons/AppliButton.js | 205 +++++++++++++++++++++ .../Frontend/widgets/ActionButtons/SubmitButton.js | 52 ++++++ .../widgets/Buttons/SubmitButtons/SubmitButtons.js | 52 ------ .../Buttons/SubmitButtons/SubmitButtons.scss | 22 --- .../Frontend/widgets/FormInput/InputPassword.js | 79 -------- .../app/Frontend/widgets/FormInput/InputText.js | 179 ------------------ .../app/Frontend/widgets/FormInput/UploadFiles.js | 2 +- .../widgets/Notifications/TokenRefreshSvc.js | 4 +- 38 files changed, 602 insertions(+), 631 deletions(-) delete mode 100644 afb-client/app/Frontend/images/appli/isnotvalid.png delete mode 100644 afb-client/app/Frontend/images/appli/istoobig.png delete mode 100644 afb-client/app/Frontend/images/appli/upload-appli.png delete mode 100644 afb-client/app/Frontend/images/audio/istoobig.png delete mode 100644 afb-client/app/Frontend/images/audio/upload-music.png delete mode 100644 afb-client/app/Frontend/images/login/fb-logo.png delete mode 100644 afb-client/app/Frontend/images/login/gg-logo.png delete mode 100644 afb-client/app/Frontend/images/login/gh-logo.png delete mode 100644 afb-client/app/Frontend/images/login/iot-logo.png delete mode 100644 afb-client/app/Frontend/images/login/lk-logo.png delete mode 100644 afb-client/app/Frontend/images/login/ms-logo.png delete mode 100644 afb-client/app/Frontend/images/login/og-logo.png delete mode 100644 afb-client/app/Frontend/images/login/pp-logo.png delete mode 100644 afb-client/app/Frontend/images/login/yh-logo.png delete mode 100644 afb-client/app/Frontend/pages/Home/Home.html delete mode 100644 afb-client/app/Frontend/pages/Home/HomeModule.js delete mode 100644 afb-client/app/Frontend/pages/Home/HomeModule.scss delete mode 100644 afb-client/app/Frontend/pages/Sample/Sample.html delete mode 100644 afb-client/app/Frontend/pages/Sample/SampleModule.js delete mode 100644 afb-client/app/Frontend/pages/Sample/SampleModule.scss create mode 100644 afb-client/app/Frontend/pages/SampleHome/SampleHome.html create mode 100644 afb-client/app/Frontend/pages/SampleHome/SampleHome.js create mode 100644 afb-client/app/Frontend/pages/SampleHome/SampleHome.scss create mode 100644 afb-client/app/Frontend/pages/SamplePost/SamplePost.html create mode 100644 afb-client/app/Frontend/pages/SamplePost/SamplePost.js create mode 100644 afb-client/app/Frontend/pages/SamplePost/SamplePost.scss create mode 100644 afb-client/app/Frontend/widgets/ActionButtons/ActionButtons.scss create mode 100644 afb-client/app/Frontend/widgets/ActionButtons/AppliButton.js create mode 100644 afb-client/app/Frontend/widgets/ActionButtons/SubmitButton.js delete mode 100644 afb-client/app/Frontend/widgets/Buttons/SubmitButtons/SubmitButtons.js delete mode 100644 afb-client/app/Frontend/widgets/Buttons/SubmitButtons/SubmitButtons.scss delete mode 100644 afb-client/app/Frontend/widgets/FormInput/InputPassword.js delete mode 100644 afb-client/app/Frontend/widgets/FormInput/InputText.js (limited to 'afb-client/app/Frontend') diff --git a/afb-client/app/Frontend/app.js b/afb-client/app/Frontend/app.js index 91a8a72..e11c266 100644 --- a/afb-client/app/Frontend/app.js +++ b/afb-client/app/Frontend/app.js @@ -26,8 +26,7 @@ // Application Components 'AppConfig', 'JQueryEmu', - 'HomeModule', - 'SampleModule', + 'SampleHomeModule', 'UploadFiles', 'LinkButton', 'TokenRefresh', @@ -42,7 +41,7 @@ config.$inject = ['$urlRouterProvider', '$locationProvider']; function config($urlProvider, $locationProvider, AppConfig) { - $urlProvider.otherwise('/home'); + $urlProvider.otherwise('/sample-home'); // https://docs.angularjs.org/error/$location/nobase $locationProvider.html5Mode(true).hashPrefix('!'); diff --git a/afb-client/app/Frontend/etc/AppConfig.js b/afb-client/app/Frontend/etc/AppConfig.js index c8f1abe..382c0a3 100644 --- a/afb-client/app/Frontend/etc/AppConfig.js +++ b/afb-client/app/Frontend/etc/AppConfig.js @@ -10,9 +10,7 @@ var myConfig = { paths: { // Warning paths should end with / image : 'images/', - avatar: 'images/avatars/', - audio : 'images/audio/', - appli : 'images/appli/' + avatar: 'images/avatars/' }, session: { // Those data are updated by session service diff --git a/afb-client/app/Frontend/etc/routes.js b/afb-client/app/Frontend/etc/routes.js index c3c5ba4..f147789 100644 --- a/afb-client/app/Frontend/etc/routes.js +++ b/afb-client/app/Frontend/etc/routes.js @@ -1 +1 @@ -var foundationRoutes = [{"name":"mysample","url":"/sample","controller":"SampleController as ctrl","animationIn":"slideInRight","path":"pages/Sample/Sample.html"},{"name":"myhome","url":"/home","controller":"HomeController as ctrl","animationIn":"slideInRight","path":"pages/Home/Home.html"}]; +var foundationRoutes = [{"name":"PostSample","url":"/sample-post","controller":"SamplePostController as ctrl","animationIn":"slideInRight","path":"pages/SamplePost/SamplePost.html"},{"name":"SampleHome","url":"/sample-home","controller":"SampleHomeController as ctrl","animationIn":"slideInRight","path":"pages/SampleHome/SampleHome.html"}]; diff --git a/afb-client/app/Frontend/images/appli/isnotvalid.png b/afb-client/app/Frontend/images/appli/isnotvalid.png deleted file mode 100644 index 057c215..0000000 Binary files a/afb-client/app/Frontend/images/appli/isnotvalid.png and /dev/null differ diff --git a/afb-client/app/Frontend/images/appli/istoobig.png b/afb-client/app/Frontend/images/appli/istoobig.png deleted file mode 100644 index 5614073..0000000 Binary files a/afb-client/app/Frontend/images/appli/istoobig.png and /dev/null differ diff --git a/afb-client/app/Frontend/images/appli/upload-appli.png b/afb-client/app/Frontend/images/appli/upload-appli.png deleted file mode 100644 index a35fd3a..0000000 Binary files a/afb-client/app/Frontend/images/appli/upload-appli.png and /dev/null differ diff --git a/afb-client/app/Frontend/images/audio/istoobig.png b/afb-client/app/Frontend/images/audio/istoobig.png deleted file mode 100644 index 5614073..0000000 Binary files a/afb-client/app/Frontend/images/audio/istoobig.png and /dev/null differ diff --git a/afb-client/app/Frontend/images/audio/upload-music.png b/afb-client/app/Frontend/images/audio/upload-music.png deleted file mode 100644 index 2006ef0..0000000 Binary files a/afb-client/app/Frontend/images/audio/upload-music.png and /dev/null differ diff --git a/afb-client/app/Frontend/images/login/fb-logo.png b/afb-client/app/Frontend/images/login/fb-logo.png deleted file mode 100644 index fcf7847..0000000 Binary files a/afb-client/app/Frontend/images/login/fb-logo.png and /dev/null differ diff --git a/afb-client/app/Frontend/images/login/gg-logo.png b/afb-client/app/Frontend/images/login/gg-logo.png deleted file mode 100644 index 0c372eb..0000000 Binary files a/afb-client/app/Frontend/images/login/gg-logo.png and /dev/null differ diff --git a/afb-client/app/Frontend/images/login/gh-logo.png b/afb-client/app/Frontend/images/login/gh-logo.png deleted file mode 100644 index ff856fc..0000000 Binary files a/afb-client/app/Frontend/images/login/gh-logo.png and /dev/null differ diff --git a/afb-client/app/Frontend/images/login/iot-logo.png b/afb-client/app/Frontend/images/login/iot-logo.png deleted file mode 100644 index ca594d7..0000000 Binary files a/afb-client/app/Frontend/images/login/iot-logo.png and /dev/null differ diff --git a/afb-client/app/Frontend/images/login/lk-logo.png b/afb-client/app/Frontend/images/login/lk-logo.png deleted file mode 100644 index d9bc51f..0000000 Binary files a/afb-client/app/Frontend/images/login/lk-logo.png and /dev/null differ diff --git a/afb-client/app/Frontend/images/login/ms-logo.png b/afb-client/app/Frontend/images/login/ms-logo.png deleted file mode 100644 index d4f23eb..0000000 Binary files a/afb-client/app/Frontend/images/login/ms-logo.png and /dev/null differ diff --git a/afb-client/app/Frontend/images/login/og-logo.png b/afb-client/app/Frontend/images/login/og-logo.png deleted file mode 100644 index a6f6e9a..0000000 Binary files a/afb-client/app/Frontend/images/login/og-logo.png and /dev/null differ diff --git a/afb-client/app/Frontend/images/login/pp-logo.png b/afb-client/app/Frontend/images/login/pp-logo.png deleted file mode 100644 index dbb8866..0000000 Binary files a/afb-client/app/Frontend/images/login/pp-logo.png and /dev/null differ diff --git a/afb-client/app/Frontend/images/login/yh-logo.png b/afb-client/app/Frontend/images/login/yh-logo.png deleted file mode 100644 index 6ab90cf..0000000 Binary files a/afb-client/app/Frontend/images/login/yh-logo.png and /dev/null differ diff --git a/afb-client/app/Frontend/pages/Home/Home.html b/afb-client/app/Frontend/pages/Home/Home.html deleted file mode 100644 index 509bd6f..0000000 --- a/afb-client/app/Frontend/pages/Home/Home.html +++ /dev/null @@ -1,35 +0,0 @@ - ---- -name: myhome -url: /home -controller: HomeController as ctrl -animationIn: slideInRight ---- - -

- - App Framework Binder Simple Client -

- - - - -
- - - - - - -
-
-
- req= {{ctrl.request}} - res= {{ctrl.response}} - status= {{ctrl.errcode}} -
-
- - - - diff --git a/afb-client/app/Frontend/pages/Home/HomeModule.js b/afb-client/app/Frontend/pages/Home/HomeModule.js deleted file mode 100644 index 1743654..0000000 --- a/afb-client/app/Frontend/pages/Home/HomeModule.js +++ /dev/null @@ -1,89 +0,0 @@ -(function() { -'use strict'; - -// WARNING: make sure than app/frontend/services/AppConfig.js match your server - -// list all rependencies within the page + controler if needed -angular.module('HomeModule', ['SubmitButton', 'TokenRefresh','ModalNotification']) - - .controller('HomeController', function (AppCall, Notification) { - var scope = this; // I hate JavaScript - scope.uuid ="none"; - scope.token ="none"; - scope.session="none"; - scope.status ="err-no"; - - console.log ("Home Controller"); - - scope.OnResponse= function(jresp, errcode) { - - // Update UI response global display zone - scope.status = jresp.request.status; - scope.errcode = errcode; - scope.request = jresp.request; - scope.response = jresp.response; - - if (jresp.request.status !== "success") { - Notification.error ({message: "Invalid API call:" + jresp.request.info , delay: 5000}); - scope.class [jresp.request.reqid]="fail"; - return; - } - - switch (jresp.request.reqid) { - case 'login': - case 'logout': - scope.class={}; - break; - - case 'refresh': - case 'check': - break; - - default: - Notification.error ({message: "Invalid RequestID:" + jresp.request.reqid , delay: 5000}); - return; - } - - // update button classes within home.html - scope.class [jresp.request.reqid]="success"; - console.log ("OK: "+ JSON.stringify(jresp)); - }; - - scope.ProcessError= function(response, errcode, config) { - Notification.error ({message: "Invalid API:" + response.request.reqid , delay: 5000}); - scope.status = "err-fx"; - scope.errcode = errcode; - scope.request = response.request; - scope.response = ""; - console.log ("FX: "+ JSON.stringify(response)); - }; - - scope.LoginClient = function() { - console.log ("LoginClient"); - AppCall.get ("auth", "login", {/*query*/}, scope.OnResponse, scope.InvalidApiCall); - }; - - scope.CheckSession = function() { - console.log ("CheckSession"); - AppCall.get ("auth", "check", {/*query*/}, scope.OnResponse, scope.InvalidApiCall); - - }; - - scope.RefreshSession = function() { - console.log ("RefreshSession"); - AppCall.get ("auth", "refresh", {/*query*/}, scope.OnResponse, scope.InvalidApiCall); - }; - - scope.LogoutClient = function() { - console.log ("LogoutClient"); - AppCall.get ("auth", "logout", {/*query*/}, scope.OnResponse, scope.InvalidApiCall); - }; - - scope.Initialised = function () { - scope.class = {login: "success"}; - } - - }); - -console.log ("SampleControler Loaded"); -})(); \ No newline at end of file diff --git a/afb-client/app/Frontend/pages/Home/HomeModule.scss b/afb-client/app/Frontend/pages/Home/HomeModule.scss deleted file mode 100644 index 8bf04a1..0000000 --- a/afb-client/app/Frontend/pages/Home/HomeModule.scss +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -@import "app/ibz-mixins"; - -$COLOR_SUCCESS: green; -$COLOR_FAIL: red; - -token-refresh { - display: block; - float: right; - margin: .5rem 1rem 0 0; -} - -.button-box { - height : 4.5rem; - - .session-button { - float: left; - width: 5rem; - }; - - .response > span{ - display: block; - margin: .3rem .5rem .3rem .5rem; - } - - .fail { - color:$COLOR_FAIL; - border: 1px solid darken($COLOR_FAIL,10%); - } - .success { - color:$COLOR_SUCCESS; - border: 1px solid darken($COLOR_SUCCESS,10%); - } - -}; - -.message-box { - height : auto; - width: 100%; - font-size: .75rem; - - .response { - .err-no { color:grey; } - .res.err-ok { color: blue; } - .req.err-ok { color:blueviolet; } - .status.err-ok { color:green; } - .status.err-fx { color:red; } - } - - -}; - - - diff --git a/afb-client/app/Frontend/pages/Sample/Sample.html b/afb-client/app/Frontend/pages/Sample/Sample.html deleted file mode 100644 index 03a4558..0000000 --- a/afb-client/app/Frontend/pages/Sample/Sample.html +++ /dev/null @@ -1,35 +0,0 @@ - ---- -name: mysample -url: /sample -controller: SampleController as ctrl -animationIn: slideInRight ---- - -

- Post File Upload -

- -
- - - - - - - - - - - -
- - diff --git a/afb-client/app/Frontend/pages/Sample/SampleModule.js b/afb-client/app/Frontend/pages/Sample/SampleModule.js deleted file mode 100644 index 8ae82ea..0000000 --- a/afb-client/app/Frontend/pages/Sample/SampleModule.js +++ /dev/null @@ -1,18 +0,0 @@ -(function() { -'use strict'; - -// list all rependencies within the page + controler if needed -angular.module('SampleModule', ['SubmitButton','UploadFiles']) - - .controller('SampleController', function ($http) { - var scope = this; // I hate JavaScript - - console.log ("sample Init"); - - scope.FileUploaded = function (response) { - console.log ("FileUploaded response=%s", JSON.stringify(response)); - }; - }); - -console.log ("SampleControler Loaded"); -})(); \ No newline at end of file diff --git a/afb-client/app/Frontend/pages/Sample/SampleModule.scss b/afb-client/app/Frontend/pages/Sample/SampleModule.scss deleted file mode 100644 index 7654424..0000000 --- a/afb-client/app/Frontend/pages/Sample/SampleModule.scss +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -@import "app/ibz-mixins"; - - -.sample-box { - display: block; - height : 4.5rem; - - .sample-button { - float: right; - width: 5rem; - }; - - .muted-on-on,.muted-off-off{ - background: blueviolet; - }; - - .muted-error{ - background: red; - }; -}; - - - diff --git a/afb-client/app/Frontend/pages/SampleHome/SampleHome.html b/afb-client/app/Frontend/pages/SampleHome/SampleHome.html new file mode 100644 index 0000000..58474b2 --- /dev/null +++ b/afb-client/app/Frontend/pages/SampleHome/SampleHome.html @@ -0,0 +1,35 @@ + +--- +name: SampleHome +url: /sample-home +controller: SampleHomeController as ctrl +animationIn: slideInRight +--- + +

+ + App Framework Binder Simple Client +

+ + + + +
+ + + + + + +
+
+
+ req= {{ctrl.request}} + res= {{ctrl.response}} + status= {{ctrl.errcode}} +
+
+ + + + diff --git a/afb-client/app/Frontend/pages/SampleHome/SampleHome.js b/afb-client/app/Frontend/pages/SampleHome/SampleHome.js new file mode 100644 index 0000000..bce1b47 --- /dev/null +++ b/afb-client/app/Frontend/pages/SampleHome/SampleHome.js @@ -0,0 +1,104 @@ +(function() { +'use strict'; + +// WARNING: make sure than app/frontend/services/AppConfig.js match your server + +// list all rependencies within the page + controler if needed +angular.module('SampleHomeModule', ['SamplePostModule', 'SubmitButton', 'TokenRefresh','ModalNotification']) + + .controller('SampleHomeController', function (AppCall, Notification) { + var scope = this; // I hate JavaScript + scope.uuid ="none"; + scope.token ="none"; + scope.session="none"; + scope.status ="err-no"; + + console.log ("Home Controller"); + + scope.OnResponse= function(jresp, errcode) { + + // Update UI response global display zone + scope.status = jresp.request.status; + scope.errcode = errcode; + scope.request = jresp.request; + scope.response = jresp.response; + + var action=jresp.request.reqid.toUpperCase(); + + switch (action) { + case 'CONNECT': + if (jresp.request.status !== "success") { + Notification.error ({message: action + ": Logout before reconnecting", delay: 5000}); + scope.class [jresp.request.reqid]="fail"; + return; + } + scope.class={}; // reset CSS buttons classes + break; + + case 'LOGOUT': + if (jresp.request.status !== "success") { + Notification.error ({message: action + ": Do connect first", delay: 5000}); + scope.class [jresp.request.reqid]="fail"; + return; + } + scope.class={}; // reset CSS buttons classes + break; + + case 'REFRESH': + case 'CHECK': + if (jresp.request.status !== "success") { + Notification.error ({message: action + ": Need to be Connected to check/refresh session", delay: 5000}); + scope.class [jresp.request.reqid]="fail"; + return; + } + + break; + + default: + Notification.error ({message: "Invalid RequestID:" + jresp.request.reqid , delay: 5000}); + return; + } + + // update button classes within home.html + scope.class [jresp.request.reqid]="success"; + console.log ("OK: "+ JSON.stringify(jresp)); + }; + + scope.ProcessError= function(response, errcode, config) { + Notification.error ({message: "Invalid API:" + response.request.reqid , delay: 5000}); + scope.status = "err-fx"; + scope.errcode = errcode; + scope.request = response.request; + scope.response = ""; + console.log ("FX: "+ JSON.stringify(response)); + }; + + scope.ConnectClient = function() { + console.log ("ConnectClient"); + AppCall.get ("auth", "connect", {/*query*/}, scope.OnResponse, scope.InvalidApiCall); + }; + + scope.CheckSession = function() { + console.log ("CheckSession"); + AppCall.get ("auth", "check", {/*query*/}, scope.OnResponse, scope.InvalidApiCall); + + }; + + scope.RefreshSession = function() { + console.log ("RefreshSession"); + AppCall.get ("auth", "refresh", {/*query*/}, scope.OnResponse, scope.InvalidApiCall); + }; + + scope.LogoutClient = function() { + console.log ("LogoutClient"); + AppCall.get ("auth", "logout", {/*query*/}, scope.OnResponse, scope.InvalidApiCall); + }; + + scope.Initialised = function () { + scope.class = {connect: "success"}; + }; + + }); + +console.log ("SampleControler Loaded"); +})(); \ No newline at end of file diff --git a/afb-client/app/Frontend/pages/SampleHome/SampleHome.scss b/afb-client/app/Frontend/pages/SampleHome/SampleHome.scss new file mode 100644 index 0000000..8bf04a1 --- /dev/null +++ b/afb-client/app/Frontend/pages/SampleHome/SampleHome.scss @@ -0,0 +1,71 @@ +/* + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +@import "app/ibz-mixins"; + +$COLOR_SUCCESS: green; +$COLOR_FAIL: red; + +token-refresh { + display: block; + float: right; + margin: .5rem 1rem 0 0; +} + +.button-box { + height : 4.5rem; + + .session-button { + float: left; + width: 5rem; + }; + + .response > span{ + display: block; + margin: .3rem .5rem .3rem .5rem; + } + + .fail { + color:$COLOR_FAIL; + border: 1px solid darken($COLOR_FAIL,10%); + } + .success { + color:$COLOR_SUCCESS; + border: 1px solid darken($COLOR_SUCCESS,10%); + } + +}; + +.message-box { + height : auto; + width: 100%; + font-size: .75rem; + + .response { + .err-no { color:grey; } + .res.err-ok { color: blue; } + .req.err-ok { color:blueviolet; } + .status.err-ok { color:green; } + .status.err-fx { color:red; } + } + + +}; + + + diff --git a/afb-client/app/Frontend/pages/SamplePost/SamplePost.html b/afb-client/app/Frontend/pages/SamplePost/SamplePost.html new file mode 100644 index 0000000..fa721c7 --- /dev/null +++ b/afb-client/app/Frontend/pages/SamplePost/SamplePost.html @@ -0,0 +1,29 @@ + +--- +name: PostSample +url: /sample-post +controller: SamplePostController as ctrl +animationIn: slideInRight +--- + +

+ Post File Upload +

+ +
+ + + + + +
+ + diff --git a/afb-client/app/Frontend/pages/SamplePost/SamplePost.js b/afb-client/app/Frontend/pages/SamplePost/SamplePost.js new file mode 100644 index 0000000..e0c06de --- /dev/null +++ b/afb-client/app/Frontend/pages/SamplePost/SamplePost.js @@ -0,0 +1,18 @@ +(function() { +'use strict'; + +// list all rependencies within the page + controler if needed +angular.module('SamplePostModule', ['SubmitButton','UploadFiles']) + + .controller('SamplePostController', function ($http) { + var scope = this; // I hate JavaScript + + console.log ("sample Init"); + + scope.FileUploaded = function (response) { + console.log ("FileUploaded response=%s", JSON.stringify(response)); + }; + }); + +console.log ("PostSampleController Loaded"); +})(); \ No newline at end of file diff --git a/afb-client/app/Frontend/pages/SamplePost/SamplePost.scss b/afb-client/app/Frontend/pages/SamplePost/SamplePost.scss new file mode 100644 index 0000000..7654424 --- /dev/null +++ b/afb-client/app/Frontend/pages/SamplePost/SamplePost.scss @@ -0,0 +1,41 @@ +/* + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +@import "app/ibz-mixins"; + + +.sample-box { + display: block; + height : 4.5rem; + + .sample-button { + float: right; + width: 5rem; + }; + + .muted-on-on,.muted-off-off{ + background: blueviolet; + }; + + .muted-error{ + background: red; + }; +}; + + + diff --git a/afb-client/app/Frontend/widgets/ActionButtons/ActionButtons.scss b/afb-client/app/Frontend/widgets/ActionButtons/ActionButtons.scss new file mode 100644 index 0000000..6cb8338 --- /dev/null +++ b/afb-client/app/Frontend/widgets/ActionButtons/ActionButtons.scss @@ -0,0 +1,40 @@ +/* + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +@import "app/ibz-mixins"; + +// place here your submit buttons customization +appli-button { + @include ibz-button(grey,1rem) + img { + height: 3rem; + } + + + .disable>i { + text-decoration:none; // really not needed for the Top Bar, just for general technique + cursor: auto; + color: grey !important; + } +} + +.appli-menu-start { + .start-start, .stop-stop { + i {color: grey;} + } +} diff --git a/afb-client/app/Frontend/widgets/ActionButtons/AppliButton.js b/afb-client/app/Frontend/widgets/ActionButtons/AppliButton.js new file mode 100644 index 0000000..269ee81 --- /dev/null +++ b/afb-client/app/Frontend/widgets/ActionButtons/AppliButton.js @@ -0,0 +1,205 @@ +/* + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * Bugs: Input with Callback SHOULD BE get 'required' class + */ + +(function () { + 'use strict'; + + var tmplAppli = '
' + + '' + + '{{label}}' + + '
'; + + var tmplModal = + '×' + + '' + + 'Application {{label}}' + + '' + + ''; + + var tmplDetail = + '×' + + '' + + 'Application {{label}}' + + '
    ' + + '
  • Name : {{detail.name}}
  • ' + + '
  • Description {{detail.description}}
  • ' + + '
  • Author : {{detail.author}}
  • ' + + '
' + + ''; + + angular.module('AppliButton', []) + .directive('appliButton', function (AppConfig, AppCall, ModalFactory, Notification, $timeout, $window, $location, urlquery) { + + function mymethods(scope, elem, attrs) { + scope.runstatus = "stop"; + scope.runmode = urlquery.runmode || "auto"; + scope.clicked = function () { + + var notifyError = function(action, response) { + Notification.error ({message: "Fail /api/afm-main" + action + "=" + scope.label + " RunID="+ scope.appID, delay: 5000}); + elem.addClass ("fail"); + elem.removeClass ("success"); + scope.callback (scope.appID, action, response); + }; + + var notifySuccess = function (action, response) { + elem.removeClass ("fail"); + scope.runID = response.data.response.runid; + scope.callback (scope.appID, action, response); + }; + + var closeModApp = function() { + scope.modApp.deactivate(); + $timeout (function() {scope.modApp.destroy();}, 1000); + }; + + var closeModInfo = function() { + scope.modInfo.deactivate(); + $timeout (function() {scope.modInfo.destroy();}, 1000); + }; + + var actionModal = function(action) { + console.log ("Modal Action=%s", action); + switch (action) { + + case "start": + if (scope.runstatus !== "stop") return; + AppCall.get ("afm-main", "start", {id: scope.appID, mode: scope.runmode}, function(response) { + if (response.status !== 200 || response.data.jtype !== "afb-reply") { + notifyError ("start", response); + return; + } + scope.runstatus="start"; + notifySuccess (action, response); + if(response.data.response.uri) + scope.winapp= $window.open(response.data.response.uri.replace("%h", $location.host())); + }); + break; + + case "stop": + if (scope.runstatus !== "start") return; + + AppCall.get ("afm-main", "terminate", {runid: scope.runID}, function(response) { + if (response.status !== 200 || response.data.jtype !== "afb-reply") { + notifyError ("stop", response); + return; + } + scope.runstatus="stop"; + + // if a remote window app was open let's close it + if (scope.winapp) { + console.log ("Closing Application Window label=%s id=%s", scope.label, scope.appID); + scope.winapp.close(); + scope.winapp=false; + } + notifySuccess (action, response); + }); + break; + + case "info": + AppCall.get ("afm-main", "detail", {id: scope.appID}, function(response) { + if (response.status !== 200 || response.data.jtype !== "afb-reply") { + notifyError ("detail", response); + return; + } + + // reference http://foundation.zurb.com/apps/docs/#!/angular-modules + var config = { + animationIn: 'slideInFromTop', + contentScope: { + close : closeModInfo, + icon : scope.icon, + label : scope.appID, + detail : response.data.response + }, template : tmplDetail + }; + // Popup Modal to render application data + scope.modInfo = new ModalFactory(config); + scope.modInfo.activate (); + + }); + break; + + case "uninstall": + if (scope.runstatus !== "stop") return; + AppCall.get ("afm-main", "uninstall", {id: scope.appID}, function(response) { + if (response.status !== 200 || response.data.jtype !== "afb-reply") { + notifyError ("uninstall", response); + return; + } + + notifySuccess (action, response); + }); + break; + + default: + console.log ("ActionModal unknown action=[%s]", action); + break; + } + + closeModApp(); + }; + + // reference http://foundation.zurb.com/apps/docs/#!/angular-modules + var config = { + animationIn: 'slideInFromTop', + contentScope: { + action : actionModal, + runstatus: scope.runstatus, + close : closeModApp, + icon : scope.icon, + label : scope.label + }, template : tmplModal + }; + // Popup Modal to render application data + scope.modApp = new ModalFactory(config); + scope.modApp.activate (); + }; + + // extract application information from AppID+Store + if (attrs.handle && scope.store [attrs.handle].name) { + scope.icon = AppConfig.paths.icons + attrs.handle; //scope.store [attrs.handle].name.toLowerCase() + '-ico.png'; + scope.label = scope.store [attrs.handle].name; + scope.appID= attrs.handle; + } else { + scope.icon = AppConfig.paths.icons + 'w3c-ico.png'; + scope.label = attrs.handle; + } + + // add label as class + elem.addClass (scope.label.toLowerCase()); + + // note: clicked in imported and when template is clicked + // it will call clicked method passed in param. + } + + return { + restrict: 'E', + template: tmplAppli, + link: mymethods, + scope: {callback: '=', store: '='} + }; + }); +})(); diff --git a/afb-client/app/Frontend/widgets/ActionButtons/SubmitButton.js b/afb-client/app/Frontend/widgets/ActionButtons/SubmitButton.js new file mode 100644 index 0000000..323cd46 --- /dev/null +++ b/afb-client/app/Frontend/widgets/ActionButtons/SubmitButton.js @@ -0,0 +1,52 @@ +/* + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * Bugs: Input with Callback SHOULD BE get 'required' class + */ + +(function () { + 'use strict'; + + var tmpl = '
' + + '' + + '{{label}}' + + '
'; + + angular.module('SubmitButton', []) + .directive('submitButton', function () { + + function mymethods(scope, elem, attrs) { + + // ajust icon or use default + scope.icon = attrs.icon || 'fi-foot'; + scope.label = attrs.label || 'Next'; + + // add label as class + elem.addClass (scope.label.toLowerCase()); + + // note: clicked in imported and when template is clicked + // it will call clicked method passed in param. + } + + return { + restrict: 'E', + template: tmpl, + link: mymethods, + scope: {clicked : '='} + }; + }); +})(); diff --git a/afb-client/app/Frontend/widgets/Buttons/SubmitButtons/SubmitButtons.js b/afb-client/app/Frontend/widgets/Buttons/SubmitButtons/SubmitButtons.js deleted file mode 100644 index cba2aeb..0000000 --- a/afb-client/app/Frontend/widgets/Buttons/SubmitButtons/SubmitButtons.js +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * Bugs: Input with Callback SHOULD BE get 'required' class - */ - -(function () { - 'use strict'; - - var tmpl = '
' + - '' + - '{{label}}' + - '
'; - - angular.module('SubmitButton', []) - .directive('submitButton', function () { - - function mymethods(scope, elem, attrs) { - - // ajust icon or use default - scope.icon = attrs.icon || 'fi-foot'; - scope.label = attrs.label || 'Next'; - - // add label as class - elem.addClass (scope.label.toLowerCase()); - - // note: clicked in imported and when template is clicked - // it will call clicked method passed in param. - } - - return { - restrict: 'E', - template: tmpl, - link: mymethods, - scope: {clicked : '='} - }; - }); -})(); diff --git a/afb-client/app/Frontend/widgets/Buttons/SubmitButtons/SubmitButtons.scss b/afb-client/app/Frontend/widgets/Buttons/SubmitButtons/SubmitButtons.scss deleted file mode 100644 index 2150e4d..0000000 --- a/afb-client/app/Frontend/widgets/Buttons/SubmitButtons/SubmitButtons.scss +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -@import "app/ibz-mixins"; - -// place here your submit buttons customization - diff --git a/afb-client/app/Frontend/widgets/FormInput/InputPassword.js b/afb-client/app/Frontend/widgets/FormInput/InputPassword.js deleted file mode 100644 index 157009c..0000000 --- a/afb-client/app/Frontend/widgets/FormInput/InputPassword.js +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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. - */ - -(function() { -'use strict'; - -var tmpl = '' + - '' + - ' '+ - ''; - -angular.module('InputPassword',[]) - -.directive('inputPassword', function() { - function mymethods(scope, elem, attrs) { - - scope.valid1 = function (name, value) { - console.log ("Clicked InputPassword1 name=%s value=%s", name, value); - scope.firstpwd = value; - }; - - scope.valid2 = function (name, value, done) { - console.log ("Clicked InputPassword2 name=%s value=%s", name, value); - - // if both passwd equal then call form CB - if (scope.firstpwd !== value) { - done({valid: false, status: 'invalid', errmsg: "both password should match"}); - } else { - scope.callback (attrs.name, value); - } - - }; - - // this method can be called from controller to update widget status - scope.done=function (data) { - console.log ("Text-Input Callback ID="+ attrs.name + " data=", data); - for (var i in data) scope[i] = data[i]; - }; - - // Export some attributes within directive scope for template - scope.name = attrs.name; - scope.label1 = attrs.label || 'Password'; - scope.label2 = attrs.label || 'Password Verification'; - scope.place1 = attrs.placeholder1 || 'User Password'; - scope.tip1 = attrs.tip || 'Choose a Password'; - scope.place2 = attrs.placeholder1 || 'Password Verification'; - scope.tip2 = attrs.tip || 'Confirme your Password'; - scope.minlen = attrs.minlen || 10; - - if ("required" in attrs) scope.required = 'required'; - - } - - return { - restrict: 'E', - template: tmpl, - link: mymethods, - scope: { - callback : '=', - } - }; -}); - -console.log ("InputPassword Loaded"); -})(); diff --git a/afb-client/app/Frontend/widgets/FormInput/InputText.js b/afb-client/app/Frontend/widgets/FormInput/InputText.js deleted file mode 100644 index 2653175..0000000 --- a/afb-client/app/Frontend/widgets/FormInput/InputText.js +++ /dev/null @@ -1,179 +0,0 @@ - -/* - * 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.. - */ - - - -(function() { -'use strict'; - -var tmpl = '' + - ''+ - '{{errmsg}}'; - -var emailpatern = /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i; - -angular.module('InputText',['JQueryEmu']) - -.directive('inputText', function(JQemu) { - function mymethods(scope, elem, attrs) { - - // default value at 1st rendering - scope.error = false; - scope.valid = false; - scope.status = 'untouch'; - - scope.input = elem.find ("input"); - scope.required = 0; - - // requirer is use to increment requested counter - if ("required" in attrs) { - scope.required = 1; - elem.addClass ("required"); - } - - // user enter input reset error status - scope.selected = function () { - scope.error=false; - scope.errmsg=false; - scope.status = 'touch'; - }; - - scope.validate = function () { - - // get value from input field bypassing Angular ng-model - console.log ("Clicked InputText name=%s value=%s valid=%s", scope.name, scope.value, scope.valid); - - // form is not untouched anymore - scope.parent.removeClass ("ng-pristine"); - - // if value not null clean up string - if (scope.value) { - scope.error=false; - // remove leading and trailling space - scope.value = scope.value.trim(); - - // remove any space is not allowed - if ('nospace' in attrs) { - scope.value=scope.value.replace(/\s/g, ''); - } - - if ('lowercase' in attrs) { - scope.value = scope.value.toLowerCase(); - } - - // check minimum lenght - if ("minlen" in attrs) { - if (scope.value.length < attrs.minlen) { - scope.status='invalid'; - scope.errmsg=scope.name + ': Mininum Lengh= ' + attrs.minlen + ' Characters'; - scope.error=true; - } - } - - if ('email' in attrs) { - if (!emailpatern.test (scope.value)) { - scope.status='invalid'; - scope.errmsg='invalid email address'; - scope.error=true; - } - } - - } else { - if (scope.required) { - scope.status='invalid'; - scope.errmsg=scope.name + ': Required Attribute'; - scope.error=true; - } - } - - // If local control fail let's refuse input - if (scope.error) { - if (scope.required && scope.valid) { - scope.valid = false; - if (scope.l4acounter.validated > 0) scope.l4acounter.validated --; - } - // use call to update form scope on form completeness - scope.callback (attrs.name, null, scope.done); - } else { - // localcheck is OK backup may nevertheless change status to false - if (scope.required && !scope.valid) scope.l4acounter.validated ++; - scope.status='valid'; - scope.valid=true; - scope.callback (attrs.name, scope.value, scope.done); - } - - }; - - // this method can be called from controller to update widget status - scope.done=function (data) { - console.log ("Text-Input Callback ID="+ attrs.name + " data=", data); - for (var i in data) scope[i] = data[i]; - }; - - // Export some attributes within directive scope for template - scope.label = attrs.label; - scope.name = attrs.name; - scope.placeholder = attrs.placeholder; - scope.type = attrs.type || "text"; - scope.tip = attrs.tip; - - // search for form within parent elemnts - scope.parent = JQemu.parent (elem, "FORM"); - - // email enforce lowercase and nospace - if ("email" in attrs) { - attrs.lowercase=true; - attrs.nospace=true; - attrs.minlen=6; - } - - if (scope.required) { - scope.l4acounter = scope.parent.data ("l4acounter"); - if (!scope.l4acounter) { - scope.l4acounter = {required:1, validated:0}; - console.log("Field "+scope.name+" is required (1st)"); - scope.parent.data ("l4acounter", scope.l4acounter); - } else { - console.log("Field "+scope.name+" is required"); - scope.l4acounter.required ++; - } - } - - // refresh validation each time controler update value - scope.$watch ('value', function(){ - if(scope.value) scope.validate(); } - ); - - } - - return { - restrict: 'E', - template: tmpl, - link: mymethods, - scope: { - callback : '=', - value: '=' - } - }; -}); - -console.log ("InputText Loaded"); -})(); diff --git a/afb-client/app/Frontend/widgets/FormInput/UploadFiles.js b/afb-client/app/Frontend/widgets/FormInput/UploadFiles.js index a23809f..90110c9 100644 --- a/afb-client/app/Frontend/widgets/FormInput/UploadFiles.js +++ b/afb-client/app/Frontend/widgets/FormInput/UploadFiles.js @@ -157,7 +157,7 @@ angular.module('UploadFiles',['AppConfig', 'ModalNotification', 'RangeSlider']) }; // Initiallize default values from attributes values - scope.name= attrs.name || 'avatar'; + scope.name= attrs.name || 'file'; scope.category= attrs.category || 'image'; scope.mimetype= (attrs.accept || 'image') + '/*'; scope.maxsize= attrs.maxsize || 100; // default max size 100KB diff --git a/afb-client/app/Frontend/widgets/Notifications/TokenRefreshSvc.js b/afb-client/app/Frontend/widgets/Notifications/TokenRefreshSvc.js index 3e5e8d6..4dee196 100644 --- a/afb-client/app/Frontend/widgets/Notifications/TokenRefreshSvc.js +++ b/afb-client/app/Frontend/widgets/Notifications/TokenRefreshSvc.js @@ -68,7 +68,7 @@ angular.module('TokenRefresh', ['AppConfig', 'ModalNotification']) scope.onsuccess = function(jresp, errcode) { if (errcode !== 200 || jresp.request.status !== "success") { - Notification.warning ({message: jresp.request.info, delay: 5000}); + Notification.warning ({message: "auto-connect :" + jresp.request.info, delay: 10000}); scope.offline(); return false; } @@ -111,7 +111,7 @@ angular.module('TokenRefresh', ['AppConfig', 'ModalNotification']) // Initial connection scope.loggin = function() { - AppCall.get (scope.plugin, "login", {token: AppConfig.session.initial}, function(jresp, errcode) { + AppCall.get (scope.plugin, "connect", {token: AppConfig.session.initial}, function(jresp, errcode) { if (!scope.onsuccess (jresp, errcode)) return; -- cgit 1.2.3-korg