parent
d2b2d813d5
commit
c7346bfdba
@ -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,13 +68,16 @@ export class ApiListComponent implements OnInit {
|
|||||||
private locationService: LocationService) { }
|
private locationService: LocationService) { }
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.filteredSections = combineLatest(
|
this.filteredSections =
|
||||||
|
combineLatest(
|
||||||
this.apiService.sections,
|
this.apiService.sections,
|
||||||
this.criteriaSubject,
|
this.criteriaSubject
|
||||||
(sections, criteria) => {
|
).pipe(
|
||||||
return sections
|
map( results => ({ sections: results[0], criteria: results[1]})),
|
||||||
.map(section => ({ ...section, items: this.filterSection(section, criteria) }));
|
map( results => (
|
||||||
}
|
results.sections
|
||||||
|
.map(section => ({ ...section, items: this.filterSection(section, results.criteria) }))
|
||||||
|
))
|
||||||
);
|
);
|
||||||
|
|
||||||
this.initializeSearchCriteria();
|
this.initializeSearchCriteria();
|
||||||
|
@ -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(
|
||||||
|
map(views => this.computeUrlToNavNodesMap(views))),
|
||||||
this.location.currentPath,
|
this.location.currentPath,
|
||||||
|
).pipe(
|
||||||
(navMap, url) => {
|
map((result) => ({navMap: result[0] , url: result[1]})),
|
||||||
const matchSpecialUrls = /^api/.exec(url);
|
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;
|
||||||
}
|
}
|
||||||
|
@ -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';
|
||||||
|
@ -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';
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user