github.com/readium/readium-lcp-server@v0.0.0-20240101192032-6e95190e99f1/frontend/manage/app/user/user-list.component.ts (about) 1 import { Component, OnInit } from '@angular/core'; 2 import { User } from './user'; 3 import { UserService } from './user.service'; 4 5 @Component({ 6 moduleId: module.id, 7 selector: 'lcp-user-list', 8 templateUrl: 'user-list.component.html' 9 }) 10 11 export class UserListComponent implements OnInit { 12 users: User[]; 13 14 order: string; 15 reverse: boolean = false; 16 17 constructor(private userService: UserService) { 18 this.users = []; 19 this.order = "id"; 20 this.reverse = true; 21 } 22 23 refreshUsers(): void { 24 this.userService.list().then( 25 users => { 26 this.users = users; 27 } 28 ); 29 } 30 31 orderBy(newOrder: string) 32 { 33 if (newOrder == this.order) 34 { 35 this.reverse = !this.reverse; 36 } 37 else 38 { 39 this.reverse = false; 40 this.order = newOrder 41 } 42 } 43 44 ngOnInit(): void { 45 this.refreshUsers(); 46 } 47 48 onRemove(objId: any): void { 49 this.userService.delete(objId).then( 50 user => { 51 this.refreshUsers(); 52 } 53 ); 54 } 55 }