mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-01-18 18:56:26 +00:00
Update template.component.ts
This commit is contained in:
parent
c7db04ce3b
commit
cf725931f9
@ -48,11 +48,16 @@ export class TemplateComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
this.templateService.list(this.server).subscribe((listOfTemplates: Template[]) => {
|
this.templateService.list(this.server).subscribe((listOfTemplates: Template[]) => {
|
||||||
this.filteredTemplates = listOfTemplates;
|
this.filteredTemplates = listOfTemplates;
|
||||||
|
this.sortTemplates();
|
||||||
this.templates = listOfTemplates;
|
this.templates = listOfTemplates;
|
||||||
});
|
});
|
||||||
this.symbolService.list(this.server);
|
this.symbolService.list(this.server);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sortTemplates() {
|
||||||
|
this.filteredTemplates = this.filteredTemplates.sort((a, b) => (a.name < b.name ? -1 : 1));
|
||||||
|
}
|
||||||
|
|
||||||
filterTemplates(event) {
|
filterTemplates(event) {
|
||||||
let temporaryTemplates = this.templates.filter(item => {
|
let temporaryTemplates = this.templates.filter(item => {
|
||||||
return item.name.toLowerCase().includes(this.searchText.toLowerCase());
|
return item.name.toLowerCase().includes(this.searchText.toLowerCase());
|
||||||
@ -63,6 +68,7 @@ export class TemplateComponent implements OnInit, OnDestroy {
|
|||||||
} else {
|
} else {
|
||||||
this.filteredTemplates = temporaryTemplates.filter(t => t.template_type === this.selectedType);
|
this.filteredTemplates = temporaryTemplates.filter(t => t.template_type === this.selectedType);
|
||||||
}
|
}
|
||||||
|
this.sortTemplates();
|
||||||
}
|
}
|
||||||
|
|
||||||
dragStart(ev) {
|
dragStart(ev) {
|
||||||
|
Loading…
Reference in New Issue
Block a user