Skip to content

Commit

Permalink
Migrate to NG 6 RC5
Browse files Browse the repository at this point in the history
Simplify store
  • Loading branch information
fisenkodv committed Apr 27, 2018
1 parent 5119c93 commit 6bececb
Show file tree
Hide file tree
Showing 9 changed files with 201 additions and 164 deletions.
62 changes: 0 additions & 62 deletions .angular-cli.json

This file was deleted.

149 changes: 149 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"itinerary": {
"root": "",
"projectType": "application",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist",
"index": "src/index.html",
"main": "src/main.ts",
"tsConfig": "src/tsconfig.app.json",
"polyfills": "src/polyfills.ts",
"assets": [
{
"glob": "**/*",
"input": "src/assets",
"output": "/assets"
},
{
"glob": "favicon.ico",
"input": "src",
"output": "/"
}
],
"styles": [
"src/styles.scss"
],
"scripts": []
},
"configurations": {
"production": {
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"serviceWorker": true,
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "itinerary:build"
},
"configurations": {
"production": {
"browserTarget": "itinerary:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "itinerary:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.karma.ts",
"karmaConfig": "./karma.conf.js",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"scripts": [],
"styles": [
"src/styles.scss"
],
"assets": [
{
"glob": "**/*",
"input": "src/assets",
"output": "/assets"
},
{
"glob": "favicon.ico",
"input": "src",
"output": "/"
}
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"itinerary-e2e": {
"root": "",
"projectType": "application",
"cli": {},
"schematics": {},
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "./protractor.conf.js",
"devServerTarget": "itinerary:serve"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"e2e/tsconfig.e2e.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"cli": {},
"schematics": {
"@schematics/angular:component": {
"prefix": "app",
"styleext": "scss"
},
"@schematics/angular:directive": {
"prefix": "app"
}
}
}
6 changes: 3 additions & 3 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular/cli'],
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular/cli/plugins/karma')
require('@angular-devkit/build-angular/plugins/karma')
],
client:{
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
reports: [ 'html', 'lcovonly' ],
dir: require('path').join(__dirname, 'coverage'), reports: [ 'html', 'lcovonly' ],
fixWebpackSourcePaths: true
},
angularCli: {
Expand Down
34 changes: 18 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@
},
"dependencies": {
"@agm/core": "^1.0.0-beta.2",
"@angular/animations": "^5.2.9",
"@angular/animations": "6.0.0-rc.5",
"@angular/cdk": "^5.2.4",
"@angular/common": "^5.2.9",
"@angular/compiler": "^5.2.9",
"@angular/core": "^5.2.9",
"@angular/forms": "^5.2.9",
"@angular/http": "^5.2.9",
"@angular/common": ">=6.0.0-rc.5 <=6.0.0-rc.5",
"@angular/compiler": ">=6.0.0-rc.5 <=6.0.0-rc.5",
"@angular/core": ">=6.0.0-rc.5 <=6.0.0-rc.5",
"@angular/forms": "6.0.0-rc.5",
"@angular/http": "6.0.0-rc.5",
"@angular/material": "^5.2.4",
"@angular/platform-browser": "^5.2.9",
"@angular/platform-browser-dynamic": "^5.2.9",
"@angular/router": "^5.2.9",
"@angular/service-worker": "^5.2.10",
"@angular/platform-browser": ">=6.0.0-rc.5 <=6.0.0-rc.5",
"@angular/platform-browser-dynamic": "6.0.0-rc.5",
"@angular/router": "6.0.0-rc.5",
"@angular/service-worker": "6.0.0-rc.5",
"@ngx-translate/core": "^9.1.1",
"@ngx-translate/http-loader": "^2.0.1",
"@ngxs/devtools-plugin": "3.0.0-rc.1",
Expand All @@ -47,13 +47,14 @@
"git-describe": "^4.0.2",
"hammerjs": "^2.0.8",
"lodash": "^4.17.5",
"rxjs": "^5.5.7",
"zone.js": "^0.8.20"
"rxjs": "^6.0.0",
"rxjs-compat": "^6.0.0",
"zone.js": "^0.8.26"
},
"devDependencies": {
"@angular/cli": "~1.7.3",
"@angular/compiler-cli": "^5.2.9",
"@angular/language-service": "^5.2.9",
"@angular/cli": "6.0.0-rc.6",
"@angular/compiler-cli": "6.0.0-rc.5",
"@angular/language-service": "6.0.0-rc.5",
"@types/jasmine": "~2.8.6",
"@types/jasminewd2": "~2.0.3",
"@types/jest": "^22.2.0",
Expand All @@ -73,6 +74,7 @@
"protractor": "~5.3.0",
"ts-node": "~4.1.0",
"tslint": "~5.9.1",
"typescript": "~2.7.2"
"typescript": "2.7.2",
"@angular-devkit/build-angular": "~0.5.0"
}
}
46 changes: 16 additions & 30 deletions src/app/modules/places/services/itinerary-places.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ import { GeoLocation, GeoLocationMeasurement } from '@app/modules/places/service
import { AngularFirestore, DocumentChangeAction, QueryFn } from 'angularfire2/firestore';
import * as firebase from 'firebase/app';
import * as _ from 'lodash';
import { Observable } from 'rxjs';
import { UnaryFunction } from 'rxjs/interfaces';
import { Observable } from 'rxjs/Observable';
import { map, switchMap } from 'rxjs/operators';
import { Subject } from 'rxjs/Subject';
import { map } from 'rxjs/operators';

export interface Filter {
distance: number;
Expand All @@ -28,35 +27,22 @@ interface FirestorePlace {

@Injectable()
export class ItineraryPlacesService {
private filter$: Subject<Filter>;
private places$: Subject<Place[]>;

constructor(private db: AngularFirestore) {
this.filter$ = new Subject<Filter>();
this.places$ = new Subject<Place[]>();
this.filter$
.pipe(
switchMap((filter: Filter) => {
const [northWestLocation, southEastLocation, baseLocation] = this.getLocationInfo(
filter.location.latitude,
filter.location.longitude,
filter.distance
);
return this.db
.collection<FirestorePlace>('places', this.getQuery(southEastLocation, northWestLocation))
.snapshotChanges()
.pipe(
this.mapToPlaces(baseLocation),
this.filterPlaces(baseLocation, filter.distance, filter.rating, filter.reviews)
);
})
)
.subscribe(res => this.places$.next(res));
}
constructor(private db: AngularFirestore) {}

public getPlaces(filter: Filter): Observable<Place[]> {
this.filter$.next(filter);
return this.places$;
const [northWestLocation, southEastLocation, baseLocation] = this.getLocationInfo(
filter.location.latitude,
filter.location.longitude,
filter.distance
);

return this.db
.collection<FirestorePlace>('places', this.getQuery(southEastLocation, northWestLocation))
.snapshotChanges()
.pipe(
this.mapToPlaces(baseLocation),
this.filterPlaces(baseLocation, filter.distance, filter.rating, filter.reviews)
);
}

public getPlaceDetails(placeId: string): Observable<Place> {
Expand Down
10 changes: 0 additions & 10 deletions src/app/modules/places/state/places.actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ export class GetPlaces {
constructor() {}
}

export class GetPlacesSuccess {
static readonly type = '[places] get places success';
constructor(public payload: Place[]) {}
}

export class ChangeViewMode {
static readonly type = '[places] change view mode';
constructor(public payload: ViewMode) {}
Expand All @@ -20,8 +15,3 @@ export class GetPlaceDetails {
static readonly type = '[places] get place details';
constructor(public payload: string) {}
}

export class GetPlaceDetailsSuccess {
static readonly type = '[places] get place details success';
constructor(public payload: Place) {}
}
Loading

0 comments on commit 6bececb

Please sign in to comment.