Fix Choice parameter overload in manager (#1962)

This commit is contained in:
Maxime Besson 2019-10-01 14:10:22 +02:00
parent a239091553
commit 914a760e25
3 changed files with 16 additions and 8 deletions

View File

@ -541,10 +541,15 @@ sub authChoiceModules {
my @res;
foreach my $k ( sort keys %$value ) {
my $data = [ split /;/, $value->{$k} ];
eval { $data->[5] = from_json( $data->[5] ) if $data->[5] };
if ($@) {
$self->logger->error(
"Bad value in choice over parameters, deleted ($@)");
if ( $data->[5] ) {
my $over;
eval { $over = from_json( $data->[5] ) };
if ($@) {
$self->logger->error(
"Bad value in choice over parameters, deleted ($@)");
} else {
$data->[5] = [ map { [ $_, $over->{$_} ] } keys %{$over} ];
}
}
push @res,
{

View File

@ -846,9 +846,11 @@ sub _scanNodes {
# authChoiceModules
if ( $name eq 'authChoiceModules' ) {
hdebug(' combModules');
hdebug(' authChoiceModules');
$n->{data}->[5] ||= {};
$n->{data}->[5] = to_json( $n->{data}->[5] );
$n->{data}->[5] =
to_json( { map { @$_ } @{ $n->{data}->[5] } } )
if ref( $n->{data}->[5] ) eq 'ARRAY';
}
$n->{data} = join ';', @{ $n->{data} };

View File

@ -42,8 +42,9 @@
<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)"/>
<span ng-if="$last" class="link text-success glyphicon glyphicon-plus-sign" ng-click="menuClick({title:'newCmbOver'})"/>
<span class="link text-danger glyphicon glyphicon-minus-sign" ng-click="del(currentNode.data[5],$index)"/>
<span ng-if="$last" class="link text-success glyphicon glyphicon-plus-sign"
ng-click="menuClick({title:'newCmbOver', action:'newChoiceOver'})" />
</td>
</tr>
</table>