Project

General

Profile

« Previous | Next » 

Revision 60248

[Library | Trunk]: Remove dashboards-users component

View differences:

modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/users/dashboard-users.module.ts
1
import {NgModule} from "@angular/core";
2
import {DashboardUsersComponent} from "./dashboard-users.component";
3
import {CommonModule} from "@angular/common";
4
import {RoleUsersModule} from "./role-users/role-users.module";
5

  
6
@NgModule({
7
  imports: [CommonModule, RoleUsersModule],
8
  declarations: [DashboardUsersComponent],
9
  exports: [DashboardUsersComponent]
10
})
11
export class DashboardUsersModule {}
modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/users/dashboard-users.component.html
1
<ng-template #tabs>
2
  <ul class="uk-tab customTabs admin uk-flex uk-flex-center uk-flex-left@m" uk-tab>
3
    <li [class.uk-active]="tab === 'manager'"><a (click)="changeTab('manager')"><span class="title">Managers</span></a></li>
4
    <li [class.uk-active]="tab === 'member'"><a (click)="changeTab('member')"><span class="title">Members</span></a></li>
5
  </ul>
6
</ng-template>
7
<role-users [id]="id" [type]="type" [name]="name" [link]="link" [isPortalAdmin]="isPortalAdmin" [role]="tab" [messages]="messages">
8
  <ng-container [ngTemplateOutlet]="tabs"></ng-container>
9
</role-users>
modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/users/dashboard-users.component.ts
1
import {Component, Input, OnInit} from "@angular/core";
2
import {UserManagementService} from "../../services/user-management.service";
3
import {Session, User} from "../../login/utils/helper.class";
4

  
5
@Component({
6
  selector: 'dashboard-users',
7
  templateUrl: 'dashboard-users.component.html'
8
})
9
export class DashboardUsersComponent implements OnInit{
10
  
11
  @Input()
12
  public id: string;
13
  @Input()
14
  public type: string;
15
  @Input()
16
  public name: string;
17
  @Input()
18
  public link: string;
19
  @Input()
20
  public messages: Map<"member" | "manager", string> = null;
21
  public user: User;
22
  public tab: "manager" | "member" = 'manager';
23
  
24
  constructor(private userManagementService: UserManagementService) {
25
  }
26
  
27
  ngOnInit() {
28
    this.userManagementService.getUserInfo().subscribe(user => {
29
      this.user = user;
30
    });
31
  }
32
  
33
  changeTab(tab: "manager" | "member") {
34
    this.tab = tab;
35
  }
36
  
37
  public get isPortalAdmin() {
38
    return Session.isPortalAdministrator(this.user) || Session.isCurator(this.type, this.user);
39
  }
40
}
modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/users/role-users/role-users.component.ts
5 5
import {UserRegistryService} from "../../../services/user-registry.service";
6 6
import {EnvProperties} from "../../../utils/properties/env-properties";
7 7
import {properties} from "../../../../../environments/environment";
8
import {Session} from "../../../login/utils/helper.class";
8
import {Session, User} from "../../../login/utils/helper.class";
9 9
import {UserManagementService} from "../../../services/user-management.service";
10 10
import {Router} from "@angular/router";
11 11
import {LoginErrorCodes} from "../../../login/utils/guardHelper.class";
......
29 29
  @Input()
30 30
  public link: string;
31 31
  @Input()
32
  public isPortalAdmin: boolean = false;
33
  @Input()
34 32
  public role: "member" | "manager" = "manager";
35 33
  @Input()
36
  public messages: Map<"member" | "manager", string> = null;
34
  public message: string = null;
35
  public user: User = null;
37 36
  public active: any[];
38 37
  public pending: any[];
39 38
  public showActive: boolean = true;
......
59 58
  ngOnInit() {
60 59
   this.updateLists();
61 60
   this.userManagementService.getUserInfo().subscribe(user => {
62
     if(user) {
63
       if(!Session.isPortalAdministrator(user) && !Session.isCurator(this.type, user) && !Session.isManager(this.type, this.id, user)) {
64
         this.router.navigate(['/user-info'], {
65
           queryParams: {
66
             "errorCode": LoginErrorCodes.NOT_AUTHORIZED,
67
             "redirectUrl": this.router.url
68
           }
69
         });
70
       }
71
     }
61
     this.user = user;
72 62
   });
73 63
  }
74 64
  
......
232 222
      this.loadPending = false;
233 223
    });
234 224
  }
225
  
226
  public get isPortalAdmin() {
227
    return Session.isPortalAdministrator(this.user) || Session.isCurator(this.type, this.user);
228
  }
235 229
}

Also available in: Unified diff