Repository: syncope Updated Branches: refs/heads/2_0_X d7d1f8245 -> ef1d815da
Revert "[SYNCOPE-941] adds dynamic configuration screens to enduser" This reverts commit 6ba24ed077746fe4f69595f782e1358ab23cb37c. Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/ef1d815d Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/ef1d815d Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/ef1d815d Branch: refs/heads/2_0_X Commit: ef1d815dadd4831fe1a2834354849252a348f9ca Parents: d7d1f82 Author: Matteo Di Carlo <[email protected]> Authored: Fri Oct 7 15:58:53 2016 +0200 Committer: Matteo Di Carlo <[email protected]> Committed: Fri Oct 7 15:58:53 2016 +0200 ---------------------------------------------------------------------- .../resources/META-INF/resources/app/js/app.js | 15 ++-- .../app/js/controllers/UserController.js | 41 ++-------- .../app/js/directives/navigationButtons.js | 84 ++++++++++---------- 3 files changed, 57 insertions(+), 83 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/syncope/blob/ef1d815d/client/enduser/src/main/resources/META-INF/resources/app/js/app.js ---------------------------------------------------------------------- diff --git a/client/enduser/src/main/resources/META-INF/resources/app/js/app.js b/client/enduser/src/main/resources/META-INF/resources/app/js/app.js index 5984f21..5bffed2 100644 --- a/client/enduser/src/main/resources/META-INF/resources/app/js/app.js +++ b/client/enduser/src/main/resources/META-INF/resources/app/js/app.js @@ -256,7 +256,6 @@ app.config(['$stateProvider', '$urlRouterProvider', '$httpProvider', '$translate }; }); }]); - app.run(['$rootScope', '$location', '$state', 'AuthService', function ($rootScope, $location, $state, AuthService) { // main program @@ -421,12 +420,16 @@ app.controller('ApplicationController', ['$scope', '$rootScope', 'InfoService', $scope.$on('hideErrorMessage', function (event, popupMessage) { $scope.hideError(popupMessage, $scope.notification); }); - - $rootScope.wizard = { - "credentials": "/credentials", - "groups": "/groups" + //wizard active element + $scope.wizard = { + "credentials": {url: "/credentials"}, + "groups": {url: "/groups"}, + "plainSchemas": {url: "/plainSchemas"}, + "derivedSchemas": {url: "/derivedSchemas"}, + "virtualSchemas": {url: "/virtualSchemas"}, + "resources": {url: "/resources"}, + "finish": {url: "/finish"} }; - $scope.clearCache = function () { $templateCache.removeAll(); }; http://git-wip-us.apache.org/repos/asf/syncope/blob/ef1d815d/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/UserController.js ---------------------------------------------------------------------- diff --git a/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/UserController.js b/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/UserController.js index 5047c06..ebf5c81 100644 --- a/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/UserController.js +++ b/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/UserController.js @@ -17,7 +17,7 @@ * under the License. */ -/* global message, component, $state, rootScope, $q */ +/* global message, component, $state, rootScope */ 'use strict'; @@ -73,7 +73,6 @@ angular.module("self").controller("UserController", ['$scope', '$rootScope', '$l $scope.dynamicForm.groupSchemas.push(group); //initializing user schemas values initSchemaValues(schemas); - initWizard(); }, function (response) { var errorMessage; // parse error response @@ -85,26 +84,6 @@ angular.module("self").controller("UserController", ['$scope', '$rootScope', '$l }); }; - var initWizard = function () { - $rootScope.wizard = { - "credentials": "/credentials", - "groups": "/groups" - }; - if ($scope.dynamicForm.plainSchemas.length > 0) { - $rootScope.wizard["plainSchemas"] = "/plainSchemas"; - } - if ($scope.dynamicForm.derSchemas.length > 0) { - $rootScope.wizard["derivedSchemas"] = "/derivedSchemas"; - } - if ($scope.dynamicForm.virSchemas.length > 0) { - $rootScope.wizard["virtualSchemas"] = "/virtualSchemas"; - } - if ($scope.dynamicForm.resources.length > 0) { - $rootScope.wizard["resources"] = "/resources"; - } - $rootScope.wizard["finish"] = "/finish"; - }; - var initSchemaValues = function (schemas) { // initialize plain attributes for (var i = 0; i < schemas.plainSchemas.length; i++) { @@ -203,7 +182,6 @@ angular.module("self").controller("UserController", ['$scope', '$rootScope', '$l $scope.dynamicForm.resources.push(response[i].key); } $scope.dynamicForm.resources.sort(); - initWizard(); }); }; @@ -265,11 +243,11 @@ angular.module("self").controller("UserController", ['$scope', '$rootScope', '$l UserSelfService.read().then(function (response) { $scope.user = UserUtil.getUnwrappedUser(response); $scope.user.password = undefined; - + $scope.initialSecurityQuestion = $scope.user.securityQuestion; // initialize already assigned resources $scope.dynamicForm.selectedResources = $scope.user.resources; - + // initialize already assigned groups -- keeping the same structure of groups for (var index in $scope.user.memberships) { $scope.dynamicForm.selectedGroups.push( @@ -355,18 +333,9 @@ angular.module("self").controller("UserController", ['$scope', '$rootScope', '$l initUserSchemas(null, group); }); - $scope.$on('addFinish', function (event) { - $rootScope.wizard.finish = { - url: "/finish" - }; - }); - - - $scope.$on('groupRemoved', function (event, group) { if (group) removeUserSchemas(null, group); - initWizard(); }); if ($scope.createMode) { @@ -440,7 +409,7 @@ angular.module("self").controller("UserController", ['$scope', '$rootScope', '$l }); } }; - + $scope.retrieveSecurityQuestion = function (user) { if ($rootScope.pwdResetRequiringSecurityQuestions) { if (user && user.username && user.username.length) { @@ -462,7 +431,7 @@ angular.module("self").controller("UserController", ['$scope', '$rootScope', '$l } } }; - + $scope.resetPassword = function (user) { if (user && user.username) { $scope.retrieveSecurityQuestion(user); http://git-wip-us.apache.org/repos/asf/syncope/blob/ef1d815d/client/enduser/src/main/resources/META-INF/resources/app/js/directives/navigationButtons.js ---------------------------------------------------------------------- diff --git a/client/enduser/src/main/resources/META-INF/resources/app/js/directives/navigationButtons.js b/client/enduser/src/main/resources/META-INF/resources/app/js/directives/navigationButtons.js index 3dcb70b..d8b6986 100644 --- a/client/enduser/src/main/resources/META-INF/resources/app/js/directives/navigationButtons.js +++ b/client/enduser/src/main/resources/META-INF/resources/app/js/directives/navigationButtons.js @@ -19,52 +19,54 @@ 'use strict'; angular.module('self') - .directive('navigationButtons', ['$state', '$rootScope', 'GenericUtil', 'ValidationExecutor', function ($state, $rootScope, GenericUtil, ValidationExecutor) { - return { - restrict: 'E', - templateUrl: 'views/navigationButtons.html', - scope: { + .directive('navigationButtons', ['$state', 'GenericUtil', 'ValidationExecutor', function ($state, GenericUtil, ValidationExecutor) { + return { + restrict: 'E', + templateUrl: 'views/navigationButtons.html', + scope: { base: "@", - current: "@" - }, - link: function (scope, element, attrs) { + current: "@" + }, + link: function (scope, element, attrs) { var base = (scope.base && scope.base != "" ? scope.base + "." : ""); - $rootScope.wizard = scope.$eval(attrs.wizard) || scope.$parent.wizard; - scope.previous = "none"; - if ($rootScope.wizard) { - var urls = Object.keys($rootScope.wizard); - var index = urls.indexOf(scope.current); - scope.previous = (index > 0 ? base + urls[index - 1] : scope.previous = "none"); - scope.next = (index < urls.length - 1 ? base + urls[index + 1] : scope.next = "none"); + scope.wizard = scope.$eval(attrs.wizard) || scope.$parent.wizard; + scope.previous = "none"; + if (scope.wizard) { + var urls = Object.keys(scope.wizard); + var index = urls.indexOf(scope.current); + scope.previous = (index > 0 ? base + urls[index - 1] : scope.previous = "none"); + scope.next = (index < urls.length - 1 ? base + urls[index + 1] : scope.next = "none"); } - }, - controller: function ($scope) { + }, + controller: function ($scope) { $scope.validateAndNext = function (event, state) { - //getting the enclosing form in order to access to its name - var currentForm = GenericUtil.getEnclosingForm(event.target); - if (currentForm != null) { - if (ValidationExecutor.validate(currentForm, $scope.$parent)) { - if (state) { - $scope.nextTab(state); - } else if ($rootScope.wizard) { - $scope.nextTab($scope.next); - } - } - } + //getting the enclosing form in order to access to its name + var currentForm = GenericUtil.getEnclosingForm(event.target); + if (currentForm != null) { + if (ValidationExecutor.validate(currentForm, $scope.$parent)) { + if (state) { + $scope.nextTab(state); + } else if ($scope.wizard) { + $scope.nextTab($scope.next); + } + } + } + + }; + + $scope.nextTab = function (state) { + //change route through parent event + console.log("State: ", state); + $state.go(state); + }; + $scope.previousTab = function () { + //change route through parent event + $state.go($scope.previous); }; - $scope.nextTab = function (state) { - //change route through parent event - console.log("State: ", state); - $state.go(state); - }; - $scope.previousTab = function () { - //change route through parent event - $state.go($scope.previous); - }; - } + } - } - ; - }]); + } + ; + }]);
