Sort board menu list alphabetically

pull/7433/head
Henriette Dinger 5 years ago
parent 2397608bac
commit 5c1e531579
  1. 11
      frontend/src/app/modules/boards/boards-sidebar/boards-menu.component.ts

@ -6,6 +6,7 @@ import {BoardCacheService} from "core-app/modules/boards/board/board-cache.servi
import {DynamicBootstrapper} from "core-app/globals/dynamic-bootstrapper";
import {AngularTrackingHelpers} from "core-components/angular/tracking-functions";
import {MainMenuNavigationService} from "core-components/main-menu/main-menu-navigation.service";
import {map} from "rxjs/operators";
@Component({
selector: 'boards-menu',
@ -15,7 +16,15 @@ import {MainMenuNavigationService} from "core-components/main-menu/main-menu-nav
export class BoardsMenuComponent {
trackById = AngularTrackingHelpers.compareByAttribute('id');
public boards$:Observable<Board[]> = this.boardCache.observeAll();
public boards$:Observable<Board[]> = this.boardCache.observeAll().pipe(
map((boards:Board[]) => {
return boards.sort(function(a, b){
if(a.name < b.name) { return -1; }
if(a.name > b.name) { return 1; }
return 0;
});
})
);
constructor(private readonly boardService:BoardService,
private readonly boardCache:BoardCacheService,

Loading…
Cancel
Save