This commit is contained in:
Bill Burke 2013-09-20 20:17:27 -04:00
parent 935f6455c0
commit fb2c2c91b7
10 changed files with 166 additions and 118 deletions

View file

@ -183,8 +183,6 @@ module.controller('RealmDetailCtrl', function($scope, Current, Realm, realm, $ht
module.controller('UserListCtrl', function($scope, realm, User) { module.controller('UserListCtrl', function($scope, realm, User) {
$scope.realm = realm; $scope.realm = realm;
$scope.users = [];
//$scope.search = "Search...";
$scope.searchQuery = function() { $scope.searchQuery = function() {
console.log('search: ' + $scope.search); console.log('search: ' + $scope.search);
@ -253,9 +251,15 @@ module.controller('UserDetailCtrl', function($scope, realm, user, User, $locatio
}; };
}); });
module.controller('RoleListCtrl', function($scope, realm, roles) { module.controller('RoleListCtrl', function($scope, $location, realm, roles) {
$scope.realm = realm; $scope.realm = realm;
$scope.roles = roles; $scope.roles = roles;
$scope.$watch(function() {
return $location.path();
}, function() {
$scope.path = $location.path().substring(1).split("/");
});
}); });
module.controller('RoleDetailCtrl', function($scope, realm, role, Role, $location, Dialog, Notifications) { module.controller('RoleDetailCtrl', function($scope, realm, role, Role, $location, Dialog, Notifications) {
@ -265,6 +269,12 @@ module.controller('RoleDetailCtrl', function($scope, realm, role, Role, $locatio
$scope.changed = $scope.create; $scope.changed = $scope.create;
$scope.$watch(function() {
return $location.path();
}, function() {
$scope.path = $location.path().substring(1).split("/");
});
$scope.$watch('role', function() { $scope.$watch('role', function() {
if (!angular.equals($scope.role, role)) { if (!angular.equals($scope.role, role)) {
$scope.changed = true; $scope.changed = true;
@ -272,34 +282,28 @@ module.controller('RoleDetailCtrl', function($scope, realm, role, Role, $locatio
}, true); }, true);
$scope.save = function() { $scope.save = function() {
if ($scope.roleForm.$valid) { if ($scope.create) {
Role.save({
realm: realm.id
}, $scope.role, function (data, headers) {
$scope.changed = false;
role = angular.copy($scope.role);
if ($scope.create) { var l = headers().location;
Role.save({ var id = l.substring(l.lastIndexOf("/") + 1);
realm: realm.id $location.url("/realms/" + realm.id + "/roles/" + id);
}, $scope.role, function (data, headers) { Notifications.success("Created role");
$scope.changed = false;
role = angular.copy($scope.role);
var l = headers().location; });
var id = l.substring(l.lastIndexOf("/") + 1); } else {
$location.url("/realms/" + realm.id + "/roles/" + id); Role.update({
Notifications.success("Created role"); realm : realm.id,
roleId : role.id
}); }, $scope.role, function() {
} else { $scope.changed = false;
Role.update({ role = angular.copy($scope.role);
realm : realm.id, Notifications.success("Saved changes to role");
roleId : role.id });
}, $scope.role, function() {
$scope.changed = false;
role = angular.copy($scope.role);
Notifications.success("Saved changes to role");
});
}
} else {
$scope.roleForm.showErrors = true;
} }
}; };

View file

@ -2,16 +2,24 @@
<div class="row"> <div class="row">
<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="'partials/realm-menu.html'"></div> <div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="'partials/realm-menu.html'"></div>
<div id="content-area" class="col-md-9" role="main"> <div id="content-area" class="col-md-9" role="main">
<div class="top-nav"> <div class="top-nav" data-ng-show="!create">
<ul class="rcue-tabs"> <ul class="rcue-tabs">
<li class="active"><a href="#">Settings</a></li> <li><a href="#/create/application/{{realm.id}}">New Application</a></li>
<li><a href="#/realms/{{realm.id}}/applications">Applications</a></li>
<li class="active"><a href="#/realms/{{realm.id}}/applications/{{application.id}}">Settings</a></li>
<li><a href="#">Credentials</a></li> <li><a href="#">Credentials</a></li>
<li><a href="#">Installation</a></li> <li><a href="#">Installation</a></li>
<li><a href="#">Roles</a></li> <li><a href="#">Roles</a></li>
<li><a href="#">Scopes</a></li> <li><a href="#">Scope</a></li>
<li><a href="#">Sessions</a></li> <li><a href="#">Sessions</a></li>
</ul> </ul>
</div> </div>
<div class="top-nav" data-ng-show="create">
<ul class="rcue-tabs">
<li class="active"><a href="#/create/application/{{realm.id}}">New Application</a></li>
<li><a href="#/realms/{{realm.id}}/applications">Applications</a></li>
</ul>
</div>
<div id="content"> <div id="content">
<h2 class="pull-left" data-ng-show="create">New Application</h2> <h2 class="pull-left" data-ng-show="create">New Application</h2>
<h2 class="pull-left" data-ng-hide="create">Application <span>{{application.name}}</span></h2> <h2 class="pull-left" data-ng-hide="create">Application <span>{{application.name}}</span></h2>

View file

@ -2,18 +2,19 @@
<div class="row"> <div class="row">
<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="'partials/realm-menu.html'"></div> <div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="'partials/realm-menu.html'"></div>
<div id="content-area" class="col-md-9" role="main"> <div id="content-area" class="col-md-9" role="main">
<div class="top-nav" data-ng-hide="createRealm"> <div class="top-nav">
<ul class="rcue-tabs"> <ul class="rcue-tabs">
<li class="active"><a href="#">Applications</a></li>
<li><a href="#/create/application/{{realm.id}}">New Application</a></li> <li><a href="#/create/application/{{realm.id}}">New Application</a></li>
<li class="active"><a href="#">Applications</a></li>
</ul> </ul>
</div> </div>
<div id="content"> <div id="content">
<h2 class="pull-left">Applications</h2> <h2 class="pull-left">Applications</h2>
<table> <table>
<caption>Table of realm applications</caption> <caption data-ng-show="applications && applications.length > 0">Table of realm applications</caption>
<caption data-ng-show="!applications || applications.length == 0">No configured applications...</caption>
<thead> <thead>
<tr> <tr data-ng-show="applications && applications.length > 5">
<th class="rcue-table-actions" colspan="3"> <th class="rcue-table-actions" colspan="3">
<div class="search-comp clearfix"> <div class="search-comp clearfix">
<input type="text" placeholder="Search..." class="search"> <input type="text" placeholder="Search..." class="search">
@ -30,7 +31,7 @@
<th>Base URL</th> <th>Base URL</th>
</tr> </tr>
</thead> </thead>
<tfoot> <tfoot data-ng-show="applications && applications.length > 5"> <!-- todo -->
<tr> <tr>
<td colspan="3"> <td colspan="3">
<div class="table-nav"> <div class="table-nav">

View file

@ -4,9 +4,9 @@
<div id="content-area" class="col-md-9" role="main"> <div id="content-area" class="col-md-9" role="main">
<div class="top-nav" data-ng-hide="createRealm"> <div class="top-nav" data-ng-hide="createRealm">
<ul class="rcue-tabs"> <ul class="rcue-tabs">
<li class="active"><a href="#">Settings</a></li> <li class="active"><a href="#/realms/{{realm.id}}">Settings</a></li>
<li data-ng-show="realm.social"><a href="#">Social</a></li> <li data-ng-show="realm.social"><a href="#">Social</a></li>
<li><a href="#">Roles</a></li> <li><a href="#/realms/{{realm.id}}/roles">Roles</a></li>
<li><a href="#">Required Credentials</a></li> <li><a href="#">Required Credentials</a></li>
<li><a href="#">Token Settings</a></li> <li><a href="#">Token Settings</a></li>
</ul> </ul>

View file

@ -1,5 +1,5 @@
<ul data-ng-hide="createRealm"> <ul data-ng-hide="createRealm">
<li data-ng-class="!path[2] && 'active'"><a href="#/realms/{{realm.id}}">Realm Settings</a></li> <li data-ng-class="(!path[2] || path[1] == 'role' || path[2] == 'roles') && 'active'"><a href="#/realms/{{realm.id}}">Realm Settings</a></li>
<li data-ng-class="(path[2] == 'users' || path[1] == 'user') && 'active'"><a href="#/realms/{{realm.id}}/users">Users</a> <li data-ng-class="(path[2] == 'users' || path[1] == 'user') && 'active'"><a href="#/realms/{{realm.id}}/users">Users</a>
</li> </li>
<li data-ng-class="(path[2] == 'applications' || path[1] == 'application') && 'active'"><a href="#/realms/{{realm.id}}/applications">Applications</a></li> <li data-ng-class="(path[2] == 'applications' || path[1] == 'application') && 'active'"><a href="#/realms/{{realm.id}}/applications">Applications</a></li>

View file

@ -1,60 +1,59 @@
<div id="wrapper" class="container"> <div id="wrapper" class="container">
<div class="row"> <div class="row">
<aside class="span3" data-ng-include data-src="'partials/realm-menu.html'"></aside> <div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="'partials/realm-menu.html'"></div>
<div id="actions-bg"></div> <div id="content-area" class="col-md-9" role="main">
<div class="top-nav">
<div id="container-right" class="span9"> <ul class="rcue-tabs">
<h1 data-ng-show="create"><span class="gray">New Role</span></h1> <li class="active"><a href="#/create/role/{{realm.id}}">New Realm Role</a></li>
<li><a href="#/realms/{{realm.id}}/roles">Realm Roles</a></li>
<h1 data-ng-hide="create"> <li><a href="#/realms/{{realm.id}}">Realm Settings</a></li>
<span class="gray">Realm Role {{role.name}}</span> </ul>
</h1>
<div data-ng-show="roleForm.showErrors && roleForm.$error.required" class="alert alert-error">Please fill in
all required fields
</div> </div>
<p class="subtitle subtitle-right" data-ng-show="create"><span class="required">*</span> Required fields</p> <div id="content">
<h2 class="pull-left" data-ng-show="create">New Realm Role</h2>
<h2 class="pull-left" data-ng-hide="create">Realm Role <span>{{role.name}}</span></h2>
<p class="subtitle" data-ng-show="create"><span class="required">*</span> Required fields</p>
<form name="realmForm" novalidate>
<fieldset>
<legend uncollapsed><span class="text">Details</span> </legend>
<div class="form-group">
<label for="name">Role name </label><span class="required" data-ng-show="create">*</span>
<form class="form-horizontal" name="roleForm" novalidate> <div class="controls">
<fieldset> <input type="text" id="name" name="name" data-ng-model="role.name" autofocus
<legend>Details</legend> required data-ng-readonly="!create">
<div class="control-group"> </div>
<label class="control-label" for="name">Role name <span class="required" data-ng-show="create">*</span></label>
<div class="controls">
<input type="text" class="input-xlarge" id="name" name="name" data-ng-model="role.name"
autofocus required data-ng-readonly="!create">
</div> </div>
<div class="form-group">
<label for="description">Description </label>
<div class="controls">
<input type="text" id="description" name="description" data-ng-model="role.description" autofocus
required>
</div>
</div>
</fieldset>
<div class="form-actions" data-ng-show="create">
<button type="submit" data-ng-click="save()" class="primary" data-ng-show="changed">Save
</button>
<button type="submit" data-ng-click="cancel()" data-ng-click="cancel()"
data-ng-show="changed">Cancel
</button>
</div> </div>
<div class="control-group"> <div class="form-actions" data-ng-show="!create">
<label class="control-label" for="description">Description </label> <button type="submit" data-ng-click="save()" class="primary" data-ng-show="changed">Save
changes
<div class="controls"> </button>
<input type="text" class="input-xlarge" id="description" name="description" data-ng-model="role.description"> <button type="submit" data-ng-click="reset()" data-ng-show="changed">Clear changes
</div> </button>
<button type="submit" data-ng-click="remove()" class="danger" data-ng-hide="changed">
Delete
</button>
</div> </div>
</fieldset>
<div class="form-actions" data-ng-show="create">
<button type="submit" data-ng-click="save()" class="btn btn-primary" data-ng-show="changed">Save
</button>
<button type="submit" data-ng-click="cancel()" class="btn" data-ng-click="cancel()"
data-ng-show="changed">Cancel
</button>
</div>
<div class="form-actions" data-ng-show="!create"> </form>
<button type="submit" data-ng-click="save()" class="btn btn-primary" data-ng-show="changed">Save </div>
changes
</button>
<button type="submit" data-ng-click="reset()" class="btn" data-ng-show="changed">Clear changes
</button>
<button type="submit" data-ng-click="remove()" class="btn btn-danger" data-ng-hide="changed">
Delete
</button>
</div>
</form>
</div> </div>
<div id="container-right-bg"></div> <div id="container-right-bg"></div>
</div> </div>

View file

@ -1,25 +1,56 @@
<div id="wrapper" class="container"> <div id="wrapper" class="container">
<div class="row"> <div class="row">
<aside class="span3" data-ng-include data-src="'partials/realm-menu.html'"></aside> <div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="'partials/realm-menu.html'"></div>
<div id="actions-bg"></div> <div id="content-area" class="col-md-9" role="main">
<div class="top-nav">
<div id="container-right" class="span9"> <ul class="rcue-tabs">
<h1> <li><a href="#/create/role/{{realm.id}}">New Realm Role</a></li>
<span class="gray">Realm Roles</span> <li class="active"><a href="#/realms/{{realm.id}}/roles">Realm Roles</a></li>
</h1> <li><a href="#/realms/{{realm.id}}">Realm Settings</a></li>
</ul>
<table class="table table-striped table-bordered"> </div>
<thead> <div id="content">
<tr> <h2 class="pull-left">Realm Roles</h2>
<th>Name</th> <table>
<th>Description</th> <caption data-ng-show="roles && roles.length > 0">Table of realm roles</caption>
</tr> <caption data-ng-show="!roles || roles.length == 0">No configured realm roles...</caption>
</thead> <thead>
<tr data-ng-repeat="role in roles"> <tr data-ng-show="roles && roles.length > 5">
<td><a href="#/realms/{{realm.id}}/roles/{{role.id}}">{{role.name}}</a></td> <th class="rcue-table-actions" colspan="2">
<td>{{role.description}}</td> <div class="search-comp clearfix">
</tr> <input type="text" placeholder="Search..." class="search">
</table> <button class="icon-search tooltipRightTrigger"
data-original-title="Search by role name.">
Icon: search
</button>
</div>
</th>
</tr>
<tr>
<th>Role Name</th>
<th>Description</th>
</tr>
</thead>
<tfoot data-ng-show="roles && roles.length > 5"> <!-- todo -->
<tr>
<td colspan="2">
<div class="table-nav">
<a href="#" class="first disabled">First page</a><a href="#" class="prev disabled">Previous
page</a><span><strong>1-8</strong> of <strong>10</strong></span><a href="#"
class="next">Next
page</a><a href="#" class="last">Last page</a>
</div>
</td>
</tr>
</tfoot>
<tbody class="selectable-rows">
<tr ng-repeat="role in roles">
<td><a href="#/realms/{{realm.id}}/roles/{{role.id}}">{{role.name}}</a></td>
<td>{{role.description}}</td>
</tr>
</tbody>
</table>
</div>
</div> </div>
<div id="container-right-bg"></div> <div id="container-right-bg"></div>
</div> </div>

View file

@ -4,12 +4,16 @@
<div id="content-area" class="col-md-9" role="main"> <div id="content-area" class="col-md-9" role="main">
<div class="top-nav" data-ng-show="create"> <div class="top-nav" data-ng-show="create">
<ul class="rcue-tabs" > <ul class="rcue-tabs" >
<li class="active"><a href="#">New User</a></li> <ul class="rcue-tabs">
<li><a href="#">Users</a></li> <li class="active"><a href="#/create/user/{{realm.id}}">New User</a></li>
<li><a href="#/realms/{{realm.id}}/users">Query Users</a></li>
</ul>
</ul> </ul>
</div> </div>
<div class="top-nav" data-ng-show="!create"> <div class="top-nav" data-ng-show="!create">
<ul class="rcue-tabs" > <ul class="rcue-tabs" >
<li><a href="#/create/user/{{realm.id}}">New User</a></li>
<li><a href="#/realms/{{realm.id}}/users">Query Users</a></li>
<li class="active"><a href="#">Attributes</a></li> <li class="active"><a href="#">Attributes</a></li>
<li><a href="#">Credentials</a></li> <li><a href="#">Credentials</a></li>
<li><a href="#">Role Mappings</a></li> <li><a href="#">Role Mappings</a></li>

View file

@ -4,14 +4,14 @@
<div id="content-area" class="col-md-9" role="main"> <div id="content-area" class="col-md-9" role="main">
<div class="top-nav" data-ng-hide="createRealm"> <div class="top-nav" data-ng-hide="createRealm">
<ul class="rcue-tabs"> <ul class="rcue-tabs">
<li class="active"><a href="#">Users</a></li>
<li><a href="#/create/user/{{realm.id}}">New User</a></li> <li><a href="#/create/user/{{realm.id}}">New User</a></li>
<li class="active"><a href="#/realms/{{realm.id}}/users">Query Users</a></li>
</ul> </ul>
</div> </div>
<div id="content"> <div id="content">
<h2 class="pull-left">Query Users</h2> <h2 class="pull-left">Query Users</h2>
<table> <table>
<caption>Table of realm users</caption> <caption data-ng-show="users && search">Table of realm users</caption>
<thead> <thead>
<tr> <tr>
<th class="rcue-table-actions" colspan="4"> <th class="rcue-table-actions" colspan="4">
@ -26,7 +26,7 @@
</th> </th>
</tr> </tr>
<tr> <tr>
<tr> <tr data-ng-show="users && search">
<th>Username</th> <th>Username</th>
<th>Last Name</th> <th>Last Name</th>
<th>First Name</th> <th>First Name</th>
@ -34,7 +34,7 @@
</tr> </tr>
</tr> </tr>
</thead> </thead>
<tfoot> <tfoot data-ng-show="users && users.length > 10"> <!-- todo -->
<tr> <tr>
<td colspan="4"> <td colspan="4">
<div class="table-nav"> <div class="table-nav">
@ -49,9 +49,9 @@
<tbody class="selectable-rows"> <tbody class="selectable-rows">
<tr ng-repeat="user in users"> <tr ng-repeat="user in users">
<td><a href="#/realms/{{realm.id}}/users/{{user.username}}">{{user.username}}</a></td> <td><a href="#/realms/{{realm.id}}/users/{{user.username}}">{{user.username}}</a></td>
<td>{{user.lastName</td> <td>{{user.lastName}}</td>
<td>{{user.firstName</td> <td>{{user.firstName}}</td>
<td>{{user.email</td> <td>{{user.email}}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

View file

@ -65,6 +65,7 @@ public class RealmAdminResource {
List<RoleRepresentation> roles = new ArrayList<RoleRepresentation>(); List<RoleRepresentation> roles = new ArrayList<RoleRepresentation>();
for (RoleModel roleModel : roleModels) { for (RoleModel roleModel : roleModels) {
RoleRepresentation role = new RoleRepresentation(roleModel.getName(), roleModel.getDescription()); RoleRepresentation role = new RoleRepresentation(roleModel.getName(), roleModel.getDescription());
role.setId(roleModel.getId());
roles.add(role); roles.add(role);
} }
return roles; return roles;