Commit 5e926e99 authored by Guillaume Perréal's avatar Guillaume Perréal
Browse files

Correction de quelques éléments pour la compilation.

No related merge requests found
Showing with 37 additions and 97 deletions
+37 -97
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
"outputPath": "dist", "outputPath": "dist",
"aot": true, "aot": true,
"index": "src/index.html", "index": "src/index.html",
"main": "src/public-api.ts", "main": "src/index.ts",
"tsConfig": "./tsconfig.lib.json" "tsConfig": "./tsconfig.lib.json"
}, },
"configurations": { "configurations": {
...@@ -51,11 +51,11 @@ ...@@ -51,11 +51,11 @@
"builder": "@angular-devkit/build-angular:tslint", "builder": "@angular-devkit/build-angular:tslint",
"options": { "options": {
"tsConfig": ["./tsconfig.lib.json", "./tsconfig.spec.json"], "tsConfig": ["./tsconfig.lib.json", "./tsconfig.spec.json"],
"exclude": ["**/node_modules/**", "dist/"] "exclude": ["**/node_modules/**", "dist/", "coverage/"]
} }
} }
} }
} }
}, },
"defaultProject": "default" "defaultProject": "ngx-debug"
} }
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
"@angular/platform-browser-dynamic": "^8", "@angular/platform-browser-dynamic": "^8",
"@angular/router": "^8", "@angular/router": "^8",
"@devatscience/ngx-errors": "^0.1.1", "@devatscience/ngx-errors": "^0.1.1",
"@devatscience/ngx-rxtools": "^1.1",
"@types/jasmine": "^3.4.2", "@types/jasmine": "^3.4.2",
"@types/lodash": "^4.14.142", "@types/lodash": "^4.14.142",
"chart.js": "^2.8.0", "chart.js": "^2.8.0",
...@@ -64,9 +65,6 @@ ...@@ -64,9 +65,6 @@
"typescript": "~3.5", "typescript": "~3.5",
"zone.js": "^0.9.1" "zone.js": "^0.9.1"
}, },
"dependencies": {
"@devatscience/ngx-rxtools": "^1.1"
},
"scripts": { "scripts": {
"test": "ng test --code-coverage --no-watch --no-progress", "test": "ng test --code-coverage --no-watch --no-progress",
"lint": "ng lint && prettier --check **/*.{js,json,html,scss}", "lint": "ng lint && prettier --check **/*.{js,json,html,scss}",
......
...@@ -2,5 +2,8 @@ ...@@ -2,5 +2,8 @@
* Public API Surface of ngx-debug * Public API Surface of ngx-debug
*/ */
export { DebugModule } from './lib/debug.module'; export * from './lib/debug.module';
export { spy } from './lib/spy/spy.operator'; export * from './lib/spy/spy.operator';
export * from './lib/api/api-debug.interceptor';
export * from './lib/api/api-debug.component';
export * from './lib/watch/watch.service';
import { HttpRequest, HttpResponseBase } from '@angular/common/http'; import { HttpRequest, HttpResponseBase } from '@angular/common/http';
import { import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Inject, InjectionToken, Output } from '@angular/core';
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
EventEmitter,
Output,
} from '@angular/core';
import { DebugStateService } from '../debug-state.service'; import { DebugStateService } from '../debug-state.service';
...@@ -35,12 +29,10 @@ export const ApiBaseUrlToken = new InjectionToken<string>('apiBaseUrl'); ...@@ -35,12 +29,10 @@ export const ApiBaseUrlToken = new InjectionToken<string>('apiBaseUrl');
changeDetection: ChangeDetectionStrategy.OnPush, changeDetection: ChangeDetectionStrategy.OnPush,
}) })
export class ApiDebugComponent { export class ApiDebugComponent {
@Output() public countChanged = new EventEmitter<number>();
private readonly requests = new Map<string, RequestInfo>(); private readonly requests = new Map<string, RequestInfo>();
private readonly unseen = new Set<string>(); private readonly unseen = new Set<string>();
private readonly ids: string[] = []; private readonly ids: string[] = [];
private readonly apiPrefix: string;
@Output() public countChanged = new EventEmitter<number>();
constructor( constructor(
interceptor: ApiDebugInterceptor, interceptor: ApiDebugInterceptor,
...@@ -53,26 +45,6 @@ export class ApiDebugComponent { ...@@ -53,26 +45,6 @@ export class ApiDebugComponent {
}); });
} }
public get unseenCount(): number {
return this.unseen.size;
}
public get totalCount(): number {
return this.ids.length;
}
public get last(): RequestInfo | null {
return this.ids.length ? this.requests.get(this.ids[0]) : null;
}
public get previous(): RequestInfo[] {
return this.ids.slice(1).map(id => this.requests.get(id));
}
public get all(): RequestInfo[] {
return this.ids.map(id => this.requests.get(id));
}
public isUnseen({ id }: RequestInfo): boolean { public isUnseen({ id }: RequestInfo): boolean {
return this.unseen.has(id); return this.unseen.has(id);
} }
...@@ -106,7 +78,7 @@ export class ApiDebugComponent { ...@@ -106,7 +78,7 @@ export class ApiDebugComponent {
private addRequest( private addRequest(
id: string, id: string,
{ urlWithParams, method }: HttpRequest<any> { urlWithParams, method }: HttpRequest<any>,
): void { ): void {
if (urlWithParams.startsWith(this.apiPrefix)) { if (urlWithParams.startsWith(this.apiPrefix)) {
urlWithParams = new URL(urlWithParams).pathname; urlWithParams = new URL(urlWithParams).pathname;
...@@ -124,7 +96,7 @@ export class ApiDebugComponent { ...@@ -124,7 +96,7 @@ export class ApiDebugComponent {
private setResponse( private setResponse(
request: RequestInfo, request: RequestInfo,
{ status, statusText, headers }: HttpResponseBase { status, statusText, headers }: HttpResponseBase,
): void { ): void {
request.response = { request.response = {
status, status,
...@@ -142,4 +114,24 @@ export class ApiDebugComponent { ...@@ -142,4 +114,24 @@ export class ApiDebugComponent {
private cancelRequest(request: RequestInfo): void { private cancelRequest(request: RequestInfo): void {
request.status = 'cancelled'; request.status = 'cancelled';
} }
public get unseenCount(): number {
return this.unseen.size;
}
public get totalCount(): number {
return this.ids.length;
}
public get last(): RequestInfo | null {
return this.ids.length ? this.requests.get(this.ids[ 0 ]) : null;
}
public get previous(): RequestInfo[] {
return this.ids.slice(1).map(id => this.requests.get(id));
}
public get all(): RequestInfo[] {
return this.ids.map(id => this.requests.get(id));
}
} }
export * from './api-debug.component';
export * from './api-debug.interceptor';
/**
* Configuration d'un serveur CAS.
*/
export interface IConfiguration {
/**
* URL de base de l'API.
*/
apiBaseURL: string;
/**
* Clef utilisée pour stocker le token d'authentification.
*/
authStorageKey: string;
/**
* Chemin de l'API de login.
*/
loginPath: string;
/**
* Le mode debut est-il activé ?
*/
debug: boolean;
/**
* Chemin de la toolbar de Symfony.
*/
debugToolbarURL: string;
}
/**
* Configuration de l'application.
*/
export class Configuration implements IConfiguration {
public apiBaseURL = '';
public authStorageKey = 'auth-token';
public debug = false;
public debugToolbarURL = '';
public loginPath = '/login_check';
public constructor(params?: Partial<IConfiguration>) {
if (params) {
Object.assign(this, params);
}
}
}
export function configurationFactory(): Configuration {
return new Configuration({
apiBaseURL: 'http://baliste-api.dvp',
debug: true,
debugToolbarURL: 'http://baliste-api.dvp/_wdt',
});
}
...@@ -14,7 +14,7 @@ import { ...@@ -14,7 +14,7 @@ import {
import { TreeModule } from 'primeng/tree'; import { TreeModule } from 'primeng/tree';
import { TreeTableModule } from 'primeng/treetable'; import { TreeTableModule } from 'primeng/treetable';
import { ApiDebugComponent } from './api/api-debug.component'; import { ApiDebugComponent } from './api';
import { DebugStateService } from './debug-state.service'; import { DebugStateService } from './debug-state.service';
import { DebugToggleComponent } from './debug-toggle.component'; import { DebugToggleComponent } from './debug-toggle.component';
import { DumpPanelComponent } from './dump-panel.component'; import { DumpPanelComponent } from './dump-panel.component';
......
...@@ -20,6 +20,6 @@ ...@@ -20,6 +20,6 @@
"strictInjectionParameters": true, "strictInjectionParameters": true,
"enableResourceInlining": true "enableResourceInlining": true
}, },
"files": ["src/index.ts"], "files": ["src/**/*.ts"],
"exclude": ["src/test.ts", "**/*.spec.ts"] "exclude": ["src/test.ts", "**/*.spec.ts"]
} }
...@@ -5,6 +5,5 @@ ...@@ -5,6 +5,5 @@
"types": ["jasmine", "node"] "types": ["jasmine", "node"]
}, },
"files": ["src/test.ts"], "files": ["src/test.ts"],
"include": ["src/**/*.ts"],
"exclude": [] "exclude": []
} }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment