You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by ma...@apache.org on 2016/08/05 12:06:47 UTC
syncope git commit: [SYNCOPE-872] shows type extensions in user form
grouped in distinct accordions
Repository: syncope
Updated Branches:
refs/heads/master 0e3ad3cf6 -> 9cc78981f
[SYNCOPE-872] shows type extensions in user form grouped in distinct accordions
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/9cc78981
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/9cc78981
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/9cc78981
Branch: refs/heads/master
Commit: 9cc78981f944546ee32e5968def5b0bb1e2f5241
Parents: 0e3ad3c
Author: Matteo Di Carlo <ma...@tirasa.net>
Authored: Fri Aug 5 14:06:28 2016 +0200
Committer: Matteo Di Carlo <ma...@tirasa.net>
Committed: Fri Aug 5 14:06:28 2016 +0200
----------------------------------------------------------------------
.../app/js/controllers/UserController.js | 15 +++-
.../js/directives/dynamicDerivedAttributes.js | 21 +++--
.../app/js/directives/dynamicPlainAttributes.js | 90 ++++++++++----------
.../js/directives/dynamicVirtualAttributes.js | 86 ++++++++++---------
.../app/views/dynamicDerivedAttributes.html | 2 +-
.../app/views/dynamicPlainAttributes.html | 2 +-
6 files changed, 119 insertions(+), 97 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/9cc78981/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 f0e2ec5..4995e26 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
@@ -69,7 +69,7 @@ angular.module("self").controller("UserController", ['$scope', '$rootScope', '$l
schemaService = SchemaService.getUserSchemas(anyTypeClass);
}
schemaService.then(function (schemas) {
- if(group && ( schemas.plainSchemas.length > 0 || schemas.derSchemas.length > 0 || schemas.virSchemas.length > 0))
+ if (group && (schemas.plainSchemas.length > 0 || schemas.derSchemas.length > 0 || schemas.virSchemas.length > 0))
$scope.dynamicForm.groupSchemas.push(group);
//initializing user schemas values
initSchemaValues(schemas);
@@ -264,17 +264,26 @@ angular.module("self").controller("UserController", ['$scope', '$rootScope', '$l
};
var removeUserSchemas = function (anyTypeClass, group) {
+
+ //removing plain groupSchemas
+ for (var i = 0; i < $scope.dynamicForm.groupSchemas.length; i++) {
+ if ($scope.dynamicForm.groupSchemas[i] === group) {
+ $scope.dynamicForm.groupSchemas.splice(i, 1);
+ i--;
+ }
+ }
+
//removing plain schemas
for (var i = 0; i < $scope.dynamicForm.plainSchemas.length; i++) {
- if ((anyTypeClass && $scope.dynamicForm.plainSchemas[i].anyTypeClass == anyTypeClass)
+ if ((anyTypeClass && $scope.dynamicForm.plainSchemas[i].anyTypeClass === anyTypeClass)
|| (group && $scope.dynamicForm.plainSchemas[i].key.includes(group + '#'))) {
-
//cleaning both form and user model
delete $scope.user.plainAttrs[$scope.dynamicForm.plainSchemas[i].key];
$scope.dynamicForm.plainSchemas.splice(i, 1);
i--;
}
}
+
//removing derived schemas
for (var i = 0; i < $scope.dynamicForm.derSchemas.length; i++) {
if ((anyTypeClass && $scope.dynamicForm.derSchemas[i].anyTypeClass == anyTypeClass)
http://git-wip-us.apache.org/repos/asf/syncope/blob/9cc78981/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicDerivedAttributes.js
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicDerivedAttributes.js b/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicDerivedAttributes.js
index 7898767..79869b0 100644
--- a/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicDerivedAttributes.js
+++ b/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicDerivedAttributes.js
@@ -32,18 +32,23 @@ angular.module('self')
user: "="
},
controller: function ($scope) {
- $scope.getByGroup = function (schema) {
+
+ $scope.getByGroup = function (group) {
var currentDerivedSchemas = new Array();
for (var i = 0; i < $scope.dynamicForm.derSchemas.length; i++) {
- if (schema == "own" && $scope.dynamicForm.derSchemas[i].key.indexOf('#') == -1) {
- var attr = $scope.dynamicForm.derSchemas[i];
+ var attr = $scope.dynamicForm.derSchemas[i];
+ if (group === "own" && $scope.dynamicForm.derSchemas[i].key.indexOf('#') == -1) {
attr.simpleKey = $scope.dynamicForm.derSchemas[i].key;
- currentDerivedSchemas.push($scope.dynamicForm.derSchemas[i]);
- }
- if ($scope.dynamicForm.derSchemas[i].key.indexOf(schema) > -1) {
- var attr = $scope.dynamicForm.derSchemas[i];
- attr.simpleKey = $scope.dynamicForm.derSchemas[i].key.substring($scope.dynamicForm.derSchemas[i].key.indexOf("#") + 1);
currentDerivedSchemas.push(attr);
+ } else {
+ var prefix = $scope.dynamicForm.derSchemas[i].key.substr
+ (0, $scope.dynamicForm.derSchemas[i].key.indexOf('#'));
+ if (prefix === group)
+ {
+ var shaPosition = $scope.dynamicForm.derSchemas[i].key.indexOf("#") + 1;
+ attr.simpleKey = $scope.dynamicForm.derSchemas[i].key.substring(shaPosition);
+ currentDerivedSchemas.push(attr);
+ }
}
}
return currentDerivedSchemas;
http://git-wip-us.apache.org/repos/asf/syncope/blob/9cc78981/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicPlainAttributes.js
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicPlainAttributes.js b/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicPlainAttributes.js
index a4014e9..7f39147 100644
--- a/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicPlainAttributes.js
+++ b/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicPlainAttributes.js
@@ -20,52 +20,56 @@
angular.module('self')
.directive('dynamicPlainAttributes', function () {
- var getTemplateUrl = function () {
- return 'views/dynamicPlainAttributes.html';
- };
- return {
- restrict: 'E',
- templateUrl: getTemplateUrl(),
- scope: {
- dynamicForm: "=form",
- user: "="
- },
- controller: function ($scope) {
-
- $scope.getByGroup = function (schema) {
- var currentPlainSchemas = new Array();
- for (var i = 0; i < $scope.dynamicForm.plainSchemas.length; i++) {
- if (schema == "own" && $scope.dynamicForm.plainSchemas[i].key.indexOf('#') == -1) {
- var attr = $scope.dynamicForm.plainSchemas[i];
- attr.simpleKey = $scope.dynamicForm.plainSchemas[i].key;
- currentPlainSchemas.push($scope.dynamicForm.plainSchemas[i]);
- }
- if ($scope.dynamicForm.plainSchemas[i].key.indexOf(schema) > -1) {
- var attr = $scope.dynamicForm.plainSchemas[i];
- attr.simpleKey = $scope.dynamicForm.plainSchemas[i].key.substring($scope.dynamicForm.plainSchemas[i].key.indexOf("#") + 1);
+ var getTemplateUrl = function () {
+ return 'views/dynamicPlainAttributes.html';
+ };
+ return {
+ restrict: 'E',
+ templateUrl: getTemplateUrl(),
+ scope: {
+ dynamicForm: "=form",
+ user: "="
+ },
+ controller: function ($scope) {
+
+ $scope.getByGroup = function (group) {
+ var currentPlainSchemas = new Array();
+ for (var i = 0; i < $scope.dynamicForm.plainSchemas.length; i++) {
+ var attr = $scope.dynamicForm.plainSchemas[i];
+ if (group === "own" && $scope.dynamicForm.plainSchemas[i].key.indexOf('#') == -1) {
+ attr.simpleKey = $scope.dynamicForm.plainSchemas[i].key;
+ currentPlainSchemas.push(attr);
+ } else {
+ var prefix = $scope.dynamicForm.plainSchemas[i].key.substr
+ (0, $scope.dynamicForm.plainSchemas[i].key.indexOf('#'));
+ if (prefix === group)
+ {
+ var shaPosition = $scope.dynamicForm.plainSchemas[i].key.indexOf("#") + 1;
+ attr.simpleKey = $scope.dynamicForm.plainSchemas[i].key.substring(shaPosition);
currentPlainSchemas.push(attr);
}
}
- return currentPlainSchemas;
- };
+ }
+ return currentPlainSchemas;
+ };
- $scope.addAttributeField = function (plainSchemaKey) {
- console.debug("Add PLAIN value:", plainSchemaKey);
- console.debug(" ", ($scope.dynamicForm.attributeTable[plainSchemaKey].fields.length));
- $scope.dynamicForm.attributeTable[plainSchemaKey].fields.push(plainSchemaKey + "_" + ($scope.dynamicForm.attributeTable[plainSchemaKey].fields.length));
- };
+ $scope.addAttributeField = function (plainSchemaKey) {
+ console.debug("Add PLAIN value:", plainSchemaKey);
+ console.debug(" ", ($scope.dynamicForm.attributeTable[plainSchemaKey].fields.length));
+ $scope.dynamicForm.attributeTable[plainSchemaKey].fields.push(plainSchemaKey + "_" + ($scope.dynamicForm.attributeTable[plainSchemaKey].fields.length));
+ };
- $scope.removeAttributeField = function (plainSchemaKey, index) {
- console.debug("Remove PLAIN value:", plainSchemaKey);
- console.debug("attribute index:", index);
- $scope.dynamicForm.attributeTable[plainSchemaKey].fields.splice(index, 1);
- // clean user model
- $scope.user.plainAttrs[plainSchemaKey].values.splice(index, 1);
- };
+ $scope.removeAttributeField = function (plainSchemaKey, index) {
+ console.debug("Remove PLAIN value:", plainSchemaKey);
+ console.debug("attribute index:", index);
+ $scope.dynamicForm.attributeTable[plainSchemaKey].fields.splice(index, 1);
+ // clean user model
+ $scope.user.plainAttrs[plainSchemaKey].values.splice(index, 1);
+ };
- $scope.getTemplateUrl = function () {
- return "views/dynamicPlainAttributes.html";
- };
- }
- };
- });
+ $scope.getTemplateUrl = function () {
+ return "views/dynamicPlainAttributes.html";
+ };
+ }
+ };
+ });
http://git-wip-us.apache.org/repos/asf/syncope/blob/9cc78981/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicVirtualAttributes.js
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicVirtualAttributes.js b/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicVirtualAttributes.js
index 6b08320..5e13233 100644
--- a/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicVirtualAttributes.js
+++ b/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicVirtualAttributes.js
@@ -21,48 +21,52 @@
angular.module('self')
.directive('dynamicVirtualAttributes', function () {
- var getTemplateUrl = function () {
- return 'views/dynamicVirtualAttributes.html';
- };
- return {
- restrict: 'E',
- templateUrl: getTemplateUrl(),
- scope: {
- dynamicForm: "=form",
- user: "="
- },
- controller: function ($scope) {
-
- $scope.getByGroup = function (schema) {
- var currentVirSchemas = new Array();
- for (var i = 0; i < $scope.dynamicForm.virSchemas.length; i++) {
- if (schema == "own" && $scope.dynamicForm.virSchemas[i].key.indexOf('#') == -1) {
- var attr = $scope.dynamicForm.virSchemas[i];
- attr.simpleKey = $scope.dynamicForm.virSchemas[i].key;
- currentVirSchemas.push($scope.dynamicForm.virSchemas[i]);
- }
- if ($scope.dynamicForm.virSchemas[i].key.indexOf(schema) > -1) {
- var attr = $scope.dynamicForm.virSchemas[i];
- attr.simpleKey = $scope.dynamicForm.virSchemas[i].key.substring($scope.dynamicForm.virSchemas[i].key.indexOf("#") + 1);
- currentVirSchemas.push(attr);
+ var getTemplateUrl = function () {
+ return 'views/dynamicVirtualAttributes.html';
+ };
+ return {
+ restrict: 'E',
+ templateUrl: getTemplateUrl(),
+ scope: {
+ dynamicForm: "=form",
+ user: "="
+ },
+ controller: function ($scope) {
+
+ $scope.getByGroup = function (group) {
+ var currentVirtualSchemas = new Array();
+ for (var i = 0; i < $scope.dynamicForm.virSchemas.length; i++) {
+ var attr = $scope.dynamicForm.virSchemas[i];
+ if (group === "own" && $scope.dynamicForm.virSchemas[i].key.indexOf('#') == -1) {
+ attr.simpleKey = $scope.dynamicForm.virSchemas[i].key;
+ currentVirtualSchemas.push(attr);
+ } else {
+ var prefix = $scope.dynamicForm.virSchemas[i].key.substr
+ (0, $scope.dynamicForm.virSchemas[i].key.indexOf('#'));
+ if (prefix === group)
+ {
+ var shaPosition = $scope.dynamicForm.virSchemas[i].key.indexOf("#") + 1;
+ attr.simpleKey = $scope.dynamicForm.virSchemas[i].key.substring(shaPosition);
+ currentVirtualSchemas.push(attr);
}
}
- return currentVirSchemas;
- };
+ }
+ return currentVirtualSchemas;
+ };
- $scope.addVirtualAttributeField = function (virSchemaKey) {
- console.debug("Add VIRTUAL value:", virSchemaKey);
- console.debug(" ", ($scope.dynamicForm.virtualAttributeTable[virSchemaKey].fields.length));
- $scope.dynamicForm.virtualAttributeTable[virSchemaKey].fields.push(virSchemaKey + "_" + ($scope.dynamicForm.virtualAttributeTable[virSchemaKey].fields.length));
- };
+ $scope.addVirtualAttributeField = function (virSchemaKey) {
+ console.debug("Add VIRTUAL value:", virSchemaKey);
+ console.debug(" ", ($scope.dynamicForm.virtualAttributeTable[virSchemaKey].fields.length));
+ $scope.dynamicForm.virtualAttributeTable[virSchemaKey].fields.push(virSchemaKey + "_" + ($scope.dynamicForm.virtualAttributeTable[virSchemaKey].fields.length));
+ };
- $scope.removeVirtualAttributeField = function (virSchemaKey, index) {
- console.debug("Remove VIRTUAL value: ", virSchemaKey);
- console.debug("Remove VIRTUAL value: ", index);
- $scope.dynamicForm.virtualAttributeTable[virSchemaKey].fields.splice(index, 1);
- // clean user model
- $scope.user.virAttrs[virSchemaKey].values.splice(index, 1);
- };
- }
- };
- });
+ $scope.removeVirtualAttributeField = function (virSchemaKey, index) {
+ console.debug("Remove VIRTUAL value: ", virSchemaKey);
+ console.debug("Remove VIRTUAL value: ", index);
+ $scope.dynamicForm.virtualAttributeTable[virSchemaKey].fields.splice(index, 1);
+ // clean user model
+ $scope.user.virAttrs[virSchemaKey].values.splice(index, 1);
+ };
+ }
+ };
+ });
http://git-wip-us.apache.org/repos/asf/syncope/blob/9cc78981/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicDerivedAttributes.html
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicDerivedAttributes.html b/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicDerivedAttributes.html
index baf1227..c64fcbb 100644
--- a/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicDerivedAttributes.html
+++ b/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicDerivedAttributes.html
@@ -17,7 +17,7 @@ specific language governing permissions and limitations
under the License.
-->
<div ng-repeat="groupSchema in dynamicForm.groupSchemas">
- <uib-accordion>
+ <uib-accordion ng-if="getByGroup(groupSchema).length > 0">
<div uib-accordion-group heading="{{groupSchema| translate}}"
ng-init="status = {isOpen: (groupSchema == 'own')}" is-open="status.isOpen"
class="breadcrumb-header">
http://git-wip-us.apache.org/repos/asf/syncope/blob/9cc78981/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicPlainAttributes.html
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicPlainAttributes.html b/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicPlainAttributes.html
index 81ebc6d..8a21985 100644
--- a/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicPlainAttributes.html
+++ b/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicPlainAttributes.html
@@ -18,7 +18,7 @@ under the License.
-->
<div ng-repeat="groupSchema in dynamicForm.groupSchemas">
- <uib-accordion>
+ <uib-accordion ng-if="getByGroup(groupSchema).length > 0">
<div uib-accordion-group heading="{{groupSchema| translate}}"
ng-init="status = {isOpen: (groupSchema == 'own')}" is-open="status.isOpen"
class="breadcrumb-header">