Merge pull request #1996 from patriot1burke/master
improve client creation when template
This commit is contained in:
commit
0f9d50924c
3 changed files with 18 additions and 1 deletions
|
@ -1055,8 +1055,10 @@ module.controller('CreateClientCtrl', function($scope, realm, client, templates,
|
|||
'saml'];//Object.keys(serverInfo.providers['login-protocol'].providers).sort();
|
||||
$scope.create = true;
|
||||
$scope.templates = [ {name:'NONE'}];
|
||||
var templateNameMap = new Object();
|
||||
for (var i = 0; i < templates.length; i++) {
|
||||
var template = templates[i];
|
||||
templateNameMap[template.name] = template;
|
||||
$scope.templates.push(template);
|
||||
}
|
||||
|
||||
|
@ -1096,6 +1098,18 @@ module.controller('CreateClientCtrl', function($scope, realm, client, templates,
|
|||
$scope.changed = true;
|
||||
}
|
||||
|
||||
$scope.changeTemplate = function() {
|
||||
if ($scope.client.clientTemplate == 'NONE') {
|
||||
$scope.protocol = 'openid-connect';
|
||||
$scope.client.protocol = 'openid-connect';
|
||||
$scope.client.clientTemplate = null;
|
||||
|
||||
} else {
|
||||
var template = templateNameMap[$scope.client.clientTemplate];
|
||||
$scope.protocol = template.protocol;
|
||||
$scope.client.protocol = template.protocol;
|
||||
}
|
||||
}
|
||||
$scope.changeProtocol = function() {
|
||||
if ($scope.protocol == "openid-connect") {
|
||||
$scope.client.protocol = "openid-connect";
|
||||
|
|
|
@ -37,7 +37,8 @@
|
|||
<select class="form-control" id="protocol"
|
||||
ng-change="changeProtocol()"
|
||||
ng-model="protocol"
|
||||
ng-options="aProtocol for aProtocol in protocols">
|
||||
ng-options="aProtocol for aProtocol in protocols"
|
||||
ng-disabled="client.clientTemplate">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -48,6 +49,7 @@
|
|||
<div class="col-sm-6">
|
||||
<div>
|
||||
<select class="form-control" id="template"
|
||||
ng-change="changeTemplate()"
|
||||
ng-model="client.clientTemplate"
|
||||
ng-options="template.name as template.name for template in templates">
|
||||
</select>
|
||||
|
|
|
@ -75,6 +75,7 @@ public class ClientTemplatesResource {
|
|||
client.setId(clientModel.getId());
|
||||
client.setName(clientModel.getName());
|
||||
client.setDescription(clientModel.getDescription());
|
||||
client.setProtocol(clientModel.getProtocol());
|
||||
rep.add(client);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue