19 Commits

Author SHA1 Message Date
914e272fc2 AW-2924 Cache codelists
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
FarmMaps/FarmMapsLib/pipeline/head This commit looks good
2023-08-07 14:49:04 +02:00
Willem Dantuma
b182b7fda6 Change select color
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2023-08-01 09:18:11 +02:00
Willem Dantuma
22040b43b3 fix selector naam
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2023-07-31 20:25:29 +02:00
Willem Dantuma
50170cf599 Fix selector name
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2023-07-31 20:19:47 +02:00
Willem Dantuma
2deff46a7e AW-5365 add selectViewGetExtent
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2023-07-31 20:07:22 +02:00
Willem Dantuma
e939a787ba AW-5365 add tags parameter
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2023-07-31 19:36:57 +02:00
Willem Dantuma
4ae9562ce1 Kick version
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2023-07-31 19:22:14 +02:00
Willem Dantuma
288e507e6c AW-5365 add crs parameter
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2023-07-31 19:14:13 +02:00
d9848a8ba3 AW-5371 Release 2023.08 libraries
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
FarmMaps/FarmMapsLib/pipeline/head There was a failure building this commit
2023-07-30 10:53:08 +02:00
a9d42484cc jenkins
All checks were successful
FarmMaps/FarmMapsLib/pipeline/head This commit looks good
2023-07-26 17:52:01 +02:00
a276593c7f Merge branch 'develop' 2023-07-26 17:45:32 +02:00
ff50650c28 fix jenkins
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2023-06-27 16:30:49 +02:00
d7efeb8d59 fix build
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2023-06-27 16:27:18 +02:00
fd71d1f38e no message
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2023-06-27 16:02:52 +02:00
bc8c9f8bf9 no message
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
2023-06-27 15:56:17 +02:00
0865ca1a93 upped version
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2023-05-30 21:16:53 +02:00
1bc3983f55 AW-5071 refactor some parts 2023-05-30 21:16:20 +02:00
3f17341b2e Revert "++version"
Some checks failed
FarmMaps/FarmMapsLib/pipeline/head There was a failure building this commit
This reverts commit 6165f523cc.
2023-03-28 13:37:50 +02:00
6165f523cc ++version
All checks were successful
FarmMaps/FarmMapsLib/pipeline/head This commit looks good
2023-03-28 13:30:16 +02:00
11 changed files with 150 additions and 114 deletions

54
Jenkinsfile vendored
View File

@@ -1,54 +1,24 @@
@Library('farmmaps-shared-library') _
pipeline { pipeline {
agent any agent any;
environment { options {
PACKAGE_VERSION_PREFIX=sh(script: 'jq .version package.json |sed "s/\\"//g"', returnStdout: true).trim() copyArtifactPermission projectNames: env.allProjectsArtifactPermission;
PACKAGE_VERSION="${PACKAGE_VERSION_PREFIX}" disableConcurrentBuilds abortPrevious: true;
} }
stages { stages {
stage('npm install'){ stage('FarmmapsLibBuildAll') {
steps { steps {
sh '''rm -rf node_modules/ stepFarmmapsLibBuildAll();
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
'''
} }
} }
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 { post {
success {
postSuccess();
}
always { always {
emailext ( postAlways();
body: '${DEFAULT_CONTENT}',
mimeType: 'text/html',
replyTo: '${DEFAULT_REPLYTO}',
subject: '${DEFAULT_SUBJECT}',
to: emailextrecipients([[$class: 'CulpritsRecipientProvider'], [$class: 'RequesterRecipientProvider']])
)
} }
} }
} }

View File

@@ -1,54 +1,24 @@
@Library('farmmaps-shared-library') _
pipeline { pipeline {
agent any agent any;
environment { options {
PACKAGE_VERSION_PREFIX=sh(script: 'jq .version package.json |sed "s/\\"//g"', returnStdout: true).trim() copyArtifactPermission projectNames: env.allProjectsArtifactPermission;
PACKAGE_VERSION="${PACKAGE_VERSION_PREFIX + '-prerelease.' + env.BUILD_NUMBER}" disableConcurrentBuilds abortPrevious: true;
} }
stages { stages {
stage('npm install'){ stage('FarmmapsLibBuildAll') {
steps { steps {
sh '''rm -rf node_modules/ stepFarmmapsLibBuildAll();
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
'''
} }
} }
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 { post {
success {
postSuccess();
}
always { always {
emailext ( postAlways();
body: '${DEFAULT_CONTENT}',
mimeType: 'text/html',
replyTo: '${DEFAULT_REPLYTO}',
subject: '${DEFAULT_SUBJECT}',
to: emailextrecipients([[$class: 'CulpritsRecipientProvider'], [$class: 'RequesterRecipientProvider']])
)
} }
} }
} }

View File

@@ -1,6 +1,6 @@
{ {
"name": "farmmaps-lib-app", "name": "farmmaps-lib-app",
"version": "3.2.0", "version": "3.4.0",
"scripts": { "scripts": {
"ng": "ng", "ng": "ng",
"start": "ng serve", "start": "ng serve",

View File

@@ -5,7 +5,7 @@ import { IItemLayer } from '../models/item.layer';
import { ILayervalue } from '../models/layer.value'; import { ILayervalue } from '../models/layer.value';
import { IQueryState } from '@farmmaps/common'; import { IQueryState } from '@farmmaps/common';
import { IItem } from '@farmmaps/common'; import { IItem } from '@farmmaps/common';
import { Feature } from 'ol'; import { Feature, Observable } from 'ol';
import { Style } from 'ol/style'; import { Style } from 'ol/style';
import { Geometry } from 'ol/geom'; import { Geometry } from 'ol/geom';
import { IPeriodState } from '../models/period.state'; import { IPeriodState } from '../models/period.state';
@@ -56,7 +56,7 @@ export const GETLAYERVALUE = '[Map] GetLayerValue'
export const GETLAYERVALUESUCCESS = '[Map] GetLayerValueSuccess' export const GETLAYERVALUESUCCESS = '[Map] GetLayerValueSuccess'
export const TOGGLESHOWDATALAYERSLIDE = '[Map] ToggleShowDataLayerSlide' export const TOGGLESHOWDATALAYERSLIDE = '[Map] ToggleShowDataLayerSlide'
export const SETVIEWSTATE = '[Map] SetViewState' export const SETVIEWSTATE = '[Map] SetViewState'
export const SETCODELIST = '[Map] SetCodeList'
export class Clear implements Action { export class Clear implements Action {
readonly type = CLEAR; readonly type = CLEAR;
@@ -329,6 +329,12 @@ export class SetViewState implements Action {
constructor(public enabled:boolean) {} constructor(public enabled:boolean) {}
} }
export class SetCodeList implements Action {
readonly type = SETCODELIST;
constructor(public itemType:string, public values: IItem[]) { }
}
export type Actions = SetMapState export type Actions = SetMapState
| Init | Init
| Clear | Clear
@@ -374,5 +380,6 @@ export type Actions = SetMapState
| GetLayerValue | GetLayerValue
| SetPeriod | SetPeriod
| ToggleShowDataLayerSlide | ToggleShowDataLayerSlide
| SetViewState; | SetViewState
| SetCodeList;

View File

@@ -250,8 +250,8 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
return new style.Style( return new style.Style(
{ {
stroke: new style.Stroke({ stroke: new style.Stroke({
color: 'red', color: '#0d6efd',
width: 2 width: 3
}) })
} }
); );

View File

@@ -36,6 +36,7 @@ import {Extent,createEmpty,extend } from 'ol/extent';
import {transform} from 'ol/proj'; import {transform} from 'ol/proj';
import { tassign } from 'tassign'; import { tassign } from 'tassign';
import * as style from 'ol/style'; import * as style from 'ol/style';
import { ICodeLists } from '../../models/codelist.cache';
@Component({ @Component({
@@ -85,6 +86,8 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
public overlayLayersCollapsed = true; public overlayLayersCollapsed = true;
public extent$: Observable<Extent> = this.store.select(mapReducers.selectGetExtent); public extent$: Observable<Extent> = this.store.select(mapReducers.selectGetExtent);
public styles$:Observable<IStyles> = this.store.select(mapReducers.selectGetStyles); 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); public fullscreen$: Observable<boolean> = this.store.select(commonReducers.selectGetFullScreen);
private lastUrl = ""; private lastUrl = "";
private initialized = false; private initialized = false;

View File

@@ -5,7 +5,7 @@ import { ROUTER_NAVIGATED, RouterReducerState } from '@ngrx/router-store';
import * as fromRouter from '@ngrx/router-store'; import * as fromRouter from '@ngrx/router-store';
import { createEffect, Actions, ofType } from '@ngrx/effects'; 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 { withLatestFrom, switchMap, map, catchError, mergeMap } from 'rxjs/operators';
import { GeoJSON, WKT } from 'ol/format'; import { GeoJSON, WKT } from 'ol/format';
@@ -99,6 +99,65 @@ export class MapEffects {
color: 'rgba(0, 0, 0, 0)' 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; return actions;
} }

View File

@@ -0,0 +1,5 @@
import { IItem } from '@farmmaps/common';
export interface ICodeLists {
[id: string]: IItem[];
}

View File

@@ -1,5 +1,5 @@
import { tassign } from 'tassign'; 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 { IItemLayer,ItemLayer,ITemporalItemLayer,TemporalItemLayer} from '../models/item.layer';
import { IMapState} from '../models/map.state'; import { IMapState} from '../models/map.state';
import { IQueryState} from '@farmmaps/common'; import { IQueryState} from '@farmmaps/common';
@@ -17,6 +17,7 @@ import {Geometry} from 'ol/geom';
import { ROUTER_NAVIGATION, RouterNavigationAction } from '@ngrx/router-store'; import { ROUTER_NAVIGATION, RouterNavigationAction } from '@ngrx/router-store';
import { MODULE_NAME } from '../module-name'; 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 startDate:Date = new Date(new Date(Date.now()).getFullYear(), new Date(Date.now()).getMonth() - 3, 1);
const endDate:Date = new Date(Date.now()); const endDate:Date = new Date(Date.now());
@@ -72,7 +73,8 @@ export interface State {
layerValuesEnabled:boolean, layerValuesEnabled:boolean,
layerValues: Array<ILayervalue> layerValues: Array<ILayervalue>
showDataLayerSlide:boolean, showDataLayerSlide:boolean,
viewEnabled:boolean viewEnabled: boolean,
codeLists:ICodeLists,
} }
export const initialState: State = { export const initialState: State = {
@@ -117,7 +119,8 @@ export const initialState: State = {
layerValuesEnabled:false, layerValuesEnabled:false,
layerValues:[], layerValues:[],
showDataLayerSlide:false, showDataLayerSlide:false,
viewEnabled:true viewEnabled: true,
codeLists: {}
} }
export function reducer(state = initialState, action: mapActions.Actions | commonActions.Actions | RouterNavigationAction): State { 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; 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: { default: {
return state; return state;
} }
@@ -588,6 +597,7 @@ export const getClearEnabled = (state: State) => state.clearEnabled;
export const getSearchCollapsed = (state: State) => state.searchCollapsed; export const getSearchCollapsed = (state: State) => state.searchCollapsed;
export const getSearchMinified = (state: State) => state.searchMinified; export const getSearchMinified = (state: State) => state.searchMinified;
export const getExtent = (state: State) => state.extent; export const getExtent = (state: State) => state.extent;
export const getViewExtent = (state: State) => state.viewExtent;
export const getOverlayLayers = (state: State) => state.overlayLayers; export const getOverlayLayers = (state: State) => state.overlayLayers;
export const getBaseLayers = (state: State) => state.baseLayers; export const getBaseLayers = (state: State) => state.baseLayers;
export const getProjection = (state: State) => state.projection; 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 getLayerValuesX = (state:State) => state.layerValuesX;
export const getLayerValuesY = (state:State) => state.layerValuesY; export const getLayerValuesY = (state:State) => state.layerValuesY;
export const getViewEnabled = (state:State) => state.viewEnabled; export const getViewEnabled = (state:State) => state.viewEnabled;
export const getCodeLists = (state:State) => state.codeLists;
export const selectMapState = createFeatureSelector<State>(MODULE_NAME); export const selectMapState = createFeatureSelector<State>(MODULE_NAME);
export const selectGetMapState= createSelector(selectMapState, getMapState); export const selectGetMapState= createSelector(selectMapState, getMapState);
@@ -622,6 +632,7 @@ export const selectGetClearEnabled = createSelector(selectMapState, getClearEnab
export const selectGetSearchCollapsed = createSelector(selectMapState, getSearchCollapsed); export const selectGetSearchCollapsed = createSelector(selectMapState, getSearchCollapsed);
export const selectGetSearchMinified = createSelector(selectMapState, getSearchMinified); export const selectGetSearchMinified = createSelector(selectMapState, getSearchMinified);
export const selectGetExtent = createSelector(selectMapState, getExtent); export const selectGetExtent = createSelector(selectMapState, getExtent);
export const selectGetViewExtent = createSelector(selectMapState, getViewExtent);
export const selectGetOverlayLayers = createSelector(selectMapState, getOverlayLayers); export const selectGetOverlayLayers = createSelector(selectMapState, getOverlayLayers);
export const selectGetBaseLayers = createSelector(selectMapState, getBaseLayers); export const selectGetBaseLayers = createSelector(selectMapState, getBaseLayers);
export const selectGetProjection = createSelector(selectMapState, getProjection); export const selectGetProjection = createSelector(selectMapState, getProjection);
@@ -640,5 +651,5 @@ export const selectGetLayerValues = createSelector(selectMapState,getLayerValues
export const selectGetLayerValuesX = createSelector(selectMapState,getLayerValuesX); export const selectGetLayerValuesX = createSelector(selectMapState,getLayerValuesX);
export const selectGetLayerValuesY = createSelector(selectMapState,getLayerValuesY); export const selectGetLayerValuesY = createSelector(selectMapState,getLayerValuesY);
export const selectGetViewEnabled = createSelector(selectMapState,getViewEnabled); export const selectGetViewEnabled = createSelector(selectMapState,getViewEnabled);
export const selectGetCodeLists = createSelector(selectMapState, getCodeLists);
export const selectGetCodeList = (id: string) => createSelector(selectGetCodeLists, (codeLists) => codeLists[id]);

View File

@@ -1,17 +1,17 @@
import { Injectable } from '@angular/core'; import {Injectable} from '@angular/core';
import { Observable , Observer } from 'rxjs'; import {Observable} from 'rxjs';
import {map} from 'rxjs/operators'; import {IListItem} from '../models/list.item';
import { IListItem } from '../models/list.item'; import {IItem} from '../models/item';
import { IItem } from '../models/item'; import {HttpClient} from '@angular/common/http';
import { HttpClient } from "@angular/common/http"; import {AppConfig} from '../shared/app.config';
import { AppConfig } from "../shared/app.config"; import {ItemService} from './item.service';
@Injectable({ @Injectable({
providedIn: 'root', providedIn: 'root',
}) })
export class FolderService { export class FolderService {
constructor(public httpClient: HttpClient, public appConfig: AppConfig) { constructor(public httpClient: HttpClient, public appConfig: AppConfig, public itemService: ItemService) {
} }
ApiEndpoint() { ApiEndpoint() {
@@ -27,15 +27,16 @@ export class FolderService {
} }
getFolderParents(code: string): Observable<IListItem[]> { 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[]> { 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[]> { 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> { moveItem(itemCode: string, newParentCode: string): Observable<IListItem> {

View File

@@ -8,6 +8,7 @@ import { IItemTask } from '../models/itemTask';
import { HttpClient, HttpParams,HttpHeaders } from "@angular/common/http"; import { HttpClient, HttpParams,HttpHeaders } from "@angular/common/http";
import { AppConfig } from "../shared/app.config"; import { AppConfig } from "../shared/app.config";
import {ItemTypeService} from './itemtype.service'; import {ItemTypeService} from './itemtype.service';
import {IListItem} from '../models/list.item';
@Injectable({ @Injectable({
providedIn: 'root', providedIn: 'root',
@@ -72,7 +73,7 @@ export class ItemService {
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, 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(); let params = new HttpParams();
if(itemType) params = params.append("it", itemType); if(itemType) params = params.append("it", itemType);
if(dataFilter) params = params.append("df", JSON.stringify(dataFilter)); 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(indexed) params = params.append("ind",indexed?"true":"false");
if (level) params = params.append("lvl", level.toFixed()); if (level) params = params.append("lvl", level.toFixed());
if (validToday) params = params.append("vt", validToday ? "true" : "false"); 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 }); return this.httpClient.get<IItem[]>(`${this.ApiEndpoint()}/api/v1/items/`, { params: params });
} }
getChildItemList(parentcode: string, itemType: string, dataFilter?: any, level = 1, deep = true, 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(); let params = new HttpParams();
if(itemType != null) { if(itemType != null) {
params = params.append("it", itemType); params = params.append("it", itemType);
@@ -96,6 +99,9 @@ export class ItemService {
params = params.append("deep", deep.toString()); params = params.append("deep", deep.toString());
if (startDate) params = params.append("sDate", startDate.toISOString()); if (startDate) params = params.append("sDate", startDate.toISOString());
if (endDate) params = params.append("eDate", endDate.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 }); 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}`); 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`);
}
} }