fix(aio): Treating some deprecated (#27981)

PR Close #27981
This commit is contained in:
WilliamKoza 2019-01-08 13:35:59 +01:00 committed by Andrew Kushnir
parent 54ba0f021f
commit 1da4b03940
5 changed files with 26 additions and 20 deletions

View File

@ -14,6 +14,7 @@ import { LocationService } from 'app/shared/location.service';
import { ApiSection, ApiService } from './api.service'; import { ApiSection, ApiService } from './api.service';
import { Option } from 'app/shared/select/select.component'; import { Option } from 'app/shared/select/select.component';
import { map } from 'rxjs/operators';
class SearchCriteria { class SearchCriteria {
query ? = ''; query ? = '';
@ -67,14 +68,17 @@ export class ApiListComponent implements OnInit {
private locationService: LocationService) { } private locationService: LocationService) { }
ngOnInit() { ngOnInit() {
this.filteredSections = combineLatest( this.filteredSections =
this.apiService.sections, combineLatest(
this.criteriaSubject, this.apiService.sections,
(sections, criteria) => { this.criteriaSubject
return sections ).pipe(
.map(section => ({ ...section, items: this.filterSection(section, criteria) })); map( results => ({ sections: results[0], criteria: results[1]})),
} map( results => (
); results.sections
.map(section => ({ ...section, items: this.filterSection(section, results.criteria) }))
))
);
this.initializeSearchCriteria(); this.initializeSearchCriteria();
} }

View File

@ -91,17 +91,19 @@ export class NavigationService {
*/ */
private getCurrentNodes(navigationViews: Observable<NavigationViews>): Observable<CurrentNodes> { private getCurrentNodes(navigationViews: Observable<NavigationViews>): Observable<CurrentNodes> {
const currentNodes = combineLatest( const currentNodes = combineLatest(
navigationViews.pipe(map(views => this.computeUrlToNavNodesMap(views))), navigationViews.pipe(
this.location.currentPath, map(views => this.computeUrlToNavNodesMap(views))),
this.location.currentPath,
(navMap, url) => { ).pipe(
const matchSpecialUrls = /^api/.exec(url); map((result) => ({navMap: result[0] , url: result[1]})),
map((result) => {
const matchSpecialUrls = /^api/.exec(result.url);
if (matchSpecialUrls) { if (matchSpecialUrls) {
url = matchSpecialUrls[0]; result.url = matchSpecialUrls[0];
} }
return navMap.get(url) || { '' : { view: '', url: url, nodes: [] }}; return result.navMap.get(result.url) || { '' : { view: '', url: result.url, nodes: [] }};
}) }),
.pipe(publishReplay(1)); publishReplay(1));
(currentNodes as ConnectableObservable<CurrentNodes>).connect(); (currentNodes as ConnectableObservable<CurrentNodes>).connect();
return currentNodes; return currentNodes;
} }

View File

@ -1,6 +1,6 @@
import { Injector, ReflectiveInjector } from '@angular/core'; import { Injector, ReflectiveInjector } from '@angular/core';
import { fakeAsync, tick } from '@angular/core/testing'; import { fakeAsync, tick } from '@angular/core/testing';
import { DOCUMENT } from '@angular/platform-browser'; import { DOCUMENT } from '@angular/common';
import { ScrollService } from 'app/shared/scroll.service'; import { ScrollService } from 'app/shared/scroll.service';
import { ScrollItem, ScrollSpiedElement, ScrollSpiedElementGroup, ScrollSpyService } from 'app/shared/scroll-spy.service'; import { ScrollItem, ScrollSpiedElement, ScrollSpiedElementGroup, ScrollSpyService } from 'app/shared/scroll-spy.service';

View File

@ -1,6 +1,6 @@
import { ReflectiveInjector } from '@angular/core'; import { ReflectiveInjector } from '@angular/core';
import { PlatformLocation } from '@angular/common'; import { PlatformLocation } from '@angular/common';
import { DOCUMENT } from '@angular/platform-browser'; import { DOCUMENT } from '@angular/common';
import { ScrollService, topMargin } from './scroll.service'; import { ScrollService, topMargin } from './scroll.service';

View File

@ -1,6 +1,6 @@
import { Injectable, Inject } from '@angular/core'; import { Injectable, Inject } from '@angular/core';
import { PlatformLocation } from '@angular/common'; import { PlatformLocation } from '@angular/common';
import { DOCUMENT } from '@angular/platform-browser'; import { DOCUMENT } from '@angular/common';
import { fromEvent } from 'rxjs'; import { fromEvent } from 'rxjs';
export const topMargin = 16; export const topMargin = 16;