github.com/readium/readium-lcp-server@v0.0.0-20240101192032-6e95190e99f1/frontend/manage/app/license/license-info.component.ts (about) 1 import { Component, Input } from '@angular/core'; 2 import { License } from './license'; 3 import { LicenseService } from './license.service'; 4 5 declare var Config: any; 6 7 @Component({ 8 moduleId: module.id, 9 selector: 'lcp-frontend-license-info', 10 templateUrl: './license-info.component.html' 11 }) 12 13 14 export class LicenseInfoComponent { 15 @Input('filterBox') filterBox: any; 16 17 licenses: License[]; 18 filter: number = 0; 19 filtred = false; 20 baseUrl: string; 21 22 reverse: boolean = false; 23 order: string; 24 25 26 27 ngOnInit(): void { 28 this.baseUrl = Config.frontend.url; 29 this.refreshInfos(); 30 31 this.order = "publicationTitle"; 32 } 33 34 constructor(private licenseService: LicenseService) { 35 36 } 37 38 onSubmit(){ 39 this.filtred = true; 40 this.refreshInfos(); 41 } 42 43 refreshInfos() 44 { 45 this.licenseService.get(this.filter).then( 46 infos => { 47 this.licenses = infos; 48 } 49 ); 50 } 51 52 orderBy(newOrder: string) 53 { 54 if (newOrder == this.order) 55 { 56 this.reverse = !this.reverse; 57 } 58 else 59 { 60 this.reverse = false; 61 this.order = newOrder 62 } 63 } 64 65 keyPressed(key:number) 66 { 67 if (key == 13) 68 { 69 this.onSubmit() 70 } 71 } 72 }