[SYNCOPE-719] aligned virtual attributes to admin console's
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/ae05dee9 Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/ae05dee9 Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/ae05dee9 Branch: refs/heads/master Commit: ae05dee916c5f456ddca26edfd525fa7c119e1c2 Parents: 4d2cd5f Author: Andrea Patricelli <andrea.patrice...@tirasa.net> Authored: Wed Dec 30 12:17:46 2015 +0100 Committer: Andrea Patricelli <andrea.patrice...@tirasa.net> Committed: Wed Dec 30 12:17:46 2015 +0100 ---------------------------------------------------------------------- client/enduser/pom.xml | 4 - .../resources/META-INF/resources/app/index.html | 3 +- .../app/js/controllers/UserController.js | 46 +++--- .../js/directives/dynamicDerivedAttribute.js | 4 +- .../js/directives/dynamicVirtualAttribute.js | 165 +------------------ .../js/directives/dynamicVirtualAttributes.js | 23 +-- .../app/views/dynamicDerivedAttributes.html | 2 +- .../app/views/dynamicPlainAttributes.html | 2 +- .../app/views/dynamicVirtualAttribute.html | 63 +------ .../app/views/dynamicVirtualAttributes.html | 35 ++-- pom.xml | 12 -- 11 files changed, 59 insertions(+), 300 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/syncope/blob/ae05dee9/client/enduser/pom.xml ---------------------------------------------------------------------- diff --git a/client/enduser/pom.xml b/client/enduser/pom.xml index 372ac7a..24b27b8 100644 --- a/client/enduser/pom.xml +++ b/client/enduser/pom.xml @@ -129,10 +129,6 @@ under the License. </dependency> <dependency> <groupId>org.webjars.bower</groupId> - <artifactId>select2</artifactId> - </dependency> - <dependency> - <groupId>org.webjars.bower</groupId> <artifactId>FileSaver.js</artifactId> </dependency> http://git-wip-us.apache.org/repos/asf/syncope/blob/ae05dee9/client/enduser/src/main/resources/META-INF/resources/app/index.html ---------------------------------------------------------------------- diff --git a/client/enduser/src/main/resources/META-INF/resources/app/index.html b/client/enduser/src/main/resources/META-INF/resources/app/index.html index 8dd9961..493e629 100644 --- a/client/enduser/src/main/resources/META-INF/resources/app/index.html +++ b/client/enduser/src/main/resources/META-INF/resources/app/index.html @@ -69,7 +69,7 @@ under the License. <script src="../webjars/angular-cookies/${angular-cookies.version}/angular-cookies.js"></script> <script src="../webjars/angular-sanitize/${angular-sanitize.version}/angular-sanitize.js"></script> <script src="../webjars/angular-ui-bootstrap/${angular-ui-bootstrap.version}/ui-bootstrap-tpls.js"></script> - <!--<script src="../webjars/angular-ui-select/${angular-ui-select.version}/select.js"></script>--> + <script src="../webjars/angular-ui-select/${angular-ui-select.version}/select.js"></script> <script src="../webjars/angular-growl-2/${angular-growl-2.version}/angular-growl.js"></script> <script type="text/javascript" src="../webjars/bootstrap-select/${bootstrap-select.version}/js/bootstrap-select.min.js"></script> <script src="../webjars/FileSaver.js/${FileSaver.version}/FileSaver.js" type="text/javascript"></script> @@ -112,7 +112,6 @@ under the License. <link href="../webjars/ionicons/${ionicons.version}/css/ionicons.min.css" rel="stylesheet" type="text/css" /> <link href="../webjars/angular-ui-select/${angular-ui-select.version}/select.css" rel="stylesheet" type="text/css"/> <link href="../webjars/angular-growl-2/${angular-growl-2.version}/angular-growl.css" rel="stylesheet" type="text/css"/> - <!--<link href="../webjars/select2/${select2.version}/select2.css" rel="stylesheet" />--> <link href="css/app.css" rel="stylesheet" type="text/css" /> <link href="css/login.css" rel="stylesheet" type="text/css" /> <link href="css/editUser.css" rel="stylesheet" type="text/css" /> http://git-wip-us.apache.org/repos/asf/syncope/blob/ae05dee9/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 6bf7cb6..10fb3b7 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 @@ -45,10 +45,9 @@ angular.module("self").controller("UserController", ['$scope', '$rootScope', '$l plainSchemas: [], derSchemas: [], virSchemas: [], -// selectedDerSchemas: [], -// selectedVirSchemas: [], errorMessage: '', - attributeTable: {} + attributeTable: {}, + virtualAttributeTable: {} }; var initSchemas = function () { @@ -77,16 +76,14 @@ angular.module("self").controller("UserController", ['$scope', '$rootScope', '$l fields: [schemas.plainSchemas[i].key + "_" + 0] }; } - } else { + } else if (schemas.plainSchemas[i].multivalue) { // initialize multivalue schema and support table: update mode, all provided values - if (schemas.plainSchemas[i].multivalue) { - $scope.dynamicForm.attributeTable[schemas.plainSchemas[i].key] = { - fields: [schemas.plainSchemas[i].key + "_" + 0] - }; - // add other values - for (var j = 1; j < $scope.user.plainAttrs[plainSchemaKey].values.length; j++) { - $scope.dynamicForm.attributeTable[schemas.plainSchemas[i].key].fields.push(schemas.plainSchemas[i].key + "_" + j); - } + $scope.dynamicForm.attributeTable[schemas.plainSchemas[i].key] = { + fields: [schemas.plainSchemas[i].key + "_" + 0] + }; + // add other values + for (var j = 1; j < $scope.user.plainAttrs[plainSchemaKey].values.length; j++) { + $scope.dynamicForm.attributeTable[schemas.plainSchemas[i].key].fields.push(schemas.plainSchemas[i].key + "_" + j); } } } @@ -119,24 +116,19 @@ angular.module("self").controller("UserController", ['$scope', '$rootScope', '$l values: [], readonly: schemas.virSchemas[i].readonly }; - // initialize multivalue schema and support table: create mode, only first value -// if (schemas.plainSchemas[i].multivalue) { -// $scope.dynamicForm.attributeTable[schemas.plainSchemas[i].key] = { -// fields: [schemas.plainSchemas[i].key + "_" + 0] -// }; -// } + $scope.dynamicForm.virtualAttributeTable[schemas.virSchemas[i].key] = { + fields: [schemas.virSchemas[i].key + "_" + 0] + }; } else { // initialize multivalue schema and support table: update mode, all provided values -// if (schemas.virSchemas[i].multivalue) { -// $scope.dynamicForm.attributeTable[schemas.virSchemas[i].key] = { -// fields: [schemas.virSchemas[i].key + "_" + 0] -// }; -// // add other values -// for (var j = 1; j < $scope.user.plainAttrs[plainSchemaKey].values.length; j++) { -// $scope.dynamicForm.attributeTable[schemas.plainSchemas[i].key].fields.push(schemas.plainSchemas[i].key + "_" + j); -// } -// } + $scope.dynamicForm.virtualAttributeTable[schemas.virSchemas[i].key] = { + fields: [schemas.virSchemas[i].key + "_" + 0] + }; + // add other values + for (var j = 1; j < $scope.user.virAttrs[virSchemaKey].values.length; j++) { + $scope.dynamicForm.virtualAttributeTable[schemas.virSchemas[i].key].fields.push(schemas.virSchemas[i].key + "_" + j); + } } } http://git-wip-us.apache.org/repos/asf/syncope/blob/ae05dee9/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicDerivedAttribute.js ---------------------------------------------------------------------- diff --git a/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicDerivedAttribute.js b/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicDerivedAttribute.js index ff3f4e3..668c78c 100644 --- a/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicDerivedAttribute.js +++ b/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicDerivedAttribute.js @@ -19,7 +19,7 @@ 'use strict'; angular.module('self') - .directive('dynamicDerivedAttribute', function ($filter) { + .directive('dynamicDerivedAttribute', function () { return { restrict: 'E', templateUrl: 'views/dynamicDerivedAttribute.html', @@ -28,7 +28,7 @@ angular.module('self') index: "=", user: "=" }, - controller: function ($scope, $element, $window) { + controller: function ($scope) { $scope.$watch(function () { return $scope.user.derAttrs[$scope.schema.key].values[$scope.index]; }, function (newValue, oldValue) { http://git-wip-us.apache.org/repos/asf/syncope/blob/ae05dee9/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicVirtualAttribute.js ---------------------------------------------------------------------- diff --git a/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicVirtualAttribute.js b/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicVirtualAttribute.js index 5ee0d11..2dbe682 100644 --- a/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicVirtualAttribute.js +++ b/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicVirtualAttribute.js @@ -19,175 +19,20 @@ 'use strict'; angular.module('self') - .directive('dynamicAttribute', function ($filter) { + .directive('dynamicVirtualAttribute', function () { return { restrict: 'E', - templateUrl: 'views/dynamicPlainAttribute.html', + templateUrl: 'views/dynamicVirtualAttribute.html', scope: { schema: "=", index: "=", user: "=" }, - controller: function ($scope, $element, $window) { - $scope.initAttribute = function (schema, index) { - - switch (schema.type) { - case "Long": - case "Double": - $scope.user.plainAttrs[schema.key].values[index] = Number($scope.user.plainAttrs[schema.key].values[index]) - || undefined; - break; - case "Enum": - $scope.enumerationValues = []; - var enumerationValuesSplitted = schema.enumerationValues.toString().split(";"); - for (var i = 0; i < enumerationValuesSplitted.length; i++) { - $scope.enumerationValues.push(enumerationValuesSplitted[i]); - } - $scope.user.plainAttrs[schema.key].values[index] = $scope.user.plainAttrs[schema.key].values[index] - || $scope.enumerationValues[0]; - break; - case "Binary": - - $scope.userFile = $scope.userFile || ''; - //for multivalue fields -// $scope.fileInputId = "fileInputId_" + index; - - $element.bind("change", function (changeEvent) { - $scope.$apply(function () { - var reader = new FileReader(); - var file = changeEvent.target.files[0]; - $scope.userFile = file.name; - reader.onload = function (readerEvt) { - var binaryString = readerEvt.target.result; - $scope.user.plainAttrs[schema.key].values[index] = btoa(binaryString); - }; - reader.readAsBinaryString(file); - }); - }); - - $scope.download = function () { - var byteString = atob($scope.user.plainAttrs[schema.key].values[index]); - - var ab = new ArrayBuffer(byteString.length); - var ia = new Uint8Array(ab); - for (var i = 0; i < byteString.length; i++) { - ia[i] = byteString.charCodeAt(i); - } - - var blob = new Blob([ia], {type: schema.mimeType}); - - saveAs(blob, schema.key); - }; - $scope.remove = function () { - $scope.user.plainAttrs[schema.key].values.splice(index, 1); - $scope.userFile = ''; - $("#fileInput").replaceWith($("#fileInput").clone(true)); - }; - break; - case "Date": - - $scope.selectedDate = $scope.user.plainAttrs[schema.key].values[index]; - $scope.format = $scope.schema.conversionPattern; - $scope.includeTimezone = false; - if ($scope.schema.conversionPattern.indexOf(".SSS") > -1) { - $scope.format = $scope.format.replace(".SSS", ".sss"); - } - if ($scope.schema.conversionPattern.indexOf("Z") > -1) { - $scope.includeTimezone = true; - $scope.format = $scope.format.replace("Z", ""); - } - if ($scope.schema.conversionPattern.indexOf("\'") > -1) { - $scope.format = $scope.format.replace(new RegExp("\'", "g"), ""); - } - - $scope.bindDateToModel = function (selectedDate, format) { - var newFormat = $scope.includeTimezone ? format.concat(" Z") : format; - if (selectedDate) { - selectedDate = $filter('date')(selectedDate, newFormat); - var dateGood = selectedDate.toString(); - $scope.user.plainAttrs[schema.key].values[index] = dateGood; - } else { - $scope.user.plainAttrs[schema.key].values[index] = selectedDate; - } - }; - - $scope.clear = function () { - $scope.user.plainAttrs[schema.key].values[index] = null; - }; - - // Disable weekend selection - $scope.disabled = function (date, mode) { - // example if you want to disable weekends - // return (mode === 'day' && (date.getDay() === 0 || date.getDay() === 6)); - return false; - }; - - $scope.toggleMin = function () { - $scope.minDate = $scope.minDate ? null : new Date(); - }; - - $scope.maxDate = new Date(2050, 5, 22); - - $scope.open = function ($event) { - $scope.status.opened = true; - }; - - $scope.setDate = function (year, month, day) { - $scope.user.plainAttrs[schema.key].values[index] = new Date(year, month, day); - }; - - $scope.dateOptions = { - startingDay: 1 - }; - - $scope.status = { - opened: false - }; - - var tomorrow = new Date(); - tomorrow.setDate(tomorrow.getDate() + 1); - var afterTomorrow = new Date(); - afterTomorrow.setDate(tomorrow.getDate() + 2); - $scope.events = - [ - { - date: tomorrow, - status: 'full' - }, - { - date: afterTomorrow, - status: 'partially' - } - ]; - - $scope.getDayClass = function (date, mode) { - if (mode === 'day') { - var dayToCheck = new Date(date).setHours(0, 0, 0, 0); - - for (var i = 0; i < $scope.events.length; i++) { - var currentDay = new Date($scope.events[i].date).setHours(0, 0, 0, 0); - - if (dayToCheck === currentDay) { - return $scope.events[i].status; - } - } - } - - }; - break; - - case "Boolean": - $scope.user.plainAttrs[schema.key].values[index] = - Boolean($scope.user.plainAttrs[schema.key].values[index]) || false; - break; - - } - }; - + controller: function ($scope) { $scope.$watch(function () { - return $scope.user.plainAttrs[$scope.schema.key].values[$scope.index]; + return $scope.user.virAttrs[$scope.schema.key].values[$scope.index]; }, function (newValue, oldValue) { - $scope.user.plainAttrs[$scope.schema.key].values = $scope.user.plainAttrs[$scope.schema.key].values + $scope.user.virAttrs[$scope.schema.key].values = $scope.user.virAttrs[$scope.schema.key].values .filter(function (n) { return (n !== undefined && n !== ""); }); http://git-wip-us.apache.org/repos/asf/syncope/blob/ae05dee9/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 62c1591..460d300 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 @@ -29,24 +29,17 @@ angular.module('self') }, controller: function ($scope) { - $scope.addVirtualAttribute = function (item, model) { - var virSchemaKey = item.key; - console.log("ADDING VIRTUAL item: ", virSchemaKey); - $scope.user.virAttrs[virSchemaKey] = { - schema: virSchemaKey, - values: [], - readonly: false - }; - + $scope.addVirtualAttributeField = function (virSchemaKey) { + console.log("ADDING VIRTUAL: ", virSchemaKey + "_" + ($scope.dynamicForm.virtualAttributeTable[virSchemaKey].fields.length)); + $scope.dynamicForm.virtualAttributeTable[virSchemaKey].fields.push(virSchemaKey + "_" + ($scope.dynamicForm.virtualAttributeTable[virSchemaKey].fields.length)); }; - $scope.removeVirtualAttribute = function (item, model) { - var virSchemaKey = item.key; - console.log("REMOVING VIRTUAL item: ", virSchemaKey); - delete $scope.user.virAttrs[virSchemaKey]; - + $scope.removeVirtualAttributeField = function (virSchemaKey, index) { + console.log("REMOVING FROM: " + virSchemaKey + " VIRTUAL ATTRIBUTE INDEX: " + 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/ae05dee9/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 5807553..e58a8de 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 @@ -1,4 +1,4 @@ <div id="attribute" class="form-group" ng-repeat="derSchema in dynamicForm.derSchemas"> - <label for="derivedSchema.key">{{derSchema.key}} <span ng-if="Boolean(derSchema.mandatoryCondition) === 'true'">*</span></label> + <label for="derivedSchema.key">{{derSchema.key}}</label> <span uib-popover="{{derSchema.expression}}" popover-trigger="mouseenter" class="glyphicon glyphicon-question-sign"/> <dynamic-derived-attribute schema="derSchema" user="user" index="0"></dynamic-derived-attribute> </div> http://git-wip-us.apache.org/repos/asf/syncope/blob/ae05dee9/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 f7759b7..5d4bb40 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 @@ -1,5 +1,5 @@ <div id="attribute" class="form-group" ng-repeat="plainSchema in dynamicForm.plainSchemas"> - <label for="plainSchema.key">{{plainSchema.key}} <span ng-if="Boolean(plainSchema.mandatoryCondition)">*</span></label> + <label for="plainSchema.key">{{plainSchema.key}} <span ng-if="plainSchema.mandatoryCondition === 'true'">*</span></label> <div ng-if="!plainSchema.multivalue"> <dynamic-plain-attribute schema="plainSchema" user="user" index="0"></dynamic-plain-attribute> </div> http://git-wip-us.apache.org/repos/asf/syncope/blob/ae05dee9/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicVirtualAttribute.html ---------------------------------------------------------------------- diff --git a/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicVirtualAttribute.html b/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicVirtualAttribute.html index 9c6b1d9..826f249 100644 --- a/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicVirtualAttribute.html +++ b/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicVirtualAttribute.html @@ -1,58 +1,5 @@ -<div ng-switch="schema.type" > - <input ng-switch-when="String" class="form-control" type="text" - ng-model="user.plainAttrs[schema.key].values[index]" - ng-required="schema.mandatoryCondition" - ng-disabled="schema.readonly" ng-init="initAttribute(schema, index)"/> - <input ng-switch-when="Encrypted" class="form-control" type="text" - ng-model="user.plainAttrs[schema.key].values[index]" - ng-required="schema.mandatoryCondition" - ng-disabled="schema.readonly" ng-init="initAttribute(schema, index)"/> - <div ng-switch-when="Boolean"> - <input type="checkbox" ng-model="user.plainAttrs[schema.key].values[index]" ng-required="schema.mandatoryCondition" - ng-init="initAttribute(schema, index)" /> - </div> - <input ng-switch-when="Long" class="form-control" type="number" ng-model="user.plainAttrs[schema.key].values[index]" ng-required="schema.mandatoryCondition" - ng-init="initAttribute(schema, index)" /> - <input ng-switch-when="Double" class="form-control" type="number" ng-model="user.plainAttrs[schema.key].values[index]" ng-required="schema.mandatoryCondition" - ng-init="initAttribute(schema, index)" /> - <p ng-switch-when="Date" class="input-group" > - <input type="text" class="form-control" - uib-datepicker-popup="{{format}}" - ng-model="selectedDate" - ng-change="bindDateToModel(selectedDate, format)" - min-date="minDate" max-date="maxDate" - is-open="status.opened" datepicker-options="dateOptions" - ng-required="schema.mandatoryCondition" close-text="Close" ng-init="initAttribute(schema, index)"/> - <span class="input-group-btn"> - <button type="button" class="btn btn-default" ng-click="open($event)"><i class="glyphicon glyphicon-calendar"></i></button> - </span> - </p> - - <div ng-switch-when="Enum" ng-init="initAttribute(schema, index)"> - <select class="form-control" - ng-model="user.plainAttrs[schema.key].values[index]" - ng-required="schema.mandatoryCondition"> - <option ng-repeat="value in enumerationValues" value="{{value}}">{{schema.enumerationKeys[$index] || value}}</option> - </select> - </div> - - <div ng-switch-when="Binary" ng-init="initAttribute(schema, index)"> - <div enctype="multipart/form-data" accept-charset="UTF-8"> - <input id="fileInput" type="file" ng-required="schema.mandatoryCondition"/> - <button type="button" title="Download file" class="fileButton btn btn-default btn-sm" ng-click="download()"> - <i class="glyphicon glyphicon-download" ></i> - </button> - <button type="button" class="fileButton btn btn-default btn-sm" title="Remove file" ng-click="remove()"> - <i class="glyphicon glyphicon-remove-sign" ></i> - </button> - <h4><span class="label label-primary" ng-model="userFile">{{userFile}}</span></h4> - </div> - - </div> - - <input ng-switch-default class="form-control" type="text" - ng-model="user.plainAttrs[schema.key].values[index]" - ng-required="schema.mandatoryCondition" - ng-disabled="schema.readonly" ng-init="initAttribute(schema, index)"/> - -</div> +<div> + <input class="form-control" type="text" + ng-model="user.virAttrs[schema.key].values[index]" + ng-disabled="schema.readonly"/> +</div> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/syncope/blob/ae05dee9/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicVirtualAttributes.html ---------------------------------------------------------------------- diff --git a/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicVirtualAttributes.html b/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicVirtualAttributes.html index 897eb2c..1334611 100644 --- a/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicVirtualAttributes.html +++ b/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicVirtualAttributes.html @@ -1,18 +1,17 @@ -<ui-select on-select="addVirtualAttribute($item, $model)" on-remove="removeVirtualAttribute($item, $model)" multiple - ng-model="dynamicForm.selectedVirSchemas" theme="select2" ng-disabled="false" class="attribute-ui-select"> - <ui-select-match placeholder="Select virtual attribute...">{{$item.key}}</ui-select-match> - <ui-select-choices repeat="virSchema in dynamicForm.virSchemas | propsFilter: {key: $select.search}"> - <div ng-bind-html="virSchema.key | highlight: $select.search"></div> - </ui-select-choices> -</ui-select> - -<ul class="attribute-virtual-value-container"> - <li class="attribute-virtual-value-field" ng-repeat="selectedVirSchema in dynamicForm.selectedVirSchemas| filter:q as results"> - {{selectedVirSchema.key}} - <input style="font-weight: normal" class="form-control" type="text" ng-disabled="selectedVirSchema.readonly" - ng-model="user.virAttrs[selectedVirSchema.key].values[0]"/> - </li> - <li class="attribute-virtual-value-field" ng-if="results.length == 0"> - <strong>No virtual attributes selected...</strong> - </li> -</ul> \ No newline at end of file +<div id="attribute" class="form-group" ng-repeat="virtualSchema in dynamicForm.virSchemas"> + <label for="virtualSchema.key">{{virtualSchema.key}}</label> + <!--all virtual schemas are multivalue--> + <div ng-repeat="field in dynamicForm.virtualAttributeTable[virtualSchema.key].fields track by $index" ng-model='dynamicForm.virtualAttributeTable[virtualSchema.key].fields[$index]'> + <dynamic-virtual-attribute schema="virtualSchema" user="user" index="$index"></dynamic-virtual-attribute> + <span> + <button class="btn btn-default btn-sm minus" ng-if="$index > 0" type="button" ng-click="removeVirtualAttributeField(virtualSchema.key, $index)"> + <i class="glyphicon glyphicon-minus" title="Remove value"></i> + </button> + </span> + </div> + <span> + <button class="btn btn-default btn-sm" type="button" ng-click="addVirtualAttributeField(virtualSchema.key)"> + <i class="glyphicon glyphicon-plus" title="Add value"></i> + </button> + </span> +</div> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/syncope/blob/ae05dee9/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 18d3781..ca492fd 100644 --- a/pom.xml +++ b/pom.xml @@ -402,7 +402,6 @@ under the License. <angular-ui-select.version>0.13.1</angular-ui-select.version> <angular-sanitize.version>1.4.8</angular-sanitize.version> <angular-growl-2.version>0.7.3</angular-growl-2.version> - <select2.version>3.4.8</select2.version> <FileSaver.version>0.0.2</FileSaver.version> <izpack.version>5.0.6</izpack.version> @@ -1080,17 +1079,6 @@ under the License. </dependency> <dependency> <groupId>org.webjars.bower</groupId> - <artifactId>select2</artifactId> - <version>${select2.version}</version> - <exclusions> - <exclusion> - <groupId>org.webjars.bower</groupId> - <artifactId>jquery</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.webjars.bower</groupId> <artifactId>FileSaver.js</artifactId> <version>${FileSaver.version}</version> </dependency>