diff --git a/dashboard/menu/menu.component.html b/dashboard/menu/menu.component.html index b5cd8aa3..17f5f3c6 100644 --- a/dashboard/menu/menu.component.html +++ b/dashboard/menu/menu.component.html @@ -104,7 +104,7 @@ [okDisabled]="menuItemForm && (menuItemForm.invalid || !menuItemForm.dirty)">
-
+
diff --git a/dashboard/menu/menu.component.ts b/dashboard/menu/menu.component.ts index 9b5fe57d..77c664a8 100644 --- a/dashboard/menu/menu.component.ts +++ b/dashboard/menu/menu.component.ts @@ -123,11 +123,11 @@ export class MenuComponent implements OnInit { data => { this.rootMenuItems = data; if(data && data.length > 0) { - // this.activeRootMenuId = data[0]['_id']; this.changeActiveRootMenuItem(data[0]); } }, - err => console.error("Server error fetching menu items: ", err) + // err => console.error("Server error fetching menu items: ", err) + error => this.handleError("Server error fetching menu items", error) ) ); } @@ -163,7 +163,7 @@ export class MenuComponent implements OnInit { } } }, - err => console.error("Server error fetching pages: ", err) + error => this.handleError("Server error fetching pages", error) ) ); } @@ -202,7 +202,8 @@ export class MenuComponent implements OnInit { }); this.newPageWindowOpen = !this.newPageWindowOpen; this.menuItemForm.get('route').setValue(page.route); - } + }, + error => this.handleError('System error creating page', error) ) ); } @@ -211,7 +212,6 @@ export class MenuComponent implements OnInit { this.destroyTypeSubscription(); this.typeSub = this.menuItemForm.get('type').valueChanges.subscribe(value => { setTimeout(() => { - // console.log(value); this.menuItemForm.controls['route'].clearValidators(); this.menuItemForm.controls['url'].clearValidators(); if(value === "internal") { @@ -286,7 +286,8 @@ export class MenuComponent implements OnInit { pos: 'bottom-right' }); this.showLoading = false; - } + }, + error => this.handleError("Server error deleting menu item", error) ) ) } @@ -325,7 +326,8 @@ export class MenuComponent implements OnInit { timeout: 6000, pos: 'bottom-right' }); - } + }, + error => this.handleError("System error creating menu item", error) ) ) } else { @@ -338,7 +340,8 @@ export class MenuComponent implements OnInit { timeout: 6000, pos: 'bottom-right' }); - } + }, + error => this.handleError("System error updating menu item", error) ) ) } @@ -362,8 +365,18 @@ export class MenuComponent implements OnInit { this.showLoading = false; } + handleError(message: string, error) { + UIkit.notification(message, { + status: 'danger', + timeout: 6000, + pos: 'bottom-right' + }); + console.log('Server responded: ' + error); + this.showLoading = false; + } + public applyFilters() { - this.childrenMenuItems = this.activeRootMenu.items.filter(item => item.title.toLowerCase().includes(this.searchText)); + this.childrenMenuItems = this.activeRootMenu.items.filter(item => item.title.toLowerCase().includes(this.searchText) || (item.url||'').toLowerCase().includes(this.searchText) || (item.route||'').toLowerCase().includes(this.searchText)); } public onSearchClose() { diff --git a/sharedComponents/input/input.component.ts b/sharedComponents/input/input.component.ts index b194161b..d33aa0b5 100644 --- a/sharedComponents/input/input.component.ts +++ b/sharedComponents/input/input.component.ts @@ -77,7 +77,7 @@ export interface Option { (openedChange)="stopPropagation()" [formControl]="formControl" [disableOptionCentering]="true"> {{placeholder}} - + {{option.label}} @@ -211,6 +211,7 @@ export class InputComponent implements OnInit, OnDestroy, OnChanges { public filteredOptions: Observable; public searchControl: FormControl; private subscriptions: any[] = []; + @Input() tooltip: boolean = true; @ViewChild('select') select: MatSelect; @ViewChild('searchInput') searchInput: ElementRef; focused: boolean = false;