KEYCLOAK-1050 Added support for selecting multiple values

This commit is contained in:
Stian Thorgersen 2015-03-17 07:52:55 +01:00
parent 2f6ae96aec
commit 2d785b5d5e
4 changed files with 19 additions and 131 deletions

View file

@ -1,116 +0,0 @@
<h2 class="pull-left" data-ng-show="createRealm">Add Realm</h2>
<h2 data-ng-hide="createRealm"><span>{{realm.realm}}</span> General Settings</h2>
<p class="subtitle" data-ng-show="createRealm"><span class="required">*</span> Required fields</p>
<form class="form-horizontal" name="realmForm" novalidate>
<fieldset>
<legend uncollapsed class="aj-collapse open"><span class="text">Required Settings</span></legend>
<div class="form-group">
<label class="col-sm-2 control-label" for="name">Name <span class="required" data-ng-show="createRealm">*</span></label>
<div class="col-sm-4">
<input class="form-control" type="text" id="name" name="name" data-ng-model="realm.realm" autofocus required>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label control-label" for="enabled">Enabled</label>
<div class="col-sm-4">
<input ng-model="realm.enabled" name="enabled" id="enabled" onoffswitch />
</div>
</div>
</fieldset>
<fieldset>
<legend uncollapsed><span class="text">Login Options</span></legend>
<div class="form-group clearfix block">
<label for="social" class="col-sm-2 control-label">Social login</label>
<div class="col-sm-4">
<input ng-model="realm.social" name="social" id="social" onoffswitch />
</div>
</div>
<div class="form-group clearfix block" data-ng-show="realm.social">
<label for="updateProfileOnInitialSocialLogin" class="col-sm-2 control-label">Update profile on first social login</label>
<div class="col-sm-4">
<input ng-model="realm.updateProfileOnInitialSocialLogin" name="updateProfileOnInitialSocialLogin" id="updateProfileOnInitialSocialLogin" onoffswitch />
</div>
</div>
<div class="form-group clearfix block">
<label for="registrationAllowed" class="col-sm-2 control-label">User registration</label>
<div class="col-sm-4">
<input ng-model="realm.registrationAllowed" name="registrationAllowed" id="registrationAllowed" onoffswitch />
</div>
</div>
<div class="form-group clearfix block">
<label for="resetPasswordAllowed" class="col-sm-2 control-label">Reset password</label>
<div class="col-sm-4">
<input ng-model="realm.resetPasswordAllowed" name="resetPasswordAllowed" id="resetPasswordAllowed" onoffswitch />
</div>
</div>
<div class="form-group clearfix block">
<label for="verifyEmail" class="col-sm-2 control-label">Verify email</label>
<div class="col-sm-4">
<input ng-model="realm.verifyEmail" name="verifyEmail" id="verifyEmail" onoffswitch />
</div>
</div>
<div class="form-group clearfix block">
<label for="requireSsl" class="col-sm-2 control-label">Require SSL</label>
<div class="col-sm-4">
<input ng-model="realm.requireSsl" name="requireSsl" id="requireSsl" onoffswitch />
</div>
</div>
</fieldset>
<fieldset>
<legend uncollapsed><span class="text">Optional Settings</span></legend>
<div class="form-group row">
<label class="col-sm-2 control-label" for="loginTheme">Login Theme</label>
<!--<select id="loginTheme" name="loginTheme" ng-model="realm.loginTheme" ng-options="t for t in serverInfo.themes.login"></select>-->
<div class="col-sm-4">
<div class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown">
{{realm.loginTheme}}
<span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">
<li role="presentation" data-ng-repeat="t in serverInfo.themes.login">
<a role="menuitem" tabindex="-1" href="" data-ng-click="realm.loginTheme = t">{{t}}</a>
</li>
</ul>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="accountTheme">Account Theme</label>
<!--<select id="accountTheme" name="accountTheme" ng-model="realm.accountTheme" ng-options="t for t in serverInfo.themes.account"></select>-->
<div class="col-sm-4">
<div class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown">
{{realm.accountTheme}}
<span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">
<li role="presentation" data-ng-repeat="t in serverInfo.themes.account">
<a role="menuitem" tabindex="-1" href="" data-ng-click="realm.accountTheme = t">{{t}}</a>
</li>
</ul>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="accountTheme2">Account Theme2</label>
<!--<select id="accountTheme" name="accountTheme" ng-model="realm.accountTheme" ng-options="t for t in serverInfo.themes.account"></select>-->
<div class="col-sm-4">
<kc-select data-kc-model="realm.accountTheme" data-kc-options="serverInfo.themes.account"/>
</div>
</div>
</fieldset>
<div class="pull-right form-actions" data-ng-show="createRealm">
<button kc-cancel data-ng-click="cancel()">Cancel</button>
<button kc-save data-ng-show="changed">Save</button>
</div>
<div class="pull-right form-actions" data-ng-show="!createRealm">
<button kc-reset data-ng-show="changed">Clear changes</button>
<button kc-save data-ng-show="changed">Save</button>
<button kc-delete data-ng-click="remove()" data-ng-hide="changed">Delete</button>
</div>
</form>
</div>

View file

@ -31,16 +31,13 @@
</div>
<form class="form-horizontal">
<div class="form-group" data-ng-show="filter">
<label class="col-sm-2 control-label" for="eventType">Event Type</label>
<label class="col-sm-2 control-label" for="eventType">Event Type</label>
<div class="col-sm-5">
<select style="width:230px" data-ui-select2 data-ng-model="query.type" data-placeholder="Select Event Type">
<!-- empty option gets placeholder working -->
<option value=""></option>
<!-- ng-repeat to populate dynamic options -->
<option data-ng-repeat="event in eventTypes">{{event.tag}}</option>
</select>
</div>
</div>
<select ui-select2 id="reqActions" ng-model="query.type" data-placeholder="Select event types..." multiple>
<option ng-repeat="event in eventTypes|orderBy:'tag'">{{event.tag}}</option>
</select>
</div>
</div>
<div class="form-group" data-ng-show="filter">
<label class="col-sm-2 control-label" for="client">Client</label>
<div class="col-sm-4">

View file

@ -382,7 +382,7 @@ public class RealmAdminResource {
* Query events. Returns all events, or will query based on URL query parameters listed here
*
* @param client app or oauth client name
* @param type type type
* @param types type type
* @param user user id
* @param ipAddress
* @param firstResult
@ -393,7 +393,7 @@ public class RealmAdminResource {
@GET
@NoCache
@Produces(MediaType.APPLICATION_JSON)
public List<Event> getEvents(@QueryParam("client") String client, @QueryParam("type") String type,
public List<Event> getEvents(@QueryParam("client") String client,
@QueryParam("user") String user, @QueryParam("dateFrom") String dateFrom, @QueryParam("dateTo") String dateTo,
@QueryParam("ipAddress") String ipAddress, @QueryParam("first") Integer firstResult,
@QueryParam("max") Integer maxResults) {
@ -405,9 +405,16 @@ public class RealmAdminResource {
if (client != null) {
query.client(client);
}
if (type != null) {
query.type(EventType.valueOf(type));
List<String> types = uriInfo.getQueryParameters().get("type");
if (types != null) {
EventType[] t = new EventType[types.size()];
for (int i = 0; i < t.length; i++) {
t[i] = EventType.valueOf(types.get(i));
}
query.type(t);
}
if (user != null) {
query.user(user);
}