-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d5b310d
commit 5589edf
Showing
5 changed files
with
60 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import {Injectable} from "@angular/core"; | ||
import {Resolve, ActivatedRouteSnapshot} from "@angular/router"; | ||
import {Observable, Observer} from "rxjs"; | ||
import {DashboardList} from "./models/dashboardList"; | ||
import {DashboardBox} from "./models/dashboardBox"; | ||
import {DashboardListItem} from "./models/dashboardListItem"; | ||
import {OrderBy} from "./sorts/orderby"; | ||
import {DashboardService} from "./dashboardService"; | ||
|
||
@Injectable() | ||
export class DashboardViewResolve implements Resolve<any> { | ||
constructor(private dashboardService: DashboardService) { | ||
|
||
} | ||
|
||
resolve(route: ActivatedRouteSnapshot): Observable<Object> { | ||
return Observable.create((observer: Observer<Object>) => { | ||
this.dashboardService.getDashboardBoxes().subscribe((res) => { | ||
let boxesCss = new DashboardList<string>(); | ||
let boxes = new DashboardListItem<DashboardBox>(); | ||
let orderBy: OrderBy = new OrderBy(); | ||
boxes.merge(orderBy.transform(res, { key: 'order', direction: 'ascending' })); | ||
|
||
let ressult = { | ||
boxesCss: boxesCss, | ||
boxes: boxes | ||
} | ||
|
||
observer.next(ressult); | ||
observer.complete(); | ||
}); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters