Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add progress bar into group page #64

Merged
merged 2 commits into from
Nov 11, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,46 @@

angular.module('dashboardApp').controller('GroupController', GroupController);

GroupController.$inject = [ '$state', '$filter', 'scimFactory', 'ModalService', 'Utils' ];
GroupController.$inject = [ '$rootScope', '$state', '$filter', 'scimFactory', '$uibModal', 'ModalService', 'Utils' ];

function GroupController($state, $filter, scimFactory, ModalService, Utils) {
function GroupController($rootScope, $state, $filter, scimFactory, $uibModal, ModalService, Utils) {

var group = this;

group.loadGroup = loadGroup;

group.id = $state.params.id;
group.data = [];

scimFactory.getGroup(group.id).then(
function(response) {
group.loadGroup();

function loadGroup() {

$rootScope.pageLoadingProgress = 30;
group.loadingModal = $uibModal
.open({
animation: false,
templateUrl : '/resources/iam/template/dashboard/loading-modal.html'
});

group.loadingModal.opened.then(function() {
scimFactory.getGroup(group.id).then(
function(response) {

console.log(response.data);
group.data = response.data;
group.data.members = $filter('orderBy')(group.data.members,
"display", false);
group.data = response.data;
group.data.members = $filter('orderBy')(group.data.members, "display", false);
$rootScope.pageLoadingProgress = 100;
group.loadingModal.dismiss("Dismiss");

}, function(error) {
$scope.operationResult = Utils.buildErrorOperationResult(error);
});
}, function(error) {

$rootScope.pageLoadingProgress = 100;
$scope.operationResult = Utils.buildErrorOperationResult(error);
group.loadingModal.dismiss("Dismiss");

});
});
}

group.removeMemberFromList = removeMemberFromList;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ function GroupsController($scope, $rootScope, $uibModal, $state, $filter,

function loadGroupList() {

$rootScope.groupsLoadingProgress = 0;
$rootScope.pageLoadingProgress = 0;
gc.loadingModal = $uibModal
.open({
animation: false,
templateUrl : '/resources/iam/template/dashboard/groups/loading-modal.html'
templateUrl : '/resources/iam/template/dashboard/loading-modal.html'
});

gc.loadingModal.opened.then(function() {
Expand All @@ -90,9 +90,9 @@ function GroupsController($scope, $rootScope, $uibModal, $state, $filter,
gc.rebuildFilteredList();
if (response.data.totalResults > (response.data.startIndex - 1 + response.data.itemsPerPage)) {
gc.getGroups(startIndex + count, count);
$rootScope.groupsLoadingProgress = Math.floor((startIndex + count) * 100 / response.data.totalResults);
$rootScope.pageLoadingProgress = Math.floor((startIndex + count) * 100 / response.data.totalResults);
} else {
$rootScope.groupsLoadingProgress = 100;
$rootScope.pageLoadingProgress = 100;
gc.loadingModal.dismiss("Cancel");
}
}, function(error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ function RequestManagementController($scope, $rootScope, $state, $filter, filter
}

var requests = this;

requests.listPending = listPending;

requests.approveRequest = approveRequest;
requests.rejectRequest = rejectRequest;
requests.loadData = loadData;
Expand All @@ -36,6 +35,8 @@ function RequestManagementController($scope, $rootScope, $state, $filter, filter
requests.searchText = "";
}

requests.loadData();

function rebuildFilteredList() {

requests.filtered = filterFilter(requests.list, function(request) {
Expand Down Expand Up @@ -72,12 +73,12 @@ function RequestManagementController($scope, $rootScope, $state, $filter, filter

function loadData() {

$rootScope.requestsLoadingProgress = 0;
$rootScope.pageLoadingProgress = 30;

requests.loadingModal = $uibModal
.open({
animation: false,
templateUrl : '/resources/iam/template/dashboard/requests/loading-modal.html'
templateUrl : '/resources/iam/template/dashboard/loading-modal.html'
});

requests.loadingModal.opened.then(function() {
Expand All @@ -86,37 +87,25 @@ function RequestManagementController($scope, $rootScope, $state, $filter, filter
function(result) {
requests.list = result.data;
requests.rebuildFilteredList();
$rootScope.requestsLoadingProgress = 100;
$rootScope.pageLoadingProgress = 100;
$rootScope.loggedUser.pendingRequests = result.data;

requests.loadingModal.dismiss("Cancel");
},
function(error) {

$rootScope.pageLoadingProgress = 100;
$scope.operationResult = Utils.buildErrorOperationResult(error);
requests.loadingModal.dismiss("Error");
});
});
}

function listPending() {
RegistrationRequestService.listPending().then(
function(result) {
requests.list = result.data;
requests.rebuildFilteredList();
$rootScope.loggedUser.pendingRequests = result.data;
},
function(error) {
$scope.operationResult = Utils.buildErrorOperationResult(error);
})
};

function approveRequest(request) {
RegistrationRequestService.updateRequest(request.uuid, 'APPROVED').then(
function() {
var msg = request.givenname + " " + request.familyname + " request APPROVED successfully";
$scope.operationResult = Utils.buildSuccessOperationResult(msg);
requests.listPending();
requests.loadData();
},
function(error) {
$scope.operationResult = Utils.buildErrorOperationResult(error);
Expand All @@ -138,7 +127,7 @@ function RequestManagementController($scope, $rootScope, $state, $filter, filter
function() {
var msg = request.givenname + " " + request.familyname + " request REJECTED successfully";
$scope.operationResult = Utils.buildSuccessOperationResult(msg);
requests.listPending();
requests.loadData();
},
function(error) {
$scope.operationResult = Utils.buildErrorOperationResult(error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,30 +39,29 @@ function UserController($scope, $rootScope, $state, $uibModal, $filter, filterFi

function getIndigoUserInfo() {

$rootScope.userLoadingProgress = 0;
console.log("progress", $rootScope.userLoadingProgress);


$rootScope.pageLoadingProgress = 0;

user.loadingModal = $uibModal
.open({
animation: false,
templateUrl : '/resources/iam/template/dashboard/user/loading-modal.html'
templateUrl : '/resources/iam/template/dashboard/loading-modal.html'
});

user.loadingModal.opened.then(function() {

$rootScope.userLoadingProgress = 50;
$rootScope.pageLoadingProgress = 50;

scimFactory.getUser(user.id).then(function(response) {

user.userInfo = response.data;
console.log("Added indigoUserInfo: ", user.userInfo);

$rootScope.userLoadingProgress = 100;
$rootScope.pageLoadingProgress = 100;
user.loadingModal.dismiss("Cancel");

}, function(error) {


$rootScope.pageLoadingProgress = 100;
console.error("getUser", error)
user.loadingModal.dismiss("Error");
$scope.operationResult = Utils.buildErrorOperationResult(error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ function UsersController($scope, $rootScope, $uibModal, $state, $filter, filterF

function loadUserList() {

$rootScope.usersLoadingProgress = 0;
$rootScope.pageLoadingProgress = 0;
users.loadingModal = $uibModal
.open({
animation: false,
templateUrl : '/resources/iam/template/dashboard/users/loading-modal.html'
templateUrl : '/resources/iam/template/dashboard/loading-modal.html'
});

users.loadingModal.opened.then(function() {
Expand All @@ -102,11 +102,11 @@ function UsersController($scope, $rootScope, $uibModal, $state, $filter, filterF
if (response.data.totalResults > (response.data.startIndex - 1 + response.data.itemsPerPage)) {

users.getAllUsers(startIndex + count, count);
$rootScope.usersLoadingProgress = Math.floor((startIndex + count) * 100 / response.data.totalResults);
$rootScope.pageLoadingProgress = Math.floor((startIndex + count) * 100 / response.data.totalResults);

} else {

$rootScope.usersLoadingProgress = 100;
$rootScope.pageLoadingProgress = 100;
users.loadingModal.dismiss("Cancel");

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,78 +1,69 @@
<!-- Content Header (Page header) -user-image -->
<section class="content-header">
<h1>
<strong>{{group.data.displayName}}</strong>
</h1>
<ol class="breadcrumb">
<li><a ui-sref="groups"><i class="fa fa-users"></i> Groups</a></li>
<li class="active"><a ui-sref="group({id: group.data.id})">{{group.data.displayName}}</a></li>
</ol>
<h1>
<strong>{{group.data.displayName}}</strong>
</h1>
<ol class="breadcrumb">
<li><a ui-sref="groups"><i class="fa fa-users"></i> Groups</a></li>
<li class="active"><a ui-sref="group({id: group.data.id})">{{group.data.displayName}}</a></li>
</ol>
</section>

<!-- Main content -->
<section class="content" ng-cloak>

<div class="row">
<div class="col-xs-12">
<operationresult/>
</div>
<div class="row">
<div class="col-xs-12">
<operationresult />
</div>
</div>

<div class="row" ng-show="$root.pageLoadingProgress == 100">

<div class="row">
<div class="col-xs-12">

<div class="col-xs-12">

<div style="min-height: 650px;">

<div class="box">
<div class="box-header with-border">
<h3 class="box-title">Members</h3>
<i class="fa fa-users pull-right"></i>
</div>
<div class="box-body">
<div style="min-height: 650px;">

<table id="userslist" class="table table-striped"
ng-show="group.data.members.length > 0">
<thead>
<tr>
<th>#</th>
<th>Member</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="user in group.data.members | orderBy:'display'">
<td>{{$index + 1}}</td>
<td><a ui-sref="user({id: user.value})">{{user.display}}</a></td>
<td>
<button class="btn btn-danger btn-xs"
ng-click="group.deleteMember(user)">
<i class="fa fa-times"></i> Remove
</button>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<th>#</th>
<th>Member</th>
<th>Actions</th>
</tr>
</tfoot>
</table>
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">Members</h3>
<i class="fa fa-users pull-right"></i>
</div>
<div class="box-body">
<p ng-show="!group.data.members.length">Members not found!</p>

<div class="alert alert-info alert-dismissible"
ng-show="!group.data.members || group.data.members.length == 0">
<h4>
<i class="icon fa fa-info"></i> Members not found!
</h4>
No members found for '{{group.data.displayName}}' group.
</div>
<table id="userslist" class="table table-striped" ng-show="group.data.members.length > 0">
<thead>
<tr>
<th>#</th>
<th>Member</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="user in group.data.members | orderBy:'display'">
<td>{{$index + 1}}</td>
<td><a ui-sref="user({id: user.value})">{{user.display}}</a></td>
<td>
<button class="btn btn-danger btn-xs" ng-click="group.deleteMember(user)">
<i class="fa fa-times"></i> Remove
</button>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<th>#</th>
<th>Member</th>
<th>Actions</th>
</tr>
</tfoot>
</table>

</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

</section>
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ <h1>
</div>

<div class="col-xs-12">
<div class="box" ng-show="$root.groupsLoadingProgress == 100">
<div class="box" ng-show="$root.pageLoadingProgress == 100">
<div class="box-header with-border">
<div class="input-group">
<input placeholder="Search.." ng-model="gc.searchText"
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ <h4>Loading ...</h4>
<!-- <span class="glyphicon glyphicon-refresh glyphicon-refresh-animate"></span> -->
</div>
<div class="modal-body">
<uib-progressbar animate="false" class="progress-striped active" max="100" value="$root.usersLoadingProgress" type="danger"><i>{{$root.usersLoadingProgress}} / 100</i></uib-progressbar>
<uib-progressbar animate="false" class="progress-striped active" max="100" value="$root.pageLoadingProgress" type="danger"><i>{{$root.pageLoadingProgress}} / 100</i></uib-progressbar>
</div>
Loading