mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-01-01 18:46:43 +00:00
Filter option added
This commit is contained in:
parent
d5e0c8271b
commit
d15b4db9fe
@ -18,9 +18,17 @@
|
|||||||
<ng-template matStepLabel>{{actionTitle}}</ng-template>
|
<ng-template matStepLabel>{{actionTitle}}</ng-template>
|
||||||
|
|
||||||
<mat-card>
|
<mat-card>
|
||||||
<mat-form-field class="filter-field">
|
<div class="tableHeader">
|
||||||
<input matInput [(ngModel)]="searchText" placeholder="Filter">
|
<mat-form-field class="filter-field">
|
||||||
</mat-form-field>
|
<input matInput [(ngModel)]="searchText" placeholder="Filter">
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-select (selectionChange)="filterAppliances($event)" [ngModelOptions]="{standalone: true}" placeholder="Category" [(ngModel)]="category">
|
||||||
|
<mat-option *ngFor="let category of categories" [value]="category">
|
||||||
|
{{category}}
|
||||||
|
</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
</div>
|
||||||
|
|
||||||
<mat-table
|
<mat-table
|
||||||
class="mat-table"
|
class="mat-table"
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
.radio-button {
|
.radio-button {
|
||||||
margin-bottom: 30px;
|
margin-bottom: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tableHeader {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-field {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
@ -19,9 +19,11 @@ export class NewTemplateDialogComponent implements OnInit {
|
|||||||
public actionTitle: string = 'Install appliance from server';
|
public actionTitle: string = 'Install appliance from server';
|
||||||
|
|
||||||
public searchText: string = '';
|
public searchText: string = '';
|
||||||
|
public allAppliances: Appliance[] = [];
|
||||||
public appliances: Appliance[] = [];
|
public appliances: Appliance[] = [];
|
||||||
|
|
||||||
public categories: string[] = ['router', 'multilayer_switch', 'guest', 'firewall'];
|
public categories: string[] = ['all categories', 'router', 'multilayer_switch', 'guest', 'firewall'];
|
||||||
|
public category: string = 'all categories';
|
||||||
public displayedColumns: string[] = ['name', 'emulator', 'vendor'];
|
public displayedColumns: string[] = ['name', 'emulator', 'vendor'];
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@ -39,9 +41,22 @@ export class NewTemplateDialogComponent implements OnInit {
|
|||||||
if (appliance.iou) appliance.emulator = 'Iou';
|
if (appliance.iou) appliance.emulator = 'Iou';
|
||||||
if (appliance.qemu) appliance.emulator = 'Qemu';
|
if (appliance.qemu) appliance.emulator = 'Qemu';
|
||||||
});
|
});
|
||||||
|
this.allAppliances = appliances;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
filterAppliances(event) {
|
||||||
|
let temporaryAppliances = this.allAppliances.filter(item => {
|
||||||
|
return item.name.toLowerCase().includes(this.searchText.toLowerCase());
|
||||||
|
});
|
||||||
|
|
||||||
|
if (this.category === 'all categories' || !this.category) {
|
||||||
|
this.appliances = temporaryAppliances;
|
||||||
|
} else {
|
||||||
|
this.appliances = temporaryAppliances.filter(t => t.category === this.category);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
setAction(action: string) {
|
setAction(action: string) {
|
||||||
this.action = action;
|
this.action = action;
|
||||||
if (action === 'install') {
|
if (action === 'install') {
|
||||||
|
Loading…
Reference in New Issue
Block a user