diff --git a/webapp/package-lock.json b/webapp/package-lock.json index 4b1a8049d5978598aaea105a244a61727181f5c2..259dca41abccf77abd90c8c3a85b9f1868938556 100644 --- a/webapp/package-lock.json +++ b/webapp/package-lock.json @@ -233,6 +233,40 @@ "tslib": "1.9.0" } }, + "@fimbul/bifrost": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/@fimbul/bifrost/-/bifrost-0.9.0.tgz", + "integrity": "sha512-efruzazTrtkipgpC166pSK3fAc+5n55B0wrLbpkO33dO6OJtI0LxP5u89OQV9I3tp6oCOZB2p4+7+CwulVmAkA==", + "dev": true, + "requires": { + "@fimbul/ymir": "0.9.0", + "get-caller-file": "1.0.2", + "tslib": "1.9.0", + "tsutils": "2.27.1" + }, + "dependencies": { + "tsutils": { + "version": "2.27.1", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.27.1.tgz", + "integrity": "sha512-AE/7uzp32MmaHvNNFES85hhUDHFdFZp6OAiZcd6y4ZKKIg6orJTm8keYWBhIhrJQH3a4LzNKat7ZPXZt5aTf6w==", + "dev": true, + "requires": { + "tslib": "1.9.0" + } + } + } + }, + "@fimbul/ymir": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/@fimbul/ymir/-/ymir-0.9.0.tgz", + "integrity": "sha512-IR3wvH2Lae6ab96CKT68Xj/o8Ozpoq8ifRnxlKmhIqHLSnABaVdJ1Mta3DGyI7wElQQsGQUySkEv/eJiL/AxTg==", + "dev": true, + "requires": { + "inversify": "4.13.0", + "reflect-metadata": "0.1.12", + "tslib": "1.9.0" + } + }, "@ngtools/json-schema": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@ngtools/json-schema/-/json-schema-1.2.0.tgz", @@ -2694,6 +2728,30 @@ "buffer-indexof": "1.1.1" } }, + "doctrine": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-0.7.2.tgz", + "integrity": "sha1-fLhgNZujvpDgQLJrcpzkv6ZUxSM=", + "dev": true, + "requires": { + "esutils": "1.1.6", + "isarray": "0.0.1" + }, + "dependencies": { + "esutils": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-1.1.6.tgz", + "integrity": "sha1-wBzKqa5LiXxtDD4hCuUvPHqEQ3U=", + "dev": true + }, + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "dev": true + } + } + }, "dom-converter": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/dom-converter/-/dom-converter-0.1.4.tgz", @@ -5531,6 +5589,12 @@ "loose-envify": "1.3.1" } }, + "inversify": { + "version": "4.13.0", + "resolved": "https://registry.npmjs.org/inversify/-/inversify-4.13.0.tgz", + "integrity": "sha512-O5d8y7gKtyRwrvTLZzYET3kdFjqUy58sGpBYMARF13mzqDobpfBXVOPLH7HmnD2VR6Q+1HzZtslGvsdQfeb0SA==", + "dev": true + }, "invert-kv": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", @@ -10730,6 +10794,70 @@ } } }, + "tslint-config-airbnb": { + "version": "5.9.2", + "resolved": "https://registry.npmjs.org/tslint-config-airbnb/-/tslint-config-airbnb-5.9.2.tgz", + "integrity": "sha512-7hT9VoPxT64Xk68+Ak4rhHCaVja6jHFIE6koeHCbZTz1XKUUVX4qZTHUZBLVS/0CmuyDJ1U/8ALyqn+gFxZgbQ==", + "dev": true, + "requires": { + "tslint-consistent-codestyle": "1.13.1", + "tslint-eslint-rules": "5.3.1", + "tslint-microsoft-contrib": "5.0.3" + } + }, + "tslint-consistent-codestyle": { + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/tslint-consistent-codestyle/-/tslint-consistent-codestyle-1.13.1.tgz", + "integrity": "sha512-t4BRGtjuejYikhcOrpR8GjaSBrN3lwP9iMlO9vbhA6SCGeJvebfNMLeo7PY2ZhXdwkjdTh0mMWV4zDyLs9FKYg==", + "dev": true, + "requires": { + "@fimbul/bifrost": "0.9.0", + "tslib": "1.9.0", + "tsutils": "2.27.1" + }, + "dependencies": { + "tsutils": { + "version": "2.27.1", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.27.1.tgz", + "integrity": "sha512-AE/7uzp32MmaHvNNFES85hhUDHFdFZp6OAiZcd6y4ZKKIg6orJTm8keYWBhIhrJQH3a4LzNKat7ZPXZt5aTf6w==", + "dev": true, + "requires": { + "tslib": "1.9.0" + } + } + } + }, + "tslint-eslint-rules": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/tslint-eslint-rules/-/tslint-eslint-rules-5.3.1.tgz", + "integrity": "sha512-qq2H/AU/FlFbQJKXuxhtIk+ni/nQu9jHHhsFKa6hnA0/n3zl1/RWRc3TVFlL8HfWFMzkST350VeTrFpy1u4OUg==", + "dev": true, + "requires": { + "doctrine": "0.7.2", + "tslib": "1.9.0", + "tsutils": "2.8.0" + }, + "dependencies": { + "tsutils": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.8.0.tgz", + "integrity": "sha1-AWAXNymzvxOGKN0UoVN+AIUdgUo=", + "dev": true, + "requires": { + "tslib": "1.9.0" + } + } + } + }, + "tslint-microsoft-contrib": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/tslint-microsoft-contrib/-/tslint-microsoft-contrib-5.0.3.tgz", + "integrity": "sha512-5AnfTGlfpUzpRHLmoojPBKFTTmbjnwgdaTHMdllausa4GBPya5u36i9ddrTX4PhetGZvd4JUYIpAmgHqVnsctg==", + "dev": true, + "requires": { + "tsutils": "2.22.2" + } + }, "tsscmp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/tsscmp/-/tsscmp-1.0.5.tgz", diff --git a/webapp/package.json b/webapp/package.json index 742daeb757c28bee73db309e4e2ea12b73e1cc0d..9edbc4e7e9be3693762db4ff61c358bf5094b05f 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -61,6 +61,7 @@ "sass-recursive-map-merge": "^1.0.1", "ts-node": "~4.1.0", "tslint": "~5.9.1", + "tslint-config-airbnb": "^5.9.2", "typescript": "~2.5.3" } } diff --git a/webapp/src/app/app-routing.module.ts b/webapp/src/app/app-routing.module.ts index eadb41763de1fab8a05310989853b44184cb922a..84551bca0534907e135e79f4ea01870589b773f8 100644 --- a/webapp/src/app/app-routing.module.ts +++ b/webapp/src/app/app-routing.module.ts @@ -5,6 +5,6 @@ export const routes: Routes = []; @NgModule({ imports: [RouterModule.forRoot(routes)], - exports: [RouterModule] + exports: [RouterModule], }) export class AppRoutingModule { } diff --git a/webapp/src/app/app.component.spec.ts b/webapp/src/app/app.component.spec.ts index a6ded0a442a917351b5f440482cb962fac5d3773..dc6f874cd9fd421c6714c1c8fda0551a91e72f8c 100644 --- a/webapp/src/app/app.component.spec.ts +++ b/webapp/src/app/app.component.spec.ts @@ -9,9 +9,9 @@ describe('AppComponent', () => { AppComponent, MockComponent({ selector: 'app-header' }), MockComponent({ selector: 'app-main' }), - MockComponent({ selector: 'app-footer' }) + MockComponent({ selector: 'app-footer' }), ], - imports: [] + imports: [], }).compileComponents(); })); it('should create the app', async(() => { diff --git a/webapp/src/app/app.component.ts b/webapp/src/app/app.component.ts index ead0de4491ac51c7a45cbf97c9f487cc61acc19e..967833b92ea94c34d1c2e36724cc8547e26fc394 100644 --- a/webapp/src/app/app.component.ts +++ b/webapp/src/app/app.component.ts @@ -2,7 +2,7 @@ import { Component } from '@angular/core'; @Component({ selector: 'app-root', - templateUrl: './app.component.html' + templateUrl: './app.component.html', }) export class AppComponent { } diff --git a/webapp/src/app/app.module.ts b/webapp/src/app/app.module.ts index 2c46a182c650a3cac1be113d6af53fc9f418b668..78e74a37eee277a14f5d99fdbf2b2d2909836353 100644 --- a/webapp/src/app/app.module.ts +++ b/webapp/src/app/app.module.ts @@ -9,10 +9,9 @@ import { CoreModule } from './core/core.module'; import { GeosourceModule } from './geosource/geosource.module'; import { EditorialisationModule } from './editorialisation/editorialisation.module'; - @NgModule({ declarations: [ - AppComponent + AppComponent, ], imports: [ BrowserModule, @@ -21,9 +20,9 @@ import { EditorialisationModule } from './editorialisation/editorialisation.modu CoreModule, GeosourceModule, EditorialisationModule, - AppRoutingModule + AppRoutingModule, ], providers: [], - bootstrap: [AppComponent] + bootstrap: [AppComponent], }) export class AppModule { } diff --git a/webapp/src/app/app.routing.spec.ts b/webapp/src/app/app.routing.spec.ts index 125d8890c42427f7868a83e342e91e74384780a4..c4f22b48b79c04b1ee3e2ea1e49e50217458ded7 100644 --- a/webapp/src/app/app.routing.spec.ts +++ b/webapp/src/app/app.routing.spec.ts @@ -1,4 +1,4 @@ -import { TestBed, fakeAsync, tick, async } from '@angular/core/testing'; +import { TestBed, async } from '@angular/core/testing'; import { Router, Routes } from '@angular/router'; import { RouterTestingModule } from '@angular/router/testing'; import { AppComponent } from './app.component'; @@ -19,8 +19,8 @@ import { EditorialisationComponents } from './editorialisation/components'; import { SharedModule } from './shared/shared.module'; import { EditorialisationService, EditorialisationServices } from './editorialisation/services'; import { HttpClientModule } from '@angular/common/http'; -import { DatasetResearchService, GeosourceServices } from './geosource/services'; -import { EditorialisationResolvers, PostDetailResolver, PostsListResolver, PostVideoResolver } from './editorialisation/resolvers'; +import { GeosourceServices } from './geosource/services'; +import { PostDetailResolver, PostsListResolver, PostVideoResolver } from './editorialisation/resolvers'; import { EditorialisationServiceMock } from './editorialisation/services/editorialisation.service.mock'; import { PageResolver } from './editorialisation/resolvers/page.resolver'; @@ -31,7 +31,7 @@ describe('App routing', () => { ...AppRoutes, ...GeosourceRoutes, ...CoreRoutes, - ...EditorialisationRoutes + ...EditorialisationRoutes, ]; beforeEach(async(() => { @@ -40,37 +40,37 @@ describe('App routing', () => { FormsModule, SharedModule, HttpClientModule, - RouterTestingModule.withRoutes(routes) + RouterTestingModule.withRoutes(routes), ], declarations: [ AppComponent, ...CoreComponents, ...GeosourceComponents, - ...EditorialisationComponents + ...EditorialisationComponents, ], providers: [ { provide: EditorialisationService, - useValue: EditorialisationServiceMock + useValue: EditorialisationServiceMock, }, { provide: PageResolver, - useValue: {resolve() { }} + useValue: { resolve() { } }, }, { provide: PostDetailResolver, - useValue: {resolve() { }} + useValue: { resolve() { } }, }, { provide: PostsListResolver, - useValue: {resolve() { }} + useValue: { resolve() { } }, }, { provide: PostVideoResolver, - useValue: {resolve() { }} + useValue: { resolve() { } }, }, - ...GeosourceServices - ] + ...GeosourceServices, + ], }).compileComponents(); })); @@ -81,30 +81,31 @@ describe('App routing', () => { // ********* From geosource module ********* // - it('navigate to "/recherche" redirects you to /recherche/datasets', done => { + it('navigate to "/recherche" redirects you to /recherche/datasets', (done) => { router.navigateByUrl('/' + routeNames.research).then(() => { expect(router.routerState.snapshot.url).toBe('/' + routeNames.research + '/' + routeNames.datasets); done(); }); }); - it('navigate to "/recherche/datasets" takes you to /datasets', done => { + it('navigate to "/recherche/datasets" takes you to /datasets', (done) => { router.navigateByUrl('/' + routeNames.research + '/' + routeNames.datasets).then(() => { expect(router.routerState.snapshot.url).toBe('/' + routeNames.research + '/' + routeNames.datasets); done(); }); }); - it('navigate to "/recherche/datasets/abcdef" takes you to /recherche/datasets/abcdef', done => { + it('navigate to "/recherche/datasets/abcdef" takes you to /recherche/datasets/abcdef', (done) => { router.navigateByUrl('/' + routeNames.research + '/' + routeNames.datasets + '/abcdef').then(() => { - expect(router.routerState.snapshot.url).toBe('/' + routeNames.research + '/' + routeNames.datasets + '/abcdef' + routeNames.info); + expect(router.routerState.snapshot.url).toBe( + '/' + routeNames.research + '/' + routeNames.datasets + '/abcdef' + routeNames.info); done(); }); }); // ********* From core module ********* // - it('navigate to "" redirects you to /accueil', done => { + it('navigate to "" redirects you to /accueil', (done) => { router.navigateByUrl('/').then(() => { expect(router.routerState.snapshot.url).toBe('/' + routeNames.home); done(); @@ -113,40 +114,38 @@ describe('App routing', () => { // ********* From editorialisation module ********* // - it('navigate to "/accueil" takes you to /accueil', done => { + it('navigate to "/accueil" takes you to /accueil', (done) => { router.navigateByUrl('/' + routeNames.home).then(() => { expect(router.routerState.snapshot.url).toBe('/' + routeNames.home); done(); }); }); - it('navigate to "/demarche" takes you to /demarche', done => { + it('navigate to "/demarche" takes you to /demarche', (done) => { router.navigateByUrl('/' + routeNames.approach).then(() => { expect(router.routerState.snapshot.url).toBe('/' + routeNames.approach); done(); }); }); - it('navigate to "/accessibilite" takes you to /accessibilite', done => { + it('navigate to "/accessibilite" takes you to /accessibilite', (done) => { router.navigateByUrl('/' + routeNames.accessibility).then(() => { expect(router.routerState.snapshot.url).toBe('/' + routeNames.accessibility); done(); }); }); - it('navigate to "/plan-du-site" takes you to /plan-du-site', done => { + it('navigate to "/plan-du-site" takes you to /plan-du-site', (done) => { router.navigateByUrl('/' + routeNames.siteMap).then(() => { expect(router.routerState.snapshot.url).toBe('/' + routeNames.siteMap); done(); }); }); - it('navigate to "/mentions-legales" takes you to /mentions-legales', done => { + it('navigate to "/mentions-legales" takes you to /mentions-legales', (done) => { router.navigateByUrl('/' + routeNames.legalNotices).then(() => { expect(router.routerState.snapshot.url).toBe('/' + routeNames.legalNotices); done(); }); }); - - }); diff --git a/webapp/src/app/core/components/footer/footer.component.spec.ts b/webapp/src/app/core/components/footer/footer.component.spec.ts index 25ce776992fa99210b5ea02a93fa195429e8e7da..5ef3200150ebf1cd8b89fa436091e5df5d66640a 100644 --- a/webapp/src/app/core/components/footer/footer.component.spec.ts +++ b/webapp/src/app/core/components/footer/footer.component.spec.ts @@ -22,7 +22,7 @@ describe('FooterComponent', () => { let fixture: ComponentFixture<FooterComponent>; let debugElement: DebugElement; const routes: Routes = [ - ...EditorialisationRoutes + ...EditorialisationRoutes, ]; let location: Location; @@ -40,25 +40,25 @@ describe('FooterComponent', () => { providers: [ { provide: EditorialisationService, - useValue: EditorialisationServiceMock + useValue: EditorialisationServiceMock, }, { provide: PageResolver, - useValue: {resolve() { }} + useValue: { resolve() { } }, }, { provide: PostDetailResolver, - useValue: {resolve() { }} + useValue: { resolve() { } }, }, { provide: PostsListResolver, - useValue: {resolve() { }} + useValue: { resolve() { } }, }, { provide: PostVideoResolver, - useValue: {resolve() { }} - } - ] + useValue: { resolve() { } }, + }, + ], }) .compileComponents(); })); diff --git a/webapp/src/app/core/components/footer/footer.component.ts b/webapp/src/app/core/components/footer/footer.component.ts index ba60242a776bf6cab6f9e87531e0f55548654e17..3ac873af3e3c6c483394f6f681c24573285e5d34 100644 --- a/webapp/src/app/core/components/footer/footer.component.ts +++ b/webapp/src/app/core/components/footer/footer.component.ts @@ -4,7 +4,7 @@ import { AppRoutes } from '../../../routes'; @Component({ selector: 'app-footer', templateUrl: './footer.component.html', - styleUrls: ['./footer.component.scss'] + styleUrls: ['./footer.component.scss'], }) export class FooterComponent implements OnInit { // Instanciate the object containing routes name diff --git a/webapp/src/app/core/components/header/header.component.spec.ts b/webapp/src/app/core/components/header/header.component.spec.ts index b4e3f4d2efd0f472619833a5f8e6944d42e44ecb..80fd461b9725a18d99af36bccc45229947441041 100644 --- a/webapp/src/app/core/components/header/header.component.spec.ts +++ b/webapp/src/app/core/components/header/header.component.spec.ts @@ -29,7 +29,7 @@ describe('HeaderComponent', () => { const routes: Routes = [ ...CoreRoutes, ...EditorialisationRoutes, - ...GeosourceRoutes + ...GeosourceRoutes, ]; let location: Location; @@ -38,7 +38,7 @@ describe('HeaderComponent', () => { declarations: [ ...CoreComponents, ...EditorialisationComponents, - ...GeosourceComponents + ...GeosourceComponents, ], imports: [ FormsModule, @@ -48,25 +48,25 @@ describe('HeaderComponent', () => { providers: [ { provide: EditorialisationService, - useValue: EditorialisationServiceMock + useValue: EditorialisationServiceMock, }, { provide: PageResolver, - useValue: {resolve() { }} + useValue: { resolve() { } }, }, { provide: PostDetailResolver, - useValue: {resolve() { }} + useValue: { resolve() { } }, }, { provide: PostsListResolver, - useValue: {resolve() { }} + useValue: { resolve() { } }, }, { provide: PostVideoResolver, - useValue: {resolve() { }} - } - ] + useValue: { resolve() { } }, + }, + ], }) .compileComponents(); })); diff --git a/webapp/src/app/core/components/header/header.component.ts b/webapp/src/app/core/components/header/header.component.ts index 3125f8093656961a5f45770cd276ce5559db21f6..ce93127141274bc93dcbf5b5d6cac5230efe98f1 100644 --- a/webapp/src/app/core/components/header/header.component.ts +++ b/webapp/src/app/core/components/header/header.component.ts @@ -5,7 +5,7 @@ import { AppRoutes } from '../../../routes'; @Component({ selector: 'app-header', templateUrl: './header.component.html', - styleUrls: ['./header.component.scss'] + styleUrls: ['./header.component.scss'], }) export class HeaderComponent implements OnInit { diff --git a/webapp/src/app/core/components/index.ts b/webapp/src/app/core/components/index.ts index 68ab1d979668cba01fe69bac74d5ba9d68a43e44..bb521cfcd45547591d7dc4d6b174c0ca7bd8c25f 100644 --- a/webapp/src/app/core/components/index.ts +++ b/webapp/src/app/core/components/index.ts @@ -4,8 +4,9 @@ import { FooterComponent } from './footer/footer.component'; export { HeaderComponent, MainComponent, FooterComponent }; +// tslint:disable-next-line:variable-name export const CoreComponents = [ HeaderComponent, MainComponent, - FooterComponent + FooterComponent, ]; diff --git a/webapp/src/app/core/components/main/main.component.spec.ts b/webapp/src/app/core/components/main/main.component.spec.ts index 9b9f9bf7add429724b1b292cdc45a95d96676c64..5e706802fa05ab147b92a2b2d7cd5b97625efb66 100644 --- a/webapp/src/app/core/components/main/main.component.spec.ts +++ b/webapp/src/app/core/components/main/main.component.spec.ts @@ -9,12 +9,11 @@ import { Router } from '@angular/router'; import { Component } from '@angular/core'; @Component({ - template: `app-dataset-list` + template: `app-dataset-list`, }) export class DatasetListComponent { } - describe('MainComponent', () => { let component: MainComponent; let fixture: ComponentFixture<MainComponent>; @@ -33,13 +32,13 @@ describe('MainComponent', () => { { path: '', redirectTo: 'datasets', - pathMatch: 'full' + pathMatch: 'full', }, { path: 'datasets', - component: DatasetListComponent + component: DatasetListComponent, }, ]), - ] + ], }) .compileComponents(); })); diff --git a/webapp/src/app/core/components/main/main.component.ts b/webapp/src/app/core/components/main/main.component.ts index 8b899ba8f85ff4b77f58fe4b40e901e358650a85..7b817777356ada8920931048630249033622bd54 100644 --- a/webapp/src/app/core/components/main/main.component.ts +++ b/webapp/src/app/core/components/main/main.component.ts @@ -3,7 +3,7 @@ import { Component, OnInit } from '@angular/core'; @Component({ selector: 'app-main', templateUrl: './main.component.html', - styleUrls: ['./main.component.scss'] + styleUrls: ['./main.component.scss'], }) export class MainComponent implements OnInit { diff --git a/webapp/src/app/core/core-routing.module.ts b/webapp/src/app/core/core-routing.module.ts index e1457786d7f2e461b1a4d2843d892544aca81265..3f868a97a65b5692428753550026fbe9bf9b0c9b 100644 --- a/webapp/src/app/core/core-routing.module.ts +++ b/webapp/src/app/core/core-routing.module.ts @@ -1,19 +1,17 @@ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; -import { MainComponent } from './components/main/main.component'; import { AppRoutes } from '../routes'; export const routes: Routes = [ { path: '', redirectTo: AppRoutes.home, - pathMatch: 'full' - } - + pathMatch: 'full', + }, ]; @NgModule({ imports: [RouterModule.forChild(routes)], - exports: [RouterModule] + exports: [RouterModule], }) export class CoreRoutingModule { } diff --git a/webapp/src/app/core/core.module.ts b/webapp/src/app/core/core.module.ts index 8f21fa2f3f625a53b5ee5466cd9225ca2065cce6..bb8a05d94afdb684dd7fbfffe2995d94ea789635 100644 --- a/webapp/src/app/core/core.module.ts +++ b/webapp/src/app/core/core.module.ts @@ -7,9 +7,9 @@ import { CoreComponents, MainComponent } from './components'; @NgModule({ imports: [ CommonModule, - CoreRoutingModule + CoreRoutingModule, ], declarations: [CoreComponents], - exports: [MainComponent] + exports: [MainComponent], }) export class CoreModule { } diff --git a/webapp/src/app/editorialisation/components/accessibility/accessibility.component.spec.ts b/webapp/src/app/editorialisation/components/accessibility/accessibility.component.spec.ts index db4974aa8c00fc93824b39e07f041bb3e77d0b37..0f85ed1a3599c60988263f7763dadf68c04724e1 100644 --- a/webapp/src/app/editorialisation/components/accessibility/accessibility.component.spec.ts +++ b/webapp/src/app/editorialisation/components/accessibility/accessibility.component.spec.ts @@ -2,7 +2,6 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { AccessibilityComponent } from './accessibility.component'; import { WordpressPageComponent } from '..'; -import { EditorialisationService } from '../../services'; import { HttpClientModule } from '@angular/common/http'; import { SharedModule } from '../../../shared/shared.module'; import { ActivatedRoute } from '@angular/router'; @@ -16,22 +15,22 @@ describe('AccessibilityComponent', () => { TestBed.configureTestingModule({ imports: [ HttpClientModule, - SharedModule + SharedModule, ], declarations: [ AccessibilityComponent, - WordpressPageComponent + WordpressPageComponent, ], providers: [ { provide: ActivatedRoute, useValue: { snapshot: { - data: Observable.of({page: {}}) - } - } - } - ] + data: Observable.of({ page: {} }), + }, + }, + }, + ], }) .compileComponents(); })); @@ -42,7 +41,7 @@ describe('AccessibilityComponent', () => { component.page = { title: 'title', status: 'status', - content: 'content' + content: 'content', }; fixture.detectChanges(); }); diff --git a/webapp/src/app/editorialisation/components/accessibility/accessibility.component.ts b/webapp/src/app/editorialisation/components/accessibility/accessibility.component.ts index 7c4a4ba852296c835674978d77713032bf454309..3634713a4bb23ca20392115211f5b89c701fde4c 100644 --- a/webapp/src/app/editorialisation/components/accessibility/accessibility.component.ts +++ b/webapp/src/app/editorialisation/components/accessibility/accessibility.component.ts @@ -1,18 +1,17 @@ import { Component, OnInit } from '@angular/core'; -import { environment } from '../../../../environments/environment'; import { WordpressPage } from '../../models'; import { ActivatedRoute } from '@angular/router'; @Component({ selector: 'app-accessibility', templateUrl: './accessibility.component.html', - styleUrls: ['./accessibility.component.scss'] + styleUrls: ['./accessibility.component.scss'], }) export class AccessibilityComponent implements OnInit { page: WordpressPage; constructor( - private _route: ActivatedRoute + private _route: ActivatedRoute, ) {} ngOnInit() { diff --git a/webapp/src/app/editorialisation/components/approach/approach.component.spec.ts b/webapp/src/app/editorialisation/components/approach/approach.component.spec.ts index ab4608fe378da79a81df6bd285de6ad9707ea874..8ac80170a1cb2f514e841cc7f0983d8b9ca3acbc 100644 --- a/webapp/src/app/editorialisation/components/approach/approach.component.spec.ts +++ b/webapp/src/app/editorialisation/components/approach/approach.component.spec.ts @@ -15,22 +15,22 @@ describe('ApproachComponent', () => { TestBed.configureTestingModule({ imports: [ HttpClientModule, - SharedModule + SharedModule, ], declarations: [ ApproachComponent, - WordpressPageComponent + WordpressPageComponent, ], providers: [ { provide: ActivatedRoute, useValue: { snapshot: { - data: Observable.of({}) - } - } - } - ] + data: Observable.of({}), + }, + }, + }, + ], }) .compileComponents(); })); diff --git a/webapp/src/app/editorialisation/components/approach/approach.component.ts b/webapp/src/app/editorialisation/components/approach/approach.component.ts index d00f2566cfdfec86b9d976964752cfca0ba51ce9..5b42b6f624390c84d438c7034606fec990eae1e4 100644 --- a/webapp/src/app/editorialisation/components/approach/approach.component.ts +++ b/webapp/src/app/editorialisation/components/approach/approach.component.ts @@ -5,13 +5,13 @@ import { WordpressPage } from '../../models'; @Component({ selector: 'app-approach', templateUrl: './approach.component.html', - styleUrls: ['./approach.component.scss'] + styleUrls: ['./approach.component.scss'], }) export class ApproachComponent implements OnInit { page: WordpressPage; constructor( - private _route: ActivatedRoute + private _route: ActivatedRoute, ) { } diff --git a/webapp/src/app/editorialisation/components/home/home.component.spec.ts b/webapp/src/app/editorialisation/components/home/home.component.spec.ts index a3d7ca4e737c41e86c2f19b924b68b89a5cd4ba8..8094a24cf3b8429d97ebd14884aa63fea1ca642f 100644 --- a/webapp/src/app/editorialisation/components/home/home.component.spec.ts +++ b/webapp/src/app/editorialisation/components/home/home.component.spec.ts @@ -2,6 +2,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { HomeComponent } from './home.component'; import { WordpressPostsListComponent } from '../wordpress-posts-list/wordpress-posts-list.component'; +// tslint:disable-next-line:max-line-length import { WordpressPostsListTileComponent } from '../wordpress-posts-list/wordpress-posts-list-tile/wordpress-posts-list-tile.component'; import { EditorialisationService } from '../../services'; import { PostsListResolver, PostVideoResolver } from '../../resolvers'; @@ -20,17 +21,17 @@ describe('HomeComponent', () => { imports: [ HttpClientModule, RouterTestingModule.withRoutes([]), - SharedModule + SharedModule, ], declarations: [ HomeComponent, WordpressPostsListComponent, - WordpressPostsListTileComponent + WordpressPostsListTileComponent, ], providers: [ { provide: EditorialisationService, - useValue: EditorialisationServiceMock + useValue: EditorialisationServiceMock, }, PostsListResolver, PostVideoResolver, @@ -40,12 +41,12 @@ describe('HomeComponent', () => { snapshot: { data: { posts: [], - videoPost: {} - } - } - } - } - ] + videoPost: {}, + }, + }, + }, + }, + ], }) .compileComponents(); })); diff --git a/webapp/src/app/editorialisation/components/home/home.component.ts b/webapp/src/app/editorialisation/components/home/home.component.ts index fb07e7f9981bf22b7a650e92f08ad49818a893ca..6c82ce68d1b223a8e6a0221cf536ee30b4ccac66 100644 --- a/webapp/src/app/editorialisation/components/home/home.component.ts +++ b/webapp/src/app/editorialisation/components/home/home.component.ts @@ -5,7 +5,7 @@ import { ActivatedRoute } from '@angular/router'; @Component({ selector: 'app-home', templateUrl: './home.component.html', - styleUrls: ['./home.component.scss'] + styleUrls: ['./home.component.scss'], }) export class HomeComponent implements OnInit { @@ -13,9 +13,8 @@ export class HomeComponent implements OnInit { videoPost: WordpressPost; constructor( - private route: ActivatedRoute - ) { - } + private route: ActivatedRoute, + ) {} ngOnInit() { this.posts = this.route.snapshot.data['posts']; diff --git a/webapp/src/app/editorialisation/components/index.ts b/webapp/src/app/editorialisation/components/index.ts index b5abffb81c4e2f9c3d736827061d82afac09cc70..5a835ce6837e6eda07e3c0fe35f9e710d0c60602 100644 --- a/webapp/src/app/editorialisation/components/index.ts +++ b/webapp/src/app/editorialisation/components/index.ts @@ -5,10 +5,10 @@ import { LegalMentionsComponent } from './legal-mentions/legal-mentions.componen import { AccessibilityComponent } from './accessibility/accessibility.component'; import { SiteMapComponent } from './site-map/site-map.component'; import { ApproachComponent } from './approach/approach.component'; +// tslint:disable-next-line:max-line-length import { WordpressPostsListTileComponent } from './wordpress-posts-list/wordpress-posts-list-tile/wordpress-posts-list-tile.component'; import { WordpressPostDetailComponent } from './wordpress-post-detail/wordpress-post-detail.component'; - export { WordpressPageComponent, WordpressPostsListComponent, @@ -18,10 +18,10 @@ export { LegalMentionsComponent, AccessibilityComponent, SiteMapComponent, - ApproachComponent + ApproachComponent, }; - +// tslint:disable-next-line:variable-name export const EditorialisationComponents = [ WordpressPageComponent, WordpressPostsListComponent, @@ -31,5 +31,5 @@ export const EditorialisationComponents = [ LegalMentionsComponent, AccessibilityComponent, SiteMapComponent, - ApproachComponent + ApproachComponent, ]; diff --git a/webapp/src/app/editorialisation/components/legal-mentions/legal-mentions.component.spec.ts b/webapp/src/app/editorialisation/components/legal-mentions/legal-mentions.component.spec.ts index c5277535f63093c5595a9b15d1ee6404ec254b87..629ada3646e8b60a42ca46175c51efce27ed04ab 100644 --- a/webapp/src/app/editorialisation/components/legal-mentions/legal-mentions.component.spec.ts +++ b/webapp/src/app/editorialisation/components/legal-mentions/legal-mentions.component.spec.ts @@ -19,17 +19,17 @@ describe('LegalMentionsComponent', () => { ], declarations: [ LegalMentionsComponent, - WordpressPageComponent + WordpressPageComponent, ], providers: [ { provide: ActivatedRoute, useValue: { snapshot: { - data: Observable.of({}) - } - } - } + data: Observable.of({}), + }, + }, + }, ], }) .compileComponents(); diff --git a/webapp/src/app/editorialisation/components/legal-mentions/legal-mentions.component.ts b/webapp/src/app/editorialisation/components/legal-mentions/legal-mentions.component.ts index 440b36d6750c06941a13e5fb9cd62858f886efc9..247c1276fdf5bbd162cb628516ac50159bf72427 100644 --- a/webapp/src/app/editorialisation/components/legal-mentions/legal-mentions.component.ts +++ b/webapp/src/app/editorialisation/components/legal-mentions/legal-mentions.component.ts @@ -5,13 +5,13 @@ import { WordpressPage } from '../../models'; @Component({ selector: 'app-legal-mentions', templateUrl: './legal-mentions.component.html', - styleUrls: ['./legal-mentions.component.scss'] + styleUrls: ['./legal-mentions.component.scss'], }) export class LegalMentionsComponent implements OnInit { page: WordpressPage; constructor( - private _route: ActivatedRoute + private _route: ActivatedRoute, ) { } diff --git a/webapp/src/app/editorialisation/components/site-map/site-map.component.spec.ts b/webapp/src/app/editorialisation/components/site-map/site-map.component.spec.ts index 11dd145638860540ee14e595cf4c4889f378f8c0..875324edd5fffedbc6d05f2407f16c5f33df8532 100644 --- a/webapp/src/app/editorialisation/components/site-map/site-map.component.spec.ts +++ b/webapp/src/app/editorialisation/components/site-map/site-map.component.spec.ts @@ -15,21 +15,21 @@ describe('SiteMapComponent', () => { TestBed.configureTestingModule({ imports: [ HttpClientModule, - SharedModule + SharedModule, ], declarations: [ SiteMapComponent, - WordpressPageComponent + WordpressPageComponent, ], providers: [ { provide: ActivatedRoute, useValue: { snapshot: { - data: Observable.of({}) - } - } - } + data: Observable.of({}), + }, + }, + }, ], }) .compileComponents(); diff --git a/webapp/src/app/editorialisation/components/site-map/site-map.component.ts b/webapp/src/app/editorialisation/components/site-map/site-map.component.ts index 78d921ac5aa026d43351ee6b5f6b2617de76efe9..095624bbd7ddb814614fe80f7dcee3046c8562d2 100644 --- a/webapp/src/app/editorialisation/components/site-map/site-map.component.ts +++ b/webapp/src/app/editorialisation/components/site-map/site-map.component.ts @@ -1,18 +1,17 @@ import { Component, OnInit } from '@angular/core'; -import { environment } from '../../../../environments/environment'; import { WordpressPage } from '../../models'; import { ActivatedRoute } from '@angular/router'; @Component({ selector: 'app-site-map', templateUrl: './site-map.component.html', - styleUrls: ['./site-map.component.scss'] + styleUrls: ['./site-map.component.scss'], }) export class SiteMapComponent implements OnInit { page: WordpressPage; constructor( - private _route: ActivatedRoute + private _route: ActivatedRoute, ) { } ngOnInit() { diff --git a/webapp/src/app/editorialisation/components/wordpress-page/wordpress-page.component.spec.ts b/webapp/src/app/editorialisation/components/wordpress-page/wordpress-page.component.spec.ts index 7a74c511d653be3a5b3e2838cf443211d3778eef..974c5d917c805415252f7b59285a8d9b96509dee 100644 --- a/webapp/src/app/editorialisation/components/wordpress-page/wordpress-page.component.spec.ts +++ b/webapp/src/app/editorialisation/components/wordpress-page/wordpress-page.component.spec.ts @@ -14,18 +14,18 @@ describe('WordpressPageComponent', () => { TestBed.configureTestingModule({ imports: [ HttpClientModule, - SharedModule + SharedModule, ], - declarations: [ WordpressPageComponent ], + declarations: [WordpressPageComponent], providers: [ { provide: ActivatedRoute, useValue: { snapshot: { - data: Observable.of({}) - } - } - } + data: Observable.of({}), + }, + }, + }, ], }) .compileComponents(); diff --git a/webapp/src/app/editorialisation/components/wordpress-page/wordpress-page.component.ts b/webapp/src/app/editorialisation/components/wordpress-page/wordpress-page.component.ts index b30550ed5540691b8544e1274242b9f6a8b7a9e1..eef408403b08fda3dc864f4aa08bbd667c2e8ec7 100644 --- a/webapp/src/app/editorialisation/components/wordpress-page/wordpress-page.component.ts +++ b/webapp/src/app/editorialisation/components/wordpress-page/wordpress-page.component.ts @@ -4,7 +4,7 @@ import { WordpressPage } from '../../models'; @Component({ selector: 'app-wordpress-page', templateUrl: './wordpress-page.component.html', - styleUrls: ['./wordpress-page.component.scss'] + styleUrls: ['./wordpress-page.component.scss'], }) export class WordpressPageComponent implements OnInit { diff --git a/webapp/src/app/editorialisation/components/wordpress-post-detail/wordpress-post-detail.component.html b/webapp/src/app/editorialisation/components/wordpress-post-detail/wordpress-post-detail.component.html index 0c4cf544b070374f59b4e27d63a44824281f57b3..87ebc4b387030219f018a2edae4c05fff0dfd95e 100644 --- a/webapp/src/app/editorialisation/components/wordpress-post-detail/wordpress-post-detail.component.html +++ b/webapp/src/app/editorialisation/components/wordpress-post-detail/wordpress-post-detail.component.html @@ -7,7 +7,7 @@ <h1 [innerHTML]="post.title"> </h1> <section> - <span>Mise à jour - {{ post.date_timestamp | date: 'dd/MM/yyyy' }}</span> + <span>Mise à jour - {{ post.dateTimestamp | date: 'dd/MM/yyyy' }}</span> <p> <img src="{{post.mediaUrl}}"> </p> diff --git a/webapp/src/app/editorialisation/components/wordpress-post-detail/wordpress-post-detail.component.spec.ts b/webapp/src/app/editorialisation/components/wordpress-post-detail/wordpress-post-detail.component.spec.ts index 9e495ee72f4e4437f14248606973a0147fa6e4b0..bd4fd609c7a1abebe4cefb523c1a2bb596cc5f8b 100644 --- a/webapp/src/app/editorialisation/components/wordpress-post-detail/wordpress-post-detail.component.spec.ts +++ b/webapp/src/app/editorialisation/components/wordpress-post-detail/wordpress-post-detail.component.spec.ts @@ -17,12 +17,12 @@ describe('WordpressPostDetailComponent', () => { provide: ActivatedRoute, useValue: { snapshot: { - data: Observable.of({}) - } - } - } + data: Observable.of({}), + }, + }, + }, ], - declarations: [ WordpressPostDetailComponent ] + declarations: [WordpressPostDetailComponent], }) .compileComponents(); })); diff --git a/webapp/src/app/editorialisation/components/wordpress-post-detail/wordpress-post-detail.component.ts b/webapp/src/app/editorialisation/components/wordpress-post-detail/wordpress-post-detail.component.ts index 9721bd7c6feb6d13d8f1740fb2273ae69eec1442..413bb96543da1cfccb65434cea395fac07ce9da1 100644 --- a/webapp/src/app/editorialisation/components/wordpress-post-detail/wordpress-post-detail.component.ts +++ b/webapp/src/app/editorialisation/components/wordpress-post-detail/wordpress-post-detail.component.ts @@ -5,13 +5,13 @@ import { WordpressPost } from '../../models/wordpress-post.model'; @Component({ selector: 'app-wordpress-post-detail', templateUrl: './wordpress-post-detail.component.html', - styleUrls: ['./wordpress-post-detail.component.scss'] + styleUrls: ['./wordpress-post-detail.component.scss'], }) export class WordpressPostDetailComponent implements OnInit { post: WordpressPost; constructor( - private route: ActivatedRoute + private route: ActivatedRoute, ) { } diff --git a/webapp/src/app/editorialisation/components/wordpress-posts-list/wordpress-posts-list-tile/wordpress-posts-list-tile.component.spec.ts b/webapp/src/app/editorialisation/components/wordpress-posts-list/wordpress-posts-list-tile/wordpress-posts-list-tile.component.spec.ts index 37b05d439f6ac1d732da10624aa12d991ab7b152..25288c9ab0a8495c106a002995ef98243afbc561 100644 --- a/webapp/src/app/editorialisation/components/wordpress-posts-list/wordpress-posts-list-tile/wordpress-posts-list-tile.component.spec.ts +++ b/webapp/src/app/editorialisation/components/wordpress-posts-list/wordpress-posts-list-tile/wordpress-posts-list-tile.component.spec.ts @@ -11,7 +11,7 @@ describe('WordpressPostsListTileComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ imports: [RouterTestingModule.withRoutes([])], - declarations: [ WordpressPostsListTileComponent ] + declarations: [WordpressPostsListTileComponent], }) .compileComponents(); })); @@ -23,17 +23,17 @@ describe('WordpressPostsListTileComponent', () => { id: 111111, date: '01-01-2018', title: { - rendered: 'title' + rendered: 'title', }, status: 'published', content: { - rendered: 'content' + rendered: 'content', }, excerpt: { - rendered: 'content' + rendered: 'content', }, featured_media: 0, - categories: [1, 2] + categories: [1, 2], }); fixture.detectChanges(); }); diff --git a/webapp/src/app/editorialisation/components/wordpress-posts-list/wordpress-posts-list-tile/wordpress-posts-list-tile.component.ts b/webapp/src/app/editorialisation/components/wordpress-posts-list/wordpress-posts-list-tile/wordpress-posts-list-tile.component.ts index e4f830436a9bd97776b6a202adfddfc5d4dc661b..66e62f8eeac7355797da32254889467d2503b464 100644 --- a/webapp/src/app/editorialisation/components/wordpress-posts-list/wordpress-posts-list-tile/wordpress-posts-list-tile.component.ts +++ b/webapp/src/app/editorialisation/components/wordpress-posts-list/wordpress-posts-list-tile/wordpress-posts-list-tile.component.ts @@ -5,7 +5,7 @@ import { AppRoutes } from '../../../../routes'; @Component({ selector: 'app-wordpress-posts-list-tile', templateUrl: './wordpress-posts-list-tile.component.html', - styleUrls: ['./wordpress-posts-list-tile.component.scss'] + styleUrls: ['./wordpress-posts-list-tile.component.scss'], }) export class WordpressPostsListTileComponent implements OnInit { @@ -22,8 +22,6 @@ export class WordpressPostsListTileComponent implements OnInit { getRandomInt() { let classTile = ''; - this.post.categories.forEach(category => { - }); if (this.post.categories.includes('applications')) { classTile = 'is-warning'; } else if (this.post.categories.includes('ma carte')) { diff --git a/webapp/src/app/editorialisation/components/wordpress-posts-list/wordpress-posts-list.component.spec.ts b/webapp/src/app/editorialisation/components/wordpress-posts-list/wordpress-posts-list.component.spec.ts index 6abdadee6fb0315e28860fb2eee16adb1a84b8b0..948ef2a67655bb9fe59ad61b285d32f6493a5540 100644 --- a/webapp/src/app/editorialisation/components/wordpress-posts-list/wordpress-posts-list.component.spec.ts +++ b/webapp/src/app/editorialisation/components/wordpress-posts-list/wordpress-posts-list.component.spec.ts @@ -13,15 +13,15 @@ describe('WordpressPostsListComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ imports: [ - HttpClientModule, RouterTestingModule.withRoutes([]) + HttpClientModule, RouterTestingModule.withRoutes([]), ], declarations: [ WordpressPostsListComponent, - WordpressPostsListTileComponent + WordpressPostsListTileComponent, ], providers: [ - EditorialisationService - ] + EditorialisationService, + ], }) .compileComponents(); })); diff --git a/webapp/src/app/editorialisation/components/wordpress-posts-list/wordpress-posts-list.component.ts b/webapp/src/app/editorialisation/components/wordpress-posts-list/wordpress-posts-list.component.ts index 7e37342a3b82a337c9f767f8d92f5fdde08f8606..5d585719e937d8657345b61dd1a347b81cce4b02 100644 --- a/webapp/src/app/editorialisation/components/wordpress-posts-list/wordpress-posts-list.component.ts +++ b/webapp/src/app/editorialisation/components/wordpress-posts-list/wordpress-posts-list.component.ts @@ -1,20 +1,16 @@ import { Component, OnInit, Input } from '@angular/core'; -import { EditorialisationService } from '../../services'; import { WordpressPost } from '../../models/wordpress-post.model'; -import { ActivatedRoute } from '@angular/router'; @Component({ selector: 'app-wordpress-posts-list', templateUrl: './wordpress-posts-list.component.html', - styleUrls: ['./wordpress-posts-list.component.scss'] + styleUrls: ['./wordpress-posts-list.component.scss'], }) export class WordpressPostsListComponent implements OnInit { @Input() posts: WordpressPost[]; - constructor( - private _editorialisationService: EditorialisationService - ) { } + constructor() { } ngOnInit() { diff --git a/webapp/src/app/editorialisation/editorialisation-routing.module.ts b/webapp/src/app/editorialisation/editorialisation-routing.module.ts index 529c723a4d450822ad3609d3fa8eef80be3ee058..236c7cab3b4f511410a032de724c5dd39f9356e6 100644 --- a/webapp/src/app/editorialisation/editorialisation-routing.module.ts +++ b/webapp/src/app/editorialisation/editorialisation-routing.module.ts @@ -1,6 +1,7 @@ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; -import { HomeComponent, ApproachComponent, AccessibilityComponent, SiteMapComponent, LegalMentionsComponent } from './components'; +import { HomeComponent, ApproachComponent, AccessibilityComponent, + SiteMapComponent, LegalMentionsComponent } from './components'; import { PageResolver } from './resolvers/page.resolver'; import { WordpressPostDetailComponent } from './components/wordpress-post-detail/wordpress-post-detail.component'; import { PostDetailResolver } from './resolvers/post-detail.resolver'; @@ -14,48 +15,48 @@ export const routes: Routes = [ component: HomeComponent, resolve: { posts: PostsListResolver, - videoPost: PostVideoResolver - } + videoPost: PostVideoResolver, + }, }, { path: AppRoutes.approach, component: ApproachComponent, resolve: { - page: PageResolver - } + page: PageResolver, + }, }, { path: AppRoutes.accessibility, component: AccessibilityComponent, resolve: { - page: PageResolver - } + page: PageResolver, + }, }, { path: AppRoutes.siteMap, component: SiteMapComponent, resolve: { - page: PageResolver - } + page: PageResolver, + }, }, { path: AppRoutes.legalNotices, component: LegalMentionsComponent, resolve: { - page: PageResolver - } + page: PageResolver, + }, }, { path: `${AppRoutes.articles}/:id`, component: WordpressPostDetailComponent, resolve: { - post: PostDetailResolver - } - } + post: PostDetailResolver, + }, + }, ]; @NgModule({ imports: [RouterModule.forChild(routes)], - exports: [RouterModule] + exports: [RouterModule], }) export class EditorialisationRoutingModule { } diff --git a/webapp/src/app/editorialisation/editorialisation.module.ts b/webapp/src/app/editorialisation/editorialisation.module.ts index bd375a40789d34681e5dfd1b973a9652a5e927b4..c79773e08e5e3e1defb9342d47dc23897567d789 100644 --- a/webapp/src/app/editorialisation/editorialisation.module.ts +++ b/webapp/src/app/editorialisation/editorialisation.module.ts @@ -6,14 +6,13 @@ import { EditorialisationServices } from './services'; import { EditorialisationResolvers } from './resolvers'; import { SharedModule } from '../shared/shared.module'; - @NgModule({ imports: [ CommonModule, EditorialisationRoutingModule, - SharedModule + SharedModule, ], declarations: [...EditorialisationComponents], - providers: [...EditorialisationServices, EditorialisationResolvers] + providers: [...EditorialisationServices, EditorialisationResolvers], }) export class EditorialisationModule { } diff --git a/webapp/src/app/editorialisation/models/wordpress-page.model.ts b/webapp/src/app/editorialisation/models/wordpress-page.model.ts index 9cd1b0c99885adf77dc9cd769f1b0409a5f5b575..a8a58a04ddd559312ce8364f22d5a7c90b9d76f5 100644 --- a/webapp/src/app/editorialisation/models/wordpress-page.model.ts +++ b/webapp/src/app/editorialisation/models/wordpress-page.model.ts @@ -1,10 +1,10 @@ export interface IWordpressPage { title: { - rendered: string + rendered: string, }; status: string; content: { - rendered: string + rendered: string, }; } diff --git a/webapp/src/app/editorialisation/models/wordpress-post.model.ts b/webapp/src/app/editorialisation/models/wordpress-post.model.ts index 2ddd97a9291a25a2a0f70844f61dd3d09a4f4f99..a38c976877f6bb6991d7ac49c005f9e474b7bf77 100644 --- a/webapp/src/app/editorialisation/models/wordpress-post.model.ts +++ b/webapp/src/app/editorialisation/models/wordpress-post.model.ts @@ -3,14 +3,14 @@ export interface IWordpressPost { // iso8601 format date: string; title: { - rendered: string + rendered: string, }; status: string; content: { - rendered: string + rendered: string, }; excerpt: { - rendered: string + rendered: string, }; featured_media: number; categories: number[]; @@ -22,10 +22,10 @@ export class WordpressPost { status: string; content: string; excerpt: string; - featured_media: number; + featuredMedia: number; categories: string[]; mediaUrl: string; - date_timestamp: number; + dateTimestamp: number; constructor(data: IWordpressPost) { this.id = data.id; @@ -33,8 +33,8 @@ export class WordpressPost { this.title = (data.title != null) ? data.title.rendered : ''; this.content = (data.content != null) ? data.content.rendered : ''; this.excerpt = (data.excerpt != null) ? data.excerpt.rendered : ''; - this.featured_media = data.featured_media; - this.date_timestamp = (data.date != null) ? Date.parse(data.date) : 0; + this.featuredMedia = data.featured_media; + this.dateTimestamp = (data.date != null) ? Date.parse(data.date) : 0; this.categories = []; } } diff --git a/webapp/src/app/editorialisation/resolvers/index.ts b/webapp/src/app/editorialisation/resolvers/index.ts index 1f66ebdae0d59897c671372e45ebc001486c8520..83acf6c0c39422246ad27df2889bae214f927fa8 100644 --- a/webapp/src/app/editorialisation/resolvers/index.ts +++ b/webapp/src/app/editorialisation/resolvers/index.ts @@ -7,12 +7,13 @@ export { PageResolver, PostsListResolver, PostDetailResolver, - PostVideoResolver + PostVideoResolver, }; +// tslint:disable-next-line:variable-name export const EditorialisationResolvers = [ PageResolver, PostsListResolver, PostDetailResolver, - PostVideoResolver + PostVideoResolver, ]; diff --git a/webapp/src/app/editorialisation/resolvers/page.resolver.spec.ts b/webapp/src/app/editorialisation/resolvers/page.resolver.spec.ts index 7e590a8c4ce2b895d2911420dbc437cadd977d5c..a84783d0baaea88e6b7a1de945e121145d5a7495 100644 --- a/webapp/src/app/editorialisation/resolvers/page.resolver.spec.ts +++ b/webapp/src/app/editorialisation/resolvers/page.resolver.spec.ts @@ -9,15 +9,15 @@ describe('PageResolver', () => { beforeEach(() => { TestBed.configureTestingModule({ imports: [ - HttpClientModule + HttpClientModule, ], providers: [ PageResolver, { provide: EditorialisationService, - useValue: EditorialisationServiceMock + useValue: EditorialisationServiceMock, }, - ] + ], }); }); diff --git a/webapp/src/app/editorialisation/resolvers/page.resolver.ts b/webapp/src/app/editorialisation/resolvers/page.resolver.ts index 9b8adc08bb4bb5f55570ec5484be4f321d115f24..1804e87ed42a2ed69ca7602406f3300c72f37bb0 100644 --- a/webapp/src/app/editorialisation/resolvers/page.resolver.ts +++ b/webapp/src/app/editorialisation/resolvers/page.resolver.ts @@ -30,7 +30,7 @@ export class PageResolver implements Resolve<Observable<WordpressPage>> { default: page = ''; } - return this._editorialisationService.getPage(page).map(res => { + return this._editorialisationService.getPage(page).map((res) => { return res; }); } diff --git a/webapp/src/app/editorialisation/services/editorialisation.service.mock.ts b/webapp/src/app/editorialisation/services/editorialisation.service.mock.ts index 1f38c3cb3ab012ce169fea313c56f6c3a5a1a22e..937a7c079f8f1778658c8c0a3fa3c592fd2499f1 100644 --- a/webapp/src/app/editorialisation/services/editorialisation.service.mock.ts +++ b/webapp/src/app/editorialisation/services/editorialisation.service.mock.ts @@ -1,4 +1,3 @@ -import { IfObservable } from 'rxjs/observable/IfObservable'; import { Observable } from 'rxjs/Observable'; import { WordpressPage } from '../models'; import { WordpressPost } from '../models/wordpress-post.model'; @@ -10,12 +9,12 @@ export class EditorialisationServiceMock extends EditorialisationService { public getPage(slug: string): Observable<WordpressPage> { return Observable.of(new WordpressPage({ title: { - rendered: 'title' + rendered: 'title', }, status: 'status', content: { - rendered: 'content' - } + rendered: 'content', + }, })); } @@ -24,17 +23,17 @@ export class EditorialisationServiceMock extends EditorialisationService { id: 111111, date: '01-01-2018', title: { - rendered: 'title' + rendered: 'title', }, status: 'published', content: { - rendered: 'content' + rendered: 'content', }, excerpt: { - rendered: 'content' + rendered: 'content', }, featured_media: 0, - categories: [1, 2] + categories: [1, 2], })]); } @@ -43,46 +42,40 @@ export class EditorialisationServiceMock extends EditorialisationService { id: 111111, date: '01-01-2018', title: { - rendered: 'title' + rendered: 'title', }, status: 'published', content: { - rendered: 'content' + rendered: 'content', }, excerpt: { - rendered: 'content' + rendered: 'content', }, featured_media: 0, - categories: [1, 2] + categories: [1, 2], })); } - public getPostVideoHome(): Observable<WordpressPost> { return Observable.of(new WordpressPost({ id: 111111, date: '01-01-2018', title: { - rendered: 'title' + rendered: 'title', }, status: 'published', content: { - rendered: 'content' + rendered: 'content', }, excerpt: { - rendered: 'content' + rendered: 'content', }, featured_media: 0, - categories: [1, 2] + categories: [1, 2], })); } - _getMediaUrl(id: number): Observable<string> { + getMediaUrl(): Observable<string> { return Observable.of('url'); } - - _getCategory(id: number): Observable<string> { - return Observable.of('category'); - } - } diff --git a/webapp/src/app/editorialisation/services/editorialisation.service.spec.ts b/webapp/src/app/editorialisation/services/editorialisation.service.spec.ts index 9d8b4da3d83dc50d63c520f140f02c01ac97d4bc..7b6fe080d7b05ba790a9fbae6222be777f3cf3f1 100644 --- a/webapp/src/app/editorialisation/services/editorialisation.service.spec.ts +++ b/webapp/src/app/editorialisation/services/editorialisation.service.spec.ts @@ -7,11 +7,11 @@ describe('EditorialisationService', () => { beforeEach(() => { TestBed.configureTestingModule({ providers: [ - EditorialisationService + EditorialisationService, ], imports: [ - HttpClientModule - ] + HttpClientModule, + ], }); }); diff --git a/webapp/src/app/editorialisation/services/editorialisation.service.ts b/webapp/src/app/editorialisation/services/editorialisation.service.ts index 89df881cc382c7cc22e8bee50ba52428d6c8e026..7ca266f746a7e74bcfaf2f01a8192df7b56dca35 100644 --- a/webapp/src/app/editorialisation/services/editorialisation.service.ts +++ b/webapp/src/app/editorialisation/services/editorialisation.service.ts @@ -10,7 +10,7 @@ import { WordpressPost, IWordpressPost, IWordpressMedia, IWordpressCategory } fr export class EditorialisationService { constructor( - private _http: HttpClient + private _http: HttpClient, ) { } /* @@ -18,7 +18,7 @@ export class EditorialisationService { */ getPage(slug: string): Observable<WordpressPage> { const url = environment.wordpressUrl + 'pages?slug=' + slug; - return this._http.get<IWordpressPage[]>(url).map(pages => { + return this._http.get<IWordpressPage[]>(url).map((pages) => { return pages.length > 0 ? new WordpressPage(pages[0]) : null; }); } @@ -35,32 +35,31 @@ export class EditorialisationService { return Observable.forkJoin([ this._http.get<IWordpressCategory[]>(environment.wordpressUrl + 'categories').map(categories => categories), - this._http.get<IWordpressPost[]>(url).map(posts => posts) - ]) - .map(([categories, posts]) => { - posts.map(post => { - if (!post.categories.includes(environment.wordpressContent.categoryIdUniqueContent)) { - const wp_post = new WordpressPost(post); - // Set the categories - post.categories.forEach(categoryId => { - const category = categories.find(element => { - return element.id === categoryId; - }); - wp_post.categories.push(category.name); + this._http.get<IWordpressPost[]>(url).map(posts => posts), + ]).map(([categories, posts]) => { + posts.map((post) => { + if (!post.categories.includes(environment.wordpressContent.categoryIdUniqueContent)) { + const wpPost = new WordpressPost(post); + // Set the categories + post.categories.forEach((categoryId) => { + const category = categories.find((element) => { + return element.id === categoryId; }); + wpPost.categories.push(category.name); + }); - postsList.push(wp_post); + postsList.push(wpPost); - // For each post get the media url - if (post.featured_media !== 0) { - this._getMediaUrl(post.featured_media).subscribe((res) => { - wp_post.mediaUrl = res; - }); - } + // For each post get the media url + if (post.featuredMedia !== 0) { + this.getMediaUrl(post.featuredMedia).subscribe((res) => { + wpPost.mediaUrl = res; + }); } - }); - return postsList; + } }); + return postsList; + }); } @@ -69,25 +68,24 @@ export class EditorialisationService { return Observable.forkJoin([ this._http.get<IWordpressCategory[]>(environment.wordpressUrl + 'categories').map(categories => categories), - this._http.get<IWordpressPost[]>(url).map(posts => posts) - ]) - .map(([categories, post]) => { - const wp_post = new WordpressPost(post); + this._http.get<IWordpressPost[]>(url).map(posts => posts), + ]).map(([categories, post]) => { + const wpPost = new WordpressPost(post); // For each post get the media url - if (post.featured_media !== 0) { - this._getMediaUrl(post.featured_media).subscribe((res) => { - wp_post.mediaUrl = res; + if (post.featuredMedia !== 0) { + this.getMediaUrl(post.featuredMedia).subscribe((res) => { + wpPost.mediaUrl = res; }); } // Set the categories - post.categories.forEach(categoryId => { - const category = categories.find(element => { + post.categories.forEach((categoryId) => { + const category = categories.find((element) => { return element.id === categoryId; }); - wp_post.categories.push(category.name); + wpPost.categories.push(category.name); }); - return wp_post; + return wpPost; }); } @@ -96,14 +94,14 @@ export class EditorialisationService { */ getPostVideoHome(): Observable<WordpressPost> { const url = environment.wordpressUrl + 'posts?slug=' + environment.wordpressContent.slugPostVideo; - return this._http.get<IWordpressPost[]>(url).map(posts => { + return this._http.get<IWordpressPost[]>(url).map((posts) => { return new WordpressPost(posts[0]); }); } - _getMediaUrl(id: number): Observable<string> { + getMediaUrl(id: number): Observable<string> { const url = environment.wordpressUrl + 'media/' + id; - return this._http.get<IWordpressMedia>(url).map(media => { + return this._http.get<IWordpressMedia>(url).map((media) => { return media.guid.rendered; }); } diff --git a/webapp/src/app/editorialisation/services/index.ts b/webapp/src/app/editorialisation/services/index.ts index dc5b0eff369acf574dceeebc79471cd98609dee9..c6447e3752f41a69d5e9f126e5fd2cbc29171bb5 100644 --- a/webapp/src/app/editorialisation/services/index.ts +++ b/webapp/src/app/editorialisation/services/index.ts @@ -1,9 +1,10 @@ import { EditorialisationService } from './editorialisation.service'; export { - EditorialisationService + EditorialisationService, }; +// tslint:disable-next-line:variable-name export const EditorialisationServices = [ - EditorialisationService + EditorialisationService, ]; diff --git a/webapp/src/app/geosource/components/dataset-detail/dataset-detail.component.spec.ts b/webapp/src/app/geosource/components/dataset-detail/dataset-detail.component.spec.ts index e8a4dbdac54bd37664a364010dc7f0226af2474b..d2e8bad2a11688456a1173ab986b115db6b47b42 100644 --- a/webapp/src/app/geosource/components/dataset-detail/dataset-detail.component.spec.ts +++ b/webapp/src/app/geosource/components/dataset-detail/dataset-detail.component.spec.ts @@ -2,7 +2,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { DatasetDetailComponent } from './dataset-detail.component'; import { RouterTestingModule } from '@angular/router/testing'; -import { ActivatedRoute, ParamMap, convertToParamMap } from '@angular/router'; +import { ActivatedRoute } from '@angular/router'; import { Observable } from 'rxjs/Observable'; import { DatasetDetailService, ElasticsearchService } from '../../services'; import { HttpClientModule } from '@angular/common/http'; @@ -15,10 +15,10 @@ describe('DatasetDetailComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ DatasetDetailComponent ], + declarations: [DatasetDetailComponent], imports: [ RouterTestingModule.withRoutes([]), - HttpClientModule + HttpClientModule, ], providers: [ { @@ -26,12 +26,12 @@ describe('DatasetDetailComponent', () => { useValue: { get paramMap(): Observable<any> { return Observable.of(); - } - } + }, + }, }, DatasetDetailService, - ElasticsearchService - ] + ElasticsearchService, + ], }) .compileComponents(); })); diff --git a/webapp/src/app/geosource/components/dataset-detail/dataset-detail.component.ts b/webapp/src/app/geosource/components/dataset-detail/dataset-detail.component.ts index 9806777ab23415a04b4db18f1efea01d356b8442..7c610bb8d8b0d3ee1d4d42b1c1e96887ffec4f71 100644 --- a/webapp/src/app/geosource/components/dataset-detail/dataset-detail.component.ts +++ b/webapp/src/app/geosource/components/dataset-detail/dataset-detail.component.ts @@ -1,7 +1,6 @@ import { Component, OnInit } from '@angular/core'; import { Metadata } from '../../models'; -import { Observable } from 'rxjs/Observable'; -import { Router, ActivatedRoute, ParamMap } from '@angular/router'; +import { ActivatedRoute } from '@angular/router'; import { DatasetDetailService } from '../../services'; import 'rxjs/add/operator/switchMap'; import { AppRoutes } from '../../../routes'; @@ -9,7 +8,7 @@ import { AppRoutes } from '../../../routes'; @Component({ selector: 'app-dataset-detail', templateUrl: './dataset-detail.component.html', - styleUrls: ['./dataset-detail.component.scss'] + styleUrls: ['./dataset-detail.component.scss'], }) export class DatasetDetailComponent implements OnInit { @@ -22,7 +21,7 @@ export class DatasetDetailComponent implements OnInit { ) {} ngOnInit() { - this._route.params.subscribe(params => { + this._route.params.subscribe((params) => { this._datasetDetailService.initializeDataset(params.id).subscribe(() => { this.metadata = this._datasetDetailService.getDatasetMetadata(); }); diff --git a/webapp/src/app/geosource/components/dataset-detail/dataset-export/dataset-export.component.spec.ts b/webapp/src/app/geosource/components/dataset-detail/dataset-export/dataset-export.component.spec.ts index 433f0ba96758822f7cf8632cbe4def793a6ebc61..d29c9e93e77e458c0ac83e31973d051df0d7fdb2 100644 --- a/webapp/src/app/geosource/components/dataset-detail/dataset-export/dataset-export.component.spec.ts +++ b/webapp/src/app/geosource/components/dataset-detail/dataset-export/dataset-export.component.spec.ts @@ -2,7 +2,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { DatasetExportComponent } from './dataset-export.component'; import { LicenseModalComponent } from '../..'; -import { ActivatedRoute, ParamMap } from '@angular/router'; +import { ActivatedRoute } from '@angular/router'; import { Observable } from 'rxjs/Observable'; import { DatasetDetailService, ElasticsearchService } from '../../../services'; import { HttpClientModule } from '@angular/common/http'; @@ -16,7 +16,7 @@ describe('DatasetExportComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ imports: [ - HttpClientModule + HttpClientModule, ], declarations: [DatasetExportComponent, LicenseModalComponent], providers: [ @@ -26,13 +26,13 @@ describe('DatasetExportComponent', () => { parent: { get paramMap(): Observable<any> { return Observable.of(); - } - } - } + }, + }, + }, }, DatasetDetailService, - ElasticsearchService - ] + ElasticsearchService, + ], }) .compileComponents(); })); diff --git a/webapp/src/app/geosource/components/dataset-detail/dataset-export/dataset-export.component.ts b/webapp/src/app/geosource/components/dataset-detail/dataset-export/dataset-export.component.ts index 62422e337c0d3115169a5283f9947e3447e5f349..4d447b0689d33b1ea4ef0df84d4fe1f7cd83d163 100644 --- a/webapp/src/app/geosource/components/dataset-detail/dataset-export/dataset-export.component.ts +++ b/webapp/src/app/geosource/components/dataset-detail/dataset-export/dataset-export.component.ts @@ -5,7 +5,7 @@ import { Metadata } from '../../../models'; @Component({ selector: 'app-dataset-export', templateUrl: './dataset-export.component.html', - styleUrls: ['./dataset-export.component.scss'] + styleUrls: ['./dataset-export.component.scss'], }) export class DatasetExportComponent implements OnInit { diff --git a/webapp/src/app/geosource/components/dataset-detail/dataset-export/license-modal/license-modal.component.spec.ts b/webapp/src/app/geosource/components/dataset-detail/dataset-export/license-modal/license-modal.component.spec.ts index a1e7b3c34b6f7522197cb686c02b32cefa728f47..b73f28a4ef2d4a5bb2af03dee4911be2096d7e7b 100644 --- a/webapp/src/app/geosource/components/dataset-detail/dataset-export/license-modal/license-modal.component.spec.ts +++ b/webapp/src/app/geosource/components/dataset-detail/dataset-export/license-modal/license-modal.component.spec.ts @@ -8,7 +8,7 @@ describe('LicenseModalComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ LicenseModalComponent ] + declarations: [LicenseModalComponent], }) .compileComponents(); })); diff --git a/webapp/src/app/geosource/components/dataset-detail/dataset-export/license-modal/license-modal.component.ts b/webapp/src/app/geosource/components/dataset-detail/dataset-export/license-modal/license-modal.component.ts index 3d13f07a0523224fa7bcdb621f02213bafb1a732..4a34e6182e96d2c1ee1097a3d0dd936dd4df7f00 100644 --- a/webapp/src/app/geosource/components/dataset-detail/dataset-export/license-modal/license-modal.component.ts +++ b/webapp/src/app/geosource/components/dataset-detail/dataset-export/license-modal/license-modal.component.ts @@ -3,7 +3,7 @@ import { Component, OnInit, EventEmitter, Output, Input } from '@angular/core'; @Component({ selector: 'app-license-modal', templateUrl: './license-modal.component.html', - styleUrls: ['./license-modal.component.scss'] + styleUrls: ['./license-modal.component.scss'], }) export class LicenseModalComponent implements OnInit { diff --git a/webapp/src/app/geosource/components/dataset-detail/dataset-info/dataset-description/dataset-description.component.spec.ts b/webapp/src/app/geosource/components/dataset-detail/dataset-info/dataset-description/dataset-description.component.spec.ts index f68a8ab8b300703e2fba18cc45931b332590d08f..4108f762ed83f3fe5179c75a91da9cbce85905b9 100644 --- a/webapp/src/app/geosource/components/dataset-detail/dataset-info/dataset-description/dataset-description.component.spec.ts +++ b/webapp/src/app/geosource/components/dataset-detail/dataset-info/dataset-description/dataset-description.component.spec.ts @@ -8,7 +8,7 @@ describe('DatasetDescriptionComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ DatasetDescriptionComponent ] + declarations: [DatasetDescriptionComponent], }) .compileComponents(); })); diff --git a/webapp/src/app/geosource/components/dataset-detail/dataset-info/dataset-description/dataset-description.component.ts b/webapp/src/app/geosource/components/dataset-detail/dataset-info/dataset-description/dataset-description.component.ts index a47989d6952d9f161eb24ccdc4c1cc045af548ae..55894bbcc445b284794caff6bcd4b71894b5a85a 100644 --- a/webapp/src/app/geosource/components/dataset-detail/dataset-info/dataset-description/dataset-description.component.ts +++ b/webapp/src/app/geosource/components/dataset-detail/dataset-info/dataset-description/dataset-description.component.ts @@ -3,7 +3,7 @@ import { Component, OnInit, Input } from '@angular/core'; @Component({ selector: 'app-dataset-description', templateUrl: './dataset-description.component.html', - styleUrls: ['./dataset-description.component.scss'] + styleUrls: ['./dataset-description.component.scss'], }) export class DatasetDescriptionComponent implements OnInit { @Input() description: any; diff --git a/webapp/src/app/geosource/components/dataset-detail/dataset-info/dataset-info.component.spec.ts b/webapp/src/app/geosource/components/dataset-detail/dataset-info/dataset-info.component.spec.ts index 20eab892cfa5363e90cd2e321163e73b87b042d3..6158ebd8e9b789e73bb443c3b302a36b30ee879b 100644 --- a/webapp/src/app/geosource/components/dataset-detail/dataset-info/dataset-info.component.spec.ts +++ b/webapp/src/app/geosource/components/dataset-detail/dataset-info/dataset-info.component.spec.ts @@ -1,14 +1,12 @@ -import { async, ComponentFixture, TestBed, fakeAsync } from '@angular/core/testing'; -import { DebugElement, Directive, Input, NO_ERRORS_SCHEMA } from '@angular/core'; -import { ActivatedRoute, convertToParamMap, ParamMap } from '@angular/router'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ActivatedRoute } from '@angular/router'; import { Observable } from 'rxjs/Observable'; import { DatasetInfoComponent } from './dataset-info.component'; -import { DatasetDetailService } from '../../../services'; +import { DatasetDetailService, ElasticsearchService } from '../../../services'; import { Metadata } from '../../../models'; import { RouterTestingModule } from '@angular/router/testing'; import 'rxjs/add/observable/of'; import { DatasetDescriptionComponent } from '../..'; -import { ElasticsearchService } from '../../../services'; import { HttpClientModule } from '@angular/common/http'; describe('DatasetInfoComponent', () => { @@ -17,7 +15,7 @@ describe('DatasetInfoComponent', () => { title: 'Metadata Title', abstract: 'abstract', keyword: ['riri', 'fifi', 'loulou'], - getCategories: function () { return ['space_exploration', 'tintin_sur_la_lune']; }, + getCategories: () => { return ['space_exploration', 'tintin_sur_la_lune']; }, dataset_id: '1', uri: [], contact: [], @@ -43,11 +41,11 @@ describe('DatasetInfoComponent', () => { TestBed.configureTestingModule({ declarations: [ DatasetInfoComponent, - DatasetDescriptionComponent + DatasetDescriptionComponent, ], imports: [ RouterTestingModule, - HttpClientModule + HttpClientModule, ], providers: [ DatasetDetailService, @@ -58,14 +56,14 @@ describe('DatasetInfoComponent', () => { parent: { get paramMap(): Observable<any> { return Observable.of({ - get: function (param) { + get: (param) => { return 1; - } + }, }); - } - } - } - } + }, + }, + }, + }, ], }).compileComponents(); })); diff --git a/webapp/src/app/geosource/components/dataset-detail/dataset-info/dataset-info.component.ts b/webapp/src/app/geosource/components/dataset-detail/dataset-info/dataset-info.component.ts index 0aeead1e650b6ad1b3444129a5fbaf9e8428038e..3d87b31b43e7a660b83145334f04031f029cfad4 100644 --- a/webapp/src/app/geosource/components/dataset-detail/dataset-info/dataset-info.component.ts +++ b/webapp/src/app/geosource/components/dataset-detail/dataset-info/dataset-info.component.ts @@ -1,13 +1,12 @@ import { Component, OnInit } from '@angular/core'; import { Metadata, IMetadataUri } from '../../../models'; -import { Observable } from 'rxjs/Observable'; import { DatasetDetailService } from '../../../services'; import 'rxjs/add/operator/switchMap'; @Component({ selector: 'app-dataset-info', templateUrl: './dataset-info.component.html', - styleUrls: ['./dataset-info.component.scss'] + styleUrls: ['./dataset-info.component.scss'], }) export class DatasetInfoComponent implements OnInit { @@ -47,29 +46,29 @@ export class DatasetInfoComponent implements OnInit { this.descriptions.push({ title: isFrenchLanguage ? 'Informations générales' : 'General Information', data: [ - { 'title': 'Source', 'value': source }, - { 'title': 'Formats', 'value': this.formatProtocols(this.metadata.uri) } - ] + { title: 'Source', value: source }, + { title: 'Formats', value: this.formatProtocols(this.metadata.uri) }, + ], }); this.descriptions.push({ title: isFrenchLanguage ? 'Catégorisation' : 'Categorisation', data: [ - { 'title': isFrenchLanguage ? 'Catégories' : 'Categories', 'value': this.metadata.topic_category.join(', ') }, - { 'title': isFrenchLanguage ? 'Mots clés' : 'Keywords', 'value': this.metadata.keyword.join(', ') } - ] + { title: isFrenchLanguage ? 'Catégories' : 'Categories', value: this.metadata.topic_category.join(', ') }, + { title: isFrenchLanguage ? 'Mots clés' : 'Keywords', value: this.metadata.keyword.join(', ') }, + ], }); this.descriptions.push({ title: isFrenchLanguage ? 'Provenance' : 'Origin', data: [ - { 'title': isFrenchLanguage ? 'Généalogie' : 'Lineage', 'value': this.metadata.lineage } - ] + { title: isFrenchLanguage ? 'Généalogie' : 'Lineage', value: this.metadata.lineage }, + ], }); this.descriptions.push({ title: isFrenchLanguage ? 'Contraintes légales' : 'Legal constraints', data: [ - { 'title': isFrenchLanguage ? 'Licence' : 'Licence', 'value': this.metadata.use_limitation[0] }, - { 'title': isFrenchLanguage ? 'Restriction' : 'Restriction', 'value': this.metadata.rights[1] } - ] + { title: isFrenchLanguage ? 'Licence' : 'Licence', value: this.metadata.use_limitation[0] }, + { title: isFrenchLanguage ? 'Restriction' : 'Restriction', value: this.metadata.rights[1] }, + ], }); // TODO To be removed once initializated correctly on the class creation @@ -87,39 +86,39 @@ export class DatasetInfoComponent implements OnInit { title: isFrenchLanguage ? 'Informations géographiques' : 'Geographical information', data: [ { - 'title': isFrenchLanguage ? 'Type de représentation' : 'Representation type', - 'idi18n': '@@dataset.representation_type', - 'value': this.metadata.spatial_type + title: isFrenchLanguage ? 'Type de représentation' : 'Representation type', + idi18n: '@@dataset.representation_type', + value: this.metadata.spatial_type, }, { - 'title': isFrenchLanguage ? 'Echelle' : 'Scale', - 'idi18n': '@@dataset.scale', - 'value': '1:' + this.metadata.denominators + title: isFrenchLanguage ? 'Echelle' : 'Scale', + idi18n: '@@dataset.scale', + value: '1:' + this.metadata.denominators, }, { - 'title': isFrenchLanguage ? 'Résolution' : 'Resolution', - 'idi18n': '@@dataset.resolution', - 'value': distance + ' ' + uom + title: isFrenchLanguage ? 'Résolution' : 'Resolution', + idi18n: '@@dataset.resolution', + value: distance + ' ' + uom, }, { - 'title': isFrenchLanguage ? 'Etendue géographique' : 'Geographical extend', - 'idi18n': '@@dataset.geographical_spread', - 'value': this.metadata.max_east + ' est,<br />' + title: isFrenchLanguage ? 'Etendue géographique' : 'Geographical extend', + idi18n: '@@dataset.geographical_spread', + value: this.metadata.max_east + ' est,<br />' + this.metadata.max_south + ' sud,<br />' + this.metadata.max_north + ' nord,<br />' - + this.metadata.max_west + ' ouest' + + this.metadata.max_west + ' ouest', }, { - 'title': isFrenchLanguage ? 'Système de coordonnées' : 'Coordonates system', - 'idi18n': '@@dataset.coordiates_system', - 'value': '-' - } - ] + title: isFrenchLanguage ? 'Système de coordonnées' : 'Coordonates system', + idi18n: '@@dataset.coordiates_system', + value: '-', + }, + ], }); } - formatProtocols(uriList: Array<IMetadataUri>): string { - return uriList.map(uri => { + formatProtocols(uriList: IMetadataUri[]): string { + return uriList.map((uri) => { return uri.protocol; }).join(', '); } diff --git a/webapp/src/app/geosource/components/dataset-detail/dataset-map/dataset-map.component.spec.ts b/webapp/src/app/geosource/components/dataset-detail/dataset-map/dataset-map.component.spec.ts index e8f8eda2f68a588d8ed72f3f8f29d0d9e67b7d14..1e7e0ccc799ec9b2319a0dbc7699c925a37a3ebe 100644 --- a/webapp/src/app/geosource/components/dataset-detail/dataset-map/dataset-map.component.spec.ts +++ b/webapp/src/app/geosource/components/dataset-detail/dataset-map/dataset-map.component.spec.ts @@ -8,7 +8,7 @@ describe('DatasetMapComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ DatasetMapComponent ] + declarations: [DatasetMapComponent], }) .compileComponents(); })); diff --git a/webapp/src/app/geosource/components/dataset-detail/dataset-map/dataset-map.component.ts b/webapp/src/app/geosource/components/dataset-detail/dataset-map/dataset-map.component.ts index 0d71706042ede7189a7f51a5a4d5a010b1ce366b..6e9f153ffa092478e99d19d328156b211c945ac8 100644 --- a/webapp/src/app/geosource/components/dataset-detail/dataset-map/dataset-map.component.ts +++ b/webapp/src/app/geosource/components/dataset-detail/dataset-map/dataset-map.component.ts @@ -7,7 +7,7 @@ import { Metadata, Data } from '../../../models'; @Component({ selector: 'app-dataset-map', templateUrl: './dataset-map.component.html', - styleUrls: ['./dataset-map.component.scss'] + styleUrls: ['./dataset-map.component.scss'], }) export class DatasetMapComponent implements OnInit { metadata: Metadata; @@ -27,7 +27,7 @@ export class DatasetMapComponent implements OnInit { initialize() { this.metadata = this._datasetDetailService.getDatasetMetadata(); if (this.metadata !== undefined) { - this._datasetResearchService.getDataByMetadataById(this.metadata.dataset_index).subscribe(results => { + this._datasetResearchService.getDataByMetadataById(this.metadata.dataset_index).subscribe((results) => { this.constructMap(results); }); } @@ -36,32 +36,48 @@ export class DatasetMapComponent implements OnInit { constructMap(results: Data[]) { // Déclaration de la carte avec les coordonnées du centre et le niveau de zoom. const attribution = 'Data Grand Lyon'; - const satellite = L.tileLayer('https://openstreetmap.data.grandlyon.com/3857/tms/1.0.0/ortho2015@GoogleMapsCompatible/{z}/{x}/{-y}.png', { id: 'MapID', attribution: attribution }); - const grayscale = L.tileLayer('https://openstreetmap.data.grandlyon.com/3857/tms/1.0.0/osm_grandlyon_nb@GoogleMapsCompatible/{z}/{x}/{-y}.png', { id: 'MapID', attribution: attribution }); - const plan = L.tileLayer('https://openstreetmap.data.grandlyon.com/3857/tms/1.0.0/osm_grandlyon@GoogleMapsCompatible/{z}/{x}/{-y}.png', { id: 'MapID', attribution: attribution }); + const satellite = L.tileLayer( + 'https://openstreetmap.data.grandlyon.com/3857/tms/1.0.0/ortho2015@GoogleMapsCompatible/{z}/{x}/{-y}.png', + { + attribution, + id: 'MapID', + }, + ); + const grayscale = L.tileLayer( + 'https://openstreetmap.data.grandlyon.com/3857/tms/1.0.0/osm_grandlyon_nb@GoogleMapsCompatible/{z}/{x}/{-y}.png', + { + attribution, + id: 'MapID', + }, + ); + const plan = L.tileLayer( + 'https://openstreetmap.data.grandlyon.com/3857/tms/1.0.0/osm_grandlyon@GoogleMapsCompatible/{z}/{x}/{-y}.png', + { + attribution, + id: 'MapID', + }, + ); const dataGrandLyonMap = L.map('frugalmap', { minZoom: 9, maxZoom: 18, layers: [plan] }) .setView([45.75, 4.85], 12); - const baseMaps = { - 'Plan': plan, + Plan: plan, 'Niveau de gris': grayscale, - 'Satellite': satellite + Satellite: satellite, }; L.control.layers(baseMaps).addTo(dataGrandLyonMap); // Set icon marker const myIcon = L.icon({ - iconUrl: 'https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.2.0/images/marker-icon.png' + iconUrl: 'https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.2.0/images/marker-icon.png', }); - const group = []; const cluster = L.markerClusterGroup({ - maxClusterRadius: 120 + maxClusterRadius: 120, }); - results.forEach(element => { + results.forEach((element) => { console.log(element); switch (element.geometry.type) { @@ -73,8 +89,8 @@ export class DatasetMapComponent implements OnInit { break; case 'Polygon': // create a red polygon from an array of LatLng points - element.geometry.coordinates.forEach(coordinates => { - coordinates.forEach(coord => { + element.geometry.coordinates.forEach((coordinates) => { + coordinates.forEach((coord) => { coord.reverse(); }); const polygon = L.polygon(coordinates, { color: 'red' }).addTo(dataGrandLyonMap); diff --git a/webapp/src/app/geosource/components/dataset-list/dataset-list.component.spec.ts b/webapp/src/app/geosource/components/dataset-list/dataset-list.component.spec.ts index e22b1183ab09cb8e34cfa73de52c3d00cd34ddd6..4d3e91b4b24a391d2f4697f27bfbd4657da2535b 100644 --- a/webapp/src/app/geosource/components/dataset-list/dataset-list.component.spec.ts +++ b/webapp/src/app/geosource/components/dataset-list/dataset-list.component.spec.ts @@ -1,12 +1,10 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { DatasetListComponent } from './dataset-list.component'; -import { ActivatedRoute } from '@angular/router'; import { DatasetResearchService, ElasticsearchService } from '../../services'; import { Observable } from 'rxjs/Observable'; -import { IMetadata, Dataset, SearchSuggestion } from '../../models'; +import { Dataset, SearchSuggestion } from '../../models'; import { RouterTestingModule } from '@angular/router/testing'; import { Subject } from 'rxjs/Subject'; -import { Subscription } from 'rxjs/Subscription'; import { HttpClientModule } from '@angular/common/http'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { MockComponent } from 'ng2-mock-component'; @@ -27,7 +25,7 @@ describe('DatasetListComponent', () => { data: [{ label: 'data label', content: 'data content', - }] + }], }, metadata: { dataset_id: '1', @@ -35,27 +33,27 @@ describe('DatasetListComponent', () => { abstract: 'abstract', keyword: ['transportation'], uri: [{ - 'description': 'desc', - 'url': 'url', - 'protocol': ['uri'], - 'name': 'name', + description: 'desc', + url: 'url', + protocol: ['uri'], + name: 'name', }], contact: [{ - 'country': '', - 'postcode': '', - 'organization': '', - 'name': '', - 'city': '', - 'role': '', - 'address': '', - 'email': '' + country: '', + postcode: '', + organization: '', + name: '', + city: '', + role: '', + address: '', + email: '', }], date_publication: [''], topic_category: [''], highlight: '', use_limitation: [''], total_documents: 10, - } + }, }] as Dataset[]; let component: DatasetListComponent; @@ -72,17 +70,17 @@ describe('DatasetListComponent', () => { MockComponent({ selector: 'app-sort' }), FilterListComponent, FilterDetailComponent, - PaginatorComponent + PaginatorComponent, ], imports: [ RouterTestingModule.withRoutes([]), BrowserAnimationsModule, HttpClientModule, - FormsModule + FormsModule, ], providers: [ DatasetResearchService, - ElasticsearchService + ElasticsearchService, ], }) .compileComponents(); diff --git a/webapp/src/app/geosource/components/dataset-list/dataset-list.component.ts b/webapp/src/app/geosource/components/dataset-list/dataset-list.component.ts index 23ec8067c47a98f068e9cbddeff96ceb7f3ea445..e03c8477a362a066b8a59621254dcb606ad8eeeb 100644 --- a/webapp/src/app/geosource/components/dataset-list/dataset-list.component.ts +++ b/webapp/src/app/geosource/components/dataset-list/dataset-list.component.ts @@ -1,14 +1,13 @@ import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core'; -import { DatasetResearchService } from '../../services'; +import { DatasetResearchService, ElasticsearchService } from '../../services'; import { Dataset, IMetadataUri, SearchSuggestion } from '../../models'; import { Subscription } from 'rxjs/Subscription'; -import { ElasticsearchService } from '../../services'; import { PaginatorOptions } from '../../../shared/models'; @Component({ selector: 'app-dataset-list', templateUrl: './dataset-list.component.html', - styleUrls: ['./dataset-list.component.scss'] + styleUrls: ['./dataset-list.component.scss'], }) export class DatasetListComponent implements OnInit, OnDestroy { @@ -21,7 +20,7 @@ export class DatasetListComponent implements OnInit, OnDestroy { pageIndex: 0, length: 0, pageSize: 5, - pageSizeOptions: [3, 5, 10] + pageSizeOptions: [3, 5, 10], }; displayFilters = false; displaySuggestion = false; @@ -29,7 +28,7 @@ export class DatasetListComponent implements OnInit, OnDestroy { constructor( private datasetResearchService: DatasetResearchService, - private elasticsearchService: ElasticsearchService + private elasticsearchService: ElasticsearchService, ) { } ngOnInit() { @@ -43,7 +42,7 @@ export class DatasetListComponent implements OnInit, OnDestroy { this.showProgressBar = true; this.search(); this.getSuggestion(); - } + }, ); } @@ -61,27 +60,28 @@ export class DatasetListComponent implements OnInit, OnDestroy { this.paginator.length = this.datasetResearchService.resultsCount; this.showProgressBar = false; this.loading = false; - }, (err) => { + }, + (err) => { this.loading = false; - } + }, ); } // When pagination is changed by user, we update datasetList with new pagination options changePagination(pageIndex) { - this.datasetResearchService.paginationChanged(this.paginator.pageSize, pageIndex - 1 ); + this.datasetResearchService.paginationChanged(this.paginator.pageSize, pageIndex - 1); } changePageSize(pageSize) { - this.datasetResearchService.paginationChanged(pageSize, 0 ); + this.datasetResearchService.paginationChanged(pageSize, 0); } formatFoundItem(e) { return '<u>' + e.label + ':</u> ' + e.content; } - formatProtocols(uriList: Array<IMetadataUri>): string { - return uriList.map(uri => { + formatProtocols(uriList: IMetadataUri[]): string { + return uriList.map((uri) => { return uri.protocol; }).join(', '); } @@ -99,7 +99,7 @@ export class DatasetListComponent implements OnInit, OnDestroy { } else { this.displaySuggestion = false; } - } + }, ); } diff --git a/webapp/src/app/geosource/components/filter-list/filter-detail/filter-detail.component.spec.ts b/webapp/src/app/geosource/components/filter-list/filter-detail/filter-detail.component.spec.ts index e8e927ab7cac67f016f6f18d712fdaa08bcb24ad..04e3f650d3aec4dfd964d880de0ebcad8e9c3ef5 100644 --- a/webapp/src/app/geosource/components/filter-list/filter-detail/filter-detail.component.spec.ts +++ b/webapp/src/app/geosource/components/filter-list/filter-detail/filter-detail.component.spec.ts @@ -3,9 +3,6 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { FilterDetailComponent } from './filter-detail.component'; import { DatasetResearchService, ElasticsearchService } from '../../../services'; import { HttpClientModule } from '@angular/common/http'; -import { FilterListComponent } from '../..'; -import { Component } from '@angular/core'; -import { IFilter } from '../../../models'; describe('FilterDetailComponent', () => { let component: FilterDetailComponent; @@ -14,15 +11,15 @@ describe('FilterDetailComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ - FilterDetailComponent + FilterDetailComponent, ], imports: [ - HttpClientModule + HttpClientModule, ], providers: [ DatasetResearchService, - ElasticsearchService - ] + ElasticsearchService, + ], }) .compileComponents(); })); @@ -31,22 +28,22 @@ describe('FilterDetailComponent', () => { fixture = TestBed.createComponent(FilterDetailComponent); component = fixture.componentInstance; component.filter = { - 'field': '', + field: '', 'label-fr': '', 'label-en': '', - 'aggregations': [{ - 'key': '', - 'doc_count': 10, - 'count_per_metadata': 3, - 'isActive': true + aggregations: [{ + key: '', + doc_count: 10, + count_per_metadata: 3, + isActive: true, }], - 'activeFilters': [{ - 'key': '', - 'doc_count': 10, - 'count_per_metadata': 3, - 'isActive': true + activeFilters: [{ + key: '', + doc_count: 10, + count_per_metadata: 3, + isActive: true, }], - 'type': '' + type: '', }; fixture.detectChanges(); }); diff --git a/webapp/src/app/geosource/components/filter-list/filter-detail/filter-detail.component.ts b/webapp/src/app/geosource/components/filter-list/filter-detail/filter-detail.component.ts index 636bc1e6850976e97d862161d54897cc00f09958..23ab517e5c2aeda1aba07c1b3f5d48caece2dc49 100644 --- a/webapp/src/app/geosource/components/filter-list/filter-detail/filter-detail.component.ts +++ b/webapp/src/app/geosource/components/filter-list/filter-detail/filter-detail.component.ts @@ -5,13 +5,13 @@ import { IFilter } from '../../../models'; @Component({ selector: 'app-filter-detail', templateUrl: './filter-detail.component.html', - styleUrls: ['./filter-detail.component.scss'] + styleUrls: ['./filter-detail.component.scss'], }) export class FilterDetailComponent implements OnInit { @Input() filter: IFilter; showList = false; constructor( - private _datasetResearchService: DatasetResearchService + private _datasetResearchService: DatasetResearchService, ) {} ngOnInit() { diff --git a/webapp/src/app/geosource/components/filter-list/filter-list.component.spec.ts b/webapp/src/app/geosource/components/filter-list/filter-list.component.spec.ts index 1d0417963dfa662bdb02b5c19ae3759c80d0af95..fffab393b721d82c84608917bf2a30dbaf67a103 100644 --- a/webapp/src/app/geosource/components/filter-list/filter-list.component.spec.ts +++ b/webapp/src/app/geosource/components/filter-list/filter-list.component.spec.ts @@ -13,15 +13,15 @@ describe('FilterListComponent', () => { TestBed.configureTestingModule({ declarations: [ FilterListComponent, - FilterDetailComponent + FilterDetailComponent, ], imports: [ - HttpClientModule + HttpClientModule, ], providers: [ DatasetResearchService, - ElasticsearchService - ] + ElasticsearchService, + ], }) .compileComponents(); })); diff --git a/webapp/src/app/geosource/components/filter-list/filter-list.component.ts b/webapp/src/app/geosource/components/filter-list/filter-list.component.ts index 6e251ea0089af6b9cf7010c3d116734a112877c5..2368bde367a23781b199b3a1db8f833862948bb3 100644 --- a/webapp/src/app/geosource/components/filter-list/filter-list.component.ts +++ b/webapp/src/app/geosource/components/filter-list/filter-list.component.ts @@ -6,15 +6,15 @@ import { IFilter } from '../../models'; @Component({ selector: 'app-filter-list', templateUrl: './filter-list.component.html', - styleUrls: ['./filter-list.component.scss'] + styleUrls: ['./filter-list.component.scss'], }) export class FilterListComponent implements OnInit, OnDestroy { private _datasetsReloaded: Subscription; - filters: Array<IFilter>; + filters: IFilter[]; constructor( - private _datasetResearchService: DatasetResearchService + private _datasetResearchService: DatasetResearchService, ) {} ngOnInit() { @@ -23,8 +23,8 @@ export class FilterListComponent implements OnInit, OnDestroy { const filters = this._datasetResearchService.filters; // If one filter is used as an active filter, we remove it of 'aggregations' property // that are used to display the filters categories - filters.forEach(filter => { - filter.activeFilters.forEach(active => { + filters.forEach((filter) => { + filter.activeFilters.forEach((active) => { const elementIndex = filter.aggregations.findIndex((el) => { return el.key === active.key; }); @@ -33,7 +33,7 @@ export class FilterListComponent implements OnInit, OnDestroy { }); this.filters = filters; - } + }, ); } diff --git a/webapp/src/app/geosource/components/index.ts b/webapp/src/app/geosource/components/index.ts index ed767816759dd118185bf4697822a9a719b2ff52..5b06a7764794dbaa138dd9962804dabfa68001b2 100644 --- a/webapp/src/app/geosource/components/index.ts +++ b/webapp/src/app/geosource/components/index.ts @@ -5,6 +5,7 @@ import { DatasetExportComponent } from './dataset-detail/dataset-export/dataset- import { LicenseModalComponent } from './dataset-detail/dataset-export/license-modal/license-modal.component'; import { DatasetMapComponent } from './dataset-detail/dataset-map/dataset-map.component'; import { DatasetInfoComponent } from './dataset-detail/dataset-info/dataset-info.component'; +// tslint:disable-next-line:max-line-length import { DatasetDescriptionComponent } from './dataset-detail/dataset-info/dataset-description/dataset-description.component'; import { SearchBarComponent } from './search-bar/search-bar.component'; @@ -25,9 +26,10 @@ export { ResearchComponent, SortComponent, FilterListComponent, - FilterDetailComponent + FilterDetailComponent, }; +// tslint:disable-next-line:variable-name export const GeosourceComponents = [ DatasetDetailComponent, DatasetExportComponent, @@ -40,5 +42,5 @@ export const GeosourceComponents = [ ResearchComponent, SortComponent, FilterListComponent, - FilterDetailComponent + FilterDetailComponent, ]; diff --git a/webapp/src/app/geosource/components/research/research.component.spec.ts b/webapp/src/app/geosource/components/research/research.component.spec.ts index 97a45f97367662404a38c2ff33b3c683ef946b74..dd34803e7166d7914e16f8ca139caf0cba1b0ab6 100644 --- a/webapp/src/app/geosource/components/research/research.component.spec.ts +++ b/webapp/src/app/geosource/components/research/research.component.spec.ts @@ -14,7 +14,7 @@ describe('ResearchComponent', () => { TestBed.configureTestingModule({ imports: [ RouterTestingModule.withRoutes([]), - HttpClientModule + HttpClientModule, ], declarations: [ ResearchComponent, @@ -23,8 +23,8 @@ describe('ResearchComponent', () => { ], providers: [ DatasetResearchService, - ElasticsearchService - ] + ElasticsearchService, + ], }) .compileComponents(); })); diff --git a/webapp/src/app/geosource/components/research/research.component.ts b/webapp/src/app/geosource/components/research/research.component.ts index e2c825a71fd7221e9dfde388064501b74183df74..f8789638ea9693f48778bb0d70da3081fffb26f4 100644 --- a/webapp/src/app/geosource/components/research/research.component.ts +++ b/webapp/src/app/geosource/components/research/research.component.ts @@ -6,20 +6,20 @@ import { AppRoutes } from '../../../routes'; @Component({ selector: 'app-research', templateUrl: './research.component.html', - styleUrls: ['./research.component.scss'] + styleUrls: ['./research.component.scss'], }) export class ResearchComponent implements OnInit { constructor( private _datasetResearchService: DatasetResearchService, private _router: Router, - private _route: ActivatedRoute + private _route: ActivatedRoute, ) { } ngOnInit() { this._datasetResearchService.searchChange$.subscribe(() => { - if ( this._route.snapshot.url[this._route.snapshot.url.length - 1].path !== AppRoutes.datasets ) { - this._router.navigate([AppRoutes.datasets], { relativeTo: this._route}); + if (this._route.snapshot.url[this._route.snapshot.url.length - 1].path !== AppRoutes.datasets) { + this._router.navigate([AppRoutes.datasets], { relativeTo: this._route }); } }); } diff --git a/webapp/src/app/geosource/components/search-bar/search-bar.component.html b/webapp/src/app/geosource/components/search-bar/search-bar.component.html index c021e762c3664dd1505d703eec4a59a66558ef38..3d369cc2c4603c582326c237fd1384a413e19f41 100644 --- a/webapp/src/app/geosource/components/search-bar/search-bar.component.html +++ b/webapp/src/app/geosource/components/search-bar/search-bar.component.html @@ -8,7 +8,7 @@ (keyup)="searchChanged($event.key)" (blur)="displayAutocomplete = false; currentAutocompleteFocus= -1;" (focus)="displayAutocomplete=true" /> <div class="autocomplete-items" [ngStyle]="{'display': displayAutocomplete ? 'block' : 'none'}"> - <p *ngFor="let option of options_autocomplete; let i = index" (mousedown)="changeValue(option.text)" + <p *ngFor="let option of optionsAutocomplete; let i = index" (mousedown)="changeValue(option.text)" [ngClass]="{'isActive' : i == currentAutocompleteFocus}"> {{ option.text }} </p> diff --git a/webapp/src/app/geosource/components/search-bar/search-bar.component.spec.ts b/webapp/src/app/geosource/components/search-bar/search-bar.component.spec.ts index fe40fea34005adfd098835b0751ba518193c3bb3..12dade116f88b27b3607e7fafc5e35f133bd5174 100644 --- a/webapp/src/app/geosource/components/search-bar/search-bar.component.spec.ts +++ b/webapp/src/app/geosource/components/search-bar/search-bar.component.spec.ts @@ -15,7 +15,7 @@ describe('SearchBarComponent', () => { TestBed.configureTestingModule({ imports: [ FormsModule, - HttpClientModule + HttpClientModule, ], declarations: [ SearchBarComponent, @@ -23,8 +23,8 @@ describe('SearchBarComponent', () => { ], providers: [ DatasetResearchService, - ElasticsearchService - ] + ElasticsearchService, + ], }) .compileComponents(); })); diff --git a/webapp/src/app/geosource/components/search-bar/search-bar.component.ts b/webapp/src/app/geosource/components/search-bar/search-bar.component.ts index c423af0f89836f4d639e017a8c55e7ccdb4ef28a..96d42f04915174f03ead2d72c6bf07f6adc3a728 100644 --- a/webapp/src/app/geosource/components/search-bar/search-bar.component.ts +++ b/webapp/src/app/geosource/components/search-bar/search-bar.component.ts @@ -5,12 +5,12 @@ import { SearchCompletion } from '../../models'; @Component({ selector: 'app-search-bar', templateUrl: './search-bar.component.html', - styleUrls: ['./search-bar.component.scss'] + styleUrls: ['./search-bar.component.scss'], }) export class SearchBarComponent implements OnInit { searchValue: string; - options_autocomplete: Array<SearchCompletion>; + optionsAutocomplete: SearchCompletion[]; currentAutocompleteFocus: number; isLoading: boolean; displayAutocomplete: boolean; @@ -19,10 +19,10 @@ export class SearchBarComponent implements OnInit { private _datasetResearchService: DatasetResearchService, private _elasticSearchService: ElasticsearchService, ) { - this.options_autocomplete = []; + this.optionsAutocomplete = []; this.currentAutocompleteFocus = -1; this.displayAutocomplete = false; - } + } ngOnInit() { this.searchValue = this._datasetResearchService.searchString; @@ -30,9 +30,9 @@ export class SearchBarComponent implements OnInit { this._datasetResearchService.searchChange$.subscribe( () => { this.searchValue = this._datasetResearchService.searchString; - this.options_autocomplete = []; + this.optionsAutocomplete = []; this.currentAutocompleteFocus = -1; - } + }, ); // Used to display the loading icon this._datasetResearchService.isLoading$.subscribe((value) => { @@ -50,33 +50,33 @@ export class SearchBarComponent implements OnInit { // These 2 keys are to go up and down in the autocomplete list items case 'ArrowDown': if (this.currentAutocompleteFocus < 2) { - this.currentAutocompleteFocus ++; + this.currentAutocompleteFocus = this.currentAutocompleteFocus + 1; } break; case 'ArrowUp': if (this.currentAutocompleteFocus > 0) { - this.currentAutocompleteFocus --; + this.currentAutocompleteFocus = this.currentAutocompleteFocus - 1; } break; case 'Enter': // When Enter is pressed and that we are inside the autocomplete list items if (this.currentAutocompleteFocus > -1) { - this.searchValue = this.options_autocomplete[this.currentAutocompleteFocus].text; + this.searchValue = this.optionsAutocomplete[this.currentAutocompleteFocus].text; this.currentAutocompleteFocus = -1; } this._datasetResearchService.searchChanged(this.searchValue); - this.options_autocomplete = []; + this.optionsAutocomplete = []; break; case 'optionSelected': case 'reset': this._datasetResearchService.searchChanged(this.searchValue); - this.options_autocomplete = []; + this.optionsAutocomplete = []; break; default: this._elasticSearchService.getAutoComplete(this.searchValue).subscribe( - res => { - this.options_autocomplete = res; - } + (res) => { + this.optionsAutocomplete = res; + }, ); break; } @@ -102,5 +102,4 @@ export class SearchBarComponent implements OnInit { this.searchChanged('reset'); } - } diff --git a/webapp/src/app/geosource/components/sort/sort.component.spec.ts b/webapp/src/app/geosource/components/sort/sort.component.spec.ts index 735cd9c895bdba8b903a5accae7d7d13ae777537..e22b1acd7c5915ab24ed54b54f17c1c4fdd46db9 100644 --- a/webapp/src/app/geosource/components/sort/sort.component.spec.ts +++ b/webapp/src/app/geosource/components/sort/sort.component.spec.ts @@ -13,12 +13,12 @@ describe('SortComponent', () => { TestBed.configureTestingModule({ imports: [ HttpClientModule, - BrowserAnimationsModule + BrowserAnimationsModule, ], - declarations: [ SortComponent ], + declarations: [SortComponent], providers: [ DatasetResearchService, - ElasticsearchService + ElasticsearchService, ], }) .compileComponents(); diff --git a/webapp/src/app/geosource/components/sort/sort.component.ts b/webapp/src/app/geosource/components/sort/sort.component.ts index ef4eea88526d47cfc5aace32e5d60cd7ea47cdea..0305e15163b4aebdf96385fa1caefee1271c6159 100644 --- a/webapp/src/app/geosource/components/sort/sort.component.ts +++ b/webapp/src/app/geosource/components/sort/sort.component.ts @@ -10,7 +10,7 @@ interface IDropdownOptions { @Component({ selector: 'app-sort', templateUrl: './sort.component.html', - styleUrls: ['./sort.component.scss'] + styleUrls: ['./sort.component.scss'], }) export class SortComponent implements OnInit { @@ -20,20 +20,20 @@ export class SortComponent implements OnInit { selectedOption: ISortOption; constructor( - private _datasetResearchService: DatasetResearchService + private _datasetResearchService: DatasetResearchService, ) { this.options = [ { - 'label': 'Date', - 'value': 'date' + label: 'Date', + value: 'date', }, { - 'label': 'Alphabétique', - 'value': 'alphabetical' + label: 'Alphabétique', + value: 'alphabetical', }, { - 'label': 'Pertinence', - 'value': 'relevance' + label: 'Pertinence', + value: 'relevance', }, ]; } diff --git a/webapp/src/app/geosource/geosource-routing.module.ts b/webapp/src/app/geosource/geosource-routing.module.ts index 59b9797ffa9947ddb7e759630f2b5c6a17721d16..9207a7db4bc065a86dd2319fca4ea8732303a019 100644 --- a/webapp/src/app/geosource/geosource-routing.module.ts +++ b/webapp/src/app/geosource/geosource-routing.module.ts @@ -1,6 +1,7 @@ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; -import { DatasetListComponent, DatasetDetailComponent, ResearchComponent, DatasetInfoComponent, DatasetMapComponent, DatasetExportComponent } from './components'; +import { DatasetListComponent, DatasetDetailComponent, ResearchComponent, DatasetInfoComponent, + DatasetMapComponent, DatasetExportComponent } from './components'; import { AppRoutes } from '../routes'; export const routes: Routes = [ @@ -11,11 +12,11 @@ export const routes: Routes = [ { path: '', redirectTo: AppRoutes.datasets, - pathMatch: 'full' + pathMatch: 'full', }, { path: AppRoutes.datasets, - component: DatasetListComponent + component: DatasetListComponent, }, { path: `${AppRoutes.datasets}/:id`, @@ -24,28 +25,28 @@ export const routes: Routes = [ { path: '', redirectTo: AppRoutes.info, - pathMatch: 'full' + pathMatch: 'full', }, { path: AppRoutes.info, - component: DatasetInfoComponent + component: DatasetInfoComponent, }, { path: AppRoutes.map, - component: DatasetMapComponent + component: DatasetMapComponent, }, { path: AppRoutes.export, - component: DatasetExportComponent - } - ] - } - ] + component: DatasetExportComponent, + }, + ], + }, + ], }, ]; @NgModule({ imports: [RouterModule.forChild(routes)], - exports: [RouterModule] + exports: [RouterModule], }) export class GeosourceRoutingModule { } diff --git a/webapp/src/app/geosource/geosource.module.ts b/webapp/src/app/geosource/geosource.module.ts index 1c07af9031b89a948cc37ba8bfe05940fbab92cc..9eb32c698ac1178729fa0f5413f8998677573673 100644 --- a/webapp/src/app/geosource/geosource.module.ts +++ b/webapp/src/app/geosource/geosource.module.ts @@ -5,6 +5,7 @@ import { GeosourceRoutingModule } from './geosource-routing.module'; import { GeosourceComponents } from './components'; import { GeosourceServices } from './services'; import { SharedModule } from '../shared/shared.module'; +// tslint:disable-next-line:max-line-length import { DatasetDescriptionComponent } from './components/dataset-detail/dataset-info/dataset-description/dataset-description.component'; @NgModule({ @@ -12,11 +13,11 @@ import { DatasetDescriptionComponent } from './components/dataset-detail/dataset CommonModule, GeosourceRoutingModule, FormsModule, - SharedModule + SharedModule, ], declarations: [...GeosourceComponents, DatasetDescriptionComponent], providers: [ - ...GeosourceServices - ] + ...GeosourceServices, + ], }) export class GeosourceModule { } diff --git a/webapp/src/app/geosource/models/data.model.ts b/webapp/src/app/geosource/models/data.model.ts index 50824a190234028648f9617e7cae796d420cfa5b..f633da0e5dd6d37fcf75d65649b525c645b50842 100644 --- a/webapp/src/app/geosource/models/data.model.ts +++ b/webapp/src/app/geosource/models/data.model.ts @@ -29,5 +29,3 @@ export class Data implements IData { Object.assign(this, data); } } - - diff --git a/webapp/src/app/geosource/models/elasticsearch-hit.model.ts b/webapp/src/app/geosource/models/elasticsearch-hit.model.ts index 8416b3d12f80195103ee2cfaea60c55ed67b0621..26c9ff756c332da325941defff249d4a302124a5 100644 --- a/webapp/src/app/geosource/models/elasticsearch-hit.model.ts +++ b/webapp/src/app/geosource/models/elasticsearch-hit.model.ts @@ -10,9 +10,9 @@ export interface IElasticsearchHit { 'inner_hits': { 'data': { 'hits': { - 'total': number - 'hits': any[] - } - } + 'total': number, + 'hits': any[], + }, + }, }; } diff --git a/webapp/src/app/geosource/models/elasticsearch-options.model.ts b/webapp/src/app/geosource/models/elasticsearch-options.model.ts index 3690bab853f5c89f45cc86bf06a32113eae471ea..d82e8ff9630c0bd384b48be466f9140c8935d724 100644 --- a/webapp/src/app/geosource/models/elasticsearch-options.model.ts +++ b/webapp/src/app/geosource/models/elasticsearch-options.model.ts @@ -5,7 +5,7 @@ export interface IElasticsearchOptions { 'pageSize'?: number; 'sortOptions'?: ISortOption; 'searchString'?: string; - 'filters'?: Array<IFilter>; + 'filters'?: IFilter[]; } export class ElasticsearchOptions { @@ -13,7 +13,7 @@ export class ElasticsearchOptions { '_pageSize': number; '_sortOptions': ISortOption; '_searchString': string; - '_filters': Array<IFilter>; + '_filters': IFilter[]; constructor(data?) { this._pageSize = (data && data.pageSize != null) ? data.pageSize : 3; @@ -21,57 +21,57 @@ export class ElasticsearchOptions { this._searchString = (data && data.searchString != null) ? data.searchString : ''; this._sortOptions = (data && data.sortOptions != null) ? data.sortOptions : { value: 'relevance', - order: 'desc' + order: 'desc', }; this._filters = (data && data.filters != null) ? data.filters : [ { - 'field': 'topic_category', + field: 'topic_category', 'label-fr': 'Catégories', 'label-en': 'Categories', - 'aggregations': [], - 'activeFilters': [], - 'type': 'string' + aggregations: [], + activeFilters: [], + type: 'string', }, { - 'field': 'keyword', + field: 'keyword', 'label-fr': 'Mots clés', 'label-en': 'Keywords', - 'aggregations': [], - 'activeFilters': [], - 'type': 'string' + aggregations: [], + activeFilters: [], + type: 'string', }, { - 'field': 'contact.organization', + field: 'contact.organization', 'label-fr': 'Acteurs', 'label-en': 'Actors', - 'aggregations': [], - 'activeFilters': [], - 'type': 'string' + aggregations: [], + activeFilters: [], + type: 'string', }, { - 'field': 'use_limitation', + field: 'use_limitation', 'label-fr': 'Licences', 'label-en': 'Licences', - 'aggregations': [], - 'activeFilters': [], - 'type': 'string' + aggregations: [], + activeFilters: [], + type: 'string', }, { - 'field': 'uri.protocol', + field: 'uri.protocol', 'label-fr': 'Formats', 'label-en': 'Formats', - 'aggregations': [], - 'activeFilters': [], - 'type': 'string' + aggregations: [], + activeFilters: [], + type: 'string', }, { - 'field': 'date_publication', + field: 'date_publication', 'label-fr': 'Année de publication', 'label-en': 'Publication year', - 'aggregations': [], - 'activeFilters': [], - 'type': 'date' - } + aggregations: [], + activeFilters: [], + type: 'date', + }, ]; } @@ -93,7 +93,7 @@ export class ElasticsearchOptions { return this._searchString; } - get filters(): Array<IFilter> { + get filters(): IFilter[] { return this._filters; } @@ -115,7 +115,7 @@ export class ElasticsearchOptions { this._searchString = value; } - set filters(filters: Array<IFilter>) { + set filters(filters: IFilter[]) { this._filters = filters; } } diff --git a/webapp/src/app/geosource/models/elasticsearch-response.model.ts b/webapp/src/app/geosource/models/elasticsearch-response.model.ts index 65c75c8ae1a9b42d59cfa83afab4f4caac6c32fb..b109cd099dbcd98aa50c0f591511eba2f9ea3084 100644 --- a/webapp/src/app/geosource/models/elasticsearch-response.model.ts +++ b/webapp/src/app/geosource/models/elasticsearch-response.model.ts @@ -5,10 +5,8 @@ export interface IElasticsearchResponse { 'hits': { 'total': number, 'max_score': number, - 'hits': Array<IElasticsearchHit> + 'hits': IElasticsearchHit[], }; 'suggest': any; 'aggregations': any; } - - diff --git a/webapp/src/app/geosource/models/highlights.model.ts b/webapp/src/app/geosource/models/highlights.model.ts index 5354b7a85fb2ba030cb1152530d410c5fdb30457..df854c48c3cd8bb4ec6f471156d0e31b9b116e3d 100644 --- a/webapp/src/app/geosource/models/highlights.model.ts +++ b/webapp/src/app/geosource/models/highlights.model.ts @@ -1,19 +1,19 @@ export interface IHighlights { 'highlightedAbstract': string; - 'metadata': Array<IHighlight>; - 'data': Array<IHighlight>; + 'metadata': IHighlight[]; + 'data': IHighlight[]; } export class Highlights implements IHighlights { - 'highlightedAbstract': string; - 'metadata': Array<IHighlight>; - 'data': Array<IHighlight>; + 'highlightedAbstract': string; + 'metadata': IHighlight[]; + 'data': IHighlight[]; - constructor(data?: IHighlights) { - this.highlightedAbstract = (data && data.highlightedAbstract != null) ? data.highlightedAbstract : null; - this.data = (data && data.data != null) ? data.data : []; - this.metadata = (data && data.metadata != null) ? data.metadata : []; - } + constructor(data?: IHighlights) { + this.highlightedAbstract = (data && data.highlightedAbstract != null) ? data.highlightedAbstract : null; + this.data = (data && data.data != null) ? data.data : []; + this.metadata = (data && data.metadata != null) ? data.metadata : []; + } } interface IHighlight { diff --git a/webapp/src/app/geosource/models/metadata.model.ts b/webapp/src/app/geosource/models/metadata.model.ts index 836459bd8889bce6f815086d59296e4fc507f0cd..f0082f03c3bbcde04c37b56918ec272553473356 100644 --- a/webapp/src/app/geosource/models/metadata.model.ts +++ b/webapp/src/app/geosource/models/metadata.model.ts @@ -32,7 +32,7 @@ interface IContact { export interface IMetadataUri { 'description': string; 'url': string; - 'protocol': Array<string>; + 'protocol': string[]; 'name': string; } diff --git a/webapp/src/app/geosource/models/suggestion.model.ts b/webapp/src/app/geosource/models/suggestion.model.ts index 674937daf420dba30726c18772352323ae0c3202..12893aacb63104fadb8ecac72ad4e928759da50a 100644 --- a/webapp/src/app/geosource/models/suggestion.model.ts +++ b/webapp/src/app/geosource/models/suggestion.model.ts @@ -3,7 +3,6 @@ export class SearchSuggestion { 'highlighted': string; 'score': number; - constructor(data?) { if (data) { Object.assign(this, data); diff --git a/webapp/src/app/geosource/services/dataset-detail.service.spec.ts b/webapp/src/app/geosource/services/dataset-detail.service.spec.ts index e6bbdd702aac1e0df349733c6a212a36e4e1ce7b..4b68799bff8339b69f62df555ac32057a44b229a 100644 --- a/webapp/src/app/geosource/services/dataset-detail.service.spec.ts +++ b/webapp/src/app/geosource/services/dataset-detail.service.spec.ts @@ -5,7 +5,7 @@ import { DatasetDetailService } from './dataset-detail.service'; describe('DatasetDetailService', () => { beforeEach(() => { TestBed.configureTestingModule({ - providers: [DatasetDetailService] + providers: [DatasetDetailService], }); }); diff --git a/webapp/src/app/geosource/services/dataset-detail.service.ts b/webapp/src/app/geosource/services/dataset-detail.service.ts index c5922619328f4ba98400a749367e7d961458e1d0..5fd248b926a9320d6a679ffa1d21e469f5f49984 100644 --- a/webapp/src/app/geosource/services/dataset-detail.service.ts +++ b/webapp/src/app/geosource/services/dataset-detail.service.ts @@ -16,21 +16,21 @@ export class DatasetDetailService { initializeDataset(index: string): Observable<Dataset> { this._dataset._index = index; - return this._elasticsearchService.getFullDataById(index).map(e => { + return this._elasticsearchService.getFullDataById(index).map((e) => { if (e.hits.hits.length > 0) { const metadata = new Metadata(e.hits.hits[0]._source['metadata-fr']); const coordinates = e.hits.hits[0]._source['metadata-fr']['bbox']['coordinates'][0]; metadata.dataset_index = e.hits.hits[0]._index; - metadata.max_west = Math.max.apply(Math, coordinates.map(point => { + metadata.max_west = Math.max.apply(Math, coordinates.map((point) => { return point[0]; })); - metadata.max_east = Math.min.apply(Math, coordinates.map(point => { + metadata.max_east = Math.min.apply(Math, coordinates.map((point) => { return point[0]; })); - metadata.max_north = Math.max.apply(Math, coordinates.map(point => { + metadata.max_north = Math.max.apply(Math, coordinates.map((point) => { return point[1]; })); - metadata.max_south = Math.min.apply(Math, coordinates.map(point => { + metadata.max_south = Math.min.apply(Math, coordinates.map((point) => { return point[1]; })); diff --git a/webapp/src/app/geosource/services/dataset-research.service.spec.ts b/webapp/src/app/geosource/services/dataset-research.service.spec.ts index c2be793cee7be5ea6728800cffed181e1cd4658b..b9e9930ea0c74dfd629e44ab197a7065ddd0de31 100644 --- a/webapp/src/app/geosource/services/dataset-research.service.spec.ts +++ b/webapp/src/app/geosource/services/dataset-research.service.spec.ts @@ -1,8 +1,3 @@ -import { TestBed, inject } from '@angular/core/testing'; -import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; -import { DatasetResearchService } from './dataset-research.service'; -import { IMetadata } from '../models'; - describe('DatasetResearchService', () => { }); diff --git a/webapp/src/app/geosource/services/dataset-research.service.ts b/webapp/src/app/geosource/services/dataset-research.service.ts index 47e563e2552ce3e9bebebb7940f45127766391cb..172840ea83d39a3267162c4f27069363b716ba17 100644 --- a/webapp/src/app/geosource/services/dataset-research.service.ts +++ b/webapp/src/app/geosource/services/dataset-research.service.ts @@ -1,17 +1,10 @@ -import { environment } from '../../../environments/environment'; - import { Injectable } from '@angular/core'; -import { HttpHeaders } from '@angular/common/http'; import { Observable } from 'rxjs/Observable'; import 'rxjs/add/operator/map'; import { Subject } from 'rxjs/Subject'; -import { - IElasticsearchOptions, IElasticsearchResponse, IMetadata, - Metadata, ISortOption, IFilter, ElasticsearchOptions, IElasticsearchHit, Dataset, Highlights, - Data -} from '../models'; +import { ISortOption, ElasticsearchOptions, IElasticsearchHit, Dataset, Highlights, Data } from '../models'; import { ElasticsearchService } from './elasticsearch.service'; @Injectable() @@ -24,7 +17,7 @@ export class DatasetResearchService { private _isLoading: Subject<boolean>; constructor( - private _elasticsearchService: ElasticsearchService + private _elasticsearchService: ElasticsearchService, ) { this._searchChangeSubject = new Subject<any>(); this._datasetsReloadedSubject = new Subject<any>(); @@ -38,7 +31,7 @@ export class DatasetResearchService { getDatasetList(): Observable<Dataset[]> { this._isLoading.next(true); return this._elasticsearchService.getFullDataList(this._elasticsearchOptions).map( - e => { + (e) => { // Set results count this._resultsCount = e.aggregations.resultsCount.value; @@ -46,7 +39,7 @@ export class DatasetResearchService { const aggregations = (e.hits.hits) ? e.aggregations : []; this._elasticsearchOptions.filters.forEach((filter) => { if (aggregations[filter.field]) { - aggregations[filter.field].buckets.forEach(element => { + aggregations[filter.field].buckets.forEach((element) => { element.count_per_metadata = element.count_per_metadata.value; }); filter.aggregations = aggregations[filter.field].buckets; @@ -60,10 +53,10 @@ export class DatasetResearchService { }); } - private initilizeDatasetList(hits: Array<IElasticsearchHit>): Array<Dataset> { - const datasets: Array<Dataset> = []; + private initilizeDatasetList(hits: IElasticsearchHit[]): Dataset[] { + const datasets: Dataset[] = []; - hits.forEach(hit => { + hits.forEach((hit) => { datasets.push(this.initilizeDataset(hit)); }); @@ -71,13 +64,13 @@ export class DatasetResearchService { } private initilizeDataset(hit: IElasticsearchHit): Dataset { - const dataset = new Dataset({ 'metadata': hit._source['metadata-fr'] }); + const dataset = new Dataset({ metadata: hit._source['metadata-fr'] }); dataset._index = hit._id; dataset.highlights = new Highlights(); dataset.metadata.total_documents = hit.inner_hits.data.hits.total; - hit.inner_hits.data.hits.hits.forEach(document => { + hit.inner_hits.data.hits.hits.forEach((document) => { const highlights = document.highlight; @@ -85,13 +78,16 @@ export class DatasetResearchService { if (highlights.hasOwnProperty(field)) { - // Split the field to separate origine of the field (metadata-fr/data-fr) and the field itself (abstract/title...) + // Split the field to separate origine of the field (metadata-fr/data-fr) + // and the field itself (abstract/title...) const arr = field.split('.'); const key = arr.pop(); // ex url, title, abstract.... const source = arr.shift(); // metadata-fr or data-fr - // Depending on the way fields have been indexed in ES, some will have to fields in highlight metadata-fr.abstract.keyword et metadata-fr.abstract.keyword - // The highlighting on the keyword is not interesting because the whole field is surrouded by the <em></em> and not just the searched word + // Depending on the way fields have been indexed in ES, some will have two fields + // in highlight metadata-fr.abstract.keyword et metadata-fr.abstract.keyword + // The highlighting on the keyword is not interesting because the whole field is surrouded by + // the <em></em> and not just the searched word // So only add the highlight to the array if the key is different of keyword if (key !== 'keyword') { // If the source of the key is in the metadata of the document @@ -101,16 +97,16 @@ export class DatasetResearchService { dataset.highlights.highlightedAbstract = highlights[field].join(); } else { // Only one value is added per key so we heck if the key is already present in the array - if (!dataset.highlights.metadata.find(function (obj) { return obj.label === key; })) { - dataset.highlights.metadata.push({ 'label': key, 'content': highlights[field].join(', ') }); + if (!dataset.highlights.metadata.find((obj) => { return obj.label === key; })) { + dataset.highlights.metadata.push({ label: key, content: highlights[field].join(', ') }); } } } // If the source of the key is in the data of the document if (source === 'data-fr') { // Only one value is added per key so we heck if the key is already present in the array - if (!dataset.highlights.data.find(function (obj) { return obj.label === key; })) { - dataset.highlights.data.push({ 'label': key, 'content': highlights[field].join(', ') }); + if (!dataset.highlights.data.find((obj) => { return obj.label === key; })) { + dataset.highlights.data.push({ label: key, content: highlights[field].join(', ') }); } } } @@ -122,9 +118,9 @@ export class DatasetResearchService { } getDataByMetadataById(id: number | string): Observable<Data[]> { - return this._elasticsearchService.getAllDataByMetadataId(id).map(e => { + return this._elasticsearchService.getAllDataByMetadataId(id).map((e) => { const dataList = []; - e.hits.hits.forEach(element => { + e.hits.hits.forEach((element) => { dataList.push(new Data(element._source['data-fr'])); }); return dataList; @@ -149,9 +145,12 @@ export class DatasetResearchService { removeFilter(field, value): any { this._elasticsearchOptions.filters.forEach((element) => { if (element.field === field) { - element.activeFilters.splice(element.activeFilters.findIndex((el) => { - return el.key === value.key; - }), 1); + element.activeFilters.splice( + element.activeFilters.findIndex((el) => { + return el.key === value.key; + }), + 1, + ); const elementIndex = element.aggregations.findIndex((el) => { return el.key === value.key; }); diff --git a/webapp/src/app/geosource/services/elasticsearch.service.spec.ts b/webapp/src/app/geosource/services/elasticsearch.service.spec.ts index 91575bfe5928b4ab350a2704b9bd17cb17a65321..f8bb14282a32b3127ef52b3c02ccc6dfe647e931 100644 --- a/webapp/src/app/geosource/services/elasticsearch.service.spec.ts +++ b/webapp/src/app/geosource/services/elasticsearch.service.spec.ts @@ -8,8 +8,8 @@ describe('ElasticsearchService', () => { TestBed.configureTestingModule({ providers: [ElasticsearchService], imports: [ - HttpClientModule - ] + HttpClientModule, + ], }); }); diff --git a/webapp/src/app/geosource/services/elasticsearch.service.ts b/webapp/src/app/geosource/services/elasticsearch.service.ts index 36acfbc50f0d42dfbfb6557706a848a698749c99..345cccaf023483511e1faa50d4dd389b6d2924a6 100644 --- a/webapp/src/app/geosource/services/elasticsearch.service.ts +++ b/webapp/src/app/geosource/services/elasticsearch.service.ts @@ -1,6 +1,7 @@ import { environment } from '../../../environments/environment'; import { Injectable } from '@angular/core'; -import { ElasticsearchOptions, IElasticsearchResponse, SearchSuggestion, SearchCompletion } from '../models'; +import { ElasticsearchOptions, IElasticsearchResponse, + SearchSuggestion, SearchCompletion } from '../models'; import { HttpClient } from '@angular/common/http'; import { Observable } from 'rxjs/Observable'; @@ -11,40 +12,39 @@ export class ElasticsearchService { private url: string; constructor( - private _http: HttpClient + private http: HttpClient, ) { this.url = environment.elasticsearchUrl.full + '/_search?pretty'; } getFullDataList(options: ElasticsearchOptions): Observable<IElasticsearchResponse> { - const request_options = this.constructElasticsearchRequest(options); + const requestOptions = this.constructElasticsearchRequest(options); - return this._http.request<IElasticsearchResponse>('POST', this.url, request_options); + return this.http.request<IElasticsearchResponse>('POST', this.url, requestOptions); } getFullDataById(id: number | string) { - return this._http.request<IElasticsearchResponse>('POST', this.url, { + return this.http.request<IElasticsearchResponse>('POST', this.url, { body: { - 'query': { - 'term': { - '_id': id - } - } - } + query: { + term: { + _id: id, + }, + }, + }, }); } - getAllDataByMetadataId(index: number | string) { - return this._http.request<IElasticsearchResponse>('POST', this.url, { + return this.http.request<IElasticsearchResponse>('POST', this.url, { body: { - 'query': { - 'term': { - '_index': index - } - } - } + query: { + term: { + _index: index, + }, + }, + }, }); } @@ -55,30 +55,30 @@ export class ElasticsearchService { */ getAutoComplete(text: string): Observable<SearchCompletion[]> { const options: SearchCompletion[] = []; - return this._http.request<IElasticsearchResponse>('POST', this.url, { + return this.http.request<IElasticsearchResponse>('POST', this.url, { body: { - '_source': false, - 'suggest': { - 'title': { - 'prefix': text, - 'completion': { - 'field': 'metadata-fr.title.suggest', - 'size': 3, - 'fuzzy': { - 'fuzziness': 2 + _source: false, + suggest: { + title: { + prefix: text, + completion: { + field: 'metadata-fr.title.suggest', + size: 3, + fuzzy: { + fuzziness: 2, }, - 'skip_duplicates': true - } - } - } - } - }).map(e => { + skip_duplicates: true, + }, + }, + }, + }, + }).map((e) => { if (e['suggest']['title']) { - e['suggest']['title'][0]['options'].forEach(option => { + e['suggest']['title'][0]['options'].forEach((option) => { options.push(new SearchCompletion(option)); }); } - return options; + return options; }); } @@ -87,28 +87,30 @@ export class ElasticsearchService { * The suggest is based on metadata-fr.title property */ getSuggestion(query: string): Observable<SearchSuggestion> { - return this._http.request<IElasticsearchResponse>('POST', this.url, { + return this.http.request<IElasticsearchResponse>('POST', this.url, { body: { - 'suggest': { - 'text': query, - 'suggestion': { - 'phrase': { - 'field': 'metadata-fr.title', - 'highlight': { - 'pre_tag': '<b><i>', - 'post_tag': '</i></b>' - } - } - } - } - } - }).map(res => { + suggest: { + text: query, + suggestion: { + phrase: { + field: 'metadata-fr.title', + highlight: { + pre_tag: '<b><i>', + post_tag: '</i></b>', + }, + }, + }, + }, + }, + }).map((res) => { const suggestions = res.suggest['suggestion'][0].options; - if ( suggestions && suggestions.length > 0) { - return new SearchSuggestion(suggestions[0]); + let suggestion: SearchSuggestion; + if (suggestions && suggestions.length > 0) { + suggestion = new SearchSuggestion(suggestions[0]); } else { - return new SearchSuggestion(); + suggestion = new SearchSuggestion(); } + return suggestion; }); } @@ -118,83 +120,84 @@ export class ElasticsearchService { const regex = (options.searchString !== '') ? escapedString + '*' : '*'; // Set query string options - const request_options = { + const requestOptions = { body: { - 'from': from, size: options.pageSize, - 'query': { - 'bool': { - } + from, + size: options.pageSize, + query: { + bool: { + }, }, - 'collapse': { - 'field': 'metadata-fr.identifier.keyword', - 'inner_hits': { - 'name': 'data', - 'size': 3, - 'highlight': { - 'pre_tags': ['<span class="highlighted">'], - 'post_tags': ['</span>'], - 'require_field_match': false, - 'type': 'fvh', - 'fragmenter': 'span', - 'order': 'score', - 'fields': { + collapse: { + field: 'metadata-fr.identifier.keyword', + inner_hits: { + name: 'data', + size: 3, + highlight: { + pre_tags: ['<span class="highlighted">'], + post_tags: ['</span>'], + require_field_match: false, + type: 'fvh', + fragmenter: 'span', + order: 'score', + fields: { '*': { - 'highlight_query': { - 'query_string': { 'query': regex, 'fuzziness': 0 } + highlight_query: { + query_string: { query: regex, fuzziness: 0 }, }, - 'fragment_size': 100, - 'number_of_fragments': 3 + fragment_size: 100, + number_of_fragments: 3, }, 'metadata-fr.abstract': { - 'highlight_query': { - 'query_string': { 'query': regex, 'fuzziness': 0 } + highlight_query: { + query_string: { query: regex, fuzziness: 0 }, }, - 'number_of_fragments': 0, - } - } - } - } + number_of_fragments: 0, + }, + }, + }, + }, }, - 'aggregations': { - 'resultsCount': { - 'cardinality': { - 'field': 'metadata-fr.identifier.keyword' - } - } - } - } + aggregations: { + resultsCount: { + cardinality: { + field: 'metadata-fr.identifier.keyword', + }, + }, + }, + }, }; // Adding sorting options switch (options.sortOptions.value) { case 'date': - request_options.body['sort'] = [ + requestOptions.body['sort'] = [ { - 'metadata-fr.date_publication': options.sortOptions.order - } + 'metadata-fr.date_publication': options.sortOptions.order, + }, ]; break; case 'alphabetical': - request_options.body['sort'] = [ + requestOptions.body['sort'] = [ { - 'metadata-fr.title.keyword': options.sortOptions.order - } + 'metadata-fr.title.keyword': options.sortOptions.order, + }, ]; break; case 'relevance': - request_options.body['sort'] = [ + requestOptions.body['sort'] = [ { - '_score': options.sortOptions.order - } + _score: options.sortOptions.order, + }, ]; break; default: break; } - const mustExpression: Array<Object> = []; + const mustExpression: Object[] = []; mustExpression.push({ - 'query_string': { 'query': 'my_catch_all_field:' + regex, 'fuzziness': 0 } + query_string: { query: 'my_catch_all_field:' + regex, fuzziness: 0 }, }); // Filters by category @@ -203,66 +206,67 @@ export class ElasticsearchService { const values = filter.activeFilters.map(e => e.key).join(' '); const field = 'metadata-fr.' + filter.field; - if (filter.type === 'date') { const date = new Date(Number(values)); mustExpression.push({ - 'range': { + range: { [field]: { - 'gte': date.getFullYear(), - 'lt': (date.getFullYear() + 1) - } - } + gte: date.getFullYear(), + lt: (date.getFullYear() + 1), + }, + }, }); } else { mustExpression.push({ - 'match': { + match: { [field]: { - 'query': values, - 'operator': 'and' - } - } + query: values, + operator: 'and', + }, + }, }); } } }); - request_options.body.query.bool['must'] = mustExpression; + requestOptions.body.query.bool['must'] = mustExpression; // Aggregations for the filter options options.filters.forEach((filter) => { let field = 'metadata-fr.' + filter.field; field = filter.type === 'string' ? field + '.keyword' : field; - const count_per_metadata = { - 'cardinality': { - 'field': 'metadata-fr.identifier.keyword' - } + const countPerMetadata = { + cardinality: { + field: 'metadata-fr.identifier.keyword', + }, }; if (filter.type === 'date') { - request_options.body['aggregations'][filter.field] = { - 'date_histogram': { - 'field': field, 'interval': 'year', 'min_doc_count': 1, - 'order': { '_count': 'desc' } + requestOptions.body['aggregations'][filter.field] = { + date_histogram: { + field, + interval: 'year', + min_doc_count: 1, + order: { + _count: 'desc', + }, + }, + aggs: { + count_per_metadata: countPerMetadata, }, - 'aggs': { - 'count_per_metadata': count_per_metadata - } }; } else { - request_options.body['aggregations'][filter.field] = { - 'terms': { - 'field': field, - 'order': { '_key': 'asc' } + requestOptions.body['aggregations'][filter.field] = { + terms: { + field, + order: { _key: 'asc' }, + }, + aggs: { + count_per_metadata: countPerMetadata, }, - 'aggs': { - 'count_per_metadata': count_per_metadata - } }; } - }); - return request_options; + return requestOptions; } - } diff --git a/webapp/src/app/geosource/services/index.ts b/webapp/src/app/geosource/services/index.ts index 80477eafc6c930addbb8280523b3a743005b1e9b..fcf8f0702359154305d55d59ba2bbc567b8c8e63 100644 --- a/webapp/src/app/geosource/services/index.ts +++ b/webapp/src/app/geosource/services/index.ts @@ -4,8 +4,9 @@ import { ElasticsearchService } from './elasticsearch.service'; export { DatasetResearchService, DatasetDetailService, ElasticsearchService }; +// tslint:disable-next-line:variable-name export const GeosourceServices = [ DatasetResearchService, DatasetDetailService, - ElasticsearchService + ElasticsearchService, ]; diff --git a/webapp/src/app/routes.ts b/webapp/src/app/routes.ts index 8030734ecade5ac097f60468f5a64030de9c807b..457f9d52b11062d57e56490ce29cf6a86c4b0265 100644 --- a/webapp/src/app/routes.ts +++ b/webapp/src/app/routes.ts @@ -1,13 +1,14 @@ +// tslint:disable-next-line:variable-name export const AppRoutes = { - 'home': 'accueil', - 'approach': 'demarche', - 'accessibility': 'accessibilite', - 'siteMap': 'plan-du-site', - 'legalNotices': 'mentions-legales', - 'articles': 'articles', - 'research': 'recherche', - 'datasets': 'datasets', - 'info': 'info', - 'map': 'carte', - 'export': 'export' + home: 'accueil', + approach: 'demarche', + accessibility: 'accessibilite', + siteMap: 'plan-du-site', + legalNotices: 'mentions-legales', + articles: 'articles', + research: 'recherche', + datasets: 'datasets', + info: 'info', + map: 'carte', + export: 'export', }; diff --git a/webapp/src/app/shared/components/index.ts b/webapp/src/app/shared/components/index.ts index aa653a31aabd2799868e27ad5537c2dfc079b775..c830fca3ea180e81b97718d390dfb204dbbf0d1a 100644 --- a/webapp/src/app/shared/components/index.ts +++ b/webapp/src/app/shared/components/index.ts @@ -2,6 +2,7 @@ import { PaginatorComponent } from './paginator/paginator.component'; export { PaginatorComponent }; +// tslint:disable-next-line:variable-name export const SharedComponents = [ - PaginatorComponent + PaginatorComponent, ]; diff --git a/webapp/src/app/shared/components/paginator/paginator.component.spec.ts b/webapp/src/app/shared/components/paginator/paginator.component.spec.ts index cabc63d031cba30eeb59b8c7a22a16563eea0ca0..b842808244f54cb38f5b1a699512cf14220547f1 100644 --- a/webapp/src/app/shared/components/paginator/paginator.component.spec.ts +++ b/webapp/src/app/shared/components/paginator/paginator.component.spec.ts @@ -8,7 +8,7 @@ describe('PaginatorComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ PaginatorComponent ] + declarations: [PaginatorComponent], }) .compileComponents(); })); diff --git a/webapp/src/app/shared/components/paginator/paginator.component.ts b/webapp/src/app/shared/components/paginator/paginator.component.ts index 5b9b6a1f5e7c67f4b4f772132cdc2b21f9b89cb0..8547f7680335aa2c6f55b2396ebf14c80f7f3256 100644 --- a/webapp/src/app/shared/components/paginator/paginator.component.ts +++ b/webapp/src/app/shared/components/paginator/paginator.component.ts @@ -3,7 +3,7 @@ import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; @Component({ selector: 'app-paginator', templateUrl: './paginator.component.html', - styleUrls: ['./paginator.component.scss'] + styleUrls: ['./paginator.component.scss'], }) export class PaginatorComponent implements OnInit { @@ -62,19 +62,23 @@ export class PaginatorComponent implements OnInit { pages.push(p); // Push the current page index let times = pagesToShow - 1; // Number of page to be added to the displayed page if (p !== 1) { - times--; // If current page is different from the first page remove one (first page automatically added to the array at the end of the function) + // If current page is different from the first page remove one (first page automatically + // added to the array at the end of the function) + times -= 1; } if (p !== totalP) { - times--; // If current page is different from the last page remove one (last page automatically added to the array at the end of the function) + // If current page is different from the last page remove one + // (last page automatically added to the array at the end of the function) + times -= 1; } - for (let i = 0; i < times; i++) { + for (let i = 0; i < times; i += 1) { let added = 0; // Count the number of page added in this loop // Take the min number in the array and add (n-1) to the array if n > 1 if (pages.length < pagesToShow) { if (Math.min.apply(null, pages) > 1) { if (Math.min.apply(null, pages) - 1 > 1) { pages.push(Math.min.apply(null, pages) - 1); - added++; + added += 1; } } } @@ -83,13 +87,13 @@ export class PaginatorComponent implements OnInit { if (Math.max.apply(null, pages) < totalP) { if (Math.max.apply(null, pages) + 1 < totalP) { pages.push(Math.max.apply(null, pages) + 1); - added++; + added += 1; } } } // If more than one page has been added then increase i by one more if (added === 2) { - i++; + i += 1; } } // Adding first page if not already in the array diff --git a/webapp/src/app/shared/pipes/index.ts b/webapp/src/app/shared/pipes/index.ts index eeecfd312c492cc9e6c547a94cbb7b1dadec7460..c92d7e4b3a585512db8b8c52bb0662b7ae520f13 100644 --- a/webapp/src/app/shared/pipes/index.ts +++ b/webapp/src/app/shared/pipes/index.ts @@ -2,6 +2,7 @@ import { EscapeHtmlPipe } from './keep-html.pipe'; export { EscapeHtmlPipe }; +// tslint:disable-next-line:variable-name export const SharedPipes = [ - EscapeHtmlPipe + EscapeHtmlPipe, ]; diff --git a/webapp/src/app/shared/shared.module.ts b/webapp/src/app/shared/shared.module.ts index 13cb8457bafbfa5fe3545e43c547983a941d9714..6db06c58a9143159dc22d6bc98646f912e264ca2 100644 --- a/webapp/src/app/shared/shared.module.ts +++ b/webapp/src/app/shared/shared.module.ts @@ -1,20 +1,19 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; -import { FormsModule } from '@angular/forms'; import { SharedComponents } from './components'; import { SharedPipes } from './pipes'; @NgModule({ imports: [ - CommonModule + CommonModule, ], declarations: [ SharedPipes, - SharedComponents + SharedComponents, ], exports: [ SharedPipes, - SharedComponents - ] + SharedComponents, + ], }) export class SharedModule { } diff --git a/webapp/src/environments/environment.prod.ts b/webapp/src/environments/environment.prod.ts index 11d9b4d3447a63f005af58c4832a9bdddaf1b333..6ddd1d474f0a7455980f7f614466f132f81e1a28 100644 --- a/webapp/src/environments/environment.prod.ts +++ b/webapp/src/environments/environment.prod.ts @@ -8,12 +8,12 @@ export const environment = { elasticsearchUrl: { full: '/elasticsearch/*.full', - meta: '/elasticsearch/*.meta' + meta: '/elasticsearch/*.meta', }, angularAppHost: { fr: '/fr', - en: '/en' + en: '/en', }, wordpressUrl: '/wordpress/wp-json/wp/v2/', @@ -22,12 +22,12 @@ export const environment = { approach: 'la-demarche', accessibility: 'accessibilite', siteMap: 'plan-du-site', - legalMentions: 'mentions-legales' + legalMentions: 'mentions-legales', }, wordpressContent: { categoryIdUniqueContent: 5, - slugPostVideo: 'video-dgl' - } + slugPostVideo: 'video-dgl', + }, }; diff --git a/webapp/src/environments/environment.ts b/webapp/src/environments/environment.ts index 45d82e1098bbd9e4a368d416ba00b326a28454d3..82506b151a39c125ce366801251cf703e58405cf 100644 --- a/webapp/src/environments/environment.ts +++ b/webapp/src/environments/environment.ts @@ -8,12 +8,12 @@ export const environment = { elasticsearchUrl: { full: 'http://localhost:8081/elasticsearch/*.full', - meta: 'http://localhost:8081/elasticsearch/*.meta' + meta: 'http://localhost:8081/elasticsearch/*.meta', }, angularAppHost: { fr: '/fr', - en: '/en' + en: '/en', }, wordpressUrl: 'http://192.168.62.15:8000/wp-json/wp/v2/', @@ -22,11 +22,11 @@ export const environment = { approach: 'la-demarche', accessibility: 'accessibilite', siteMap: 'plan-du-site', - legalMentions: 'mentions-legales' + legalMentions: 'mentions-legales', }, wordpressContent: { categoryIdUniqueContent: 5, - slugPostVideo: 'video-dgl' - } + slugPostVideo: 'video-dgl', + }, }; diff --git a/webapp/src/polyfills.ts b/webapp/src/polyfills.ts index af84770782bb064a7de007c9de8113bab08811cc..8fe6920d44fc075ab2c6fd7f5445b516bf51cb60 100644 --- a/webapp/src/polyfills.ts +++ b/webapp/src/polyfills.ts @@ -40,12 +40,10 @@ /** IE10 and IE11 requires the following for the Reflect API. */ // import 'core-js/es6/reflect'; - /** Evergreen browsers require these. **/ // Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove. import 'core-js/es7/reflect'; - /** * Required to support Web Animations `@angular/platform-browser/animations`. * Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation @@ -72,8 +70,6 @@ import 'core-js/es7/reflect'; */ import 'zone.js/dist/zone'; // Included with Angular CLI. - - /*************************************************************************************************** * APPLICATION IMPORTS */ diff --git a/webapp/src/test.ts b/webapp/src/test.ts index 16317897b1c50a3a71bc775a8d6429f2b4c6cf98..b6d614daa243e0869709092a8276dc9d81e7c085 100644 --- a/webapp/src/test.ts +++ b/webapp/src/test.ts @@ -4,7 +4,7 @@ import 'zone.js/dist/zone-testing'; import { getTestBed } from '@angular/core/testing'; import { BrowserDynamicTestingModule, - platformBrowserDynamicTesting + platformBrowserDynamicTesting, } from '@angular/platform-browser-dynamic/testing'; declare const require: any; @@ -12,7 +12,7 @@ declare const require: any; // First, initialize the Angular testing environment. getTestBed().initTestEnvironment( BrowserDynamicTestingModule, - platformBrowserDynamicTesting() + platformBrowserDynamicTesting(), ); // Then we find all the tests. const context = require.context('./', true, /\.spec\.ts$/); diff --git a/webapp/tslint.json b/webapp/tslint.json index 3dc3ff9ef2067ce2c93dff7964b091c237001f68..05dbcd6b3a39673b991909c27ea4bb203e6c48dc 100644 --- a/webapp/tslint.json +++ b/webapp/tslint.json @@ -1,143 +1,10 @@ { - "rulesDirectory": [ - "node_modules/codelyzer" + "extends": [ + "tslint-config-airbnb" ], "rules": { - "arrow-return-shorthand": true, - "callable-types": true, - "class-name": true, - "comment-format": [ - true, - "check-space" - ], - "curly": true, - "deprecation": { - "severity": "warn" - }, - "eofline": true, - "forin": true, - "import-blacklist": [ - true, - "rxjs", - "rxjs/Rx" - ], - "import-spacing": true, - "indent": [ - true, - "spaces" - ], - "interface-over-type-literal": true, - "label-position": true, - "max-line-length": [ - false, - 140 - ], - "member-access": false, - "member-ordering": [ - true, - { - "order": [ - "static-field", - "instance-field", - "static-method", - "instance-method" - ] - } - ], - "no-arg": true, - "no-bitwise": true, - "no-console": [ - true, - "debug", - "info", - "time", - "timeEnd", - "trace" - ], - "no-construct": true, - "no-debugger": true, - "no-duplicate-super": true, - "no-empty": false, - "no-empty-interface": true, - "no-eval": true, - "no-inferrable-types": [ - true, - "ignore-params" - ], - "no-misused-new": true, - "no-non-null-assertion": true, - "no-shadowed-variable": true, - "no-string-literal": false, - "no-string-throw": true, - "no-switch-case-fall-through": true, - "no-trailing-whitespace": true, - "no-unnecessary-initializer": true, - "no-unused-expression": true, - "no-use-before-declare": true, - "no-var-keyword": true, - "object-literal-sort-keys": false, - "one-line": [ - true, - "check-open-brace", - "check-catch", - "check-else", - "check-whitespace" - ], - "prefer-const": true, - "quotemark": [ - true, - "single" - ], - "radix": true, - "semicolon": [ - true, - "always" - ], - "triple-equals": [ - true, - "allow-null-check" - ], - "typedef-whitespace": [ - true, - { - "call-signature": "nospace", - "index-signature": "nospace", - "parameter": "nospace", - "property-declaration": "nospace", - "variable-declaration": "nospace" - } - ], - "unified-signatures": true, - "variable-name": false, - "whitespace": [ - true, - "check-branch", - "check-decl", - "check-operator", - "check-separator", - "check-type" - ], - "directive-selector": [ - true, - "attribute", - "app", - "camelCase" - ], - "component-selector": [ - true, - "element", - "app", - "kebab-case" - ], - "no-output-on-prefix": true, - "use-input-property-decorator": true, - "use-output-property-decorator": true, - "use-host-property-decorator": true, - "no-input-rename": true, - "no-output-rename": true, - "use-life-cycle-interface": true, - "use-pipe-transform-interface": true, - "component-class-suffix": true, - "directive-class-suffix": true + "variable-name": [true, "ban-keywords", "check-format", "allow-leading-underscore"], + "strict-boolean-expressions": [false], + "max-line-length": [true, 120] } -} +} \ No newline at end of file