Skip to content
Snippets Groups Projects
Commit 3253e039 authored by kbeyro's avatar kbeyro
Browse files

add search

parent ff74177c
No related branches found
No related tags found
No related merge requests found
<div class="col-sm-12 col-sm-offset-1 col-sm 10 col-md-offset-1 col-md-10"> <div class="col-sm-12 col-sm-offset-1 col-sm 10 col-md-offset-1 col-md-10">
<h3>{{'APPS_MANAGEMENT.TITLE'| translate}}</h3> <h3>{{'APPS_MANAGEMENT.TITLE'| translate}}</h3>
<button [routerLink]="['/admin/apps/create']" class="btn btn-primary">{{ 'APPS_MANAGEMENT.ADD_BUTTON' | translate }}</button> <div style="display:flex; justify-content: space-between">
<button (click)="appAddJson.show()" class="btn btn-primary" style="margin-left: 10px">{{ 'APPS_MANAGEMENT.ADD_BUTTON' | translate }} (JSON)</button> <div style="display:flex">
<button [routerLink]="['/admin/apps/create']" class="btn btn-primary">{{ 'APPS_MANAGEMENT.ADD_BUTTON' | translate }}</button>
<button (click)="appAddJson.show()" class="btn btn-primary" style="margin-left: 10px">{{ 'APPS_MANAGEMENT.ADD_BUTTON' | translate }} (JSON)</button>
</div>
<div style="display: flex">
<input pInputText id="searchText" type="text" placeholder="Search" (keyup)="searchApp($event.target.value)">
<hr> </div>
<table class="table table-hover table-condensed" aria-describedby="Apps management table"> </div>
<table class="table table-hover table-condensed" aria-describedby="Apps management table" style="margin-top:15px">
<thead> <thead>
<tr> <tr>
<th scope="col"></th> <th scope="col"></th>
......
...@@ -27,6 +27,8 @@ export class AppManagementListComponent implements OnInit { ...@@ -27,6 +27,8 @@ export class AppManagementListComponent implements OnInit {
public versionRowVisible: boolean[] = [] public versionRowVisible: boolean[] = []
public filteredApps: ApplicationBase[] = [];
constructor(public appsService: AppsService, constructor(public appsService: AppsService,
public router: Router, public router: Router,
public authService: AuthService) { public authService: AuthService) {
...@@ -84,8 +86,22 @@ export class AppManagementListComponent implements OnInit { ...@@ -84,8 +86,22 @@ export class AppManagementListComponent implements OnInit {
}) })
).subscribe(val => { ).subscribe(val => {
this.apps = val; this.apps = val;
this.filteredApps = val;
this.versionRowVisible = new Array(val.length).fill(false); this.versionRowVisible = new Array(val.length).fill(false);
}); });
} }
public searchApp(value: string) {
const result = [];
if (value !== null && value !== '') {
this.apps.forEach(app => {
if (app.name.toLowerCase().includes(value.toLowerCase())) {
result.push(app)
}
})
this.apps = result;
} else {
this.apps = this.filteredApps
}
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment