Compare commits
8 Commits
FarmMapsLi
...
16db063339
Author | SHA1 | Date | |
---|---|---|---|
|
16db063339 | ||
|
5d79dcc7b6 | ||
|
deda769e8b | ||
|
f31e4154b2 | ||
|
7476e4c928 | ||
|
d5258b7c79 | ||
|
04929a1ca3 | ||
|
67e0e5ed5d |
23504
package-lock.json
generated
23504
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
126
package.json
126
package.json
@@ -1,63 +1,63 @@
|
|||||||
{
|
{
|
||||||
"name": "farmmaps-lib-app",
|
"name": "farmmaps-lib-app",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"ng": "ng",
|
"ng": "ng",
|
||||||
"start": "ng serve",
|
"start": "ng serve",
|
||||||
"build": "ng build",
|
"build": "ng build",
|
||||||
"test": "ng test",
|
"test": "ng test",
|
||||||
"lint": "ng lint",
|
"lint": "ng lint",
|
||||||
"e2e": "ng e2e"
|
"e2e": "ng e2e"
|
||||||
},
|
},
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@angular/animations": "~7.2.0",
|
"@angular/animations": "~7.2.0",
|
||||||
"@angular/common": "~7.2.0",
|
"@angular/common": "~7.2.0",
|
||||||
"@angular/compiler": "~7.2.0",
|
"@angular/compiler": "~7.2.0",
|
||||||
"@angular/core": "~7.2.0",
|
"@angular/core": "~7.2.0",
|
||||||
"@angular/forms": "~7.2.0",
|
"@angular/forms": "~7.2.0",
|
||||||
"@angular/platform-browser": "~7.2.0",
|
"@angular/platform-browser": "~7.2.0",
|
||||||
"@angular/platform-browser-dynamic": "~7.2.0",
|
"@angular/platform-browser-dynamic": "~7.2.0",
|
||||||
"@angular/router": "~7.2.0",
|
"@angular/router": "~7.2.0",
|
||||||
"@aspnet/signalr": "^1.1.4",
|
"@aspnet/signalr": "^1.1.4",
|
||||||
"@farmmaps/common": ">=0.0.1-prerelease.69 <0.0.1",
|
"@farmmaps/common": ">=0.0.1-prerelease.77 <0.0.1",
|
||||||
"@farmmaps/common-map": ">=0.0.1-prerelease.69 <0.0.1",
|
"@farmmaps/common-map": ">=0.0.1-prerelease.77 <0.0.1",
|
||||||
"@ng-bootstrap/ng-bootstrap": "^4.2.1",
|
"@ng-bootstrap/ng-bootstrap": "^4.2.1",
|
||||||
"@ngrx/effects": "^7.2.0",
|
"@ngrx/effects": "^7.2.0",
|
||||||
"@ngrx/router-store": "^7.2.0",
|
"@ngrx/router-store": "^7.2.0",
|
||||||
"@ngrx/store": "^7.2.0",
|
"@ngrx/store": "^7.2.0",
|
||||||
"bootstrap": "^4.3.1",
|
"bootstrap": "^4.3.1",
|
||||||
"font-awesome": "^4.7.0",
|
"font-awesome": "^4.7.0",
|
||||||
"core-js": "^2.5.4",
|
"core-js": "^2.5.4",
|
||||||
"ngrx-store-localstorage": "^8.0.0",
|
"ngrx-store-localstorage": "^8.0.0",
|
||||||
"resumablejs": "^1.1.0",
|
"resumablejs": "^1.1.0",
|
||||||
"rxjs": "~6.3.3",
|
"rxjs": "~6.3.3",
|
||||||
"tassign": "^1.0.0",
|
"tassign": "^1.0.0",
|
||||||
"zone.js": "~0.8.26"
|
"zone.js": "~0.8.26"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@angular-devkit/build-angular": "~0.13.0",
|
"@angular-devkit/build-angular": "~0.13.0",
|
||||||
"@angular-devkit/build-ng-packagr": "~0.13.0",
|
"@angular-devkit/build-ng-packagr": "~0.13.0",
|
||||||
"@angular/cli": "~7.3.8",
|
"@angular/cli": "~7.3.8",
|
||||||
"@angular/compiler-cli": "~7.2.0",
|
"@angular/compiler-cli": "~7.2.0",
|
||||||
"@angular/language-service": "~7.2.0",
|
"@angular/language-service": "~7.2.0",
|
||||||
"@types/node": "~8.9.4",
|
"@types/node": "~8.9.4",
|
||||||
"@types/jasmine": "~2.8.8",
|
"@types/jasmine": "~2.8.8",
|
||||||
"@types/jasminewd2": "~2.0.3",
|
"@types/jasminewd2": "~2.0.3",
|
||||||
"codelyzer": "~4.5.0",
|
"codelyzer": "~4.5.0",
|
||||||
"jasmine-core": "~2.99.1",
|
"jasmine-core": "~2.99.1",
|
||||||
"jasmine-spec-reporter": "~4.2.1",
|
"jasmine-spec-reporter": "~4.2.1",
|
||||||
"karma": "~4.0.0",
|
"karma": "~4.0.0",
|
||||||
"karma-chrome-launcher": "~2.2.0",
|
"karma-chrome-launcher": "~2.2.0",
|
||||||
"karma-coverage-istanbul-reporter": "~2.0.1",
|
"karma-coverage-istanbul-reporter": "~2.0.1",
|
||||||
"karma-jasmine": "~1.1.2",
|
"karma-jasmine": "~1.1.2",
|
||||||
"karma-jasmine-html-reporter": "^0.2.2",
|
"karma-jasmine-html-reporter": "^0.2.2",
|
||||||
"ng-packagr": "^4.2.0",
|
"ng-packagr": "^4.2.0",
|
||||||
"protractor": "~5.4.0",
|
"protractor": "~5.4.0",
|
||||||
"ts-node": "~7.0.0",
|
"ts-node": "~7.0.0",
|
||||||
"tsickle": ">=0.34.0",
|
"tsickle": ">=0.34.0",
|
||||||
"tslib": "^1.9.0",
|
"tslib": "^1.9.0",
|
||||||
"tslint": "~5.11.0",
|
"tslint": "~5.11.0",
|
||||||
"typescript": "~3.2.2"
|
"typescript": "~3.2.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,8 @@
|
|||||||
import { Action } from '@ngrx/store';
|
import { Action } from '@ngrx/store';
|
||||||
|
|
||||||
import { IMapState,IItemLayer,IQueryState } from '../models';
|
import { IMapState } from '../models/map.state';
|
||||||
|
import { IItemLayer } from '../models/item.layer';
|
||||||
|
import { IQueryState } from '../models/query.state';
|
||||||
import { IItem } from '@farmmaps/common';
|
import { IItem } from '@farmmaps/common';
|
||||||
import { Feature } from 'ol';
|
import { Feature } from 'ol';
|
||||||
import { Extent } from 'ol/extent';
|
import { Extent } from 'ol/extent';
|
||||||
|
@@ -16,12 +16,12 @@ import * as mapReducers from './reducers/map.reducer';
|
|||||||
import * as mapActions from './actions/map.actions';
|
import * as mapActions from './actions/map.actions';
|
||||||
import * as mapEffects from './effects/map.effects';
|
import * as mapEffects from './effects/map.effects';
|
||||||
|
|
||||||
import { IMapState} from './models';
|
import { IMapState} from './models/map.state';
|
||||||
import { ISelectedFeatures } from './models';
|
import { ISelectedFeatures } from './models/selected.features';
|
||||||
import { IItemLayer } from './models';
|
import { IItemLayer } from './models/item.layer';
|
||||||
import { ItemLayer} from './models';
|
import { ItemLayer} from './models/item.layer';
|
||||||
import { IQueryState } from './models';
|
import { IQueryState } from './models/query.state';
|
||||||
import { IPeriodState } from './models';
|
import { IPeriodState } from './models/period.state';
|
||||||
|
|
||||||
// components
|
// components
|
||||||
import { GpsLocation} from './components/aol/gps-location/gps-location.component';
|
import { GpsLocation} from './components/aol/gps-location/gps-location.component';
|
||||||
@@ -54,7 +54,7 @@ import { LayerListComponent } from './components/aol/layer-list/layer-list.compo
|
|||||||
import { MetaDataModalComponent } from './components/meta-data-modal/meta-data-modal.component';
|
import { MetaDataModalComponent } from './components/meta-data-modal/meta-data-modal.component';
|
||||||
import { SelectPeriodModalComponent } from './components/select-period-modal/select-period-modal.component';
|
import { SelectPeriodModalComponent } from './components/select-period-modal/select-period-modal.component';
|
||||||
import { MapComponent } from './components/map/map.component';
|
import { MapComponent } from './components/map/map.component';
|
||||||
import { MapSearchComponent } from './components/map-search';
|
import { MapSearchComponent } from './components/map-search/map-search.component';
|
||||||
import { MapRoutingModule } from './common-map-routing.module';
|
import { MapRoutingModule } from './common-map-routing.module';
|
||||||
import { LegendComponent } from './components/legend/legend.component';
|
import { LegendComponent } from './components/legend/legend.component';
|
||||||
import { LayerVectorImageComponent } from './components/aol/layer-vector-image/layer-vector-image.component';
|
import { LayerVectorImageComponent } from './components/aol/layer-vector-image/layer-vector-image.component';
|
||||||
|
@@ -4,7 +4,7 @@ import { LayerVectorComponent, SourceVectorComponent, MapComponent, LayerImageCo
|
|||||||
import { LayerVectorImageComponent } from '../layer-vector-image/layer-vector-image.component';
|
import { LayerVectorImageComponent } from '../layer-vector-image/layer-vector-image.component';
|
||||||
import { ItemService } from '@farmmaps/common';
|
import { ItemService } from '@farmmaps/common';
|
||||||
import { IItem } from '@farmmaps/common';
|
import { IItem } from '@farmmaps/common';
|
||||||
import { ISelectedFeatures } from '../../../models';
|
import { ISelectedFeatures } from '../../../models/selected.features';
|
||||||
|
|
||||||
import {Vector} from 'ol/source';
|
import {Vector} from 'ol/source';
|
||||||
import {Feature,Collection} from 'ol';
|
import {Feature,Collection} from 'ol';
|
||||||
|
@@ -3,8 +3,9 @@ import { HttpClient } from "@angular/common/http";
|
|||||||
import { LayerVectorComponent, LayerTileComponent, LayerGroupComponent, MapComponent } from 'ngx-openlayers';
|
import { LayerVectorComponent, LayerTileComponent, LayerGroupComponent, MapComponent } from 'ngx-openlayers';
|
||||||
import { ItemService } from '@farmmaps/common';
|
import { ItemService } from '@farmmaps/common';
|
||||||
import { AppConfig } from '@farmmaps/common';
|
import { AppConfig } from '@farmmaps/common';
|
||||||
import { IItemLayer, ILayerData, IRenderoutputTiles, IRenderoutputImage, IGradientstop, ILayer, IHistogram } from '../../../models';
|
import { IItemLayer} from '../../../models/item.layer';
|
||||||
|
import { ILayerData} from '../../../models/layer.data';
|
||||||
|
import { IRenderoutputTiles,IRenderoutputImage,IGradientstop,ILayer,IHistogram} from '../../../models/color.map';
|
||||||
import {Extent} from 'ol/extent';
|
import {Extent} from 'ol/extent';
|
||||||
import Projection from 'ol/proj/Projection';
|
import Projection from 'ol/proj/Projection';
|
||||||
import * as proj from 'ol/proj';
|
import * as proj from 'ol/proj';
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { Component,Input,Output,EventEmitter } from '@angular/core';
|
import { Component,Input,Output,EventEmitter } from '@angular/core';
|
||||||
import { IItemLayer } from '../../../models';
|
import { IItemLayer } from '../../../models/item.layer';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'fm-map-layer-list',
|
selector: 'fm-map-layer-list',
|
||||||
|
@@ -8,7 +8,7 @@ import * as mapActions from '../../actions/map.actions';
|
|||||||
import { Observable, from } from 'rxjs';
|
import { Observable, from } from 'rxjs';
|
||||||
import { withLatestFrom } from 'rxjs/operators';
|
import { withLatestFrom } from 'rxjs/operators';
|
||||||
import { tassign } from 'tassign';
|
import { tassign } from 'tassign';
|
||||||
import { IQueryState } from '../../models';
|
import { IQueryState } from '../../models/query.state';
|
||||||
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
|
@@ -1,14 +1,10 @@
|
|||||||
import { Component, Input, Injectable } from '@angular/core';
|
import { Component, Input, Injectable } from '@angular/core';
|
||||||
import { Location } from '@angular/common';
|
import { Location } from '@angular/common';
|
||||||
import { Feature } from 'ol';
|
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import * as mapReducers from '../../reducers/map.reducer';
|
import * as mapReducers from '../../reducers/map.reducer';
|
||||||
import { commonReducers,ItemTypeService, IItem, Item,IListItem } from '@farmmaps/common';
|
import { commonReducers,ItemTypeService,IListItem } from '@farmmaps/common';
|
||||||
import * as mapActions from '../../actions/map.actions';
|
import * as mapActions from '../../actions/map.actions';
|
||||||
import { Observable, from } from 'rxjs';
|
|
||||||
import { withLatestFrom } from 'rxjs/operators';
|
|
||||||
import { tassign } from 'tassign';
|
import { tassign } from 'tassign';
|
||||||
import { IQueryState } from '../../models';
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr *ngFor="let entry of layer.renderer.colorMap.entries; let i = index ">
|
<tr *ngFor="let entry of layer.renderer.colorMap.entries; let i = index ">
|
||||||
<td class="legend-items"><div [style.background-color]="getHex(entry.color)"></div></td>
|
<td class="legend-items"><div [style.background-color]="getHex(entry.color)"></div></td>
|
||||||
<td class="legend-items-text">{{entry.value | number:'1.0-2'}} {{legendunit}}</td>
|
<td class="legend-items-text"><span *ngIf="!entry.label">{{entry.value | number:'1.0-2'}} {{legendunit}}</span><span *ngIf="entry.label">{{entry.label}}</span></td>
|
||||||
<!--<td class="histogram-items-text"><span *ngIf="histogramenabled">{{entry.value}} {{histogramunit}}</span></td>
|
<!--<td class="histogram-items-text"><span *ngIf="histogramenabled">{{entry.value}} {{histogramunit}}</span></td>
|
||||||
<td class="histogram-items">
|
<td class="histogram-items">
|
||||||
<div *ngIf="histogramenabled" [style.background-color]="getHex(selectedColorMap.noValue)" [style.width]="getPart(selectedColorMap, entry)">
|
<div *ngIf="histogramenabled" [style.background-color]="getHex(selectedColorMap.noValue)" [style.width]="getPart(selectedColorMap, entry)">
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { Component, OnInit, Input,AfterViewInit } from '@angular/core';
|
import { Component, OnInit, Input,AfterViewInit } from '@angular/core';
|
||||||
import { IColorMap, IColor, IColorEntry,ILayer } from '../../models';
|
import { IColorMap, IColor, IColorEntry,ILayer } from '../../models/color.map';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@@ -1 +0,0 @@
|
|||||||
export * from './map-search.component';
|
|
@@ -2,7 +2,8 @@ import { Component, Input, Output, OnInit, EventEmitter, SimpleChanges, OnChange
|
|||||||
import { Observable , of } from 'rxjs';
|
import { Observable , of } from 'rxjs';
|
||||||
import { debounceTime,distinctUntilChanged,tap,switchMap,merge,catchError} from 'rxjs/operators';
|
import { debounceTime,distinctUntilChanged,tap,switchMap,merge,catchError} from 'rxjs/operators';
|
||||||
import { TypeaheadService, TimespanService } from '@farmmaps/common';
|
import { TypeaheadService, TimespanService } from '@farmmaps/common';
|
||||||
import { IQueryState,IPeriodState } from '../../models';
|
import { IQueryState } from '../../models/query.state';
|
||||||
|
import { IPeriodState } from '../../models/period.state';
|
||||||
import { fillProperties } from '@angular/core/src/util/property';
|
import { fillProperties } from '@angular/core/src/util/property';
|
||||||
import { tassign } from 'tassign';
|
import { tassign } from 'tassign';
|
||||||
|
|
||||||
|
@@ -9,7 +9,11 @@ import { Store } from '@ngrx/store';
|
|||||||
// Map
|
// Map
|
||||||
import * as mapReducers from '../../reducers/map.reducer';
|
import * as mapReducers from '../../reducers/map.reducer';
|
||||||
import * as mapActions from '../../actions/map.actions';
|
import * as mapActions from '../../actions/map.actions';
|
||||||
import { IMapState,ISelectedFeatures,IItemLayer, ItemLayer,IQueryState,IPeriodState } from '../../models';
|
import { IMapState} from '../../models/map.state';
|
||||||
|
import { ISelectedFeatures } from '../../models/selected.features';
|
||||||
|
import { IItemLayer } from '../../models/item.layer';
|
||||||
|
import { IQueryState } from '../../models/query.state';
|
||||||
|
import { IPeriodState } from '../../models/period.state';
|
||||||
import { IDroppedFile } from '../aol/file-drop-target/file-drop-target.component';
|
import { IDroppedFile } from '../aol/file-drop-target/file-drop-target.component';
|
||||||
import { IMetaData } from '../meta-data-modal/meta-data-modal.component';
|
import { IMetaData } from '../meta-data-modal/meta-data-modal.component';
|
||||||
import { StateSerializerService } from '../../services/state-serializer.service';
|
import { StateSerializerService } from '../../services/state-serializer.service';
|
||||||
|
@@ -1,7 +0,0 @@
|
|||||||
export * from './map.state';
|
|
||||||
export * from './selected.features';
|
|
||||||
export * from './item.layer'
|
|
||||||
export * from './layer.data'
|
|
||||||
export * from './color.map';
|
|
||||||
export * from './query.state';
|
|
||||||
export * from './period.state';
|
|
@@ -1,6 +1,9 @@
|
|||||||
import { tassign } from 'tassign';
|
import { tassign } from 'tassign';
|
||||||
import { IItem,Item } from '@farmmaps/common';
|
import { IItem,Item } from '@farmmaps/common';
|
||||||
import { IItemLayer,ItemLayer, IMapState,IQueryState,IPeriodState} from '../models'
|
import { IItemLayer,ItemLayer} from '../models/item.layer';
|
||||||
|
import { IMapState} from '../models/map.state';
|
||||||
|
import { IQueryState} from '../models/query.state';
|
||||||
|
import { IPeriodState} from '../models/period.state';
|
||||||
import * as mapActions from '../actions/map.actions';
|
import * as mapActions from '../actions/map.actions';
|
||||||
import {commonActions} from '@farmmaps/common';
|
import {commonActions} from '@farmmaps/common';
|
||||||
import { createSelector, createFeatureSelector } from '@ngrx/store';
|
import { createSelector, createFeatureSelector } from '@ngrx/store';
|
||||||
|
105
projects/common/src/fm/common-service.module.ts
Normal file
105
projects/common/src/fm/common-service.module.ts
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
// angular modules
|
||||||
|
import { NgModule, APP_INITIALIZER, ModuleWithProviders, Injector,Optional,SkipSelf } from '@angular/core';
|
||||||
|
import { CommonModule, DatePipe } from '@angular/common';
|
||||||
|
import { HttpClientModule, HttpClient, HTTP_INTERCEPTORS } from '@angular/common/http';
|
||||||
|
import { FormsModule } from '@angular/forms';
|
||||||
|
|
||||||
|
// external modules
|
||||||
|
import { OAuthModule,AuthConfig, OAuthService, OAuthStorage } from 'angular-oauth2-oidc';
|
||||||
|
|
||||||
|
|
||||||
|
// routing module
|
||||||
|
import { AppCommonRoutingModule } from './common-routing.module';
|
||||||
|
|
||||||
|
import { MODULE_NAME } from './module-name';
|
||||||
|
|
||||||
|
//components
|
||||||
|
import { ItemTypeService } from './services/itemtype.service';
|
||||||
|
import { FolderService } from './services/folder.service';
|
||||||
|
import { TimespanService} from './services/timespan.service';
|
||||||
|
import { ItemService} from './services/item.service';
|
||||||
|
import { EventService } from './services/event.service';
|
||||||
|
import { TypeaheadService } from './services/typeahead.service';
|
||||||
|
import { UserService } from './services/user.service';
|
||||||
|
import { AppConfig } from './shared/app.config';
|
||||||
|
import { AccessTokenInterceptor } from "./shared/accesstoken.interceptor";
|
||||||
|
import { appConfigFactory } from "./shared/app.config.factory";
|
||||||
|
import { AuthGuard } from './services/auth-guard.service';
|
||||||
|
import { NavBarGuard } from './services/nav-bar-guard.service';
|
||||||
|
import { FullScreenGuard } from './services/full-screen-guard.service';
|
||||||
|
import { SafePipe } from './shared/safe.pipe';
|
||||||
|
import { AppComponent} from './components/app/app.component';
|
||||||
|
import { AuthCallbackComponent } from './components/auth-callback/auth-callback.component';
|
||||||
|
import { AuthCallbackGuard } from './components/auth-callback/auth-callback.guard';
|
||||||
|
import { SessionClearedComponent } from './components/session-cleared/session-cleared.component';
|
||||||
|
import { ResumableFileUploadService } from './components/resumable-file-upload/resumable-file-upload.service';
|
||||||
|
import { ResumableFileUploadComponent } from './components/resumable-file-upload/resumable-file-upload.component';
|
||||||
|
import { NotFoundComponent } from './components/not-found/not-found.component';
|
||||||
|
import { NotImplementedComponent } from './components/not-implemented/not-implemented.component';
|
||||||
|
import { SidePanelComponent } from './components/side-panel/side-panel.component';
|
||||||
|
import { TimespanComponent } from './components/timespan/timespan.component';
|
||||||
|
import { TagInputComponent } from './components/tag-input/tag-input.component';
|
||||||
|
import {IEventMessage } from './models/event.message';
|
||||||
|
import { IItem, Item } from './models/item';
|
||||||
|
import {IItemType} from './models/item.type';
|
||||||
|
import {IItemTypes} from './models/item.types';
|
||||||
|
import {IItemTask,ItemTask} from './models/itemTask';
|
||||||
|
import {IListItem} from './models/list.item';
|
||||||
|
import {ITypeaheadItem} from './models/typeahead.item';
|
||||||
|
import {IUser} from './models/user';
|
||||||
|
import * as commonActions from './actions/app-common.actions';
|
||||||
|
import * as commonReducers from './reducers/app-common.reducer';
|
||||||
|
import * as commonEffects from './effects/app-common.effects';
|
||||||
|
import {NgbDateNativeAdapter} from './services/date-adapter.service'
|
||||||
|
import { from } from 'rxjs';
|
||||||
|
|
||||||
|
export {FolderService,
|
||||||
|
ItemTypeService,
|
||||||
|
TimespanService,
|
||||||
|
ItemService,
|
||||||
|
EventService,
|
||||||
|
TypeaheadService,
|
||||||
|
UserService,
|
||||||
|
AppConfig,
|
||||||
|
AccessTokenInterceptor,
|
||||||
|
AuthGuard,
|
||||||
|
NavBarGuard,
|
||||||
|
FullScreenGuard,
|
||||||
|
AuthCallbackGuard,
|
||||||
|
ResumableFileUploadService,
|
||||||
|
NgbDateNativeAdapter
|
||||||
|
};
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
OAuthModule.forRoot(),
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class AppCommonServiceModule {
|
||||||
|
constructor (@Optional() @SkipSelf() parentModule: AppCommonServiceModule) {
|
||||||
|
if (parentModule) {
|
||||||
|
throw new Error(
|
||||||
|
'AppCommonServiceModule is already loaded. Import it in the AppModule only');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static forRoot(): ModuleWithProviders {
|
||||||
|
return {
|
||||||
|
ngModule: AppCommonServiceModule,
|
||||||
|
providers: [
|
||||||
|
AppConfig,
|
||||||
|
{
|
||||||
|
provide: APP_INITIALIZER,
|
||||||
|
useFactory: appConfigFactory,
|
||||||
|
deps: [Injector, AppConfig, OAuthService],
|
||||||
|
multi: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
provide: HTTP_INTERCEPTORS,
|
||||||
|
useClass: AccessTokenInterceptor,
|
||||||
|
multi: true
|
||||||
|
},
|
||||||
|
DatePipe
|
||||||
|
]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@@ -18,25 +18,10 @@ import { AppCommonRoutingModule } from './common-routing.module';
|
|||||||
import { MODULE_NAME } from './module-name';
|
import { MODULE_NAME } from './module-name';
|
||||||
|
|
||||||
//components
|
//components
|
||||||
import { ItemTypeService } from './services/itemtype.service';
|
|
||||||
import { FolderService } from './services/folder.service';
|
|
||||||
import { TimespanService} from './services/timespan.service';
|
|
||||||
import { ItemService} from './services/item.service';
|
|
||||||
import { EventService } from './services/event.service';
|
|
||||||
import { TypeaheadService } from './services/typeahead.service';
|
|
||||||
import { UserService } from './services/user.service';
|
|
||||||
import { AppConfig } from './shared/app.config';
|
|
||||||
import { AccessTokenInterceptor } from "./shared/accesstoken.interceptor";
|
|
||||||
import { appConfigFactory } from "./shared/app.config.factory";
|
|
||||||
import { AuthGuard } from './services/auth-guard.service';
|
|
||||||
import { NavBarGuard } from './services/nav-bar-guard.service';
|
|
||||||
import { FullScreenGuard } from './services/full-screen-guard.service';
|
|
||||||
import { SafePipe } from './shared/safe.pipe';
|
import { SafePipe } from './shared/safe.pipe';
|
||||||
import { AppComponent} from './components/app/app.component';
|
import { AppComponent} from './components/app/app.component';
|
||||||
import { AuthCallbackComponent } from './components/auth-callback/auth-callback.component';
|
import { AuthCallbackComponent } from './components/auth-callback/auth-callback.component';
|
||||||
import { AuthCallbackGuard } from './components/auth-callback/auth-callback.guard';
|
|
||||||
import { SessionClearedComponent } from './components/session-cleared/session-cleared.component';
|
import { SessionClearedComponent } from './components/session-cleared/session-cleared.component';
|
||||||
import { ResumableFileUploadService } from './components/resumable-file-upload/resumable-file-upload.service';
|
|
||||||
import { ResumableFileUploadComponent } from './components/resumable-file-upload/resumable-file-upload.component';
|
import { ResumableFileUploadComponent } from './components/resumable-file-upload/resumable-file-upload.component';
|
||||||
import { NotFoundComponent } from './components/not-found/not-found.component';
|
import { NotFoundComponent } from './components/not-found/not-found.component';
|
||||||
import { NotImplementedComponent } from './components/not-implemented/not-implemented.component';
|
import { NotImplementedComponent } from './components/not-implemented/not-implemented.component';
|
||||||
@@ -54,27 +39,12 @@ import {IUser} from './models/user';
|
|||||||
import * as commonActions from './actions/app-common.actions';
|
import * as commonActions from './actions/app-common.actions';
|
||||||
import * as commonReducers from './reducers/app-common.reducer';
|
import * as commonReducers from './reducers/app-common.reducer';
|
||||||
import * as commonEffects from './effects/app-common.effects';
|
import * as commonEffects from './effects/app-common.effects';
|
||||||
import {NgbDateNativeAdapter} from './services/date-adapter.service'
|
|
||||||
import { from } from 'rxjs';
|
|
||||||
|
|
||||||
export {FolderService,
|
export {
|
||||||
ItemTypeService,
|
|
||||||
TimespanService,
|
|
||||||
ItemService,
|
|
||||||
EventService,
|
|
||||||
TypeaheadService,
|
|
||||||
UserService,
|
|
||||||
AppConfig,
|
|
||||||
AccessTokenInterceptor,
|
|
||||||
AuthGuard,
|
|
||||||
NavBarGuard,
|
|
||||||
FullScreenGuard,
|
|
||||||
SafePipe,
|
SafePipe,
|
||||||
AuthCallbackComponent,
|
AuthCallbackComponent,
|
||||||
AuthCallbackGuard,
|
|
||||||
AppComponent,
|
AppComponent,
|
||||||
SessionClearedComponent,
|
SessionClearedComponent,
|
||||||
ResumableFileUploadService,
|
|
||||||
ResumableFileUploadComponent,
|
ResumableFileUploadComponent,
|
||||||
NotFoundComponent,
|
NotFoundComponent,
|
||||||
NotImplementedComponent,
|
NotImplementedComponent,
|
||||||
@@ -92,8 +62,7 @@ export {FolderService,
|
|||||||
ITypeaheadItem,
|
ITypeaheadItem,
|
||||||
IUser,
|
IUser,
|
||||||
commonActions,
|
commonActions,
|
||||||
commonReducers,
|
commonReducers
|
||||||
NgbDateNativeAdapter
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
@@ -108,9 +77,6 @@ export {FolderService,
|
|||||||
FormsModule,
|
FormsModule,
|
||||||
UploadxModule
|
UploadxModule
|
||||||
],
|
],
|
||||||
providers: [
|
|
||||||
DatePipe
|
|
||||||
],
|
|
||||||
declarations: [
|
declarations: [
|
||||||
AppComponent,
|
AppComponent,
|
||||||
AuthCallbackComponent,
|
AuthCallbackComponent,
|
||||||
@@ -141,29 +107,4 @@ export {FolderService,
|
|||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class AppCommonModule {
|
export class AppCommonModule {
|
||||||
constructor (@Optional() @SkipSelf() parentModule: AppCommonModule) {
|
|
||||||
if (parentModule) {
|
|
||||||
throw new Error(
|
|
||||||
'AppCommonModule is already loaded. Import it in the AppModule only');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
static forRoot(): ModuleWithProviders {
|
|
||||||
return {
|
|
||||||
ngModule: AppCommonModule,
|
|
||||||
providers: [
|
|
||||||
AppConfig,
|
|
||||||
{
|
|
||||||
provide: APP_INITIALIZER,
|
|
||||||
useFactory: appConfigFactory,
|
|
||||||
deps: [Injector, AppConfig, OAuthService],
|
|
||||||
multi: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
provide: HTTP_INTERCEPTORS,
|
|
||||||
useClass: AccessTokenInterceptor,
|
|
||||||
multi: true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -1 +0,0 @@
|
|||||||
|
|
@@ -1,126 +1,128 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
import { IItemType } from '../models/item.type';
|
import { IItemType } from '../models/item.type';
|
||||||
import { IItem } from '../models/item';
|
import { IItem } from '../models/item';
|
||||||
import { IItemTask } from '../models/itemTask';
|
import { IItemTask } from '../models/itemTask';
|
||||||
import { HttpClient, HttpParams } from "@angular/common/http";
|
import { HttpClient, HttpParams } from "@angular/common/http";
|
||||||
import { AppConfig } from "../shared/app.config";
|
import { AppConfig } from "../shared/app.config";
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class ItemService {
|
export class ItemService {
|
||||||
constructor(public httpClient: HttpClient, public appConfig: AppConfig) {
|
constructor(public httpClient: HttpClient, public appConfig: AppConfig) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ApiEndpoint() {
|
ApiEndpoint() {
|
||||||
return this.appConfig.getConfig("apiEndPoint");
|
return this.appConfig.getConfig("apiEndPoint");
|
||||||
}
|
}
|
||||||
|
|
||||||
parseDates(item: any): IItem {
|
parseDates(item: any): IItem {
|
||||||
item.created = new Date(Date.parse(item.created));
|
item.created = new Date(Date.parse(item.created));
|
||||||
item.updated = new Date(Date.parse(item.updated));
|
item.updated = new Date(Date.parse(item.updated));
|
||||||
item.dataDate = new Date(Date.parse(item.dataDate));
|
item.dataDate = new Date(Date.parse(item.dataDate));
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
getItemTypes(): Observable<{ [id: string]: IItemType }> {
|
getItemTypes(): Observable<{ [id: string]: IItemType }> {
|
||||||
return this.httpClient.get<{ [id: string]: IItemType }>(`${this.ApiEndpoint()}/api/v1/itemtypes/`);
|
return this.httpClient.get<{ [id: string]: IItemType }>(`${this.ApiEndpoint()}/api/v1/itemtypes/`);
|
||||||
}
|
}
|
||||||
|
|
||||||
getFeatures(extent: number[], crs: string, searchText?: string, searchTags?:string,startDate?:Date,endDate?:Date,itemType?:string,parentCode?:string,dataFilter?:string,level?:number): Observable<any> {
|
getFeatures(extent: number[], crs: string, searchText?: string, searchTags?:string,startDate?:Date,endDate?:Date,itemType?:string,parentCode?:string,dataFilter?:string,level?:number): Observable<any> {
|
||||||
var params = new HttpParams();
|
var params = new HttpParams();
|
||||||
params = params.append("bbox", extent.join(","));
|
params = params.append("bbox", extent.join(","));
|
||||||
params = params.append("crs", crs);
|
params = params.append("crs", crs);
|
||||||
if (searchText) params = params.append("q", searchText);
|
if (searchText) params = params.append("q", searchText);
|
||||||
if (searchTags) params = params.append("t", searchTags);
|
if (searchTags) params = params.append("t", searchTags);
|
||||||
if (startDate) params = params.append("sd", startDate.toISOString());
|
if (startDate) params = params.append("sd", startDate.toISOString());
|
||||||
if (endDate) params = params.append("ed", endDate.toISOString());
|
if (endDate) params = params.append("ed", endDate.toISOString());
|
||||||
if (itemType) params = params.append("it", itemType);
|
if (itemType) params = params.append("it", itemType);
|
||||||
if (parentCode) params = params.append("pc", parentCode);
|
if (parentCode) params = params.append("pc", parentCode);
|
||||||
if (dataFilter) params = params.append("df", dataFilter);
|
if (dataFilter) params = params.append("df", dataFilter);
|
||||||
if (level) params = params.append("lvl", dataFilter);
|
if (level) params = params.append("lvl", dataFilter);
|
||||||
return this.httpClient.get<any>(`${this.ApiEndpoint()}/api/v1/items/features/`, {params:params});
|
return this.httpClient.get<any>(`${this.ApiEndpoint()}/api/v1/items/features/`, {params:params});
|
||||||
}
|
}
|
||||||
|
|
||||||
getFeature(code:string, crs: string): Observable<any> {
|
getFeature(code:string, crs: string): Observable<any> {
|
||||||
var params = new HttpParams();
|
var params = new HttpParams();
|
||||||
params = params.append("crs", crs);
|
params = params.append("crs", crs);
|
||||||
return this.httpClient.get<any>(`${this.ApiEndpoint()}/api/v1/items/${code}/feature/`, { params: params });
|
return this.httpClient.get<any>(`${this.ApiEndpoint()}/api/v1/items/${code}/feature/`, { params: params });
|
||||||
}
|
}
|
||||||
|
|
||||||
getItem(code: string): Observable<IItem> {
|
getItem(code: string): Observable<IItem> {
|
||||||
return this.httpClient.get<IItem>(`${this.ApiEndpoint()}/api/v1/items/${code}`).pipe(map(i => this.parseDates(i)));
|
return this.httpClient.get<IItem>(`${this.ApiEndpoint()}/api/v1/items/${code}`).pipe(map(i => this.parseDates(i)));
|
||||||
}
|
}
|
||||||
|
|
||||||
getItemByCodeAndType(code: string, itemType: string): Observable<IItem> {
|
getItemByCodeAndType(code: string, itemType: string): Observable<IItem> {
|
||||||
return this.httpClient.get<IItem>(`${this.ApiEndpoint()}/api/v1/items/${code}/${itemType}`);
|
return this.httpClient.get<IItem>(`${this.ApiEndpoint()}/api/v1/items/${code}/${itemType}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
getItemList(itemType: string, dataFilter?: any, level: number = 1): Observable<IItem[]> {
|
getItemList(itemType: string, dataFilter?: any, level: number = 1): Observable<IItem[]> {
|
||||||
var params = new HttpParams();
|
var params = new HttpParams();
|
||||||
params = params.append("it", itemType);
|
params = params.append("it", itemType);
|
||||||
if(dataFilter != null){
|
if(dataFilter != null){
|
||||||
params = params.append("df", JSON.stringify(dataFilter));
|
params = params.append("df", JSON.stringify(dataFilter));
|
||||||
}
|
}
|
||||||
params = params.append("lvl", itemType);
|
params = params.append("lvl", itemType);
|
||||||
return this.httpClient.get<IItem[]>(`${this.ApiEndpoint()}/api/v1/items/`, { params: params }).pipe(map(ia => ia.map(i => this.parseDates(i))));
|
return this.httpClient.get<IItem[]>(`${this.ApiEndpoint()}/api/v1/items/`, { params: params }).pipe(map(ia => ia.map(i => this.parseDates(i))));
|
||||||
}
|
}
|
||||||
|
|
||||||
getChildItemList(parentcode: string, itemType: string, dataFilter?: any, level: number = 1): Observable<IItem[]> {
|
getChildItemList(parentcode: string, itemType: string, dataFilter?: any, level: number = 1): Observable<IItem[]> {
|
||||||
var params = new HttpParams();
|
var params = new HttpParams();
|
||||||
params = params.append("it", itemType);
|
params = params.append("it", itemType);
|
||||||
if (dataFilter != null) {
|
if (dataFilter != null) {
|
||||||
params = params.append("df", JSON.stringify(dataFilter));
|
params = params.append("df", JSON.stringify(dataFilter));
|
||||||
}
|
}
|
||||||
params = params.append("lvl", level.toString());
|
params = params.append("lvl", level.toString());
|
||||||
return this.httpClient.get<IItem[]>(`${this.ApiEndpoint()}/api/v1/items/${parentcode}/children`, { params: params });
|
return this.httpClient.get<IItem[]>(`${this.ApiEndpoint()}/api/v1/items/${parentcode}/children`, { params: params }).pipe(map(ia => ia.map(i => this.parseDates(i))));
|
||||||
}
|
}
|
||||||
|
|
||||||
getChildItemListByExtent(parentcode: string, itemType: string, extent: number[], crs: string, dataFilter?: any, level: number = 1): Observable<IItem[]> {
|
getChildItemListByExtent(parentcode: string, itemType: string, extent: number[], crs: string, dataFilter?: any, level: number = 1): Observable<IItem[]> {
|
||||||
var params = new HttpParams();
|
var params = new HttpParams();
|
||||||
params = params.append("it", itemType);
|
params = params.append("it", itemType);
|
||||||
params = params.append("bbox", extent.join(","));
|
params = params.append("bbox", extent.join(","));
|
||||||
params = params.append("crs", crs);
|
params = params.append("crs", crs);
|
||||||
if (dataFilter != null) {
|
if (dataFilter != null) {
|
||||||
params = params.append("df", JSON.stringify(dataFilter));
|
params = params.append("df", JSON.stringify(dataFilter));
|
||||||
}
|
}
|
||||||
params = params.append("lvl", level.toString());
|
params = params.append("lvl", level.toString());
|
||||||
return this.httpClient.get<IItem[]>(`${this.ApiEndpoint()}/api/v1/items/${parentcode}/children`, { params: params });
|
return this.httpClient.get<IItem[]>(`${this.ApiEndpoint()}/api/v1/items/${parentcode}/children`, { params: params }).pipe(map(ia => ia.map(i => this.parseDates(i))));
|
||||||
}
|
}
|
||||||
|
|
||||||
getItemFeatures(code: string, extent: number[], crs: string, layerIndex?:number): Observable<any> {
|
getItemFeatures(code: string, extent: number[], crs: string, layerIndex?:number): Observable<any> {
|
||||||
var params = new HttpParams();
|
var params = new HttpParams();
|
||||||
params = params.append("bbox", extent.join(","));
|
params = params.append("crs", crs);
|
||||||
params = params.append("crs", crs);
|
if(extent != null) {
|
||||||
if(layerIndex!=null)
|
params = params.append("bbox", extent.join(","));
|
||||||
return this.httpClient.get<any>(`${this.ApiEndpoint()}/api/v1/items/${code}/features/layer/${layerIndex}`, { params: params });
|
}
|
||||||
else
|
if(layerIndex!=null)
|
||||||
return this.httpClient.get<any>(`${this.ApiEndpoint()}/api/v1/items/${code}/features`, { params: params });
|
return this.httpClient.get<any>(`${this.ApiEndpoint()}/api/v1/items/${code}/features/layer/${layerIndex}`, { params: params });
|
||||||
}
|
else
|
||||||
|
return this.httpClient.get<any>(`${this.ApiEndpoint()}/api/v1/items/${code}/features`, { params: params });
|
||||||
putItem(item:IItem): Observable<IItem> {
|
}
|
||||||
return this.httpClient.put<IItem>(`${this.ApiEndpoint()}/api/v1/items/${item.code}`,item);
|
|
||||||
}
|
putItem(item:IItem): Observable<IItem> {
|
||||||
|
return this.httpClient.put<IItem>(`${this.ApiEndpoint()}/api/v1/items/${item.code}`,item);
|
||||||
deleteItems(itemCodes:string[]): Observable<any> {
|
}
|
||||||
return this.httpClient.post<any>(`${this.ApiEndpoint()}/api/v1/items/delete`, itemCodes);
|
|
||||||
}
|
deleteItems(itemCodes:string[]): Observable<any> {
|
||||||
|
return this.httpClient.post<any>(`${this.ApiEndpoint()}/api/v1/items/delete`, itemCodes);
|
||||||
getTemporalLast(code: string): Observable<any> {
|
}
|
||||||
return this.httpClient.get<any>(`${this.ApiEndpoint()}/api/v1/items/${code}/temporal/last`);
|
|
||||||
}
|
getTemporalLast(code: string): Observable<any> {
|
||||||
|
return this.httpClient.get<any>(`${this.ApiEndpoint()}/api/v1/items/${code}/temporal/last`);
|
||||||
getTemporal(code: string, startDate?: Date, endDate?: Date): Observable<any> {
|
}
|
||||||
var params = new HttpParams();
|
|
||||||
if (startDate) params = params.append("sd", startDate.toISOString());
|
getTemporal(code: string, startDate?: Date, endDate?: Date): Observable<any> {
|
||||||
if (endDate) params = params.append("ed", endDate.toISOString());
|
var params = new HttpParams();
|
||||||
return this.httpClient.get<any>(`${this.ApiEndpoint()}/api/v1/items/${code}/temporal/`, { params: params });
|
if (startDate) params = params.append("sd", startDate.toISOString());
|
||||||
}
|
if (endDate) params = params.append("ed", endDate.toISOString());
|
||||||
|
return this.httpClient.get<any>(`${this.ApiEndpoint()}/api/v1/items/${code}/temporal/`, { params: params });
|
||||||
postItemTask(item: IItem, task: IItemTask): Observable<IItemTask> {
|
}
|
||||||
return this.httpClient.post<IItemTask>(`${this.ApiEndpoint()}/api/v1/items/${item.code}/tasks`, task);
|
|
||||||
}
|
postItemTask(item: IItem, task: IItemTask): Observable<IItemTask> {
|
||||||
}
|
return this.httpClient.post<IItemTask>(`${this.ApiEndpoint()}/api/v1/items/${item.code}/tasks`, task);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
import {Inject, Injectable} from '@angular/core';
|
import {Inject, Injectable} from '@angular/core';
|
||||||
|
import { Location } from '@angular/common';
|
||||||
import {HttpClient, HttpXhrBackend} from '@angular/common/http';
|
import {HttpClient, HttpXhrBackend} from '@angular/common/http';
|
||||||
import {Observable} from 'rxjs';
|
import {Observable} from 'rxjs';
|
||||||
|
|
||||||
@@ -8,7 +9,7 @@ export class AppConfig {
|
|||||||
private config: Object = null;
|
private config: Object = null;
|
||||||
private httpClient: HttpClient;
|
private httpClient: HttpClient;
|
||||||
|
|
||||||
constructor(xhrBackend: HttpXhrBackend) {
|
constructor(xhrBackend: HttpXhrBackend,private location:Location) {
|
||||||
this.httpClient = new HttpClient(xhrBackend);
|
this.httpClient = new HttpClient(xhrBackend);
|
||||||
this.config = null;
|
this.config = null;
|
||||||
}
|
}
|
||||||
@@ -21,7 +22,7 @@ export class AppConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public load(): Promise<any> {
|
public load(): Promise<any> {
|
||||||
return this.httpClient.get('/configuration.json')
|
return this.httpClient.get(this.location.prepareExternalUrl('/configuration.json'))
|
||||||
.toPromise()
|
.toPromise()
|
||||||
.then(data => {
|
.then(data => {
|
||||||
this.config = data;
|
this.config = data;
|
||||||
|
@@ -3,3 +3,4 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
export * from './fm/common.module';
|
export * from './fm/common.module';
|
||||||
|
export * from './fm/common-service.module';
|
||||||
|
@@ -1,31 +0,0 @@
|
|||||||
import { TestBed, async } from '@angular/core/testing';
|
|
||||||
import { AppComponent } from './app.component';
|
|
||||||
|
|
||||||
describe('AppComponent', () => {
|
|
||||||
beforeEach(async(() => {
|
|
||||||
TestBed.configureTestingModule({
|
|
||||||
declarations: [
|
|
||||||
AppComponent
|
|
||||||
],
|
|
||||||
}).compileComponents();
|
|
||||||
}));
|
|
||||||
|
|
||||||
it('should create the app', () => {
|
|
||||||
const fixture = TestBed.createComponent(AppComponent);
|
|
||||||
const app = fixture.debugElement.componentInstance;
|
|
||||||
expect(app).toBeTruthy();
|
|
||||||
});
|
|
||||||
|
|
||||||
it(`should have as title 'farmmaps-lib-app'`, () => {
|
|
||||||
const fixture = TestBed.createComponent(AppComponent);
|
|
||||||
const app = fixture.debugElement.componentInstance;
|
|
||||||
expect(app.title).toEqual('farmmaps-lib-app');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render title in a h1 tag', () => {
|
|
||||||
const fixture = TestBed.createComponent(AppComponent);
|
|
||||||
fixture.detectChanges();
|
|
||||||
const compiled = fixture.debugElement.nativeElement;
|
|
||||||
expect(compiled.querySelector('h1').textContent).toContain('Welcome to farmmaps-lib-app!');
|
|
||||||
});
|
|
||||||
});
|
|
@@ -1,64 +1,65 @@
|
|||||||
import {
|
import {
|
||||||
NgModule,
|
NgModule,
|
||||||
Inject,
|
Inject,
|
||||||
APP_BOOTSTRAP_LISTENER,
|
APP_BOOTSTRAP_LISTENER,
|
||||||
InjectionToken, Type,
|
InjectionToken, Type,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import { BrowserModule } from '@angular/platform-browser';
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
|
|
||||||
import { AppCommonModule, } from '@farmmaps/common';
|
import { AppCommonModule,AppCommonServiceModule } from '@farmmaps/common';
|
||||||
import { AppCommonMapModule} from '@farmmaps/common-map';
|
import { AppCommonMapModule} from '@farmmaps/common-map';
|
||||||
|
|
||||||
import {AppRootComponent} from './app.component';
|
import {AppRootComponent} from './app.component';
|
||||||
|
|
||||||
import {StoreModule, Store} from '@ngrx/store';
|
import {StoreModule, Store} from '@ngrx/store';
|
||||||
import {EffectsModule, EffectSources} from '@ngrx/effects';
|
import {EffectsModule, EffectSources} from '@ngrx/effects';
|
||||||
import { StoreRouterConnectingModule} from '@ngrx/router-store';
|
import { StoreRouterConnectingModule} from '@ngrx/router-store';
|
||||||
|
|
||||||
import {AppRoutingModule} from './app-routing.module';
|
import {AppRoutingModule} from './app-routing.module';
|
||||||
import { LogoComponent } from './logo/logo.component';
|
import { LogoComponent } from './logo/logo.component';
|
||||||
import { MenuComponent } from './menu/menu.component';
|
import { MenuComponent } from './menu/menu.component';
|
||||||
|
|
||||||
export const BOOTSTRAP_EFFECTS = new InjectionToken('Bootstrap Effects');
|
export const BOOTSTRAP_EFFECTS = new InjectionToken('Bootstrap Effects');
|
||||||
|
|
||||||
export function bootstrapEffects(effects: Type<any>[], sources: EffectSources) {
|
export function bootstrapEffects(effects: Type<any>[], sources: EffectSources) {
|
||||||
return () => {
|
return () => {
|
||||||
effects.forEach(effect => sources.addEffects(effect));
|
effects.forEach(effect => sources.addEffects(effect));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createInstances(...instances: any[]) {
|
export function createInstances(...instances: any[]) {
|
||||||
return instances;
|
return instances;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function provideBootstrapEffects(effects: Type<any>[]) {
|
export function provideBootstrapEffects(effects: Type<any>[]) {
|
||||||
return [
|
return [
|
||||||
effects,
|
effects,
|
||||||
{provide: BOOTSTRAP_EFFECTS, deps: effects, useFactory: createInstances},
|
{provide: BOOTSTRAP_EFFECTS, deps: effects, useFactory: createInstances},
|
||||||
{
|
{
|
||||||
provide: APP_BOOTSTRAP_LISTENER,
|
provide: APP_BOOTSTRAP_LISTENER,
|
||||||
multi: true,
|
multi: true,
|
||||||
useFactory: bootstrapEffects,
|
useFactory: bootstrapEffects,
|
||||||
deps: [[new Inject(BOOTSTRAP_EFFECTS)], EffectSources],
|
deps: [[new Inject(BOOTSTRAP_EFFECTS)], EffectSources],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [
|
declarations: [
|
||||||
AppRootComponent,
|
AppRootComponent,
|
||||||
LogoComponent,
|
LogoComponent,
|
||||||
MenuComponent
|
MenuComponent
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
AppRoutingModule,
|
AppRoutingModule,
|
||||||
AppCommonModule.forRoot() ,
|
AppCommonModule,
|
||||||
AppCommonMapModule.forRoot(),
|
AppCommonServiceModule.forRoot(),
|
||||||
BrowserModule,
|
AppCommonMapModule.forRoot(),
|
||||||
StoreModule.forRoot({}),
|
BrowserModule,
|
||||||
EffectsModule.forRoot([])
|
StoreModule.forRoot({}),
|
||||||
],
|
EffectsModule.forRoot([])
|
||||||
providers: [],
|
],
|
||||||
bootstrap: [AppRootComponent]
|
providers: [],
|
||||||
})
|
bootstrap: [AppRootComponent]
|
||||||
export class AppModule { }
|
})
|
||||||
|
export class AppModule { }
|
||||||
|
Reference in New Issue
Block a user