diff --git a/Jenkinsfile.develop b/Jenkinsfile.develop index 39ad8b2..3f03a79 100644 --- a/Jenkinsfile.develop +++ b/Jenkinsfile.develop @@ -1,54 +1,23 @@ +@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; } 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(); } } } \ No newline at end of file diff --git a/fonts/FMIconFont/FMIconFont.svg b/fonts/FMIconFont/FMIconFont.svg index 7d92793..1b9c09f 100644 --- a/fonts/FMIconFont/FMIconFont.svg +++ b/fonts/FMIconFont/FMIconFont.svg @@ -11,6 +11,7 @@ inkscape:export-ydpi="75" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" @@ -24,14 +25,14 @@ inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="0.5" - inkscape:cx="679" + inkscape:cx="193" inkscape:cy="500" inkscape:document-units="px" - inkscape:current-layer="layer14" + inkscape:current-layer="layer15" showgrid="false" showguides="true" inkscape:window-width="1920" - inkscape:window-height="1002" + inkscape:window-height="1122" inkscape:window-x="-8" inkscape:window-y="-8" inkscape:window-maximized="1" @@ -72,6 +73,18 @@ + + + + + + + + + + + + @@ -443,10 +518,57 @@ image/svg+xml - + + + + + + + + { 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 +242,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 +314,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 +348,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 +367,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 +425,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 +434,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 +443,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 diff --git a/projects/common/src/fm/actions/app-common.actions.ts b/projects/common/src/fm/actions/app-common.actions.ts index 82006f9..2c21045 100644 --- a/projects/common/src/fm/actions/app-common.actions.ts +++ b/projects/common/src/fm/actions/app-common.actions.ts @@ -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 { diff --git a/projects/common/src/fm/components/app/app.component.ts b/projects/common/src/fm/components/app/app.component.ts index 835c852..94b32b2 100644 --- a/projects/common/src/fm/components/app/app.component.ts +++ b/projects/common/src/fm/components/app/app.component.ts @@ -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 } }); } } diff --git a/projects/common/src/fm/effects/app-common.effects.ts b/projects/common/src/fm/effects/app-common.effects.ts index 5a56289..36e91ef 100644 --- a/projects/common/src/fm/effects/app-common.effects.ts +++ b/projects/common/src/fm/effects/app-common.effects.ts @@ -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(); } } diff --git a/projects/common/src/fm/services/auth-guard.service.ts b/projects/common/src/fm/services/auth-guard.service.ts index 04bc822..46e77f7 100644 --- a/projects/common/src/fm/services/auth-guard.service.ts +++ b/projects/common/src/fm/services/auth-guard.service.ts @@ -24,44 +24,53 @@ export class AuthGuard implements CanActivate, CanLoad, CanActivateChild { constructor(private oauthService: OAuthService, private router: Router, private store: Store) { } canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean | UrlTree | Observable | Promise { - 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 | Promise { - 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 | Promise { - 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; } } diff --git a/projects/common/src/fm/services/folder.service.ts b/projects/common/src/fm/services/folder.service.ts index f491509..3f7c07b 100644 --- a/projects/common/src/fm/services/folder.service.ts +++ b/projects/common/src/fm/services/folder.service.ts @@ -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 { - return this.httpClient.get(`${this.ApiEndpoint()}/api/v1/folders/${code}`); + return this.httpClient.get(`${this.ApiEndpoint()}/api/v1/folders/${code}`); } getMyRoots(): Observable { return this.httpClient.get(`${this.ApiEndpoint()}/api/v1/folders/my_roots`); - } + } getFolderParents(code: string): Observable { - return this.httpClient.get(`${this.ApiEndpoint()}/api/v1/folders/${code}/parents`); + return this.itemService.getBreadcrumbs(code); } getChildFolders(code: string): Observable { - return this.httpClient.get(`${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 { - return this.httpClient.get(`${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 { diff --git a/projects/common/src/fm/services/item.service.ts b/projects/common/src/fm/services/item.service.ts index 552b650..e0ef352 100644 --- a/projects/common/src/fm/services/item.service.ts +++ b/projects/common/src/fm/services/item.service.ts @@ -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', @@ -84,7 +85,7 @@ export class ItemService { } getChildItemList(parentcode: string, itemType: string, dataFilter?: any, level = 1, deep = true, - startDate?: Date, endDate?: Date): Observable { + startDate?: Date, endDate?: Date, skip?: number, take?: number): Observable { let params = new HttpParams(); if(itemType != null) { params = params.append("it", itemType); @@ -96,6 +97,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(`${this.ApiEndpoint()}/api/v1/items/${parentcode}/children`, { params: params }); } @@ -181,4 +185,8 @@ export class ItemService { return this.httpClient.get(`${this.ApiEndpoint()}/api/v1/items/${itemCode}/value/layer/${layerIndex}?c=${x},${y}&crs=${crs}`); } + getBreadcrumbs(itemCode: string): Observable { + return this.httpClient.get(`${this.ApiEndpoint()}/api/v1/items/${itemCode}/breadcrumbs`); + } + } diff --git a/projects/common/src/fm/services/package-preload-strategy.service.ts b/projects/common/src/fm/services/package-preload-strategy.service.ts index 3df617d..6031f09 100644 --- a/projects/common/src/fm/services/package-preload-strategy.service.ts +++ b/projects/common/src/fm/services/package-preload-strategy.service.ts @@ -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() } diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 3228a63..1f95162 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -52,8 +52,8 @@ export function provideBootstrapEffects(effects: Type[]) { // console.log all actions export function debug(reducer: ActionReducer): ActionReducer { return function(state, action) { - console.debug('-- State', state); - console.debug('-- Action', action); + //console.debug('-- State', state); + //console.debug('-- Action', action); return reducer(state, action); };