Combination in manager in progress (#1151)

This commit is contained in:
Xavier Guimard 2017-02-06 17:40:17 +00:00
parent 2982abb589
commit 820d57ab33
8 changed files with 63 additions and 44 deletions

View File

@ -308,10 +308,12 @@ llapp.controller 'TreeCtrl', [
data:
type: 'LDAP'
for: 0
over: {}
over: []
$scope.newCmbOver = ->
$scope.currentNode.data.over.set "new#{id++}", ''
d = $scope.currentNode.data
d.over = [] unless d.over
d.over.push ["new#{id++}", '']
# Add host
$scope.addHost = (cn,scope) ->
@ -586,7 +588,18 @@ llapp.controller 'TreeCtrl', [
$scope.keyWritable = (scope) ->
node = scope.$modelValue
return if node.type and node.type.match /^(authChoice|keyText|virtualHost|rule|menuCat|menuApp|saml(Attribute|(IDP|SP)MetaDataNode))$/ then true else false
# regexp-assemble of:
# authChoice
# keyText
# cmbModule
# virtualHost
# rule
# menuCat
# menuApp
# samlAttribute
# samlIDPMetaDataNode
# samlSPMetaDataNode
return if node.type and node.type.match /^(?:(?:saml(?:(?:ID|S)PMetaDataNod|Attribut)|(?:cmbMod|r)ul|authChoic)e|(?:virtualHos|keyTex)t|menu(?:App|Cat))$/ then true else false
# RSA keys generation
$scope.newRSAKey = ->

View File

@ -18,7 +18,7 @@
</td>
<td>
<select class="form-control" ng-model="currentNode.data.type" ng-change="execFilters(_findScopeByKey('authParams'))">
<option ng-repeat="item in _findContainer().select" ng-selected="item.k==currentNode.data.type" value="{{item.k}}">{{item.v}}</option>
<option ng-repeat="item in _findContainer().select" ng-selected="item.k===currentNode.data.type" value="{{item.k}}">{{item.v}}</option>
</select>
</td>
<td>
@ -31,13 +31,14 @@
</tr>
</tbody>
</table>
<h4 trspan="overPrm"></h4>
<table class="table">
<tr ng-repeat="(k,v) in currentNode.data.over">
<tr ng-repeat="t in currentNode.data.over">
<td>
<input class="form-control" ng-model="k" />
<input class="form-control" ng-model="t[0]" />
</td>
<td>
<input class="form-control" ng-model="v" />
<input class="form-control" ng-model="t[1]" />
</td>
<td>
<span class="link text-danger glyphicon glyphicon-minus-sign" ng-click="del(currentNode.data.over,$index)"/>

View File

@ -25,54 +25,52 @@ var filterFunctions = {
}
nToShow.push(tmp + 'Params');
}
if (node.nodes[0].data.match(/^(Choice|Multi)/)) {
node.nodes[1].data = node.nodes[0].data;
if (node.nodes[0].data.match(/^Choice/)) {
node.nodes[2].data = 'Choice';
}
//all = true;
if (node.nodes[0].data.match(/^Choice/)) {
node.nodes[2].data = 'Choice';
}
node.nodes.forEach(function(n) {
p(n.data);
});
/* Get choice or multi sub modules */
node.nodes_cond.forEach(function(n) {
var restart = 0;
var nd = n._nodes ? n._nodes : n.nodes;
if (node.nodes[0].data == 'Choice' && n.id == 'choiceParams') {
var nd = n._nodes ? n._nodes : n.nodes;
if (!nd[1].cnodes) {
if (nd[1].cnodes) {
restart++;
}
else {
nd = nd[1]._nodes ? nd[1]._nodes : nd[1].nodes;
nd.forEach(function(m) {
m.data.forEach(function(s) {
p(s);
});
});
}
else {
scope.waiting = true;
scope.download({
'$modelValue': nd[1]
}).then(function() {
filterFunctions.authParams(scope, $q, node)
});
return;
};
}
else if (node.nodes[0].data == 'Multi' && n.id == 'multiParams') {
var nd = n._nodes ? n._nodes : n.nodes;
if (! ('data' in nd[0])) {
$q.all([scope.getKey(nd[0]), scope.getKey(nd[1])]).then(function() {
filterFunctions.authParams(scope, $q, node)
});
return;
}
/* TODO: Change this with multiValueSeparator when it will be set in tree */
var sep = ';';
var reg = new RegExp(sep + '\\s*(\\w+)', 'g');
var s = '' + (nd[0].data ? sep + nd[0].data : '') + (nd[1].data ? sep + nd[1].data : '');
while ((result = reg.exec(s)) !== null) {
p(result[1]);
else if (node.nodes[0].data == 'Combination' && n.id == 'combinationParams') {
if (nd[1].cnodes) {
restart++;
}
else {
nd = nd[1]._nodes ? nd[1]._nodes : nd[1].nodes;
nd.forEach(function(m) {
m.data.over.forEach(function(s) {
p(s.type);
});
});
}
}
if(restart==1) {
scope.waiting = true;
scope.download({
'$modelValue': nd[1]
}).then(function() {
filterFunctions.authParams(scope, $q, node)
});
return;
}
});
/* 2.2 Display modules */
node.nodes_cond.forEach(function(n) {
@ -84,4 +82,4 @@ var filterFunctions = {
});
});
}
}
}

View File

@ -1 +1 @@
var filterFunctions={authParams:function(b,a,c){var d=[];c.nodes.forEach(function(e){d.push(b.getKey(e))});a.all(d).then(function(){var f=false;var e=[];var g=function(i){var h=i.toLowerCase();if(h=="ad"){h="ldap"}if(h=="openidconnect"){h="oidc"}e.push(h+"Params")};if(c.nodes[0].data.match(/^(Choice|Multi)/)){c.nodes[1].data=c.nodes[0].data;if(c.nodes[0].data.match(/^Choice/)){c.nodes[2].data="Choice"}}c.nodes.forEach(function(h){g(h.data)});c.nodes_cond.forEach(function(l){if(c.nodes[0].data=="Choice"&&l.id=="choiceParams"){var k=l._nodes?l._nodes:l.nodes;if(!k[1].cnodes){k=k[1]._nodes?k[1]._nodes:k[1].nodes;k.forEach(function(n){n.data.forEach(function(m){g(m)})})}else{b.waiting=true;b.download({"$modelValue":k[1]}).then(function(){filterFunctions.authParams(b,a,c)});return}}else{if(c.nodes[0].data=="Multi"&&l.id=="multiParams"){var k=l._nodes?l._nodes:l.nodes;if(!("data" in k[0])){a.all([b.getKey(k[0]),b.getKey(k[1])]).then(function(){filterFunctions.authParams(b,a,c)});return}var h=";";var j=new RegExp(h+"\\s*(\\w+)","g");var i=""+(k[0].data?h+k[0].data:"")+(k[1].data?h+k[1].data:"");while((result=j.exec(i))!==null){g(result[1])}}}});c.nodes_cond.forEach(function(h){if(!f&&e.indexOf(h.id)==-1){h.show=false}else{h.show=true}})})}};
var filterFunctions={authParams:function(b,a,c){var d=[];c.nodes.forEach(function(e){d.push(b.getKey(e))});a.all(d).then(function(){var f=false;var e=[];var g=function(i){var h=i.toLowerCase();if(h=="ad"){h="ldap"}if(h=="openidconnect"){h="oidc"}e.push(h+"Params")};if(c.nodes[0].data.match(/^Choice/)){c.nodes[2].data="Choice"}c.nodes.forEach(function(h){g(h.data)});c.nodes_cond.forEach(function(j){var h=0;var i=j._nodes?j._nodes:j.nodes;if(c.nodes[0].data=="Choice"&&j.id=="choiceParams"){if(i[1].cnodes){h++}else{i=i[1]._nodes?i[1]._nodes:i[1].nodes;i.forEach(function(k){k.data.forEach(function(l){g(l)})})}}else{if(c.nodes[0].data=="Combination"&&j.id=="combinationParams"){if(i[1].cnodes){h++}else{i=i[1]._nodes?i[1]._nodes:i[1].nodes;i.forEach(function(k){k.data.over.forEach(function(l){g(l.type)})})}}}if(h==1){b.waiting=true;b.download({"$modelValue":i[1]}).then(function(){filterFunctions.authParams(b,a,c)});return}});c.nodes_cond.forEach(function(h){if(!f&&e.indexOf(h.id)==-1){h.show=false}else{h.show=true}})})}};

View File

@ -358,12 +358,17 @@ This file contains:
data: {
type: 'LDAP',
"for": 0,
over: {}
over: []
}
});
};
$scope.newCmbOver = function() {
return $scope.currentNode.data.over.set("new" + (id++), '');
var d;
d = $scope.currentNode.data;
if (!d.over) {
d.over = [];
}
return d.over.push(["new" + (id++), '']);
};
$scope.addHost = function(cn, scope) {
if (!cn.data) {
@ -719,7 +724,7 @@ This file contains:
$scope.keyWritable = function(scope) {
var node;
node = scope.$modelValue;
if (node.type && node.type.match(/^(authChoice|keyText|virtualHost|rule|menuCat|menuApp|saml(Attribute|(IDP|SP)MetaDataNode))$/)) {
if (node.type && node.type.match(/^(?:(?:saml(?:(?:ID|S)PMetaDataNod|Attribut)|(?:cmbMod|r)ul|authChoic)e|(?:virtualHos|keyTex)t|menu(?:App|Cat))$/)) {
return true;
} else {
return false;

File diff suppressed because one or more lines are too long

View File

@ -493,6 +493,7 @@
"OpenIDConnect_IDToken": "ID Token",
"OpenIDConnect_OP": "Provider key",
"OptionalTitle": "Optional title",
"overPrm": "Overloaded parameters",
"password": "Password",
"passwordDB": "Password module",
"passwordManagement": "Password management",

View File

@ -493,6 +493,7 @@
"OpenIDConnect_IDToken": "Jeton d'identité",
"OpenIDConnect_OP": "Clef du fournisseur",
"OptionalTitle": "Titre optionnel",
"overPrm": "Paramètres surchargés",
"password": "Mot-de-passe",
"passwordDB": "Module de mot de passe",
"passwordManagement": "Gestion des mots de passe",