Refactor Date to string
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
This commit is contained in:
parent
263fb6c3d4
commit
4af6b2937c
4
package-lock.json
generated
4
package-lock.json
generated
@ -2692,9 +2692,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@farmmaps/common": {
|
"@farmmaps/common": {
|
||||||
"version": "0.0.1-prerelease.308",
|
"version": "file:dist/common"
|
||||||
"resolved": "https://repository.akkerweb.nl/repository/npm-group/@farmmaps/common/-/common-0.0.1-prerelease.308.tgz",
|
|
||||||
"integrity": "sha512-sbX5NEHons4ZH3HAnMoOgyeoicbj8tS24s7Xtzx6xE6QQHeeuxi2EmQR9CwQENFynHi7C0U/+nxNTu1ClIuIjw=="
|
|
||||||
},
|
},
|
||||||
"@farmmaps/common-map": {
|
"@farmmaps/common-map": {
|
||||||
"version": "0.0.1-prerelease.308",
|
"version": "0.0.1-prerelease.308",
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
"@angular/platform-browser": "~9.1.0",
|
"@angular/platform-browser": "~9.1.0",
|
||||||
"@angular/platform-browser-dynamic": "~9.1.0",
|
"@angular/platform-browser-dynamic": "~9.1.0",
|
||||||
"@angular/router": "~9.1.0",
|
"@angular/router": "~9.1.0",
|
||||||
"@farmmaps/common": ">=0.0.1-prerelease.308 <0.0.1",
|
"@farmmaps/common": "file:dist/common",
|
||||||
"@farmmaps/common-map": ">=0.0.1-prerelease.308 <0.0.1",
|
"@farmmaps/common-map": ">=0.0.1-prerelease.308 <0.0.1",
|
||||||
"@microsoft/signalr": "^3.1.3",
|
"@microsoft/signalr": "^3.1.3",
|
||||||
"@ng-bootstrap/ng-bootstrap": "^6.0",
|
"@ng-bootstrap/ng-bootstrap": "^6.0",
|
||||||
|
@ -89,13 +89,13 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
|
|||||||
var layerIndex = -1;
|
var layerIndex = -1;
|
||||||
var layer: Layer = null;
|
var layer: Layer = null;
|
||||||
layerIndex = itemLayer.layerIndex != -1 ? itemLayer.layerIndex : item.data.layers[0].index;
|
layerIndex = itemLayer.layerIndex != -1 ? itemLayer.layerIndex : item.data.layers[0].index;
|
||||||
let source = new XYZ({ maxZoom: 19, minZoom: 1, url: `${this._apiEndPoint}/api/v1/items/${item.code}/tiles/${layerIndex}/{z}/{x}/{y}.png?v=${item.updated.getTime()}` });
|
let source = new XYZ({ maxZoom: 19, minZoom: 1, url: `${this._apiEndPoint}/api/v1/items/${item.code}/tiles/${layerIndex}/{z}/{x}/{y}.png?v=${Date.parse(item.updated)}` });
|
||||||
layer = new Tile({ source: source });
|
layer = new Tile({ source: source });
|
||||||
var data = item.data;
|
var data = item.data;
|
||||||
var l = (data && data.layers && data.layers.length > 0) ? data.layers[0] : null;
|
var l = (data && data.layers && data.layers.length > 0) ? data.layers[0] : null;
|
||||||
if (l && l.rendering && l.rendering.renderoutputType == "Tiles") {
|
if (l && l.rendering && l.rendering.renderoutputType == "Tiles") {
|
||||||
var rt = l.rendering as IRenderoutputTiles;
|
var rt = l.rendering as IRenderoutputTiles;
|
||||||
let source = new XYZ({ maxZoom: rt.maxzoom, minZoom: rt.minzoom, url: `${this._apiEndPoint}/api/v1/items/${item.code}/tiles/${layerIndex}/{z}/{x}/{y}.png?v=${item.updated.getTime()}` });
|
let source = new XYZ({ maxZoom: rt.maxzoom, minZoom: rt.minzoom, url: `${this._apiEndPoint}/api/v1/items/${item.code}/tiles/${layerIndex}/{z}/{x}/{y}.png?v=${Date.parse(item.updated)}` });
|
||||||
layer = new Tile({ source: source });
|
layer = new Tile({ source: source });
|
||||||
}
|
}
|
||||||
if (l && l.rendering && l.rendering.renderoutputType == "Image") {
|
if (l && l.rendering && l.rendering.renderoutputType == "Image") {
|
||||||
@ -105,7 +105,7 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
|
|||||||
units: 'pixels',
|
units: 'pixels',
|
||||||
extent: ri.extent
|
extent: ri.extent
|
||||||
});
|
});
|
||||||
let source = new ImageStatic({ imageExtent: ri.extent, projection: projection, url: `${this._apiEndPoint}/api/v1/items/${item.code}/mapimage/${layerIndex}?v=${item.updated.getTime()}` });
|
let source = new ImageStatic({ imageExtent: ri.extent, projection: projection, url: `${this._apiEndPoint}/api/v1/items/${item.code}/mapimage/${layerIndex}?v=${Date.parse(item.updated)}` });
|
||||||
layer = new Image({ source: source });
|
layer = new Image({ source: source });
|
||||||
}
|
}
|
||||||
return layer;
|
return layer;
|
||||||
@ -125,7 +125,7 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
|
|||||||
maxZoom: rt.maxzoom,
|
maxZoom: rt.maxzoom,
|
||||||
minZoom: rt.minzoom,
|
minZoom: rt.minzoom,
|
||||||
format: new MVT(),
|
format: new MVT(),
|
||||||
url: `${this._apiEndPoint}/api/v1/items/${item.code}/vectortiles/{z}/{x}/{y}.pbf?v=${item.updated.getTime()}`
|
url: `${this._apiEndPoint}/api/v1/items/${item.code}/vectortiles/{z}/{x}/{y}.pbf?v=${Date.parse(item.updated)}`
|
||||||
}),
|
}),
|
||||||
style: (feature) => {
|
style: (feature) => {
|
||||||
return this.getColorFromGradient(l, feature);
|
return this.getColorFromGradient(l, feature);
|
||||||
@ -137,7 +137,7 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
|
|||||||
source: new XYZ({
|
source: new XYZ({
|
||||||
maxZoom: rt.maxzoom,
|
maxZoom: rt.maxzoom,
|
||||||
minZoom: rt.minzoom,
|
minZoom: rt.minzoom,
|
||||||
url: `${this._apiEndPoint}/api/v1/items/${item.code}/vectortiles/image_tiles/${layerIndex}/{z}/{x}/{y}.png?v=${item.updated.getTime()}`
|
url: `${this._apiEndPoint}/api/v1/items/${item.code}/vectortiles/image_tiles/${layerIndex}/{z}/{x}/{y}.png?v=${Date.parse(item.updated)}`
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<div *ngIf="item;let item">
|
<div *ngIf="item;let item">
|
||||||
<div class="card border-0">
|
<div class="card border-0">
|
||||||
<img *ngIf="item.thumbnail" class="card-img-top" [src]="config.getConfig('apiEndPoint') +'/api/v1/items/'+item.code+'/thumbnail?v='+item.updated.getTime()" />
|
<img *ngIf="item.thumbnail" class="card-img-top" [src]="config.getConfig('apiEndPoint') +'/api/v1/items/'+item.code+'/thumbnail?v=' + Date.parse(item.updated)" />
|
||||||
<div *ngIf="!item.thumbnail" class="big-icon" [style.background-color]="itemTypeService.getColor(item.itemType)">
|
<div *ngIf="!item.thumbnail" class="big-icon" [style.background-color]="itemTypeService.getColor(item.itemType)">
|
||||||
<i [ngClass]="itemTypeService.getIcon(item.itemType)"></i>
|
<i [ngClass]="itemTypeService.getIcon(item.itemType)"></i>
|
||||||
</div>
|
</div>
|
||||||
|
@ -203,7 +203,7 @@ export class MapEffects {
|
|||||||
return this.itemService$.getChildItemList(action.item.code,null).pipe(
|
return this.itemService$.getChildItemList(action.item.code,null).pipe(
|
||||||
map(items => new mapActions.SelectTemporalItemsSuccess(
|
map(items => new mapActions.SelectTemporalItemsSuccess(
|
||||||
items.sort((a, b) =>
|
items.sort((a, b) =>
|
||||||
-(b.dataDate.getTime() - a.dataDate.getTime())
|
-(Date.parse(b.dataDate) - Date.parse(a.dataDate))
|
||||||
)
|
)
|
||||||
)),
|
)),
|
||||||
catchError(error => of(new commonActions.Fail(error))));
|
catchError(error => of(new commonActions.Fail(error))));
|
||||||
|
@ -15,10 +15,10 @@ export class Item implements IItem {
|
|||||||
public geometry?:any;
|
public geometry?:any;
|
||||||
public url?: string;
|
public url?: string;
|
||||||
public name?: string;
|
public name?: string;
|
||||||
public created?: Date;
|
public created?: string;
|
||||||
public updated?: Date;
|
public updated?: string;
|
||||||
public dataDate?: Date;
|
public dataDate?: string;
|
||||||
public dataEndDate?: Date;
|
public dataEndDate?: string;
|
||||||
public itemType?: string;
|
public itemType?: string;
|
||||||
public sourceTask?: string;
|
public sourceTask?: string;
|
||||||
public size?: number;
|
public size?: number;
|
||||||
|
@ -2,10 +2,10 @@ export interface IListItem {
|
|||||||
url?: string;
|
url?: string;
|
||||||
code?: string;
|
code?: string;
|
||||||
name?: string;
|
name?: string;
|
||||||
created?: Date;
|
created?: string;
|
||||||
updated?: Date;
|
updated?: string;
|
||||||
dataDate?: Date;
|
dataDate?: string;
|
||||||
dataEndDate?: Date;
|
dataEndDate?: string;
|
||||||
itemType?: string;
|
itemType?: string;
|
||||||
sourceTask?: string;
|
sourceTask?: string;
|
||||||
size?: number;
|
size?: number;
|
||||||
|
@ -18,40 +18,32 @@ export class FolderService {
|
|||||||
return this.appConfig.getConfig("apiEndPoint");
|
return this.appConfig.getConfig("apiEndPoint");
|
||||||
}
|
}
|
||||||
|
|
||||||
parseDates(item: any): IListItem {
|
getFolder(code: string): Observable<IListItem> {
|
||||||
item.created = new Date(Date.parse(item.created));
|
return this.httpClient.get<IListItem>(`${this.ApiEndpoint()}/api/v1/folders/${code}`);
|
||||||
item.updated = new Date(Date.parse(item.updated));
|
|
||||||
item.dataDate = new Date(Date.parse(item.dataDate));
|
|
||||||
item.dataEndDate = new Date(Date.parse(item.dataEndDate));
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
|
|
||||||
getFolder(code: string): Observable<IListItem> {
|
|
||||||
return this.httpClient.get<IListItem>(`${this.ApiEndpoint()}/api/v1/folders/${code}`).pipe(map(i => this.parseDates(i)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getMyRoots(): Observable<IListItem[]> {
|
getMyRoots(): Observable<IListItem[]> {
|
||||||
return this.httpClient.get<IListItem[]>(`${this.ApiEndpoint()}/api/v1/folders/my_roots`).pipe(map(ia => ia.map(i => this.parseDates(i))));
|
return this.httpClient.get<IListItem[]>(`${this.ApiEndpoint()}/api/v1/folders/my_roots`);
|
||||||
}
|
}
|
||||||
|
|
||||||
getFolderParents(code: string): Observable<IListItem[]> {
|
getFolderParents(code: string): Observable<IListItem[]> {
|
||||||
return this.httpClient.get<IListItem[]>(`${this.ApiEndpoint()}/api/v1/folders/${code}/parents`).pipe(map(ia => ia.map(i => this.parseDates(i))));
|
return this.httpClient.get<IListItem[]>(`${this.ApiEndpoint()}/api/v1/folders/${code}/parents`);
|
||||||
}
|
}
|
||||||
|
|
||||||
getChildFolders(code: string): Observable<IListItem[]> {
|
getChildFolders(code: string): Observable<IListItem[]> {
|
||||||
return this.httpClient.get<IListItem[]>(`${this.ApiEndpoint()}/api/v1/folders/${code}/listfolders`).pipe(map(ia => ia.map(i => this.parseDates(i))));
|
return this.httpClient.get<IListItem[]>(`${this.ApiEndpoint()}/api/v1/folders/${code}/listfolders`);
|
||||||
}
|
}
|
||||||
|
|
||||||
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}`).pipe(map(ia => ia.map(i => this.parseDates(i))));
|
return this.httpClient.get<IListItem[]>(`${this.ApiEndpoint()}/api/v1/folders/${code}/list?skip=${skip}&take=${take}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
moveItem(itemCode: string, newParentCode: string): Observable<IListItem> {
|
moveItem(itemCode: string, newParentCode: string): Observable<IListItem> {
|
||||||
const body = { itemCode: itemCode,newParentCode: newParentCode };
|
const body = { itemCode: itemCode,newParentCode: newParentCode };
|
||||||
return this.httpClient.post<IListItem>(`${this.ApiEndpoint()}/api/v1/items/move`, body).pipe(map(i => this.parseDates(i)));
|
return this.httpClient.post<IListItem>(`${this.ApiEndpoint()}/api/v1/items/move`, body);
|
||||||
}
|
}
|
||||||
|
|
||||||
createFolder(folder: IItem): Observable<IListItem> {
|
createFolder(folder: IItem): Observable<IListItem> {
|
||||||
return this.httpClient.post<IListItem>(`${this.ApiEndpoint()}/api/v1/folders/`, folder).pipe(map(i => this.parseDates(i)));
|
return this.httpClient.post<IListItem>(`${this.ApiEndpoint()}/api/v1/folders/`, folder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,14 +20,6 @@ export class ItemService {
|
|||||||
return this.appConfig.getConfig("apiEndPoint");
|
return this.appConfig.getConfig("apiEndPoint");
|
||||||
}
|
}
|
||||||
|
|
||||||
parseDates(item: any): IItem {
|
|
||||||
item.created = new Date(Date.parse(item.created));
|
|
||||||
item.updated = new Date(Date.parse(item.updated));
|
|
||||||
item.dataDate = new Date(Date.parse(item.dataDate));
|
|
||||||
item.dataEndDate = new Date(Date.parse(item.dataEndDate));
|
|
||||||
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/`);
|
||||||
}
|
}
|
||||||
@ -60,7 +52,7 @@ export class ItemService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
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}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
getItemByCodeAndType(code: string, itemType: string): Observable<IItem> {
|
getItemByCodeAndType(code: string, itemType: string): Observable<IItem> {
|
||||||
@ -74,7 +66,7 @@ export class ItemService {
|
|||||||
if(atItemLocationItemCode) params = params.append("ail",atItemLocationItemCode);
|
if(atItemLocationItemCode) params = params.append("ail",atItemLocationItemCode);
|
||||||
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());
|
||||||
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 });
|
||||||
}
|
}
|
||||||
|
|
||||||
getChildItemList(parentcode: string, itemType: string, dataFilter?: any, level: number = 1, deep: boolean = true): Observable<IItem[]> {
|
getChildItemList(parentcode: string, itemType: string, dataFilter?: any, level: number = 1, deep: boolean = true): Observable<IItem[]> {
|
||||||
@ -87,7 +79,7 @@ export class ItemService {
|
|||||||
}
|
}
|
||||||
params = params.append("lvl", level.toString());
|
params = params.append("lvl", level.toString());
|
||||||
params = params.append("deep", deep.toString());
|
params = params.append("deep", deep.toString());
|
||||||
return this.httpClient.get<IItem[]>(`${this.ApiEndpoint()}/api/v1/items/${parentcode}/children`, { params: params }).pipe(map(ia => ia.map(i => this.parseDates(i))));
|
return this.httpClient.get<IItem[]>(`${this.ApiEndpoint()}/api/v1/items/${parentcode}/children`, { params: params });
|
||||||
}
|
}
|
||||||
|
|
||||||
getChildItemListCount(parentcode: string, itemType: string): Observable<Number> {
|
getChildItemListCount(parentcode: string, itemType: string): Observable<Number> {
|
||||||
@ -105,7 +97,7 @@ export class ItemService {
|
|||||||
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 }).pipe(map(ia => ia.map(i => this.parseDates(i))));
|
return this.httpClient.get<IItem[]>(`${this.ApiEndpoint()}/api/v1/items/${parentcode}/children`, { params: params });
|
||||||
}
|
}
|
||||||
|
|
||||||
getItemFeatures(code: string, extent: number[], crs: string, layerIndex?:number): Observable<any> {
|
getItemFeatures(code: string, extent: number[], crs: string, layerIndex?:number): Observable<any> {
|
||||||
@ -154,6 +146,6 @@ export class ItemService {
|
|||||||
getItemTaskList(itemcode: string, unfinishedOnly?: boolean): Observable<IItemTask[]> {
|
getItemTaskList(itemcode: string, unfinishedOnly?: boolean): Observable<IItemTask[]> {
|
||||||
var params = new HttpParams();
|
var params = new HttpParams();
|
||||||
if (unfinishedOnly) params = params.append("unfinishedOnly", unfinishedOnly.toString());
|
if (unfinishedOnly) params = params.append("unfinishedOnly", unfinishedOnly.toString());
|
||||||
return this.httpClient.get<IItemTask[]>(`${this.ApiEndpoint()}/api/v1/items/${itemcode}/tasks`, { params: params }).pipe(map(ia => ia.map(i => this.parseDates(i))));
|
return this.httpClient.get<IItemTask[]>(`${this.ApiEndpoint()}/api/v1/items/${itemcode}/tasks`, { params: params });
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user