Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Commit 59418dd

Browse files
committed
api-list - WIP - partial updates to work in new app
1 parent e437b32 commit 59418dd

File tree

2 files changed

+8
-17
lines changed

2 files changed

+8
-17
lines changed

src/app/api-list/api-list.component.css

Whitespace-only changes.

src/app/api-list/api-list.component.ts

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {Component, Input, OnInit} from '@angular/core';
22
import {Http} from '@angular/http';
33
import {Router, NavigationExtras} from '@angular/router';
4-
import {DocInfoService} from '../../../../shared';
4+
import { DocInfoService, NgLang } from '../doc-info.service';
55
import 'rxjs/add/operator/toPromise';
66

77
type Lang = 'dart' | 'ts' | 'js';
@@ -58,23 +58,21 @@ export class ApiListComponent implements OnInit {
5858

5959
constructor(
6060
private http: Http,
61-
private router: Router,
6261
private docInfoSvc: DocInfoService
6362
) {
64-
router.events.subscribe((event) => {
65-
this.applyFilterOnSections();
66-
});
63+
this.applyFilterOnSections();
64+
// router.events.subscribe((event) => { ... });
6765
}
6866

6967
get ngLang() { return this.docInfoSvc.ngLang; }
7068

7169
ngOnInit(): void {
72-
const urlPrefix = this.router.url.split('?')[0].replace(/^\/docs\//, '/assets/');
70+
const urlPrefix = this.docInfoSvc.path.split('?')[0]; // .replace(/^\/docs\//, '/assets/');
7371
const url = `${urlPrefix}/${this.src}`;
7472
this.fetchUrl(url);
7573

7674
// extract type and status from url
77-
var split = this.router.url.split('?');
75+
var split = this.docInfoSvc.path.split('?'); // FIXME: path doesn't currently contain query params
7876
if (split.length > 1) {
7977
const paramsRaw = split[1].split('&');
8078
const type = paramsRaw[0] ? paramsRaw[0].split('=')[1] : '';
@@ -125,7 +123,7 @@ export class ApiListComponent implements OnInit {
125123

126124
applyFilterOnSections() {
127125
// Cannot guarantee that <param> in queryParam=<param> is an ApiMatch so we union type check it with a string.
128-
const selectedApiMatchOnUrl: string | ApiMatch = this.router.url.split('=')[1];
126+
const selectedApiMatchOnUrl: string | ApiMatch = this.docInfoSvc.path.split('=')[1];
129127
this.changeSelectedApiTypeForApiMatch(selectedApiMatchOnUrl);
130128
if (this.isApiLoaded) {
131129
this.groupedSections.forEach((s) => {
@@ -204,9 +202,7 @@ export class ApiListComponent implements OnInit {
204202
status: status
205203
}
206204
};
207-
208-
this.router.navigate([`/docs/${this.ngLang}/latest/api`], navigationExtras);
209-
205+
// FIXME, was: this.router.navigate([`/docs/${this.ngLang}/latest/api`], navigationExtras);
210206
this.toggleApiMenu();
211207
}
212208

@@ -222,9 +218,7 @@ export class ApiListComponent implements OnInit {
222218
status: status
223219
}
224220
};
225-
226-
this.router.navigate([`/docs/${this.ngLang}/latest/api`], navigationExtras);
227-
221+
// FIXME, was: this.router.navigate([`/docs/${this.ngLang}/latest/api`], navigationExtras);
228222
this.toggleStatusMenu();
229223
}
230224

@@ -236,7 +230,4 @@ export class ApiListComponent implements OnInit {
236230
this.showStatusMenu = !this.showStatusMenu;
237231
}
238232

239-
clearType() {
240-
241-
}
242233
}

0 commit comments

Comments
 (0)