Compare commits
25 Commits
Author | SHA1 | Date | |
---|---|---|---|
914e272fc2 | |||
|
b182b7fda6 | ||
|
22040b43b3 | ||
|
50170cf599 | ||
|
2deff46a7e | ||
|
e939a787ba | ||
|
4ae9562ce1 | ||
|
288e507e6c | ||
d9848a8ba3 | |||
a9d42484cc | |||
a276593c7f | |||
ff50650c28 | |||
d7efeb8d59 | |||
fd71d1f38e | |||
bc8c9f8bf9 | |||
0865ca1a93 | |||
1bc3983f55 | |||
945d88839f | |||
7c06343909 | |||
b8f8f27794 | |||
2a31771ac6 | |||
3f17341b2e | |||
6165f523cc | |||
19dce51a28 | |||
b29cd8e4c9 |
54
Jenkinsfile
vendored
54
Jenkinsfile
vendored
@@ -1,54 +1,24 @@
|
||||
@Library('farmmaps-shared-library') _
|
||||
|
||||
pipeline {
|
||||
agent any
|
||||
environment {
|
||||
PACKAGE_VERSION_PREFIX=sh(script: 'jq .version package.json |sed "s/\\"//g"', returnStdout: true).trim()
|
||||
PACKAGE_VERSION="${PACKAGE_VERSION_PREFIX}"
|
||||
agent any;
|
||||
options {
|
||||
copyArtifactPermission projectNames: env.allProjectsArtifactPermission;
|
||||
disableConcurrentBuilds abortPrevious: true;
|
||||
}
|
||||
stages {
|
||||
stage('npm install'){
|
||||
stage('FarmmapsLibBuildAll') {
|
||||
steps {
|
||||
sh '''rm -rf node_modules/
|
||||
npm install --legacy-peer-deps
|
||||
cd projects/common
|
||||
npm install --legacy-peer-deps
|
||||
cd ../common-map
|
||||
npm install --legacy-peer-deps
|
||||
cd ../common-map3d
|
||||
npm install --legacy-peer-deps
|
||||
'''
|
||||
stepFarmmapsLibBuildAll();
|
||||
}
|
||||
}
|
||||
stage('build'){
|
||||
steps {
|
||||
sh '''ng build common --configuration production
|
||||
ng build common-map --configuration production
|
||||
ng build common-map3d --configuration production'''
|
||||
}
|
||||
}
|
||||
stage('npm publish'){
|
||||
steps {
|
||||
sh '''cd dist/common
|
||||
npm version ${PACKAGE_VERSION} --allow-same-version
|
||||
npm publish
|
||||
cd ../common-map
|
||||
npm version ${PACKAGE_VERSION} --allow-same-version
|
||||
npm publish
|
||||
cd ../common-map3d
|
||||
npm version ${PACKAGE_VERSION} --allow-same-version
|
||||
npm publish'''
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
post {
|
||||
success {
|
||||
postSuccess();
|
||||
}
|
||||
always {
|
||||
emailext (
|
||||
body: '${DEFAULT_CONTENT}',
|
||||
mimeType: 'text/html',
|
||||
replyTo: '${DEFAULT_REPLYTO}',
|
||||
subject: '${DEFAULT_SUBJECT}',
|
||||
to: emailextrecipients([[$class: 'CulpritsRecipientProvider'], [$class: 'RequesterRecipientProvider']])
|
||||
)
|
||||
postAlways();
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,54 +1,24 @@
|
||||
@Library('farmmaps-shared-library') _
|
||||
|
||||
pipeline {
|
||||
agent any
|
||||
environment {
|
||||
PACKAGE_VERSION_PREFIX=sh(script: 'jq .version package.json |sed "s/\\"//g"', returnStdout: true).trim()
|
||||
PACKAGE_VERSION="${PACKAGE_VERSION_PREFIX + '-prerelease.' + env.BUILD_NUMBER}"
|
||||
agent any;
|
||||
options {
|
||||
copyArtifactPermission projectNames: env.allProjectsArtifactPermission;
|
||||
disableConcurrentBuilds abortPrevious: true;
|
||||
}
|
||||
stages {
|
||||
stage('npm install'){
|
||||
stage('FarmmapsLibBuildAll') {
|
||||
steps {
|
||||
sh '''rm -rf node_modules/
|
||||
npm install --legacy-peer-deps
|
||||
cd projects/common
|
||||
npm install --legacy-peer-deps
|
||||
cd ../common-map
|
||||
npm install --legacy-peer-deps
|
||||
cd ../common-map3d
|
||||
npm install --legacy-peer-deps
|
||||
'''
|
||||
stepFarmmapsLibBuildAll();
|
||||
}
|
||||
}
|
||||
stage('build'){
|
||||
steps {
|
||||
sh '''ng build common --configuration production
|
||||
ng build common-map --configuration production
|
||||
ng build common-map3d --configuration production'''
|
||||
}
|
||||
}
|
||||
stage('npm publish'){
|
||||
steps {
|
||||
sh '''cd dist/common
|
||||
npm version ${PACKAGE_VERSION}
|
||||
npm publish
|
||||
cd ../common-map
|
||||
npm version ${PACKAGE_VERSION}
|
||||
npm publish
|
||||
cd ../common-map3d
|
||||
npm version ${PACKAGE_VERSION}
|
||||
npm publish'''
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
post {
|
||||
success {
|
||||
postSuccess();
|
||||
}
|
||||
always {
|
||||
emailext (
|
||||
body: '${DEFAULT_CONTENT}',
|
||||
mimeType: 'text/html',
|
||||
replyTo: '${DEFAULT_REPLYTO}',
|
||||
subject: '${DEFAULT_SUBJECT}',
|
||||
to: emailextrecipients([[$class: 'CulpritsRecipientProvider'], [$class: 'RequesterRecipientProvider']])
|
||||
)
|
||||
postAlways();
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 73 KiB After Width: | Height: | Size: 143 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -51,7 +51,17 @@
|
||||
content: "i";
|
||||
}
|
||||
|
||||
hallo
|
||||
.fm-carbon:before {
|
||||
content: "j";
|
||||
}
|
||||
|
||||
.fm-bo-akkerbouw:before {
|
||||
content: "k";
|
||||
}
|
||||
|
||||
.fm-grass:before {
|
||||
content: "l";
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "FarmMaps";
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "farmmaps-lib-app",
|
||||
"version": "3.0.2",
|
||||
"version": "3.4.0",
|
||||
"scripts": {
|
||||
"ng": "ng",
|
||||
"start": "ng serve",
|
||||
@@ -86,4 +86,4 @@
|
||||
"ts-node": "^8.8.1",
|
||||
"typescript": "~4.6.4"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -5,7 +5,7 @@ import { IItemLayer } from '../models/item.layer';
|
||||
import { ILayervalue } from '../models/layer.value';
|
||||
import { IQueryState } from '@farmmaps/common';
|
||||
import { IItem } from '@farmmaps/common';
|
||||
import { Feature } from 'ol';
|
||||
import { Feature, Observable } from 'ol';
|
||||
import { Style } from 'ol/style';
|
||||
import { Geometry } from 'ol/geom';
|
||||
import { IPeriodState } from '../models/period.state';
|
||||
@@ -56,7 +56,7 @@ export const GETLAYERVALUE = '[Map] GetLayerValue'
|
||||
export const GETLAYERVALUESUCCESS = '[Map] GetLayerValueSuccess'
|
||||
export const TOGGLESHOWDATALAYERSLIDE = '[Map] ToggleShowDataLayerSlide'
|
||||
export const SETVIEWSTATE = '[Map] SetViewState'
|
||||
|
||||
export const SETCODELIST = '[Map] SetCodeList'
|
||||
|
||||
export class Clear implements Action {
|
||||
readonly type = CLEAR;
|
||||
@@ -329,6 +329,12 @@ export class SetViewState implements Action {
|
||||
constructor(public enabled:boolean) {}
|
||||
}
|
||||
|
||||
export class SetCodeList implements Action {
|
||||
readonly type = SETCODELIST;
|
||||
|
||||
constructor(public itemType:string, public values: IItem[]) { }
|
||||
}
|
||||
|
||||
export type Actions = SetMapState
|
||||
| Init
|
||||
| Clear
|
||||
@@ -374,5 +380,6 @@ export type Actions = SetMapState
|
||||
| GetLayerValue
|
||||
| SetPeriod
|
||||
| ToggleShowDataLayerSlide
|
||||
| SetViewState;
|
||||
| SetViewState
|
||||
| SetCodeList;
|
||||
|
||||
|
@@ -250,8 +250,8 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
|
||||
return new style.Style(
|
||||
{
|
||||
stroke: new style.Stroke({
|
||||
color: 'red',
|
||||
width: 2
|
||||
color: '#0d6efd',
|
||||
width: 3
|
||||
})
|
||||
}
|
||||
);
|
||||
@@ -466,7 +466,7 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
|
||||
mapEventHandler = (event) => {
|
||||
// select only when having observers
|
||||
if(event.type === 'click' && !this.onFeatureSelected.observers.length) return;
|
||||
if(event.type === 'pointermove' && !this.onFeatureHover.observers.length) return;
|
||||
if(event.type === 'pointermove' && !this.onFeatureHover.observers.length) return;
|
||||
const itemLayer= this.getItemlayer(this.itemLayer);
|
||||
if(itemLayer && itemLayer.layer) {
|
||||
this.selectedFeatures = {};
|
||||
|
@@ -36,6 +36,7 @@ import {Extent,createEmpty,extend } from 'ol/extent';
|
||||
import {transform} from 'ol/proj';
|
||||
import { tassign } from 'tassign';
|
||||
import * as style from 'ol/style';
|
||||
import { ICodeLists } from '../../models/codelist.cache';
|
||||
|
||||
|
||||
@Component({
|
||||
@@ -85,6 +86,8 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
|
||||
public overlayLayersCollapsed = true;
|
||||
public extent$: Observable<Extent> = this.store.select(mapReducers.selectGetExtent);
|
||||
public styles$:Observable<IStyles> = this.store.select(mapReducers.selectGetStyles);
|
||||
public codeLists$: Observable<ICodeLists> = this.store.select(mapReducers.selectGetCodeLists);
|
||||
public codeList$ = (id: string) => this.store.select(mapReducers.selectGetCodeList(id));
|
||||
public fullscreen$: Observable<boolean> = this.store.select(commonReducers.selectGetFullScreen);
|
||||
private lastUrl = "";
|
||||
private initialized = false;
|
||||
@@ -119,7 +122,7 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
|
||||
this.querySub = this.query$.pipe(skip(1), withLatestFrom(this.mapState$)).subscribe(([query,mapState]) =>{
|
||||
if(query && query.querystate) {
|
||||
let newQueryState = tassign(mapReducers.initialQueryState);
|
||||
console.debug(`Do Query`);
|
||||
//console.debug(`Do Query`);
|
||||
const urlparts=[];
|
||||
if (query.querystate.itemCode && query.querystate.itemCode != "") {
|
||||
if(query.querystate.itemType && query.querystate.itemType!= "") {
|
||||
@@ -242,7 +245,7 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
|
||||
|
||||
ngOnInit() {
|
||||
this.initialized = false;
|
||||
console.debug("Init");
|
||||
//console.debug("Init");
|
||||
this.store.dispatch(new mapActions.Clear());
|
||||
this.selectedFeatures$.next({x:0,y:0,features:[]});
|
||||
this.selectedFeatures$.next(null);
|
||||
@@ -314,7 +317,7 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
console.debug("View init");
|
||||
//console.debug("View init");
|
||||
this.noContent=true;
|
||||
this.route.children.forEach((entry) => {
|
||||
if(entry.outlet=="primary") {
|
||||
@@ -348,7 +351,7 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
|
||||
})).subscribe((action) => {
|
||||
if(action) {
|
||||
this.zone.run(() => {
|
||||
console.debug("Url to state");
|
||||
//console.debug("Url to state");
|
||||
this.store.dispatch(action);
|
||||
});
|
||||
}
|
||||
@@ -367,7 +370,7 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
|
||||
}
|
||||
})).subscribe((newUrlState) =>{
|
||||
if(newUrlState) {
|
||||
console.debug(`State to url`);
|
||||
//console.debug(`State to url`);
|
||||
this.replaceUrl(newUrlState.mapState,newUrlState.queryState,newUrlState.replaceUrl);
|
||||
}
|
||||
});
|
||||
@@ -425,7 +428,7 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
|
||||
parts.push(mapState.baseLayerCode);
|
||||
parts.push( this.serializeService.serialize(queryState));
|
||||
|
||||
console.debug("Replace url",parts);
|
||||
//console.debug("Replace url",parts);
|
||||
this.router.navigate(parts, { replaceUrl: replace,relativeTo:this.route.parent });
|
||||
}
|
||||
}
|
||||
@@ -434,7 +437,7 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
|
||||
handleOnMoveEnd(event) {
|
||||
if(this.initialized && this.viewEnabled) {
|
||||
this.zone.run(() =>{
|
||||
console.debug("Move end");
|
||||
//console.debug("Move end");
|
||||
const map = event.map;
|
||||
const view = map.getView();
|
||||
const rotation = view.getRotation();
|
||||
@@ -443,7 +446,7 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
|
||||
const viewExtent = view.calculateExtent(this.map.instance.getSize());
|
||||
const mapState: IMapState = { xCenter: center[0], yCenter: center[1], zoom: zoom, rotation: rotation, baseLayerCode: null };
|
||||
const state = { mapState: mapState, viewExtent: viewExtent };
|
||||
console.debug("Center: ",center[0],center[1] );
|
||||
//console.debug("Center: ",center[0],center[1] );
|
||||
const source = from([state]);
|
||||
source.pipe(withLatestFrom(this.selectedBaseLayer$)).subscribe(([state, baselayer]) => {
|
||||
if (mapState && baselayer) { // do not react on first move
|
||||
|
@@ -5,7 +5,7 @@ import { ROUTER_NAVIGATED, RouterReducerState } from '@ngrx/router-store';
|
||||
import * as fromRouter from '@ngrx/router-store';
|
||||
import { createEffect, Actions, ofType } from '@ngrx/effects';
|
||||
|
||||
import { EMPTY, Observable, of } from 'rxjs';
|
||||
import { EMPTY, Observable, of, forkJoin } from 'rxjs';
|
||||
import { withLatestFrom, switchMap, map, catchError, mergeMap } from 'rxjs/operators';
|
||||
|
||||
import { GeoJSON, WKT } from 'ol/format';
|
||||
@@ -99,6 +99,65 @@ export class MapEffects {
|
||||
color: 'rgba(0, 0, 0, 0)'
|
||||
})
|
||||
})));
|
||||
// cache code lists
|
||||
forkJoin([
|
||||
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl017'),
|
||||
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl018'),
|
||||
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl020'),
|
||||
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl022'),
|
||||
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl104'),
|
||||
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl127'),
|
||||
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl232'),
|
||||
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl251'),
|
||||
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl256'),
|
||||
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl259'),
|
||||
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl263'),
|
||||
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl264'),
|
||||
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl290'),
|
||||
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl291'),
|
||||
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl293'),
|
||||
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl405'),
|
||||
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl411'),
|
||||
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl421'),
|
||||
]).subscribe(([
|
||||
cl017,
|
||||
cl018,
|
||||
cl020,
|
||||
cl022,
|
||||
cl104,
|
||||
cl127,
|
||||
cl232,
|
||||
cl251,
|
||||
cl256,
|
||||
cl259,
|
||||
cl263,
|
||||
cl264,
|
||||
cl290,
|
||||
cl291,
|
||||
cl293,
|
||||
cl405,
|
||||
cl411,
|
||||
cl421,
|
||||
]) => {
|
||||
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl017', cl017));
|
||||
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl018', cl018));
|
||||
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl020', cl020));
|
||||
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl020', cl020));
|
||||
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl104', cl104));
|
||||
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl127', cl127));
|
||||
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl232', cl232));
|
||||
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl251', cl251));
|
||||
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl256', cl256));
|
||||
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl259', cl259));
|
||||
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl263', cl263));
|
||||
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl264', cl264));
|
||||
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl290', cl290));
|
||||
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl291', cl291));
|
||||
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl293', cl293));
|
||||
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl405', cl405));
|
||||
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl411', cl411));
|
||||
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl421', cl421));
|
||||
});
|
||||
|
||||
return actions;
|
||||
}
|
||||
|
5
projects/common-map/src/fm-map/models/codelist.cache.ts
Normal file
5
projects/common-map/src/fm-map/models/codelist.cache.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import { IItem } from '@farmmaps/common';
|
||||
|
||||
export interface ICodeLists {
|
||||
[id: string]: IItem[];
|
||||
}
|
@@ -1,5 +1,5 @@
|
||||
import { tassign } from 'tassign';
|
||||
import { IItem,Item } from '@farmmaps/common';
|
||||
import { IItem } from '@farmmaps/common';
|
||||
import { IItemLayer,ItemLayer,ITemporalItemLayer,TemporalItemLayer} from '../models/item.layer';
|
||||
import { IMapState} from '../models/map.state';
|
||||
import { IQueryState} from '@farmmaps/common';
|
||||
@@ -17,6 +17,7 @@ import {Geometry} from 'ol/geom';
|
||||
import { ROUTER_NAVIGATION, RouterNavigationAction } from '@ngrx/router-store';
|
||||
|
||||
import { MODULE_NAME } from '../module-name';
|
||||
import { ICodeLists } from '../models/codelist.cache';
|
||||
|
||||
const startDate:Date = new Date(new Date(Date.now()).getFullYear(), new Date(Date.now()).getMonth() - 3, 1);
|
||||
const endDate:Date = new Date(Date.now());
|
||||
@@ -72,7 +73,8 @@ export interface State {
|
||||
layerValuesEnabled:boolean,
|
||||
layerValues: Array<ILayervalue>
|
||||
showDataLayerSlide:boolean,
|
||||
viewEnabled:boolean
|
||||
viewEnabled: boolean,
|
||||
codeLists:ICodeLists,
|
||||
}
|
||||
|
||||
export const initialState: State = {
|
||||
@@ -117,7 +119,8 @@ export const initialState: State = {
|
||||
layerValuesEnabled:false,
|
||||
layerValues:[],
|
||||
showDataLayerSlide:false,
|
||||
viewEnabled:true
|
||||
viewEnabled: true,
|
||||
codeLists: {}
|
||||
}
|
||||
|
||||
export function reducer(state = initialState, action: mapActions.Actions | commonActions.Actions | RouterNavigationAction): State {
|
||||
@@ -569,6 +572,12 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
|
||||
}
|
||||
return state;
|
||||
}
|
||||
case mapActions.SETCODELIST:{
|
||||
const a = action as mapActions.SetCodeList;
|
||||
const codeLists = tassign(state.codeLists);
|
||||
codeLists[a.itemType] = a.values;
|
||||
return tassign(state,{codeLists:codeLists});
|
||||
}
|
||||
default: {
|
||||
return state;
|
||||
}
|
||||
@@ -588,6 +597,7 @@ export const getClearEnabled = (state: State) => state.clearEnabled;
|
||||
export const getSearchCollapsed = (state: State) => state.searchCollapsed;
|
||||
export const getSearchMinified = (state: State) => state.searchMinified;
|
||||
export const getExtent = (state: State) => state.extent;
|
||||
export const getViewExtent = (state: State) => state.viewExtent;
|
||||
export const getOverlayLayers = (state: State) => state.overlayLayers;
|
||||
export const getBaseLayers = (state: State) => state.baseLayers;
|
||||
export const getProjection = (state: State) => state.projection;
|
||||
@@ -606,7 +616,7 @@ export const getLayerValues = (state:State) => state.layerValues;
|
||||
export const getLayerValuesX = (state:State) => state.layerValuesX;
|
||||
export const getLayerValuesY = (state:State) => state.layerValuesY;
|
||||
export const getViewEnabled = (state:State) => state.viewEnabled;
|
||||
|
||||
export const getCodeLists = (state:State) => state.codeLists;
|
||||
|
||||
export const selectMapState = createFeatureSelector<State>(MODULE_NAME);
|
||||
export const selectGetMapState= createSelector(selectMapState, getMapState);
|
||||
@@ -622,6 +632,7 @@ export const selectGetClearEnabled = createSelector(selectMapState, getClearEnab
|
||||
export const selectGetSearchCollapsed = createSelector(selectMapState, getSearchCollapsed);
|
||||
export const selectGetSearchMinified = createSelector(selectMapState, getSearchMinified);
|
||||
export const selectGetExtent = createSelector(selectMapState, getExtent);
|
||||
export const selectGetViewExtent = createSelector(selectMapState, getViewExtent);
|
||||
export const selectGetOverlayLayers = createSelector(selectMapState, getOverlayLayers);
|
||||
export const selectGetBaseLayers = createSelector(selectMapState, getBaseLayers);
|
||||
export const selectGetProjection = createSelector(selectMapState, getProjection);
|
||||
@@ -640,5 +651,5 @@ export const selectGetLayerValues = createSelector(selectMapState,getLayerValues
|
||||
export const selectGetLayerValuesX = createSelector(selectMapState,getLayerValuesX);
|
||||
export const selectGetLayerValuesY = createSelector(selectMapState,getLayerValuesY);
|
||||
export const selectGetViewEnabled = createSelector(selectMapState,getViewEnabled);
|
||||
|
||||
|
||||
export const selectGetCodeLists = createSelector(selectMapState, getCodeLists);
|
||||
export const selectGetCodeList = (id: string) => createSelector(selectGetCodeLists, (codeLists) => codeLists[id]);
|
@@ -126,7 +126,7 @@ export class InitUserSettingsRoot implements Action {
|
||||
export class InitUserSettingsRootSuccess implements Action {
|
||||
readonly type = INITUSERSETTINGSROOTSUCCESS;
|
||||
|
||||
constructor(public item: IItem ) { }
|
||||
constructor(public item: IListItem ) { }
|
||||
}
|
||||
|
||||
export class InitRoot implements Action {
|
||||
|
@@ -69,7 +69,7 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||
|
||||
getActionFromEvent(event: IEventMessage): Action {
|
||||
let action: Action = null;
|
||||
console.debug(`${event.eventType} Event received`);
|
||||
//console.debug(`${event.eventType} Event received`);
|
||||
switch (event.eventType) {
|
||||
case "ItemChanged": {
|
||||
action = new commonActions.ItemChangedEvent(event.itemCode, event.attributes);
|
||||
@@ -146,12 +146,12 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||
private InstallAuthenticationEventHandler() {
|
||||
// auth event handler
|
||||
this.oauthService$.events.subscribe((event) => {
|
||||
console.debug(event.type);
|
||||
//console.debug(event.type);
|
||||
if (event.type == 'token_error' || event.type == 'silent_refresh_timeout' || event.type == 'logout') {
|
||||
const e = event as OAuthErrorEvent;
|
||||
const p = e.params as any;
|
||||
if (event.type == 'silent_refresh_timeout' || event.type == 'logout' || (p.error && p.error == 'login_required')) {
|
||||
console.debug("Session expired");
|
||||
//console.debug("Session expired");
|
||||
this.router.navigate(['loggedout'], { queryParams: { redirectTo: this.router.url } });
|
||||
}
|
||||
}
|
||||
|
@@ -85,9 +85,8 @@ export class AppCommonEffects {
|
||||
|
||||
initUserSettingsRoot$ = createEffect(() => this.actions$.pipe(
|
||||
ofType(appCommonActions.INITUSERSETTINGSROOT),
|
||||
withLatestFrom(this.store$.select(appCommonReducers.SelectGetUser)),
|
||||
switchMap(([, user]) => {
|
||||
return this.itemService$.getItem(user.code + ':USER_SETTINGS').pipe(
|
||||
switchMap(_ => {
|
||||
return this.folderService$.getFolder('my_settings').pipe(
|
||||
switchMap((item) => of(new appCommonActions.InitUserSettingsRootSuccess(item))),
|
||||
catchError(error => of(new appCommonActions.Fail(error)))
|
||||
)
|
||||
@@ -170,7 +169,7 @@ export class AppCommonEffects {
|
||||
this.router$.navigate(['/map', query ])
|
||||
}else if(viewer == 'edit_in_editor') {
|
||||
this.router$.navigate(['/editor', editor, 'item', a.item.code])
|
||||
} else {
|
||||
} else if(viewer) {
|
||||
this.router$.navigate(['/viewer', viewer, 'item', a.item.code])
|
||||
}
|
||||
return [];
|
||||
@@ -182,18 +181,18 @@ export class AppCommonEffects {
|
||||
ofType(appCommonActions.FAIL),
|
||||
map((action) => {
|
||||
const failAction = action as appCommonActions.Fail;
|
||||
console.debug(failAction.payload)
|
||||
//console.debug(failAction.payload)
|
||||
return null;
|
||||
})),{dispatch:false});
|
||||
|
||||
online$ = createEffect(() => this.actions$.pipe(
|
||||
ofType(appCommonActions.ONLINE),
|
||||
switchMap((action) => {
|
||||
console.debug("Online: Check token");
|
||||
//console.debug("Online: Check token");
|
||||
if(!this.oauthService$.hasValidAccessToken()) {
|
||||
console.debug("No valid token, try to refresh");
|
||||
//console.debug("No valid token, try to refresh");
|
||||
if(this.oauthService$.getRefreshToken() != null ) {
|
||||
console.debug("We have a refresh token");
|
||||
//console.debug("We have a refresh token");
|
||||
this.oauthService$.refreshToken();
|
||||
}
|
||||
}
|
||||
|
@@ -24,44 +24,53 @@ export class AuthGuard implements CanActivate, CanLoad, CanActivateChild {
|
||||
constructor(private oauthService: OAuthService, private router: Router, private store: Store<appCommonReducer.State>) { }
|
||||
|
||||
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean | UrlTree | Observable<boolean | UrlTree> | Promise<boolean | UrlTree> {
|
||||
console.debug("AuthGuard->canActivate", route, state);
|
||||
//console.debug("AuthGuard->canActivate", route, state);
|
||||
const url: string = state.url;
|
||||
|
||||
return this.checkLogin(url, route);
|
||||
}
|
||||
|
||||
canActivateChild(childRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean | UrlTree | Observable<boolean | UrlTree> | Promise<boolean | UrlTree> {
|
||||
console.debug("AuthGuard->canActivateChild", childRoute, state);
|
||||
//console.debug("AuthGuard->canActivateChild", childRoute, state);
|
||||
const url: string = state.url;
|
||||
|
||||
return this.checkLogin(url, childRoute);
|
||||
}
|
||||
|
||||
canLoad(route: Route, segments: UrlSegment[]): boolean | UrlTree | Observable<boolean | UrlTree> | Promise<boolean | UrlTree> {
|
||||
console.debug("AuthGuard->canLoad", route, segments);
|
||||
//console.debug("AuthGuard->canLoad", route, segments);
|
||||
return this.checkLogin(route.path, null);
|
||||
}
|
||||
|
||||
checkLogin(url: string, route: ActivatedRouteSnapshot): boolean {
|
||||
console.debug("AuthGuard->checkLogin", url, route);
|
||||
//console.debug("AuthGuard->checkLogin", url, route);
|
||||
if (!this.oauthService.hasValidAccessToken()) {
|
||||
console.debug("No valid token");
|
||||
//console.debug("No valid token");
|
||||
this.oauthService.initCodeFlow(url);
|
||||
return false;
|
||||
} else {
|
||||
const requiredRoleClaim = route.data.role;
|
||||
if (!requiredRoleClaim) { return true; }
|
||||
const ownedClaims = this.oauthService.getIdentityClaims();
|
||||
if (!ownedClaims) { console.debug("No owned claims"); return false; }
|
||||
if (!ownedClaims) {
|
||||
//console.debug("No owned claims");
|
||||
return false;
|
||||
}
|
||||
const ownedRoleClaims: string[] = ownedClaims['role'];
|
||||
if (!ownedRoleClaims) { console.debug("No owned role claims"); return false; }
|
||||
if (!ownedRoleClaims) {
|
||||
// console.debug("No owned role claims");
|
||||
return false;
|
||||
}
|
||||
if (Array.isArray(ownedRoleClaims)) {
|
||||
if (ownedRoleClaims.findIndex(r => r === requiredRoleClaim) <= -1) { console.debug("No required role claim", ownedRoleClaims, requiredRoleClaim); return false; }
|
||||
if (ownedRoleClaims.findIndex(r => r === requiredRoleClaim) <= -1) {
|
||||
//console.debug("No required role claim", ownedRoleClaims, requiredRoleClaim);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (ownedRoleClaims !== requiredRoleClaim) { console.debug("No required role claim", ownedRoleClaims, requiredRoleClaim); return false; }
|
||||
}
|
||||
console.debug("Has required role claim", requiredRoleClaim);
|
||||
//console.debug("Has required role claim", requiredRoleClaim);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -1,17 +1,17 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable , Observer } from 'rxjs';
|
||||
import {map} from 'rxjs/operators';
|
||||
import { IListItem } from '../models/list.item';
|
||||
import { IItem } from '../models/item';
|
||||
import { HttpClient } from "@angular/common/http";
|
||||
import { AppConfig } from "../shared/app.config";
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Observable} from 'rxjs';
|
||||
import {IListItem} from '../models/list.item';
|
||||
import {IItem} from '../models/item';
|
||||
import {HttpClient} from '@angular/common/http';
|
||||
import {AppConfig} from '../shared/app.config';
|
||||
import {ItemService} from './item.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class FolderService {
|
||||
|
||||
constructor(public httpClient: HttpClient, public appConfig: AppConfig) {
|
||||
constructor(public httpClient: HttpClient, public appConfig: AppConfig, public itemService: ItemService) {
|
||||
}
|
||||
|
||||
ApiEndpoint() {
|
||||
@@ -19,23 +19,24 @@ export class FolderService {
|
||||
}
|
||||
|
||||
getFolder(code: string): Observable<IListItem> {
|
||||
return this.httpClient.get<IListItem>(`${this.ApiEndpoint()}/api/v1/folders/${code}`);
|
||||
return this.httpClient.get<IListItem>(`${this.ApiEndpoint()}/api/v1/folders/${code}`);
|
||||
}
|
||||
|
||||
getMyRoots(): Observable<IListItem[]> {
|
||||
return this.httpClient.get<IListItem[]>(`${this.ApiEndpoint()}/api/v1/folders/my_roots`);
|
||||
}
|
||||
}
|
||||
|
||||
getFolderParents(code: string): Observable<IListItem[]> {
|
||||
return this.httpClient.get<IListItem[]>(`${this.ApiEndpoint()}/api/v1/folders/${code}/parents`);
|
||||
return this.itemService.getBreadcrumbs(code);
|
||||
}
|
||||
|
||||
getChildFolders(code: string): Observable<IListItem[]> {
|
||||
return this.httpClient.get<IListItem[]>(`${this.ApiEndpoint()}/api/v1/folders/${code}/listfolders`);
|
||||
const folderItemTypes = "FOLDER,FTP_FOLDER";
|
||||
return this.itemService.getChildItemList(code, folderItemTypes);
|
||||
}
|
||||
|
||||
getItems(code: string,skip:number, take:number): Observable<IListItem[]> {
|
||||
return this.httpClient.get<IListItem[]>(`${this.ApiEndpoint()}/api/v1/folders/${code}/list?skip=${skip}&take=${take}`);
|
||||
return this.itemService.getChildItemList(code, null, null, 1, true, null, null, skip, take);
|
||||
}
|
||||
|
||||
moveItem(itemCode: string, newParentCode: string): Observable<IListItem> {
|
||||
|
@@ -8,6 +8,7 @@ import { IItemTask } from '../models/itemTask';
|
||||
import { HttpClient, HttpParams,HttpHeaders } from "@angular/common/http";
|
||||
import { AppConfig } from "../shared/app.config";
|
||||
import {ItemTypeService} from './itemtype.service';
|
||||
import {IListItem} from '../models/list.item';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
@@ -72,7 +73,7 @@ export class ItemService {
|
||||
return this.httpClient.get<IItem>(`${this.ApiEndpoint()}/api/v1/items/${code}/${itemType}`);
|
||||
}
|
||||
|
||||
getItemList(itemType?: string, dataFilter?: any, level?: number, atItemLocationItemCode?: string, indexed?: boolean, validToday?: boolean): Observable<IItem[]> {
|
||||
getItemList(itemType?: string, dataFilter?: any, level?: number, atItemLocationItemCode?: string, indexed?: boolean, validToday?: boolean,tags?:string,crs?:string): Observable<IItem[]> {
|
||||
let params = new HttpParams();
|
||||
if(itemType) params = params.append("it", itemType);
|
||||
if(dataFilter) params = params.append("df", JSON.stringify(dataFilter));
|
||||
@@ -80,11 +81,13 @@ export class ItemService {
|
||||
if(indexed) params = params.append("ind",indexed?"true":"false");
|
||||
if (level) params = params.append("lvl", level.toFixed());
|
||||
if (validToday) params = params.append("vt", validToday ? "true" : "false");
|
||||
if (tags) params = params.append("t", tags);
|
||||
if (crs) params = params.append("crs", crs);
|
||||
return this.httpClient.get<IItem[]>(`${this.ApiEndpoint()}/api/v1/items/`, { params: params });
|
||||
}
|
||||
|
||||
getChildItemList(parentcode: string, itemType: string, dataFilter?: any, level = 1, deep = true,
|
||||
startDate?: Date, endDate?: Date): Observable<IItem[]> {
|
||||
startDate?: Date, endDate?: Date, skip?: number, take?: number): Observable<IItem[]> {
|
||||
let params = new HttpParams();
|
||||
if(itemType != null) {
|
||||
params = params.append("it", itemType);
|
||||
@@ -96,6 +99,9 @@ export class ItemService {
|
||||
params = params.append("deep", deep.toString());
|
||||
if (startDate) params = params.append("sDate", startDate.toISOString());
|
||||
if (endDate) params = params.append("eDate", endDate.toISOString());
|
||||
|
||||
if(skip) params = params.append("skip", skip);
|
||||
if(take) params = params.append("take", take);
|
||||
return this.httpClient.get<IItem[]>(`${this.ApiEndpoint()}/api/v1/items/${parentcode}/children`, { params: params });
|
||||
}
|
||||
|
||||
@@ -181,4 +187,8 @@ export class ItemService {
|
||||
return this.httpClient.get<any>(`${this.ApiEndpoint()}/api/v1/items/${itemCode}/value/layer/${layerIndex}?c=${x},${y}&crs=${crs}`);
|
||||
}
|
||||
|
||||
getBreadcrumbs(itemCode: string): Observable<IListItem[]> {
|
||||
return this.httpClient.get<any>(`${this.ApiEndpoint()}/api/v1/items/${itemCode}/breadcrumbs`);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -21,7 +21,7 @@ export class PackagePreloadStrategy extends PreloadingStrategy {
|
||||
}
|
||||
if(route.data && route.data.package) {
|
||||
if(this.packageService$.hasPackage(route.data.package)) {
|
||||
console.debug(`Load module for package ${route.data.package}`)
|
||||
//console.debug(`Load module for package ${route.data.package}`)
|
||||
this.loading.add(route);
|
||||
return load()
|
||||
}
|
||||
|
@@ -52,8 +52,8 @@ export function provideBootstrapEffects(effects: Type<any>[]) {
|
||||
// console.log all actions
|
||||
export function debug(reducer: ActionReducer<any>): ActionReducer<any> {
|
||||
return function(state, action) {
|
||||
console.debug('-- State', state);
|
||||
console.debug('-- Action', action);
|
||||
//console.debug('-- State', state);
|
||||
//console.debug('-- Action', action);
|
||||
|
||||
return reducer(state, action);
|
||||
};
|
||||
|
Reference in New Issue
Block a user