KEYCLOAK-1794 Admin console issues with kc-provider-config directive

This commit is contained in:
Stian Thorgersen 2015-09-04 08:57:16 +02:00
parent 9f30a51925
commit b223e1a7af
3 changed files with 83 additions and 84 deletions

View file

@ -1840,7 +1840,6 @@ module.directive('kcTabsUserFederation', function () {
}); });
module.controller('RoleSelectorModalCtrl', function($scope, realm, config, configName, RealmRoles, Client, ClientRole, $modalInstance) { module.controller('RoleSelectorModalCtrl', function($scope, realm, config, configName, RealmRoles, Client, ClientRole, $modalInstance) {
console.log('realm: ' + realm.realm);
$scope.selectedRealmRole = { $scope.selectedRealmRole = {
role: undefined role: undefined
}; };
@ -1888,6 +1887,25 @@ module.controller('RoleSelectorModalCtrl', function($scope, realm, config, confi
}) })
}); });
module.controller('ProviderConfigCtrl', function ($modal, $scope) {
$scope.openRoleSelector = function (configName, config) {
$modal.open({
templateUrl: resourceUrl + '/partials/modal/role-selector.html',
controller: 'RoleSelectorModalCtrl',
resolve: {
realm: function () {
return $scope.realm;
},
config: function () {
return config;
},
configName: function () {
return configName;
}
}
})
}
});
module.directive('kcProviderConfig', function ($modal) { module.directive('kcProviderConfig', function ($modal) {
return { return {
@ -1895,32 +1913,12 @@ module.directive('kcProviderConfig', function ($modal) {
config: '=', config: '=',
properties: '=', properties: '=',
realm: '=', realm: '=',
clients: '=' clients: '=',
configName: '='
}, },
restrict: 'E', restrict: 'E',
replace: true, replace: true,
link: function(scope, element, attrs) { controller: 'ProviderConfigCtrl',
scope.openRoleSelector = function(configName) {
$modal.open({
templateUrl: resourceUrl + '/partials/modal/role-selector.html',
controller: 'RoleSelectorModalCtrl',
resolve: {
realm: function () {
return scope.realm;
},
config: function() {
return scope.config;
},
configName: function() {
return configName;
}
}
})
};
},
templateUrl: resourceUrl + '/templates/kc-provider-config.html' templateUrl: resourceUrl + '/templates/kc-provider-config.html'
} }
}); });

View file

@ -4,42 +4,37 @@
</button> </button>
<h4 class="modal-title">Role Selector</h4> <h4 class="modal-title">Role Selector</h4>
</div> </div>
<div style="padding: 15px 60px 75px 60px"> <div style="padding: 0 15px 15px 15px;">
<form> <form>
<div data-ng-show="realmRoles.length > 0"> <div data-ng-show="realmRoles.length > 0" style="margin-bottom: 30px;">
<label class="control-label" for="available">Realm Roles</label> <label class="control-label" for="available">Realm Roles</label>
<kc-tooltip>Realm roles that can be selected.</kc-tooltip> <kc-tooltip>Realm roles that can be selected.</kc-tooltip>
<select id="available" class="form-control" size="5" <select id="available" class="form-control" size="5"
ng-dblclick="selectRealmRole()" ng-dblclick="selectRealmRole()"
ng-model="selectedRealmRole.role" ng-model="selectedRealmRole.role"
ng-options="r.name for r in realmRoles | orderBy:'toString()'"> ng-options="r.name for r in realmRoles | orderBy:'toString()'">
<option style="display:none" value="">Select a role</option> <option style="display:none" value="">Select a role</option>
</select>
<button class="btn btn-default" type="submit" ng-click="selectRealmRole()" tooltip-trigger="mouseover mouseout" tooltip="Select realm role" tooltip-placement="right">
Select Realm Role</i>
</button>
</div>
<br>
<br>
<div data-ng-show="clients.length > 0">
<label class="control-label">
<span>Client Roles</span>
<kc-tooltip>Client roles that can be selected.</kc-tooltip>
<select class="form-control" id="clients" name="clients" ng-change="changeClient()" ng-model="client.selected" ng-options="a.clientId for a in clients" ng-disabled="false">
</select> </select>
</label> <button class="btn btn-default" type="submit" ng-click="selectRealmRole()" tooltip-trigger="mouseover mouseout" tooltip="Select realm role" tooltip-placement="right">
<select id="available-client" class="form-control" size="5" Select Realm Role</i>
ng-dblclick="selectClientRole()" </button>
ng-model="selectedClientRole.role" </div>
ng-options="r.name for r in clientRoles | orderBy:'toString()'"> <div data-ng-show="clients.length > 0">
<option style="display:none" value="">Select a role</option> <label class="control-label">
</select> <span>Client Roles</span>
<button class="btn btn-default" type="submit" ng-click="selectClientRole()" tooltip-trigger="mouseover mouseout" tooltip="Select client role" tooltip-placement="right"> <kc-tooltip>Client roles that can be selected.</kc-tooltip>
Select Client Role <select class="form-control" id="clients" name="clients" ng-change="changeClient()" ng-model="client.selected" ng-options="a.clientId for a in clients" ng-disabled="false">
</button> </select>
</label>
<select id="available-client" class="form-control" size="5"
ng-dblclick="selectClientRole()"
ng-model="selectedClientRole.role"
ng-options="r.name for r in clientRoles | orderBy:'toString()'">
<option style="display:none" value="">Select a role</option>
</select>
<button class="btn btn-default" type="submit" ng-click="selectClientRole()" tooltip-trigger="mouseover mouseout" tooltip="Select client role" tooltip-placement="right">
Select Client Role
</button>
</div> </div>
</form> </form>
<div class="modal-footer">
<button type="button" data-ng-class="btns.cancel.cssClass" ng-click="cancel()">Cancel</button>
</div>
</div> </div>

View file

@ -1,28 +1,34 @@
<div data-ng-repeat="option in properties" class="form-group"> <div>
<label class="col-md-2 control-label">{{option.label}}</label> <div data-ng-repeat="option in properties" class="form-group" data-ng-controller="ProviderConfigCtrl">
<label class="col-md-2 control-label">{{option.label}}</label>
<div class="col-sm-6" data-ng-hide="option.type == 'boolean' || option.type == 'List' || option.type == 'Role' || option.type == 'ClientList'"> <div class="col-sm-6" data-ng-hide="option.type == 'boolean' || option.type == 'List' || option.type == 'Role' || option.type == 'ClientList'">
<input class="form-control" type="text" data-ng-model="config[ option.name ]" > <input class="form-control" type="text" data-ng-model="config[ option.name ]" >
</div> </div>
<div class="col-sm-6" data-ng-show="option.type == 'boolean'"> <div class="col-sm-6" data-ng-show="option.type == 'boolean'">
<input ng-model="config[ option.name ]" value="'true'" name="option.name" id="option.name" onoffswitchmodel /> <input ng-model="config[ option.name ]" value="'true'" name="option.name" id="option.name" onoffswitchmodel />
</div> </div>
<div class="col-sm-6" data-ng-show="option.type == 'List'"> <div class="col-sm-6" data-ng-show="option.type == 'List'">
<select ng-model="config[ option.name ]" ng-options="data for data in option.defaultValue"> <select ng-model="config[ option.name ]" ng-options="data for data in option.defaultValue">
<option value="" selected> Select one... </option> <option value="" selected> Select one... </option>
</select> </select>
</div> </div>
<div class="col-sm-6" data-ng-show="option.type == 'Role'"> <div class="col-sm-6" data-ng-show="option.type == 'Role'">
<input class="form-control" type="text" data-ng-model="config[ option.name ]" > <div class="row">
</div> <div class="col-sm-8">
<div class="col-sm-4" data-ng-show="option.type == 'Role'"> <input class="form-control" type="text" data-ng-model="config[ option.name ]" >
<button type="submit" data-ng-click="openRoleSelector(option.name)" class="btn btn-default" tooltip-placement="top" tooltip-trigger="mouseover mouseout" tooltip="Enter role in the textbox to the left, or click this button to browse and select the role you want">Select Role</button> </div>
</div> <div class="col-sm-2">
<div class="col-sm-4" data-ng-show="option.type == 'ClientList'"> <button type="submit" data-ng-click="openRoleSelector(option.name, config)" class="btn btn-default" tooltip-placement="top" tooltip-trigger="mouseover mouseout" tooltip="Enter role in the textbox to the left, or click this button to browse and select the role you want">Select Role</button>
<select ng-model="config[ option.name ]" ng-options="client.clientId as client.clientId for client in clients"> </div>
<option value="" selected> Select one... </option> </div>
</select> </div>
</div> <div class="col-sm-4" data-ng-show="option.type == 'ClientList'">
<select ng-model="config[ option.name ]" ng-options="client.clientId as client.clientId for client in clients">
<option value="" selected> Select one... </option>
</select>
</div>
<kc-tooltip>{{option.helpText}}</kc-tooltip> <kc-tooltip>{{option.helpText}}</kc-tooltip>
</div>
</div> </div>