Merge pull request #3429 from stianst/KEY-FIXES

Various fixes for key providers
This commit is contained in:
Stian Thorgersen 2016-10-26 11:38:33 +02:00 committed by GitHub
commit fbe1fd8f98
3 changed files with 23 additions and 18 deletions

View file

@ -1112,12 +1112,10 @@ module.controller('RealmKeysProvidersCtrl', function($scope, Realm, realm, $http
parent: realm.id,
type: 'org.keycloak.keys.KeyProvider'
}, function(data) {
console.debug(data);
$scope.instances = data;
});
$scope.addProvider = function(provider) {
console.log('Add provider: ' + provider.id);
$location.url("/create/keys/" + realm.realm + "/providers/" + provider.id);
};
@ -1159,19 +1157,27 @@ module.controller('GenericKeystoreCtrl', function($scope, $location, Notificatio
'priority': ["0"]
}
}
} else {
$scope.instance = angular.copy(instance);
}
if (providerFactory.properties) {
for (var i = 0; i < providerFactory.properties.length; i++) {
var configProperty = providerFactory.properties[i];
if (!$scope.instance.config[configProperty.name]) {
if (configProperty.defaultValue) {
$scope.instance.config[configProperty.name] = [configProperty.defaultValue];
if (!$scope.create) {
instance.config[configProperty.name] = [configProperty.defaultValue];
}
} else {
$scope.instance.config[configProperty.name] = [''];
if (!$scope.create) {
instance.config[configProperty.name] = [configProperty.defaultValue];
}
}
}
}
} else {
$scope.instance = angular.copy(instance);
}
$scope.$watch('instance', function() {

View file

@ -41,19 +41,18 @@
<div class="form-group clearfix">
<label class="col-md-2 control-label" for="consoleDisplayName">{{:: 'console-display-name' | translate}} </label>
<div class="col-md-6">
<input class="form-control" id="consoleDisplayName" type="text" ng-model="instance.name" placeholder="{{:: 'defaults-to-id' | translate}}">
<input required class="form-control" id="consoleDisplayName" type="text" ng-model="instance.name" placeholder="{{:: 'defaults-to-id' | translate}}">
</div>
<kc-tooltip>{{:: 'console-display-name.tooltip' | translate}}</kc-tooltip>
</div>
<kc-component-config realm="realm" config="instance.config" properties="providerFactory.properties"></kc-component-config>
</fieldset>
<div class="form-group">
<div class="col-md-10 col-md-offset-2" data-ng-show="create && access.manageRealm">
<button kc-save>{{:: 'save' | translate}}</button>
<button kc-cancel data-ng-click="cancel()">{{:: 'cancel' | translate}}</button>
<button kc-save data-ng-disabled="!changed">{{:: 'save' | translate}}</button>
<button kc-cancel data-ng-disabled="!changed" data-ng-click="cancel()">{{:: 'cancel' | translate}}</button>
</div>
</div>

View file

@ -2,26 +2,26 @@
<div data-ng-repeat="option in properties" class="form-group" data-ng-controller="ProviderConfigCtrl">
<label class="col-md-2 control-label">{{:: option.label | translate}}</label>
<div class="col-md-6" data-ng-show="option.type == 'String'">
<div class="col-md-6" data-ng-if="option.type == 'String'">
<input class="form-control" type="text" data-ng-model="config[ option.name ][0]" >
</div>
<div class="col-md-6" data-ng-show="option.type == 'Password'">
<div class="col-md-6" data-ng-if="option.type == 'Password'">
<input class="form-control" type="password" data-ng-model="config[ option.name ][0]" >
</div>
<div class="col-md-6" data-ng-show="option.type == 'boolean'">
<div class="col-md-6" data-ng-if="option.type == 'boolean'">
<input ng-model="config[ option.name ][0]" value="'true'" id="option.name" name="option.name" onoffswitchstring on-text="{{:: 'onText' | translate}}" off-text="{{:: 'offText' | translate}}"/>
</div>
<div class="col-md-6" data-ng-show="option.type == 'List'">
<div class="col-md-6" data-ng-if="option.type == 'List'">
<select ng-model="config[ option.name ][0]" ng-options="data for data in option.options">
<option value="" selected> {{:: 'selectOne' | translate}} </option>
</select>
</div>
<div class="col-md-6" data-ng-show="option.type == 'MultivaluedList'">
<div class="col-md-6" data-ng-if="option.type == 'MultivaluedList'">
<select ui-select2 data-ng-model="config[ option.name ]" data-placeholder="{{:: 'selectMultiple' | translate}}..." multiple>
<option ng-repeat="val in option.options" value="{{val}}" ng-selected="true">{{val}}</option>
</select>
</div>
<div class="col-md-6" data-ng-show="option.type == 'Role'">
<div class="col-md-6" data-ng-if="option.type == 'Role'">
<div class="row">
<div class="col-md-8">
<input class="form-control" type="text" data-ng-model="config[ option.name ][0]" >
@ -31,7 +31,7 @@
</div>
</div>
</div>
<div class="col-md-4" data-ng-show="option.type == 'ClientList'">
<div class="col-md-4" data-ng-if="option.type == 'ClientList'">
<select ng-model="config[ option.name ][0]" ng-options="client.clientId as client.clientId for client in clients">
<option value="" selected> {{:: 'selectOne' | translate}} </option>
</select>