Skip to content

Commit

Permalink
Merge pull request primefaces#134 from atretyak1985/issue_#116_v2
Browse files Browse the repository at this point in the history
Overview page enhancements
  • Loading branch information
Alfred Hall authored Feb 22, 2019
2 parents 47d5306 + 216602a commit b668899
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 9 deletions.
21 changes: 17 additions & 4 deletions src/organization/loggedin_user/loggedin_user_list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,9 @@ export class LoggedinUserListComponent implements OnInit {

this.ptable.first = 0;

this.customReuseStrategyService.routeReused$.subscribe((d: any) => {
let subscribeFunction = (d: any) => {
if(this.route.snapshot.url == d.url) {
let filter: string = this.route.snapshot.queryParams['filter'];
this.selectedId = this.route.snapshot.queryParams['id'];
if(this.selectedId) {
// Use the scroll position from when we navigated from the list so the view will be exactly the same
Expand All @@ -162,13 +163,23 @@ export class LoggedinUserListComponent implements OnInit {
this.savedScrollPos = 0;
}, 50);
}

if (filter) {
this.clearContextFilter(() => {
this.service.userFiltersState[filter] = true;
this.refresh();
});
}
} else {
let scrollPos = this.ptable.getScrollPosition();
if (scrollPos > 0) {
this.savedScrollPos = scrollPos;
}
}
});
};

subscribeFunction({url: this.route.snapshot.url});
this.customReuseStrategyService.routeReused$.subscribe(subscribeFunction);
}

onPage(event) {
Expand Down Expand Up @@ -238,7 +249,7 @@ export class LoggedinUserListComponent implements OnInit {
});
}

clearContextFilter(callback: Function) {
clearContextFilter(callback: Function = null) {
// Clear UI
this.textFilter.clear();
this.service.userFiltersState = {};
Expand All @@ -247,7 +258,9 @@ export class LoggedinUserListComponent implements OnInit {
this.ptable.first = 0;
}

callback();
if (callback) {
callback();
}
}

updateProfileFilters(event) {
Expand Down
10 changes: 5 additions & 5 deletions src/organization/overview/overview.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,23 +77,23 @@ <h1 class="panel-title">Users</h1>
<div class="row text-center">
<div class="col-md-1"></div>
<div class="col-md-2">
<button class="rounded-button">{{response.user.num_total_users}}</button>
<button class="rounded-button" (click)="userItemSelected($event, '')">{{response.user.num_total_users}}</button>
<div class="m-t-5">Total</div>
</div>
<div class="col-md-2">
<button class="rounded-button">{{response.user.num_stale_users}}</button>
<button class="rounded-button" (click)="userItemSelected($event, 'staleaccounts')">{{response.user.num_stale_users}}</button>
<div class="m-t-5">Stale</div>
</div>
<div class="col-md-2">
<button class="rounded-button">{{response.user.num_password_never_expires}}</button>
<button class="rounded-button" (click)="userItemSelected($event, 'passneverexpires')">{{response.user.num_password_never_expires}}</button>
<div class="m-t-5">Password Never Expires</div>
</div>
<div class="col-md-2">
<button class="rounded-button">{{response.user.num_domain_admins}}</button>
<button class="rounded-button" (click)="userItemSelected($event, 'domainadmins')">{{response.user.num_domain_admins}}</button>
<div class="m-t-5">Domain Admins</div>
</div>
<div class="col-md-2">
<button class="rounded-button">{{response.user.num_local_admins}}</button>
<button class="rounded-button" (click)="userItemSelected($event, 'localadmins')">{{response.user.num_local_admins}}</button>
<div class="m-t-5">Local Admins</div>
</div>
<div class="col-md-1"></div>
Expand Down
7 changes: 7 additions & 0 deletions src/organization/overview/overview.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,11 @@ export class OverviewComponent implements OnInit {
this.router.navigateByUrl(url);
}

userItemSelected(event, filter) {
event.preventDefault();
let subPath = `/loggedinusers?filter=${filter}`;
let url = this.service.accountService.navigateOrganization(subPath);
this.router.navigateByUrl(url);
}

}

0 comments on commit b668899

Please sign in to comment.